Connect with Band Protocol

Now that you are onboard with us. Let's get started on to the actual implementation. In this section, we will go over the way you can set up your project to connect with Band Protocol. Depending on your project's state, there are three primary ways you can add Band Protocol connection to your project.

Create a Band-Powered Project

If you are building a new project, by using Truffle, you can bootstrap a new Ethereum-based project from a prepared boilerplate. Run the commands below to create a new project under a new folder named my_project with Band Protocol connection pre-installed.

mkdir my_project
cd my_project
npx truffle unbox bandprotocol/band

Add Band to Your Existing Project

If you already have a project setup, you can install band-solidity library as its dependency to gain access to Band Protocol. Simply install the library with NPM or Yarn.

NPM:

npm install band-solidity --save

Yarn:

yarn add band-solidity

Directly Import Band's Oracle Interface

If you prefer to develop your project without a thrid-party dependency, you can simply add Band Protocol's Oracle interface to the top of your smart contract files.

interface Oracle {
  enum QueryStatus { INVALID, OK, NOT_AVAILABLE, DISAGREEMENT }

  function query(bytes calldata input)
    external payable returns (bytes32 output, uint256 updatedAt, QueryStatus status);

  function queryPrice() external view returns (uint256);
}

Note that by using this approach, you will not have access to band-solidity's utility functions.