This Chainlink has a dedicated connection to Binance's API. This Chainlink will allow requesters to create queries to the API, and return the response.

Steps for using this oracle Steps for using this oracle

Write and deploy your Chainlinked contract using the network details below

Fund it with LINK (1 LINK is required per-request) Ropsten faucet

Call your request method

Chainlink Network Details Chainlink Network Details

You will need to use the following LINK token address, oracle address, and Job ID in order to create the Chainlink request.

Ropsten Ropsten

LINK Token address: 0x20fE562d797A42Dcb3399062AE9546cd06f63280

Oracle address: 0xc99B3D447826532722E41bc36e644ba3479E4365

Bool JobID: f2b0f585c84a45d1993f8f3cb48ffb49

Bytes32 JobID: 1e322d70fce94991baa56e7151acddcf

Uint256 JobID: b8b8a31a3833434eba5bff70b203343d

Create your Chainlinked contract Create your Chainlinked contract

Import ChainlinkClient.sol into your contract so you can inherit the ability to create Chainlink requests.

Solidity 4 Solidity 5 Solidity 6 pragma solidity ^0.4.24; import "@chainlink/contracts/src/v0.4/ChainlinkClient.sol"; contract BinanceChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: } pragma solidity ^0.5.0; import "@chainlink/contracts/src/v0.5/ChainlinkClient.sol"; contract BinanceChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: } pragma solidity ^0.6.0; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; contract BinanceChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: }

Tasks Tasks

Bool Job Bool Job

Bytes32 Job Bytes32 Job

Uint256 Job Uint256 Job

Request Parameters Request Parameters

endpoint endpoint

Required

The endpoint of the api to call. Supported values are:

ping

time

avgPrice symbol



Solidity example Solidity example

req.add("endpoint", "avgPrice");

symbol symbol

Used by the avgPrice endpoint. The symbol (pairing) to query.

Solidity example Solidity example

req.add("symbol", "BNBUSDT");

copyPath copyPath

The path of the desired data field to return to the smart contract.

Solidity example Solidity example

req.add("copyPath", "price");

The response payload will vary depending on the endpoint used. Refer to the REST API docs for details.

times times

Only valid for the Uint256 Job

The number to multiply the result by (since Solidity can't handle decimal places).

Solidity example Solidity example

req.addInt("times", 100);

Chainlink Examples Chainlink Examples

The example below shows how to create requests for the adapter.

getServerStatus getAvgPrice function getServerStatus(address _oracle, bytes32 _jobId) public onlyOwner { Chainlink.Request memory req = buildChainlinkRequest(_jobId, address(this), this.fulfillStatus.selector); req.add("endpoint", "ping"); sendChainlinkRequestTo(_oracle, req, oraclePayment); } function getAvgPrice(address _oracle, bytes32 _jobId, string _symbol) public onlyOwner { Chainlink.Request memory req = buildChainlinkRequest(_jobId, address(this), this.fulfillPrice.selector); req.add("endpoint", "avgPrice"); req.add("symbol", _symbol); req.add("copyPath", "price"); req.addInt("times", 100); sendChainlinkRequestTo(_oracle, req, oraclePayment); }

Here is an example of the fulfill methods: