Last active
May 22, 2019 23:13
-
-
Save taylorjdawson/6079cd09981d8dc73cc53c3ac5b535dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
import './ChainlinkClient.sol'; | |
contract AmberdataChainlink is ChainlinkClient { | |
bytes32 constant JOB_ID = bytes32("447f3b6fac1240ab91d3679fba00baf6"); | |
uint256 public currentPrice; | |
constructor() public { | |
setChainlinkToken(0x20fE562d797A42Dcb3399062AE9546cd06f63280); | |
setChainlinkOracle(0xc99B3D447826532722E41bc36e644ba3479E4365); | |
} | |
function requestPrice() public { | |
Chainlink.Request memory req = buildChainlinkRequest(JOB_ID, this, this.fulfill.selector); | |
req.add("token", "0x514910771AF9Ca656af840dff83E8264EcF986CA"); | |
req.addInt("times", 100); | |
sendChainlinkRequest(req, 1 * LINK); | |
} | |
function fulfill(bytes32 _requestId, uint256 _price) public recordChainlinkFulfillment(_requestId) { | |
currentPrice = _price; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment