Skip to content

Instantly share code, notes, and snippets.

View thodges-gh's full-sized avatar
⛓️
Linking chains

Thomas thodges-gh

⛓️
Linking chains
View GitHub Profile
@thodges-gh
thodges-gh / ATestnetConsumer.sol
Created August 2, 2019 17:24
A Chainlink example with Solidity 5 support
// File: @ensdomains/buffer/contracts/Buffer.sol
pragma solidity >0.4.18;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
@thodges-gh
thodges-gh / ATestnetConsumer.sol
Last active August 7, 2019 22:34
VWAP Interval
// File: @ensdomains/buffer/contracts/Buffer.sol
pragma solidity >0.4.18;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
pragma solidity 0.4.24;
import "https://github.com/thodges-gh/chainlink/evm/contracts/ChainlinkClient.sol";
import "https://github.com/thodges-gh/chainlink/evm/contracts/vendor/Ownable.sol";
contract ATestnetConsumer is ChainlinkClient, Ownable {
uint256 constant private ORACLE_PAYMENT = 1 * LINK;
uint256 public currentPrice;
int256 public changeDay;
pragma solidity 0.4.24;
import { Ownable as Ownable_Chainlink } from "https://github.com/thodges-gh/chainlink/evm/contracts/vendor/Ownable.sol";
import { SafeMath as SafeMath_Chainlink } from "https://github.com/thodges-gh/chainlink/evm/contracts/vendor/SafeMath.sol";
import "https://github.com/thodges-gh/chainlink/evm/contracts/interfaces/ChainlinkRequestInterface.sol";
import "https://github.com/thodges-gh/chainlink/evm/contracts/interfaces/OracleInterface.sol";
import "https://github.com/thodges-gh/chainlink/evm/contracts/interfaces/LinkTokenInterface.sol";
/**
* @title The Chainlink Oracle contract
pragma solidity 0.4.24;
import "https://github.com/thodges-gh/chainlink/evm/contracts/Oracle.sol";
// File: @ensdomains/buffer/contracts/Buffer.sol
pragma solidity >0.4.18;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
pragma solidity 0.4.24;
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.4/ChainlinkClient.sol";
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.4/vendor/Ownable.sol";
contract ATestnetConsumer is ChainlinkClient, Ownable {
uint256 constant private ORACLE_PAYMENT = 1 * LINK;
uint256 public currentPrice;
int256 public changeDay;
@thodges-gh
thodges-gh / Oracle.sol
Last active September 20, 2020 17:31
pragma solidity 0.4.24;
import "https://github.com/smartcontractkit/chainlink/evm-contracts/src/v0.4/Oracle.sol";
pragma solidity 0.5.0;
interface LinkTokenInterface {
function balanceOf(address owner) external returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool success);
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success);
}
interface CoordinatorInterface {
function withdraw(address recipient, uint256 amount) external;
@thodges-gh
thodges-gh / MyContract.sol
Created October 26, 2019 14:51
Solidity 5 Chainlinked contract for Remix
pragma solidity >=0.5.0;
import "https://github.com/smartcontractkit/chainlink/evm/v0.5/contracts/ChainlinkClient.sol";
import "https://github.com/smartcontractkit/chainlink/evm/v0.5/contracts/vendor/Ownable.sol";
/**
* @title MyContract is an example contract which requests data from
* the Chainlink network
* @dev This contract is designed to work on multiple networks, including
* local test networks