INTRODUCTION Tutorials The Basics Random Numbers API Calls Other Tutorials Architecture Overview Basic Request Model Decentralized Data Model Off-Chain Reporting
USING DATA FEEDS Introduction to Data Feeds Get the Latest Price (EVM) Get the Latest Price (Solana) Historical Price Data Feed Registry API Reference Contract Addresses ENS Ethereum Data Feeds Binance Smart Chain Data Feeds Polygon (Matic) Data Feeds xDai Data Feeds Huobi Eco Chain Data Feeds Avalanche Data Feeds Fantom Data Feeds Arbitrum Data Feeds Harmony Data Feeds Solana Data Feeds Optimism Data Feeds
USING RANDOMNESS Introduction to Chainlink VRF Get a Random Number API Reference Security Considerations Contract Addresses Best Practices
USING CHAINLINK KEEPERS Introduction Making Compatible Contracts Register Upkeep for a Contract Patterns and Best Practices Network Overview FAQs
USING ANY API Introduction to Using Any API Make a GET Request Make an Existing Job Request Multi-Variable Responses Large Responses Find Existing Jobs API Reference Contract Addresses
DEVELOPER REFERENCE Install Instructions LINK Token Contracts Developer Communications Getting Help Data Provider Nodes Hackathon Resources Contributing to Chainlink User Guides Install, configure & fund MetaMask Acquire testnet LINK Deploy your first contract Fund your contract Use your first contract!
FlightAware Chainlink (Testnet)
This Chainlink has a dedicated connection to FlightAware.
Steps for using this oracle
- Write and deploy your Chainlink contract using the network details below
- Fund it with LINK
- Call your request method
Chainlink Network Details
You will need to use the following LINK token address, oracle address, and Job IDs to create the request.
Kovan
LINK Token address: 0xa36085f69e2889c224210f603d836748e7dc0088
Oracle address: 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e
JobID: a644d4e30977459d9a596bef89c09e71
Sleep JobID: f0003b2c52024e7fa931d6ee9a947c87
Create your Chainlink contract
Import ChainlinkClient.sol into your contract so you can inherit the Chainlink behavior.
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
contract FlightAwareChainlink 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 FlightAwareChainlink is ChainlinkClient {
uint256 oraclePayment;
constructor(uint256 _oraclePayment) public {
setPublicChainlinkToken();
oraclePayment = _oraclePayment;
}
// Additional functions here:
}
pragma solidity ^0.4.24;
import "@chainlink/contracts/src/v0.4/ChainlinkClient.sol";
contract FlightAwareChainlink is ChainlinkClient {
uint256 oraclePayment;
constructor(uint256 _oraclePayment) public {
setPublicChainlinkToken();
oraclePayment = _oraclePayment;
}
// Additional functions here:
}
Tasks
Request Parameters
endpoint
The endpoint to query (optional, defaults to FlightInfoEx)
Solidity example
req.add("endpoint", "FlightInfoEx");
flight
The flight identification/number (required)
Solidity example
req.add("flight", "NAX105");
departure
The unix timestamp of the departure (required)
Solidity example
req.addUint("departure", 1594378824);
until
Required for the Sleep job
Solidity example
req.addUint("until", now + 1 hours);
Chainlink Examples
The examples below use the different endpoints available from this Chainlink:
function createRequest
(
address _oracle,
bytes32 _jobId,
string memory _flight,
uint256 _departure,
)
public
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(_jobId, this, this.fulfill.selector);
req.add("flight", _flight);
req.addUint("departure", _departure);
sendChainlinkRequestTo(_oracle, req, oraclePayment);
}
Here is an example of the fulfill method:
uint256 public result;
function fulfill(bytes32 _requestId, uint256 _result)
public
recordChainlinkFulfillment(_requestId)
{
result = _result;
}