View KrakenConsumer.sol
pragma solidity ^0.6.0; | |
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
/** | |
* DO NOT USE IN PRODUCTION!! | |
* THIS IS EXAMPLE CONTRACT FOR THE KOVAN TESTNET | |
*/ | |
contract KrakenConsumer is ChainlinkClient { | |
View ChainlinkOracleGasCostMeasure.sol
pragma solidity ^0.5.0; | |
interface AggregatorV3Interface { | |
function decimals() external view returns (uint8); | |
function description() external view returns (string memory); | |
function version() external view returns (uint256); | |
// getRoundData and latestRoundData should both raise "No data present" | |
// if they do not have data to report, instead of returning unset values |
View OpenOracleGasMeasure.sol
pragma solidity ^0.5.0; | |
interface Oracle { | |
function getUnderlyingPrice(address cToken) external view returns (uint); | |
} | |
contract Comptroller { | |
Oracle public oracle; | |
} |
View VRFD20.sol
// SPDX-License-Identifier: MIT | |
pragma solidity 0.6.6; | |
import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/VRFConsumerBase.sol"; | |
import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/Owned.sol"; | |
/** | |
* @notice A Chainlink VRF consumer which uses randomness to mimic the rolling | |
* of a 20 sided die | |
* @dev This is only an example implementation and not necessarily suitable for mainnet. |
View bytesSwap.sol
pragma solidity ^0.7.0; | |
library bytesSwap { | |
function bytes32ToString(bytes32 _bytes32) public pure returns (string memory) { | |
uint8 i = 0; | |
while(i < 32 && _bytes32[i] != 0) { | |
i++; | |
} | |
bytes memory bytesArray = new bytes(i); |
View Client.sol
pragma solidity ^0.6.0; | |
import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/ChainlinkClient.sol"; | |
contract Client is ChainlinkClient { | |
// where to store the last id scanned | |
bytes32 public last_uid; | |
// chainlink vars for communicating with the RFID external adapter | |
address private oracle; | |
bytes32 private jobId; |
View HistoricalPriceConsumerV3.sol
/** This example code is designed to quickly deploy an example contract using Remix. | |
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough | |
* You will need testnet ETH and LINK. | |
* - Kovan ETH faucet: https://faucet.kovan.network/ | |
* - Kovan LINK faucet: https://kovan.chain.link/ | |
*/ | |
pragma solidity ^0.6.7; | |
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; |
View getLatestPrice_web3.py
from web3 import Web3 | |
web3 = Web3(Web3.HTTPProvider('https://ropsten.infura.io/v3/<infura_project_id>')) | |
abi = '[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getTimestamp","outputs":[{"internal |
View getLatestPrice_web3.js
// Require web3js | |
const Web3 = require("web3"); | |
// Setup web3 | |
const provider = new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/<infura_project_id>"); | |
const web3 = new Web3(provider); | |
// Load ABI and Address | |
const aggregatorInterfaceABI = [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":" |
View HistoricalPriceConsumerV3.sol
/** This example code is designed to quickly deploy an example contract using Remix. | |
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough | |
* You will need testnet ETH and LINK. | |
* - Kovan ETH faucet: https://faucet.kovan.network/ | |
* - Kovan LINK faucet: https://kovan.chain.link/ | |
*/ | |
pragma solidity ^0.6.7; | |
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; |
NewerOlder