"ERC677Token.sol":"pragma solidity ^0.4.11;\n\n\nimport \"./interfaces/ERC677.sol\";\nimport \"./interfaces/ERC677Receiver.sol\";\n\n\ncontract ERC677Token is ERC677 {\n\n /**\n * @dev transfer token to a contract address with additional data if the recipient is a contact.\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n * @param _data The extra data to be passed to the receiving contract.\n */\n function transferAndCall(address _to, uint _value, bytes _data)\n public\n returns (bool success)\n {\n super.transfer(_to, _value);\n Transfer(msg.sender, _to, _value, _data);\n if (isContract(_to)) {\n contractFallback(_to, _value, _data);\n }\n return true;\n }\n\n\n // PRIVATE\n\n function contractFallback(address _to, uint _value, bytes _data)\n private\n {\n ERC677Receiver receiver = ERC677Receiver(_to);\n receiver.onTokenTransfer(msg.sender, _value, _data);\n }\n\n function isContract(address _addr)\n private\n returns (bool hasCode)\n {\n uint length;\n assembly { length := extcodesize(_addr) }\n return length > 0;\n }\n\n}\n",
"interfaces/ERC677.sol":"pragma solidity ^0.4.8;\n\nimport { ERC20 as linkERC20 } from \"./ERC20.sol\";\n\ncontract ERC677 is linkERC20 {\n function transferAndCall(address to, uint value, bytes data) returns (bool success);\n\n event Transfer(address indexed from, address indexed to, uint value, bytes data);\n}\n",
"interfaces/ERC20.sol":"pragma solidity ^0.4.11;\n\n\nimport { ERC20Basic as linkERC20Basic } from \"./ERC20Basic.sol\";\n\n\n/**\n * @title ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/20\n */\ncontract ERC20 is linkERC20Basic {\n function allowance(address owner, address spender) constant returns (uint256);\n function transferFrom(address from, address to, uint256 value) returns (bool);\n function approve(address spender, uint256 value) returns (bool);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n",
"interfaces/ERC20Basic.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title ERC20Basic\n * @dev Simpler version of ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/179\n */\ncontract ERC20Basic {\n uint256 public totalSupply;\n function balanceOf(address who) constant returns (uint256);\n function transfer(address to, uint256 value) returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n",
"metadata":"{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"transferAndCall\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseApproval\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseApproval\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"remaining\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"allowance(address,address)\":{\"details\":\"Function to check the amount of tokens that an owner allowed to a spender.\",\"params\":{\"_owner\":\"address The address which owns the funds.\",\"_spender\":\"address The address which will spend the funds.\"},\"return\":\"A uint256 specifying the amount of tokens still available for the spender.\"},\"approve(address,uint256)\":{\"details\":\"Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\",\"params\":{\"_spender\":\"The address which will spend the funds.\",\"_value\":\"The amount of tokens to be spent.\"}},\"balanceOf(address)\":{\"details\":\"Gets the balance of the specified address.\",\"params\":{\"_owner\":\"The address to query the the balance of. \"},\"return\":\"An uint256 representing the amount owned by the passed address.\"},\"transfer(address,uint256)\":{\"details\":\"transfer token to a specified address.\",\"params\":{\"_to\":\"The address to transfer to.\",\"_value\":\"The amount to be transferred.\"}},\"transferAndCall(address,uint256,bytes)\":{\"details\":\"transfer token to a specified address with additional data if the recipient is a contract.\",\"params\":{\"_data\":\"The extra data to be passed to the receiving contract.\",\"_to\":\"The address to transfer to.\",\"_value\":\"The amount to be transferred.\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfer tokens from one address to another\",\"params\":{\"_from\":\"address The address which you want to send tokens from\",\"_to\":\"address The address which you want to transfer to\",\"_value\":\"uint256 the amount of tokens to be transferred\"}}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/LinkToken.sol\":\"LinkToken\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/ERC677Token.sol\":{\"keccak256\":\"0xeacb6ca1b05d37392d8387d8f41111eea4b117a078bdd419f09690d14947779c\",\"urls\":[\"bzzr://fac29cb30cae651c0cce7aeb96d4fa186548b003d89f6b5b4a6d53b26fc9dcd8\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/LinkToken.sol\":{\"keccak256\":\"0x2547b52b2242a521aa50c1907e2ed75d2d66276a00348ba9adac78976b913ba0\",\"urls\":[\"bzzr://90fe793eb447bbaf66fa7f59d27c263e2ab2fbaab7a1031ce7ed4ded11518a22\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/ERC20.sol\":{\"keccak256\":\"0x2e730e56649a5cb6666156e209fc3dc20cacfc4ec20cb85dc54cd6a3fa0b813b\",\"urls\":[\"bzzr://f9fc1f27ff4e7b6135aa0a5935a71907513fc4330d336d0b221797f680c32cbe\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/ERC20Basic.sol\":{\"keccak256\":\"0x5c0857cec6aebc5dfbafe5c0b3761952f0180c07f23200ed2b80051ccc6a6d6d\",\"urls\":[\"bzzr://658dc7a8924774d1009631c1ff7c546328ff32bf5a53274fb7651d5ca20e3e48\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/ERC677.sol\":{\"keccak256\":\"0xeec3140eb61694ad393e98430c7f7d2ecedf69cf2db73a4897bebed69c0c19da\",\"urls\":[\"bzzr://319a9e0cf7acd42a01793dd89947ac79fa9e8e39314be23791575c743b984887\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/ERC677Receiver.sol\":{\"keccak256\":\"0x52941220da118a31f512cef775e8123339380e50fcac039d7b057f035634ddaa\",\"urls\":[\"bzzr://0c60bb2d511315b364ad717f046259f6f5233010bd6a82ad4a0651754d3c1889\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/BasicToken.sol\":{\"keccak256\":\"0xe024b5f9c509c6e630587c51beeb5417a7b147c4532b0cbf00763a01ff98ad45\",\"urls\":[\"bzzr://b898aa83d88a05011b5f6e4a7aedea29b0f8f27f742049efd7b9b89988901ae6\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/SafeMathChainlink.sol\":{\"keccak256\":\"0xb822782dea15f1fa4992c27639e9f9e4a4758b2c2fd8b12ec90c4de336de9074\",\"urls\":[\"bzzr://1328bb1e33d56d48209e5bbea79fa18b212e8df3f449ac9a75d20962cc36cce5\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/StandardToken.sol\":{\"keccak256\":\"0xd95075ff88d9c3e18f894f3a65f698d98b041db68bddaf9adf63ad9652363c06\",\"urls\":[\"bzzr://030366986f2090ce6642b729d43c0b8ab9972e08f691120e38239da5d2cd9627\"]}},\"version\":1}",
"userdoc":{
"methods":{}
}
},
"sources":{
"LinkToken.sol":{
"id":5
},
"ERC677Token.sol":{
"id":4
},
"interfaces/ERC677.sol":{
"id":15
},
"interfaces/ERC20.sol":{
"id":13
},
"interfaces/ERC20Basic.sol":{
"id":14
},
"interfaces/ERC677Receiver.sol":{
"id":16
},
"vendor/StandardToken.sol":{
"id":42
},
"vendor/BasicToken.sol":{
"id":32
},
"vendor/SafeMathChainlink.sol":{
"id":40
}
},
"sourceCodes":{
"LinkToken.sol":"pragma solidity ^0.4.11;\n\n\nimport \"./ERC677Token.sol\";\nimport { StandardToken as linkStandardToken } from \"./vendor/StandardToken.sol\";\n\n\ncontract LinkToken is linkStandardToken, ERC677Token {\n\n uint public constant totalSupply = 10**27;\n string public constant name = \"ChainLink Token\";\n uint8 public constant decimals = 18;\n string public constant symbol = \"LINK\";\n\n function LinkToken()\n public\n {\n balances[msg.sender] = totalSupply;\n }\n\n /**\n * @dev transfer token to a specified address with additional data if the recipient is a contract.\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n * @param _data The extra data to be passed to the receiving contract.\n */\n function transferAndCall(address _to, uint _value, bytes _data)\n public\n validRecipient(_to)\n returns (bool success)\n {\n return super.transferAndCall(_to, _value, _data);\n }\n\n /**\n * @dev transfer token to a specified address.\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n */\n function transfer(address _to, uint _value)\n public\n validRecipient(_to)\n returns (bool success)\n {\n return super.transfer(_to, _value);\n }\n\n /**\n * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n * @param _spender The address which will spend the funds.\n * @param _value The amount of tokens to be spent.\n */\n function approve(address _spender, uint256 _value)\n public\n validRecipient(_spender)\n returns (bool)\n {\n return super.approve(_spender, _value);\n }\n\n /**\n * @dev Transfer tokens from one address to another\n * @param _from address The address which you want to send tokens from\n * @param _to address The address which you want to transfer to\n * @param _value uint256 the amount of tokens to be transferred\n */\n function transferFrom(address _from, address _to, uint256 _value)\n public\n validRecipient(_to)\n returns (bool)\n {\n return super.transferFrom(_from, _to, _value);\n }\n\n\n // MODIFIERS\n\n modifier validRecipient(address _recipient) {\n require(_recipient != address(0) && _recipient != address(this));\n _;\n }\n\n}\n",
"ERC677Token.sol":"pragma solidity ^0.4.11;\n\n\nimport \"./interfaces/ERC677.sol\";\nimport \"./interfaces/ERC677Receiver.sol\";\n\n\ncontract ERC677Token is ERC677 {\n\n /**\n * @dev transfer token to a contract address with additional data if the recipient is a contact.\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n * @param _data The extra data to be passed to the receiving contract.\n */\n function transferAndCall(address _to, uint _value, bytes _data)\n public\n returns (bool success)\n {\n super.transfer(_to, _value);\n Transfer(msg.sender, _to, _value, _data);\n if (isContract(_to)) {\n contractFallback(_to, _value, _data);\n }\n return true;\n }\n\n\n // PRIVATE\n\n function contractFallback(address _to, uint _value, bytes _data)\n private\n {\n ERC677Receiver receiver = ERC677Receiver(_to);\n receiver.onTokenTransfer(msg.sender, _value, _data);\n }\n\n function isContract(address _addr)\n private\n returns (bool hasCode)\n {\n uint length;\n assembly { length := extcodesize(_addr) }\n return length > 0;\n }\n\n}\n",
"interfaces/ERC677.sol":"pragma solidity ^0.4.8;\n\nimport { ERC20 as linkERC20 } from \"./ERC20.sol\";\n\ncontract ERC677 is linkERC20 {\n function transferAndCall(address to, uint value, bytes data) returns (bool success);\n\n event Transfer(address indexed from, address indexed to, uint value, bytes data);\n}\n",
"interfaces/ERC20.sol":"pragma solidity ^0.4.11;\n\n\nimport { ERC20Basic as linkERC20Basic } from \"./ERC20Basic.sol\";\n\n\n/**\n * @title ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/20\n */\ncontract ERC20 is linkERC20Basic {\n function allowance(address owner, address spender) constant returns (uint256);\n function transferFrom(address from, address to, uint256 value) returns (bool);\n function approve(address spender, uint256 value) returns (bool);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n",
"interfaces/ERC20Basic.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title ERC20Basic\n * @dev Simpler version of ERC20 interface\n * @dev see https://github.com/ethereum/EIPs/issues/179\n */\ncontract ERC20Basic {\n uint256 public totalSupply;\n function balanceOf(address who) constant returns (uint256);\n function transfer(address to, uint256 value) returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n",
"vendor/StandardToken.sol":"pragma solidity ^0.4.11;\n\n\nimport { BasicToken as linkBasicToken } from \"./BasicToken.sol\";\nimport { ERC20 as linkERC20 } from \"../interfaces/ERC20.sol\";\n\n\n/**\n * @title Standard ERC20 token\n *\n * @dev Implementation of the basic standard token.\n * @dev https://github.com/ethereum/EIPs/issues/20\n * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol\n */\ncontract StandardToken is linkERC20, linkBasicToken {\n\n mapping (address => mapping (address => uint256)) allowed;\n\n\n /**\n * @dev Transfer tokens from one address to another\n * @param _from address The address which you want to send tokens from\n * @param _to address The address which you want to transfer to\n * @param _value uint256 the amount of tokens to be transferred\n */\n function transferFrom(address _from, address _to, uint256 _value) returns (bool) {\n var _allowance = allowed[_from][msg.sender];\n\n // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met\n // require (_value <= _allowance);\n\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(_value);\n allowed[_from][msg.sender] = _allowance.sub(_value);\n Transfer(_from, _to, _value);\n return true;\n }\n\n /**\n * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n * @param _spender The address which will spend the funds.\n * @param _value The amount of tokens to be spent.\n */\n function approve(address _spender, uint256 _value) returns (bool) {\n allowed[msg.sender][_spender] = _value;\n Approval(msg.sender, _spender, _value);\n return true;\n }\n\n /**\n * @dev Function to check the amount of tokens that an owner allowed to a spender.\n * @param _owner address The address which owns the funds.\n * @param _spender address The address which will spend the funds.\n * @return A uint256 specifying the amount of tokens still available for the spender.\n */\n function allowance(address _owner, address _spender) constant returns (uint256 remaining) {\n return allowed[_owner][_spender];\n }\n\n /*\n * approve should be called when allowed[_spender] == 0. To increment\n * allowed value is better to use this function to avoid 2 calls (and wait until \n * the first transaction is mined)\n * From MonolithDAO Token.sol\n */\n function increaseApproval (address _spender, uint _addedValue) \n returns (bool success) {\n allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);\n Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n return true;\n }\n\n function decreaseApproval (address _spender, uint _subtractedValue) \n returns (bool success) {\n uint oldValue = allowed[msg.sender][_spender];\n if (_subtractedValue > oldValue) {\n allowed[msg.sender][_spender] = 0;\n } else {\n allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);\n }\n Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n return true;\n }\n\n}\n",
"vendor/BasicToken.sol":"pragma solidity ^0.4.24;\n\n\nimport { ERC20Basic as linkERC20Basic } from \"../interfaces/ERC20Basic.sol\";\nimport { SafeMathChainlink as linkSafeMath } from \"./SafeMathChainlink.sol\";\n\n\n/**\n * @title Basic token\n * @dev Basic version of StandardToken, with no allowances. \n */\ncontract BasicToken is linkERC20Basic {\n using linkSafeMath for uint256;\n\n mapping(address => uint256) balances;\n\n /**\n * @dev transfer token for a specified address\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n */\n function transfer(address _to, uint256 _value) returns (bool) {\n balances[msg.sender] = balances[msg.sender].sub(_value);\n balances[_to] = balances[_to].add(_value);\n Transfer(msg.sender, _to, _value);\n return true;\n }\n\n /**\n * @dev Gets the balance of the specified address.\n * @param _owner The address to query the the balance of. \n * @return An uint256 representing the amount owned by the passed address.\n */\n function balanceOf(address _owner) constant returns (uint256 balance) {\n return balances[_owner];\n }\n\n}\n",
"vendor/SafeMathChainlink.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMathChainlink {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n"
"vendor/Buffer.sol":"pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n"
"vendor/Buffer.sol":"pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n",
"Chainlinked.sol":"pragma solidity ^0.4.24;\n\nimport \"./ChainlinkClient.sol\";\n\n/**\n * @title The Chainlinked contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network. ChainlinkClient is an alias of the Chainlinked contract.\n */\ncontract Chainlinked is ChainlinkClient {\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function newRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n return buildChainlinkRequest(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `sendChainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequest(_req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n return sendChainlinkRequestTo(_oracle, _req, _payment);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setOracle(address _oracle) internal {\n setChainlinkOracle(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setLinkToken(address _link) internal {\n setChainlinkToken(_link);\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkToken()\n internal\n view\n returns (address)\n {\n return chainlinkTokenAddress();\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function oracleAddress()\n internal\n view\n returns (address)\n {\n return chainlinkOracleAddress();\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function fulfillChainlinkRequest(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function setChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n useChainlinkWithENS(_ens, _node);\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `setChainlinkWithENS` has been called previously\n */\n function setOracleWithENS()\n internal\n {\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addExternalRequest(address _oracle, bytes32 _requestId)\n internal\n {\n addChainlinkExternalRequest(_oracle, _requestId);\n }\n}\n",
"ChainlinkClient.sol":"pragma solidity ^0.4.24;\n\nimport \"./Chainlink.sol\";\nimport \"./interfaces/ENSInterface.sol\";\nimport \"./interfaces/LinkTokenInterface.sol\";\nimport \"./interfaces/ChainlinkRequestInterface.sol\";\nimport \"./interfaces/PointerInterface.sol\";\nimport { ENSResolver as ENSResolver_Chainlink } from \"./vendor/ENSResolver.sol\";\n\n/**\n * @title The ChainlinkClient contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network\n */\ncontract ChainlinkClient {\n using Chainlink for Chainlink.Request;\n\n uint256 constant internal LINK = 10**18;\n uint256 constant private AMOUNT_OVERRIDE = 0;\n address constant private SENDER_OVERRIDE = 0x0;\n uint256 constant private ARGS_VERSION = 1;\n bytes32 constant private ENS_TOKEN_SUBNAME = keccak256(\"link\");\n bytes32 constant private ENS_ORACLE_SUBNAME = keccak256(\"oracle\");\n address constant private LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;\n\n ENSInterface private ens;\n bytes32 private ensNode;\n LinkTokenInterface private link;\n ChainlinkRequestInterface private oracle;\n uint256 private requests = 1;\n mapping(bytes32 => address) private pendingRequests;\n\n event ChainlinkRequested(bytes32 indexed id);\n event ChainlinkFulfilled(bytes32 indexed id);\n event ChainlinkCancelled(bytes32 indexed id);\n\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function buildChainlinkRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n Chainlink.Request memory req;\n return req.initialize(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `chainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequestTo(oracle, _req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, requests));\n _req.nonce = requests;\n pendingRequests[requestId] = _oracle;\n emit ChainlinkRequested(requestId);\n require(link.transferAndCall(_oracle, _payment, encodeRequest(_req)), \"unable to transferAndCall to oracle\");\n requests += 1;\n\n return requestId;\n }\n\n /**\n * @notice Allows a request to be cancelled if it has not been fulfilled\n * @dev Requires keeping track of the expiration value emitted from the oracle contract.\n * Deletes the request from the `pendingRequests` mapping.\n * Emits ChainlinkCancelled event.\n * @param _requestId The request ID\n * @param _payment The amount of LINK sent for the request\n * @param _callbackFunc The callback function specified for the request\n * @param _expiration The time of the expiration for the request\n */\n function cancelChainlinkRequest(\n bytes32 _requestId,\n uint256 _payment,\n bytes4 _callbackFunc,\n uint256 _expiration\n )\n internal\n {\n ChainlinkRequestInterface requested = ChainlinkRequestInterface(pendingRequests[_requestId]);\n delete pendingRequests[_requestId];\n emit ChainlinkCancelled(_requestId);\n requested.cancelOracleRequest(_requestId, _payment, _callbackFunc, _expiration);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setChainlinkOracle(address _oracle) internal {\n oracle = ChainlinkRequestInterface(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setChainlinkToken(address _link) internal {\n link = LinkTokenInterface(_link);\n }\n\n /**\n * @notice Sets the Chainlink token address for the public\n * network as given by the Pointer contract\n */\n function setPublicChainlinkToken() internal {\n setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkTokenAddress()\n internal\n view\n returns (address)\n {\n return address(link);\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function chainlinkOracleAddress()\n internal\n view\n returns (address)\n {\n return address(oracle);\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addChainlinkExternalRequest(address _oracle, bytes32 _requestId)\n internal\n notPendingRequest(_requestId)\n {\n pendingRequests[_requestId] = _oracle;\n }\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function useChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n ens = ENSInterface(_ens);\n ensNode = _node;\n bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(linkSubnode));\n setChainlinkToken(resolver.addr(linkSubnode));\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously\n */\n function updateChainlinkOracleWithENS()\n internal\n {\n bytes32 oracleSubnode = keccak256(abi.encodePacked(ensNode, ENS_ORACLE_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(oracleSubnode));\n setChainlinkOracle(resolver.addr(oracleSubnode));\n }\n\n /**\n * @notice Encodes the request to be sent to the oracle contract\n * @dev The Chainlink node expects values to be in order for the request to be picked up. Order of types\n * will be validated in the oracle contract.\n * @param _req The initialized Chainlink Request\n * @return The bytes payload for the `transferAndCall` method\n */\n function encodeRequest(Chainlink.Request memory _req)\n private\n view\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n oracle.oracleRequest.selector,\n SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address\n AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n ARGS_VERSION,\n _req.buf.buf);\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function validateChainlinkCallback(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @dev Reverts if the sender is not the oracle of the request.\n * Emits ChainlinkFulfilled event.\n * @param _requestId The request ID for fulfillment\n */\n modifier recordChainlinkFulfillment(bytes32 _requestId) {\n require(msg.sender == pendingRequests[_requestId], \"Source must be the oracle of the request\");\n delete pendingRequests[_requestId];\n emit ChainlinkFulfilled(_requestId);\n _;\n }\n\n /**\n * @dev Reverts if the request is already pending\n * @param _requestId The request ID for fulfillment\n */\n modifier notPendingRequest(bytes32 _requestId) {\n require(pendingRequests[_requestId] == address(0), \"Request is already pending\");\n _;\n }\n}\n",
"Chainlink.sol":"pragma solidity ^0.4.24;\n\nimport { CBOR as CBOR_Chainlink } from \"./vendor/CBOR.sol\";\nimport { Buffer as Buffer_Chainlink } from \"./vendor/Buffer.sol\";\n\n/**\n * @title Library for common Chainlink functions\n * @dev Uses imported CBOR library for encoding to buffer\n */\nlibrary Chainlink {\n uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase\n\n using CBOR_Chainlink for Buffer_Chainlink.buffer;\n\n struct Request {\n bytes32 id;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer_Chainlink.buffer buf;\n }\n\n /**\n * @notice Initializes a Chainlink request\n * @dev Sets the ID, callback address, and callback function signature on the request\n * @param self The uninitialized request\n * @param _id The Job Specification ID\n * @param _callbackAddress The callback address\n * @param _callbackFunction The callback function signature\n * @return The initialized request\n */\n function initialize(\n Request memory self,\n bytes32 _id,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (Chainlink.Request memory) {\n Buffer_Chainlink.init(self.buf, defaultBufferSize);\n self.id = _id;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n /**\n * @notice Sets the data for the buffer without encoding CBOR on-chain\n * @dev CBOR can be closed with curly-brackets {} or they can be left off\n * @param self The initialized request\n * @param _data The CBOR data\n */\n function setBuffer(Request memory self, bytes _data)\n internal pure\n {\n Buffer_Chainlink.init(self.buf, _data.length);\n Buffer_Chainlink.append(self.buf, _data);\n }\n\n /**\n * @notice Adds a string value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The string value to add\n */\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n /**\n * @notice Adds a bytes value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The bytes value to add\n */\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n /**\n * @notice Adds a int256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The int256 value to add\n */\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n /**\n * @notice Adds a uint256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The uint256 value to add\n */\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n /**\n * @notice Adds an array of strings to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _values The array of string values to add\n */\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
"interfaces/ENSInterface.sol":"pragma solidity ^0.4.24;\n\ninterface ENSInterface {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;\n function setResolver(bytes32 node, address resolver) external;\n function setOwner(bytes32 node, address owner) external;\n function setTTL(bytes32 node, uint64 ttl) external;\n function owner(bytes32 node) external view returns (address);\n function resolver(bytes32 node) external view returns (address);\n function ttl(bytes32 node) external view returns (uint64);\n\n}\n",
"interfaces/LinkTokenInterface.sol":"pragma solidity ^0.4.24;\n\ninterface LinkTokenInterface {\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n function approve(address spender, uint256 value) external returns (bool success);\n function balanceOf(address owner) external view returns (uint256 balance);\n function decimals() external view returns (uint8 decimalPlaces);\n function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n function increaseApproval(address spender, uint256 subtractedValue) external;\n function name() external view returns (string tokenName);\n function symbol() external view returns (string tokenSymbol);\n function totalSupply() external view returns (uint256 totalTokensIssued);\n function transfer(address to, uint256 value) external returns (bool success);\n function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);\n function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n",
"vendor/ENSResolver.sol":"pragma solidity 0.4.24;\n\ncontract ENSResolver {\n function addr(bytes32 node) public view returns (address);\n}\n",
"vendor/SafeMathChainlink.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMathChainlink {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n"
"tests/MaliciousConsumer.sol":"pragma solidity 0.4.24;\n\n\nimport \"../Chainlinked.sol\";\nimport \"../vendor/SafeMathChainlink.sol\";\n\n\ncontract MaliciousConsumer is Chainlinked {\n using SafeMathChainlink for uint256;\n\n uint256 constant private ORACLE_PAYMENT = 1 * LINK;\n uint256 private expiration;\n\n constructor(address _link, address _oracle) public payable {\n setLinkToken(_link);\n setOracle(_oracle);\n }\n\n function () public payable {} // solhint-disable-line no-empty-blocks\n\n function requestData(bytes32 _id, bytes _callbackFunc) public {\n Chainlink.Request memory req = newRequest(_id, this, bytes4(keccak256(_callbackFunc)));\n expiration = now.add(5 minutes); // solhint-disable-line not-rely-on-time\n chainlinkRequest(req, ORACLE_PAYMENT);\n }\n\n function assertFail(bytes32, bytes32) public pure {\n assert(1 == 2);\n }\n\n function cancelRequestOnFulfill(bytes32 _requestId, bytes32) public {\n cancelChainlinkRequest(\n _requestId,\n ORACLE_PAYMENT,\n this.cancelRequestOnFulfill.selector,\n expiration);\n }\n\n function remove() public {\n selfdestruct(address(0));\n }\n\n function stealEthCall(bytes32 _requestId, bytes32) public recordChainlinkFulfillment(_requestId) {\n require(address(this).call.value(100)(), \"Call failed\"); // solhint-disable-line avoid-call-value\n }\n\n function stealEthSend(bytes32 _requestId, bytes32) public recordChainlinkFulfillment(_requestId) {\n // solhint-disable-next-line check-send-result\n require(address(this).send(100), \"Send failed\"); // solhint-disable-line multiple-sends\n }\n\n function stealEthTransfer(bytes32 _requestId, bytes32) public recordChainlinkFulfillment(_requestId) {\n address(this).transfer(100);\n }\n\n function doesNothing(bytes32, bytes32) public pure {} // solhint-disable-line no-empty-blocks\n}\n",
"Chainlinked.sol":"pragma solidity ^0.4.24;\n\nimport \"./ChainlinkClient.sol\";\n\n/**\n * @title The Chainlinked contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network. ChainlinkClient is an alias of the Chainlinked contract.\n */\ncontract Chainlinked is ChainlinkClient {\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function newRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n return buildChainlinkRequest(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `sendChainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequest(_req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n return sendChainlinkRequestTo(_oracle, _req, _payment);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setOracle(address _oracle) internal {\n setChainlinkOracle(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setLinkToken(address _link) internal {\n setChainlinkToken(_link);\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkToken()\n internal\n view\n returns (address)\n {\n return chainlinkTokenAddress();\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function oracleAddress()\n internal\n view\n returns (address)\n {\n return chainlinkOracleAddress();\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function fulfillChainlinkRequest(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function setChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n useChainlinkWithENS(_ens, _node);\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `setChainlinkWithENS` has been called previously\n */\n function setOracleWithENS()\n internal\n {\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addExternalRequest(address _oracle, bytes32 _requestId)\n internal\n {\n addChainlinkExternalRequest(_oracle, _requestId);\n }\n}\n",
"ChainlinkClient.sol":"pragma solidity ^0.4.24;\n\nimport \"./Chainlink.sol\";\nimport \"./interfaces/ENSInterface.sol\";\nimport \"./interfaces/LinkTokenInterface.sol\";\nimport \"./interfaces/ChainlinkRequestInterface.sol\";\nimport \"./interfaces/PointerInterface.sol\";\nimport { ENSResolver as ENSResolver_Chainlink } from \"./vendor/ENSResolver.sol\";\n\n/**\n * @title The ChainlinkClient contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network\n */\ncontract ChainlinkClient {\n using Chainlink for Chainlink.Request;\n\n uint256 constant internal LINK = 10**18;\n uint256 constant private AMOUNT_OVERRIDE = 0;\n address constant private SENDER_OVERRIDE = 0x0;\n uint256 constant private ARGS_VERSION = 1;\n bytes32 constant private ENS_TOKEN_SUBNAME = keccak256(\"link\");\n bytes32 constant private ENS_ORACLE_SUBNAME = keccak256(\"oracle\");\n address constant private LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;\n\n ENSInterface private ens;\n bytes32 private ensNode;\n LinkTokenInterface private link;\n ChainlinkRequestInterface private oracle;\n uint256 private requests = 1;\n mapping(bytes32 => address) private pendingRequests;\n\n event ChainlinkRequested(bytes32 indexed id);\n event ChainlinkFulfilled(bytes32 indexed id);\n event ChainlinkCancelled(bytes32 indexed id);\n\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function buildChainlinkRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n Chainlink.Request memory req;\n return req.initialize(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `chainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequestTo(oracle, _req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, requests));\n _req.nonce = requests;\n pendingRequests[requestId] = _oracle;\n emit ChainlinkRequested(requestId);\n require(link.transferAndCall(_oracle, _payment, encodeRequest(_req)), \"unable to transferAndCall to oracle\");\n requests += 1;\n\n return requestId;\n }\n\n /**\n * @notice Allows a request to be cancelled if it has not been fulfilled\n * @dev Requires keeping track of the expiration value emitted from the oracle contract.\n * Deletes the request from the `pendingRequests` mapping.\n * Emits ChainlinkCancelled event.\n * @param _requestId The request ID\n * @param _payment The amount of LINK sent for the request\n * @param _callbackFunc The callback function specified for the request\n * @param _expiration The time of the expiration for the request\n */\n function cancelChainlinkRequest(\n bytes32 _requestId,\n uint256 _payment,\n bytes4 _callbackFunc,\n uint256 _expiration\n )\n internal\n {\n ChainlinkRequestInterface requested = ChainlinkRequestInterface(pendingRequests[_requestId]);\n delete pendingRequests[_requestId];\n emit ChainlinkCancelled(_requestId);\n requested.cancelOracleRequest(_requestId, _payment, _callbackFunc, _expiration);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setChainlinkOracle(address _oracle) internal {\n oracle = ChainlinkRequestInterface(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setChainlinkToken(address _link) internal {\n link = LinkTokenInterface(_link);\n }\n\n /**\n * @notice Sets the Chainlink token address for the public\n * network as given by the Pointer contract\n */\n function setPublicChainlinkToken() internal {\n setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkTokenAddress()\n internal\n view\n returns (address)\n {\n return address(link);\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function chainlinkOracleAddress()\n internal\n view\n returns (address)\n {\n return address(oracle);\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addChainlinkExternalRequest(address _oracle, bytes32 _requestId)\n internal\n notPendingRequest(_requestId)\n {\n pendingRequests[_requestId] = _oracle;\n }\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function useChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n ens = ENSInterface(_ens);\n ensNode = _node;\n bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(linkSubnode));\n setChainlinkToken(resolver.addr(linkSubnode));\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously\n */\n function updateChainlinkOracleWithENS()\n internal\n {\n bytes32 oracleSubnode = keccak256(abi.encodePacked(ensNode, ENS_ORACLE_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(oracleSubnode));\n setChainlinkOracle(resolver.addr(oracleSubnode));\n }\n\n /**\n * @notice Encodes the request to be sent to the oracle contract\n * @dev The Chainlink node expects values to be in order for the request to be picked up. Order of types\n * will be validated in the oracle contract.\n * @param _req The initialized Chainlink Request\n * @return The bytes payload for the `transferAndCall` method\n */\n function encodeRequest(Chainlink.Request memory _req)\n private\n view\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n oracle.oracleRequest.selector,\n SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address\n AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n ARGS_VERSION,\n _req.buf.buf);\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function validateChainlinkCallback(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @dev Reverts if the sender is not the oracle of the request.\n * Emits ChainlinkFulfilled event.\n * @param _requestId The request ID for fulfillment\n */\n modifier recordChainlinkFulfillment(bytes32 _requestId) {\n require(msg.sender == pendingRequests[_requestId], \"Source must be the oracle of the request\");\n delete pendingRequests[_requestId];\n emit ChainlinkFulfilled(_requestId);\n _;\n }\n\n /**\n * @dev Reverts if the request is already pending\n * @param _requestId The request ID for fulfillment\n */\n modifier notPendingRequest(bytes32 _requestId) {\n require(pendingRequests[_requestId] == address(0), \"Request is already pending\");\n _;\n }\n}\n",
"Chainlink.sol":"pragma solidity ^0.4.24;\n\nimport { CBOR as CBOR_Chainlink } from \"./vendor/CBOR.sol\";\nimport { Buffer as Buffer_Chainlink } from \"./vendor/Buffer.sol\";\n\n/**\n * @title Library for common Chainlink functions\n * @dev Uses imported CBOR library for encoding to buffer\n */\nlibrary Chainlink {\n uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase\n\n using CBOR_Chainlink for Buffer_Chainlink.buffer;\n\n struct Request {\n bytes32 id;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer_Chainlink.buffer buf;\n }\n\n /**\n * @notice Initializes a Chainlink request\n * @dev Sets the ID, callback address, and callback function signature on the request\n * @param self The uninitialized request\n * @param _id The Job Specification ID\n * @param _callbackAddress The callback address\n * @param _callbackFunction The callback function signature\n * @return The initialized request\n */\n function initialize(\n Request memory self,\n bytes32 _id,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (Chainlink.Request memory) {\n Buffer_Chainlink.init(self.buf, defaultBufferSize);\n self.id = _id;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n /**\n * @notice Sets the data for the buffer without encoding CBOR on-chain\n * @dev CBOR can be closed with curly-brackets {} or they can be left off\n * @param self The initialized request\n * @param _data The CBOR data\n */\n function setBuffer(Request memory self, bytes _data)\n internal pure\n {\n Buffer_Chainlink.init(self.buf, _data.length);\n Buffer_Chainlink.append(self.buf, _data);\n }\n\n /**\n * @notice Adds a string value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The string value to add\n */\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n /**\n * @notice Adds a bytes value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The bytes value to add\n */\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n /**\n * @notice Adds a int256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The int256 value to add\n */\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n /**\n * @notice Adds a uint256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The uint256 value to add\n */\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n /**\n * @notice Adds an array of strings to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _values The array of string values to add\n */\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
"vendor/Buffer.sol":"pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n",
"interfaces/ENSInterface.sol":"pragma solidity ^0.4.24;\n\ninterface ENSInterface {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;\n function setResolver(bytes32 node, address resolver) external;\n function setOwner(bytes32 node, address owner) external;\n function setTTL(bytes32 node, uint64 ttl) external;\n function owner(bytes32 node) external view returns (address);\n function resolver(bytes32 node) external view returns (address);\n function ttl(bytes32 node) external view returns (uint64);\n\n}\n",
"interfaces/LinkTokenInterface.sol":"pragma solidity ^0.4.24;\n\ninterface LinkTokenInterface {\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n function approve(address spender, uint256 value) external returns (bool success);\n function balanceOf(address owner) external view returns (uint256 balance);\n function decimals() external view returns (uint8 decimalPlaces);\n function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n function increaseApproval(address spender, uint256 subtractedValue) external;\n function name() external view returns (string tokenName);\n function symbol() external view returns (string tokenSymbol);\n function totalSupply() external view returns (uint256 totalTokensIssued);\n function transfer(address to, uint256 value) external returns (bool success);\n function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);\n function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n",
"vendor/ENSResolver.sol":"pragma solidity 0.4.24;\n\ncontract ENSResolver {\n function addr(bytes32 node) public view returns (address);\n}\n",
"vendor/SafeMathChainlink.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMathChainlink {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n"
"vendor/Buffer.sol":"pragma solidity >0.4.18;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n uint mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = 256 ** len - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n",
"Chainlinked.sol":"pragma solidity ^0.4.24;\n\nimport \"./ChainlinkClient.sol\";\n\n/**\n * @title The Chainlinked contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network. ChainlinkClient is an alias of the Chainlinked contract.\n */\ncontract Chainlinked is ChainlinkClient {\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function newRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n return buildChainlinkRequest(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `sendChainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequest(_req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function chainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n return sendChainlinkRequestTo(_oracle, _req, _payment);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setOracle(address _oracle) internal {\n setChainlinkOracle(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setLinkToken(address _link) internal {\n setChainlinkToken(_link);\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkToken()\n internal\n view\n returns (address)\n {\n return chainlinkTokenAddress();\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function oracleAddress()\n internal\n view\n returns (address)\n {\n return chainlinkOracleAddress();\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function fulfillChainlinkRequest(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function setChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n useChainlinkWithENS(_ens, _node);\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `setChainlinkWithENS` has been called previously\n */\n function setOracleWithENS()\n internal\n {\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addExternalRequest(address _oracle, bytes32 _requestId)\n internal\n {\n addChainlinkExternalRequest(_oracle, _requestId);\n }\n}\n",
"ChainlinkClient.sol":"pragma solidity ^0.4.24;\n\nimport \"./Chainlink.sol\";\nimport \"./interfaces/ENSInterface.sol\";\nimport \"./interfaces/LinkTokenInterface.sol\";\nimport \"./interfaces/ChainlinkRequestInterface.sol\";\nimport \"./interfaces/PointerInterface.sol\";\nimport { ENSResolver as ENSResolver_Chainlink } from \"./vendor/ENSResolver.sol\";\n\n/**\n * @title The ChainlinkClient contract\n * @notice Contract writers can inherit this contract in order to create requests for the\n * Chainlink network\n */\ncontract ChainlinkClient {\n using Chainlink for Chainlink.Request;\n\n uint256 constant internal LINK = 10**18;\n uint256 constant private AMOUNT_OVERRIDE = 0;\n address constant private SENDER_OVERRIDE = 0x0;\n uint256 constant private ARGS_VERSION = 1;\n bytes32 constant private ENS_TOKEN_SUBNAME = keccak256(\"link\");\n bytes32 constant private ENS_ORACLE_SUBNAME = keccak256(\"oracle\");\n address constant private LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;\n\n ENSInterface private ens;\n bytes32 private ensNode;\n LinkTokenInterface private link;\n ChainlinkRequestInterface private oracle;\n uint256 private requests = 1;\n mapping(bytes32 => address) private pendingRequests;\n\n event ChainlinkRequested(bytes32 indexed id);\n event ChainlinkFulfilled(bytes32 indexed id);\n event ChainlinkCancelled(bytes32 indexed id);\n\n /**\n * @notice Creates a request that can hold additional parameters\n * @param _specId The Job Specification ID that the request will be created for\n * @param _callbackAddress The callback address that the response will be sent to\n * @param _callbackFunctionSignature The callback function signature to use for the callback address\n * @return A Chainlink Request struct in memory\n */\n function buildChainlinkRequest(\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionSignature\n ) internal pure returns (Chainlink.Request memory) {\n Chainlink.Request memory req;\n return req.initialize(_specId, _callbackAddress, _callbackFunctionSignature);\n }\n\n /**\n * @notice Creates a Chainlink request to the stored oracle address\n * @dev Calls `chainlinkRequestTo` with the stored oracle address\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequest(Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32)\n {\n return sendChainlinkRequestTo(oracle, _req, _payment);\n }\n\n /**\n * @notice Creates a Chainlink request to the specified oracle address\n * @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to\n * send LINK which creates a request on the target oracle contract.\n * Emits ChainlinkRequested event.\n * @param _oracle The address of the oracle for the request\n * @param _req The initialized Chainlink Request\n * @param _payment The amount of LINK to send for the request\n * @return The request ID\n */\n function sendChainlinkRequestTo(address _oracle, Chainlink.Request memory _req, uint256 _payment)\n internal\n returns (bytes32 requestId)\n {\n requestId = keccak256(abi.encodePacked(this, requests));\n _req.nonce = requests;\n pendingRequests[requestId] = _oracle;\n emit ChainlinkRequested(requestId);\n require(link.transferAndCall(_oracle, _payment, encodeRequest(_req)), \"unable to transferAndCall to oracle\");\n requests += 1;\n\n return requestId;\n }\n\n /**\n * @notice Allows a request to be cancelled if it has not been fulfilled\n * @dev Requires keeping track of the expiration value emitted from the oracle contract.\n * Deletes the request from the `pendingRequests` mapping.\n * Emits ChainlinkCancelled event.\n * @param _requestId The request ID\n * @param _payment The amount of LINK sent for the request\n * @param _callbackFunc The callback function specified for the request\n * @param _expiration The time of the expiration for the request\n */\n function cancelChainlinkRequest(\n bytes32 _requestId,\n uint256 _payment,\n bytes4 _callbackFunc,\n uint256 _expiration\n )\n internal\n {\n ChainlinkRequestInterface requested = ChainlinkRequestInterface(pendingRequests[_requestId]);\n delete pendingRequests[_requestId];\n emit ChainlinkCancelled(_requestId);\n requested.cancelOracleRequest(_requestId, _payment, _callbackFunc, _expiration);\n }\n\n /**\n * @notice Sets the stored oracle address\n * @param _oracle The address of the oracle contract\n */\n function setChainlinkOracle(address _oracle) internal {\n oracle = ChainlinkRequestInterface(_oracle);\n }\n\n /**\n * @notice Sets the LINK token address\n * @param _link The address of the LINK token contract\n */\n function setChainlinkToken(address _link) internal {\n link = LinkTokenInterface(_link);\n }\n\n /**\n * @notice Sets the Chainlink token address for the public\n * network as given by the Pointer contract\n */\n function setPublicChainlinkToken() internal {\n setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());\n }\n\n /**\n * @notice Retrieves the stored address of the LINK token\n * @return The address of the LINK token\n */\n function chainlinkTokenAddress()\n internal\n view\n returns (address)\n {\n return address(link);\n }\n\n /**\n * @notice Retrieves the stored address of the oracle contract\n * @return The address of the oracle contract\n */\n function chainlinkOracleAddress()\n internal\n view\n returns (address)\n {\n return address(oracle);\n }\n\n /**\n * @notice Allows for a request which was created on another contract to be fulfilled\n * on this contract\n * @param _oracle The address of the oracle contract that will fulfill the request\n * @param _requestId The request ID used for the response\n */\n function addChainlinkExternalRequest(address _oracle, bytes32 _requestId)\n internal\n notPendingRequest(_requestId)\n {\n pendingRequests[_requestId] = _oracle;\n }\n\n /**\n * @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS\n * @dev Accounts for subnodes having different resolvers\n * @param _ens The address of the ENS contract\n * @param _node The ENS node hash\n */\n function useChainlinkWithENS(address _ens, bytes32 _node)\n internal\n {\n ens = ENSInterface(_ens);\n ensNode = _node;\n bytes32 linkSubnode = keccak256(abi.encodePacked(ensNode, ENS_TOKEN_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(linkSubnode));\n setChainlinkToken(resolver.addr(linkSubnode));\n updateChainlinkOracleWithENS();\n }\n\n /**\n * @notice Sets the stored oracle contract with the address resolved by ENS\n * @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously\n */\n function updateChainlinkOracleWithENS()\n internal\n {\n bytes32 oracleSubnode = keccak256(abi.encodePacked(ensNode, ENS_ORACLE_SUBNAME));\n ENSResolver_Chainlink resolver = ENSResolver_Chainlink(ens.resolver(oracleSubnode));\n setChainlinkOracle(resolver.addr(oracleSubnode));\n }\n\n /**\n * @notice Encodes the request to be sent to the oracle contract\n * @dev The Chainlink node expects values to be in order for the request to be picked up. Order of types\n * will be validated in the oracle contract.\n * @param _req The initialized Chainlink Request\n * @return The bytes payload for the `transferAndCall` method\n */\n function encodeRequest(Chainlink.Request memory _req)\n private\n view\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n oracle.oracleRequest.selector,\n SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address\n AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent\n _req.id,\n _req.callbackAddress,\n _req.callbackFunctionId,\n _req.nonce,\n ARGS_VERSION,\n _req.buf.buf);\n }\n\n /**\n * @notice Ensures that the fulfillment is valid for this contract\n * @dev Use if the contract developer prefers methods instead of modifiers for validation\n * @param _requestId The request ID for fulfillment\n */\n function validateChainlinkCallback(bytes32 _requestId)\n internal\n recordChainlinkFulfillment(_requestId)\n // solhint-disable-next-line no-empty-blocks\n {}\n\n /**\n * @dev Reverts if the sender is not the oracle of the request.\n * Emits ChainlinkFulfilled event.\n * @param _requestId The request ID for fulfillment\n */\n modifier recordChainlinkFulfillment(bytes32 _requestId) {\n require(msg.sender == pendingRequests[_requestId], \"Source must be the oracle of the request\");\n delete pendingRequests[_requestId];\n emit ChainlinkFulfilled(_requestId);\n _;\n }\n\n /**\n * @dev Reverts if the request is already pending\n * @param _requestId The request ID for fulfillment\n */\n modifier notPendingRequest(bytes32 _requestId) {\n require(pendingRequests[_requestId] == address(0), \"Request is already pending\");\n _;\n }\n}\n",
"Chainlink.sol":"pragma solidity ^0.4.24;\n\nimport { CBOR as CBOR_Chainlink } from \"./vendor/CBOR.sol\";\nimport { Buffer as Buffer_Chainlink } from \"./vendor/Buffer.sol\";\n\n/**\n * @title Library for common Chainlink functions\n * @dev Uses imported CBOR library for encoding to buffer\n */\nlibrary Chainlink {\n uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase\n\n using CBOR_Chainlink for Buffer_Chainlink.buffer;\n\n struct Request {\n bytes32 id;\n address callbackAddress;\n bytes4 callbackFunctionId;\n uint256 nonce;\n Buffer_Chainlink.buffer buf;\n }\n\n /**\n * @notice Initializes a Chainlink request\n * @dev Sets the ID, callback address, and callback function signature on the request\n * @param self The uninitialized request\n * @param _id The Job Specification ID\n * @param _callbackAddress The callback address\n * @param _callbackFunction The callback function signature\n * @return The initialized request\n */\n function initialize(\n Request memory self,\n bytes32 _id,\n address _callbackAddress,\n bytes4 _callbackFunction\n ) internal pure returns (Chainlink.Request memory) {\n Buffer_Chainlink.init(self.buf, defaultBufferSize);\n self.id = _id;\n self.callbackAddress = _callbackAddress;\n self.callbackFunctionId = _callbackFunction;\n return self;\n }\n\n /**\n * @notice Sets the data for the buffer without encoding CBOR on-chain\n * @dev CBOR can be closed with curly-brackets {} or they can be left off\n * @param self The initialized request\n * @param _data The CBOR data\n */\n function setBuffer(Request memory self, bytes _data)\n internal pure\n {\n Buffer_Chainlink.init(self.buf, _data.length);\n Buffer_Chainlink.append(self.buf, _data);\n }\n\n /**\n * @notice Adds a string value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The string value to add\n */\n function add(Request memory self, string _key, string _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeString(_value);\n }\n\n /**\n * @notice Adds a bytes value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The bytes value to add\n */\n function addBytes(Request memory self, string _key, bytes _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeBytes(_value);\n }\n\n /**\n * @notice Adds a int256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The int256 value to add\n */\n function addInt(Request memory self, string _key, int256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeInt(_value);\n }\n\n /**\n * @notice Adds a uint256 value to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _value The uint256 value to add\n */\n function addUint(Request memory self, string _key, uint256 _value)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.encodeUInt(_value);\n }\n\n /**\n * @notice Adds an array of strings to the request with a given key name\n * @param self The initialized request\n * @param _key The name of the key\n * @param _values The array of string values to add\n */\n function addStringArray(Request memory self, string _key, string[] memory _values)\n internal pure\n {\n self.buf.encodeString(_key);\n self.buf.startArray();\n for (uint256 i = 0; i < _values.length; i++) {\n self.buf.encodeString(_values[i]);\n }\n self.buf.endSequence();\n }\n}\n",
"interfaces/ENSInterface.sol":"pragma solidity ^0.4.24;\n\ninterface ENSInterface {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;\n function setResolver(bytes32 node, address resolver) external;\n function setOwner(bytes32 node, address owner) external;\n function setTTL(bytes32 node, uint64 ttl) external;\n function owner(bytes32 node) external view returns (address);\n function resolver(bytes32 node) external view returns (address);\n function ttl(bytes32 node) external view returns (uint64);\n\n}\n",
"interfaces/LinkTokenInterface.sol":"pragma solidity ^0.4.24;\n\ninterface LinkTokenInterface {\n function allowance(address owner, address spender) external view returns (uint256 remaining);\n function approve(address spender, uint256 value) external returns (bool success);\n function balanceOf(address owner) external view returns (uint256 balance);\n function decimals() external view returns (uint8 decimalPlaces);\n function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n function increaseApproval(address spender, uint256 subtractedValue) external;\n function name() external view returns (string tokenName);\n function symbol() external view returns (string tokenSymbol);\n function totalSupply() external view returns (uint256 totalTokensIssued);\n function transfer(address to, uint256 value) external returns (bool success);\n function transferAndCall(address to, uint256 value, bytes data) external returns (bool success);\n function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n",
"vendor/ENSResolver.sol":"pragma solidity 0.4.24;\n\ncontract ENSResolver {\n function addr(bytes32 node) public view returns (address);\n}\n",
"vendor/SafeMathChainlink.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMathChainlink {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n"
"details":"Given params must hash back to the commitment stored from `oracleRequest`. Will call the callback address' callback function without bubbling up error checking in a `require` so that the node can get paid.",
"params":{
"_callbackAddress":"The callback address to call for fulfillment",
"_callbackFunctionId":"The callback function ID to use for fulfillment",
"_data":"The data to return to the consuming contract",
"_expiration":"The expiration that the node should respond by before the requester can cancel",
"_payment":"The payment amount that will be released for the oracle (specified in wei)",
"_requestId":"The fulfillment request ID that must match the requester's"
},
"return":"Status if the external call was successful"
},
"getAuthorizationStatus(address)":{
"params":{
"_node":"The address of the Chainlink node"
},
"return":"The authorization status of the node"
},
"onTokenTransfer(address,uint256,bytes)":{
"details":"The data payload's first 2 words will be overwritten by the `_sender` and `_amount` values to ensure correctness. Calls oracleRequest.",
"params":{
"_amount":"Amount of LINK sent (specified in wei)",
"metadata":"{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"_payment\",\"type\":\"uint256\"},{\"name\":\"_specId\",\"type\":\"bytes32\"},{\"name\":\"_callbackAddress\",\"type\":\"address\"},{\"name\":\"_callbackFunctionId\",\"type\":\"bytes4\"},{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_dataVersion\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"oracleRequest\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_requestId\",\"type\":\"bytes32\"},{\"name\":\"_payment\",\"type\":\"uint256\"},{\"name\":\"_callbackAddress\",\"type\":\"address\"},{\"name\":\"_callbackFunctionId\",\"type\":\"bytes4\"},{\"name\":\"_expiration\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes32\"}],\"name\":\"fulfillOracleRequest\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"EXPIRY_TIME\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"withdrawable\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_requestId\",\"type\":\"bytes32\"},{\"name\":\"_payment\",\"type\":\"uint256\"},{\"name\":\"_callbackFunc\",\"type\":\"bytes4\"},{\"name\":\"_expiration\",\"type\":\"uint256\"}],\"name\":\"cancelOracleRequest\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_node\",\"type\":\"address\"},{\"name\":\"_allowed\",\"type\":\"bool\"}],\"name\":\"setFulfillmentPermission\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"onTokenTransfer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_node\",\"type\":\"address\"}],\"name\":\"getAuthorizationStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_recipient\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_link\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"specId\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"requester\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"requestId\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"payment\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"callbackAddr\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"callbackFunctionId\",\"type\":\"bytes4\"},{\"indexed\":false,\"name\":\"cancelExpiration\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"dataVersion\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"OracleRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"requestId\",\"type\":\"bytes32\"}],\"name\":\"CancelOracleRequest\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"}],\"name\":\"OwnershipRenounced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"cancelOracleRequest(bytes32,uint256,bytes4,uint256)\":{\"details\":\"Given params must hash to a commitment stored on the contract in order for the request to be valid Emits CancelOracleRequest event.\",\"params\":{\"_callbackFunc\":\"The requester's specified callback address\",\"_expiration\":\"The time of the expiration for the request\",\"_payment\":\"The amount of payment given (specified in wei)\",\"_requestId\":\"The request ID\"}},\"fulfillOracleRequest(bytes32,uint256,address,bytes4,uint256,bytes32)\":{\"details\":\"Given params must hash back to the commitment stored from `oracleRequest`. Will call the callback address' callback function without bubbling up error checking in a `require` so that the node can get paid.\",\"params\":{\"_callbackAddress\":\"The callback address to call for fulfillment\",\"_callbackFunctionId\":\"The callback function ID to use for fulfillment\",\"_data\":\"The data to return to the consuming contract\",\"_expiration\":\"The expiration that the node should respond by before the requester can cancel\",\"_payment\":\"The payment amount that will be released for the oracle (specified in wei)\",\"_requestId\":\"The fulfillment request ID that must match the requester's\"},\"return\":\"Status if the external call was successful\"},\"getAuthorizationStatus(address)\":{\"params\":{\"_node\":\"The address of the Chainlink node\"},\"return\":\"The authorization status of the node\"},\"onTokenTransfer(address,uint256,bytes)\":{\"details\":\"The data payload's first 2 words will be overwritten by the `_sender` and `_amount` values to ensure correctness. Calls oracleRequest.\",\"params\":{\"_amount\":\"Amount of LINK sent (specified in wei)\",\"_data\":\"Payload of the transaction\",\"_sender\":\"Address of the sender\"}},\"oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)\":{\"details\":\"Stores the hash of the params as the on-chain commitment for the request. Emits OracleRequest event for the Chainlink node to detect.\",\"params\":{\"_callbackAddress\":\"The callback address for the response\",\"_callbackFunctionId\":\"The callback function ID for the response\",\"_data\":\"The CBOR payload of the request\",\"_dataVersion\":\"The specified data version\",\"_nonce\":\"The nonce sent by the requester\",\"_payment\":\"The amount of payment given (specified in wei)\",\"_sender\":\"The sender of the request\",\"_specId\":\"The Job Specification ID\"}},\"renounceOwnership()\":{\"details\":\"Allows the current owner to relinquish control of the contract.\"},\"setFulfillmentPermission(address,bool)\":{\"params\":{\"_allowed\":\"Bool value to determine if the node can fulfill requests\",\"_node\":\"The address of the Chainlink node\"}},\"transferOwnership(address)\":{\"details\":\"Allows the current owner to transfer control of the contract to a newOwner.\",\"params\":{\"_newOwner\":\"The address to transfer ownership to.\"}},\"withdraw(address,uint256)\":{\"details\":\"The owner of the contract can be another wallet and does not have to be a Chainlink node\",\"params\":{\"_amount\":\"The amount to send (specified in wei)\",\"_recipient\":\"The address to send the LINK token to\"}},\"withdrawable()\":{\"details\":\"We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storage\",\"return\":\"The amount of withdrawable LINK on the contract\"}},\"title\":\"The Chainlink Oracle contract\"},\"userdoc\":{\"methods\":{\"cancelOracleRequest(bytes32,uint256,bytes4,uint256)\":{\"notice\":\"Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK sent for the request back to the requester's address.\"},\"fulfillOracleRequest(bytes32,uint256,address,bytes4,uint256,bytes32)\":{\"notice\":\"Called by the Chainlink node to fulfill requests\"},\"getAuthorizationStatus(address)\":{\"notice\":\"Use this to check if a node is authorized for fulfilling requests\"},\"onTokenTransfer(address,uint256,bytes)\":{\"notice\":\"Called when LINK is sent to the contract via `transferAndCall`\"},\"oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)\":{\"notice\":\"Creates the Chainlink request\"},\"renounceOwnership()\":{\"notice\":\"Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore.\"},\"setFulfillmentPermission(address,bool)\":{\"notice\":\"Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow.\"},\"withdraw(address,uint256)\":{\"notice\":\"Allows the node operator to withdraw earned LINK to a given address\"},\"withdrawable()\":{\"notice\":\"Displays the amount of LINK that is available for the node operator to withdraw\"}}}},\"settings\":{\"compilationTarget\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/Oracle.sol\":\"Oracle\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/Oracle.sol\":{\"keccak256\":\"0x7da124d10016e12221da68742b62f6332f489eeaf4c8a69771535f380b062d92\",\"urls\":[\"bzzr://4da4b4039575bbe33085b58e39b2522c3af2aba7dbd73c56c023318b30557546\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/ChainlinkRequestInterface.sol\":{\"keccak256\":\"0x7d3983584065248fba8f0ce75fd86feac43ade43784466f87ea502254ddec992\",\"urls\":[\"bzzr://30de07df8cb9fb4ec53aff0f115f88d65936ffd6e90d2aeb031a05d6bf4de6c1\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/LinkTokenInterface.sol\":{\"keccak256\":\"0x37f31fbd4f4f28ba236cbd9a61ae9b6f7806ea7fe0a684a855e4835f808f8b92\",\"urls\":[\"bzzr://5518135de15ba1afd8bdac829875935dea5520b152d1f602cdc34551d3c0b806\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/interfaces/OracleInterface.sol\":{\"keccak256\":\"0x44f2d7022bf1598dfb2c2c915edba1634088ea29ca25953c641afc3cc3b1a346\",\"urls\":[\"bzzr://d29326f52f4e1387cba2f75c6b577c41bd50dc3eb8a5b3d6c0f16674fb4e3367\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/Ownable.sol\":{\"keccak256\":\"0x84c7090c27cf3657b73d9e26b6b316975fa0bd233b8169f254de0c3b3acfaefc\",\"urls\":[\"bzzr://b983355647976c1daa5de581a1b6a41be9c5adc17cce257b8679649db78f8a11\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/SafeMathChainlink.sol\":{\"keccak256\":\"0xb822782dea15f1fa4992c27639e9f9e4a4758b2c2fd8b12ec90c4de336de9074\",\"urls\":[\"bzzr://1328bb1e33d56d48209e5bbea79fa18b212e8df3f449ac9a75d20962cc36cce5\"]}},\"version\":1}",
"notice":"Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK sent for the request back to the requester's address."
"notice":"Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore."
},
"setFulfillmentPermission(address,bool)":{
"notice":"Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow."
},
"withdraw(address,uint256)":{
"notice":"Allows the node operator to withdraw earned LINK to a given address"
},
"withdrawable()":{
"notice":"Displays the amount of LINK that is available for the node operator to withdraw"
}
}
}
},
"sources":{
"Oracle.sol":{
"id":7
},
"vendor/Ownable.sol":{
"id":38
},
"vendor/SafeMathChainlink.sol":{
"id":40
},
"interfaces/ChainlinkRequestInterface.sol":{
"id":11
},
"interfaces/OracleInterface.sol":{
"id":19
},
"interfaces/LinkTokenInterface.sol":{
"id":18
}
},
"sourceCodes":{
"Oracle.sol":"pragma solidity 0.4.24;\n\nimport \"./vendor/Ownable.sol\";\nimport \"./vendor/SafeMathChainlink.sol\";\nimport \"./interfaces/ChainlinkRequestInterface.sol\";\nimport \"./interfaces/OracleInterface.sol\";\nimport \"./interfaces/LinkTokenInterface.sol\";\n\n/**\n * @title The Chainlink Oracle contract\n * @notice Node operators can deploy this contract to fulfill requests sent to them\n */\ncontract Oracle is ChainlinkRequestInterface, OracleInterface, Ownable {\n using SafeMathChainlink for uint256;\n\n uint256 constant public EXPIRY_TIME = 5 minutes;\n uint256 constant private MINIMUM_CONSUMER_GAS_LIMIT = 400000;\n // We initialize fields to 1 instead of 0 so that the first invocation\n // does not cost more gas.\n uint256 constant private ONE_FOR_CONSISTENT_GAS_COST = 1;\n uint256 constant private SELECTOR_LENGTH = 4;\n uint256 constant private EXPECTED_REQUEST_WORDS = 2;\n uint256 constant private MINIMUM_REQUEST_LENGTH = SELECTOR_LENGTH + (32 * EXPECTED_REQUEST_WORDS);\n\n LinkTokenInterface internal LinkToken;\n mapping(bytes32 => bytes32) private commitments;\n mapping(address => bool) private authorizedNodes;\n uint256 private withdrawableTokens = ONE_FOR_CONSISTENT_GAS_COST;\n\n event OracleRequest(\n bytes32 indexed specId,\n address requester,\n bytes32 requestId,\n uint256 payment,\n address callbackAddr,\n bytes4 callbackFunctionId,\n uint256 cancelExpiration,\n uint256 dataVersion,\n bytes data\n );\n\n event CancelOracleRequest(\n bytes32 indexed requestId\n );\n\n /**\n * @notice Deploy with the address of the LINK token\n * @dev Sets the LinkToken address for the imported LinkTokenInterface\n * @param _link The address of the LINK token\n */\n constructor(address _link) public Ownable() {\n LinkToken = LinkTokenInterface(_link); // external but already deployed and unalterable\n }\n\n /**\n * @notice Called when LINK is sent to the contract via `transferAndCall`\n * @dev The data payload's first 2 words will be overwritten by the `_sender` and `_amount`\n * values to ensure correctness. Calls oracleRequest.\n * @param _sender Address of the sender\n * @param _amount Amount of LINK sent (specified in wei)\n * @param _data Payload of the transaction\n */\n function onTokenTransfer(\n address _sender,\n uint256 _amount,\n bytes _data\n )\n public\n onlyLINK\n validRequestLength(_data)\n permittedFunctionsForLINK(_data)\n {\n assembly { // solhint-disable-line no-inline-assembly\n mstore(add(_data, 36), _sender) // ensure correct sender is passed\n mstore(add(_data, 68), _amount) // ensure correct amount is passed\n }\n // solhint-disable-next-line avoid-low-level-calls\n require(address(this).delegatecall(_data), \"Unable to create request\"); // calls oracleRequest\n }\n\n /**\n * @notice Creates the Chainlink request\n * @dev Stores the hash of the params as the on-chain commitment for the request.\n * Emits OracleRequest event for the Chainlink node to detect.\n * @param _sender The sender of the request\n * @param _payment The amount of payment given (specified in wei)\n * @param _specId The Job Specification ID\n * @param _callbackAddress The callback address for the response\n * @param _callbackFunctionId The callback function ID for the response\n * @param _nonce The nonce sent by the requester\n * @param _dataVersion The specified data version\n * @param _data The CBOR payload of the request\n */\n function oracleRequest(\n address _sender,\n uint256 _payment,\n bytes32 _specId,\n address _callbackAddress,\n bytes4 _callbackFunctionId,\n uint256 _nonce,\n uint256 _dataVersion,\n bytes _data\n )\n external\n onlyLINK\n checkCallbackAddress(_callbackAddress)\n {\n bytes32 requestId = keccak256(abi.encodePacked(_sender, _nonce));\n require(commitments[requestId] == 0, \"Must use a unique ID\");\n // solhint-disable-next-line not-rely-on-time\n uint256 expiration = now.add(EXPIRY_TIME);\n\n commitments[requestId] = keccak256(\n abi.encodePacked(\n _payment,\n _callbackAddress,\n _callbackFunctionId,\n expiration\n )\n );\n\n emit OracleRequest(\n _specId,\n _sender,\n requestId,\n _payment,\n _callbackAddress,\n _callbackFunctionId,\n expiration,\n _dataVersion,\n _data);\n }\n\n /**\n * @notice Called by the Chainlink node to fulfill requests\n * @dev Given params must hash back to the commitment stored from `oracleRequest`.\n * Will call the callback address' callback function without bubbling up error\n * checking in a `require` so that the node can get paid.\n * @param _requestId The fulfillment request ID that must match the requester's\n * @param _payment The payment amount that will be released for the oracle (specified in wei)\n * @param _callbackAddress The callback address to call for fulfillment\n * @param _callbackFunctionId The callback function ID to use for fulfillment\n * @param _expiration The expiration that the node should respond by before the requester can cancel\n * @param _data The data to return to the consuming contract\n * @return Status if the external call was successful\n */\n function fulfillOracleRequest(\n bytes32 _requestId,\n uint256 _payment,\n address _callbackAddress,\n bytes4 _callbackFunctionId,\n uint256 _expiration,\n bytes32 _data\n )\n external\n onlyAuthorizedNode\n isValidRequest(_requestId)\n returns (bool)\n {\n bytes32 paramsHash = keccak256(\n abi.encodePacked(\n _payment,\n _callbackAddress,\n _callbackFunctionId,\n _expiration\n )\n );\n require(commitments[_requestId] == paramsHash, \"Params do not match request ID\");\n withdrawableTokens = withdrawableTokens.add(_payment);\n delete commitments[_requestId];\n require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, \"Must provide consumer enough gas\");\n // All updates to the oracle's fulfillment should come before calling the\n // callback(addr+functionId) as it is untrusted.\n // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern\n return _callbackAddress.call(_callbackFunctionId, _requestId, _data); // solhint-disable-line avoid-low-level-calls\n }\n\n /**\n * @notice Use this to check if a node is authorized for fulfilling requests\n * @param _node The address of the Chainlink node\n * @return The authorization status of the node\n */\n function getAuthorizationStatus(address _node) external view returns (bool) {\n return authorizedNodes[_node];\n }\n\n /**\n * @notice Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow.\n * @param _node The address of the Chainlink node\n * @param _allowed Bool value to determine if the node can fulfill requests\n */\n function setFulfillmentPermission(address _node, bool _allowed) external onlyOwner {\n authorizedNodes[_node] = _allowed;\n }\n\n /**\n * @notice Allows the node operator to withdraw earned LINK to a given address\n * @dev The owner of the contract can be another wallet and does not have to be a Chainlink node\n * @param _recipient The address to send the LINK token to\n * @param _amount The amount to send (specified in wei)\n */\n function withdraw(address _recipient, uint256 _amount)\n external\n onlyOwner\n hasAvailableFunds(_amount)\n {\n withdrawableTokens = withdrawableTokens.sub(_amount);\n assert(LinkToken.transfer(_recipient, _amount));\n }\n\n /**\n * @notice Displays the amount of LINK that is available for the node operator to withdraw\n * @dev We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storage\n * @return The amount of withdrawable LINK on the contract\n */\n function withdrawable() external view onlyOwner returns (uint256) {\n return withdrawableTokens.sub(ONE_FOR_CONSISTENT_GAS_COST);\n }\n\n /**\n * @notice Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK\n * sent for the request back to the requester's address.\n * @dev Given params must hash to a commitment stored on the contract in order for the request to be valid\n * Emits CancelOracleRequest event.\n * @param _requestId The request ID\n * @param _payment The amount of payment given (specified in wei)\n * @param _callbackFunc The requester's specified callback address\n * @param _expiration The time of the expiration for the request\n */\n function cancelOracleRequest(\n bytes32 _requestId,\n uint256 _payment,\n bytes4 _callbackFunc,\n uint256 _expiration\n ) external {\n bytes32 paramsHash = keccak256(\n abi.encodePacked(\n _payment,\n msg.sender,\n _callbackFunc,\n _expiration)\n );\n require(paramsHash == commitments[_requestId], \"Params do not match request ID\");\n // solhint-disable-next-line not-rely-on-time\n require(_expiration <= now, \"Request is not expired\");\n\n delete commitments[_requestId];\n emit CancelOracleRequest(_requestId);\n\n assert(LinkToken.transfer(msg.sender, _payment));\n }\n\n // MODIFIERS\n\n /**\n * @dev Reverts if amount requested is greater than withdrawable balance\n * @param _amount The given amount to compare to `withdrawableTokens`\n */\n modifier hasAvailableFunds(uint256 _amount) {\n require(withdrawableTokens >= _amount.add(ONE_FOR_CONSISTENT_GAS_COST), \"Amount requested is greater than withdrawable balance\");\n _;\n }\n\n /**\n * @dev Reverts if request ID does not exist\n * @param _requestId The given request ID to check in stored `commitments`\n */\n modifier isValidRequest(bytes32 _requestId) {\n require(commitments[_requestId] != 0, \"Must have a valid requestId\");\n _;\n }\n\n /**\n * @dev Reverts if `msg.sender` is not authorized to fulfill requests\n */\n modifier onlyAuthorizedNode() {\n require(authorizedNodes[msg.sender] || msg.sender == owner, \"Not an authorized node to fulfill requests\");\n _;\n }\n\n /**\n * @dev Reverts if not sent from the LINK token\n */\n modifier onlyLINK() {\n require(msg.sender == address(LinkToken), \"Must use LINK token\");\n _;\n }\n\n /**\n * @dev Reverts if the given data does not begin with the `oracleRequest` function selector\n * @param _data The data payload of the request\n */\n modifier permittedFunctionsForLINK(bytes _data) {\n bytes4 funcSelector;\n assembly { // solhint-disable-line no-inline-assembly\n funcSelector := mload(add(_data, 32))\n }\n require(funcSelector == this.oracleRequest.selector, \"Must use whitelisted functions\");\n _;\n }\n\n /**\n * @dev Reverts if the callback address is the LINK token\n * @param _to The callback address\n */\n modifier checkCallbackAddress(address _to) {\n require(_to != address(LinkToken), \"Cannot callback to LINK\");\n _;\n }\n\n /**\n * @dev Reverts if the given payload is less than needed to create a request\n * @param _data The request payload\n */\n modifier validRequestLength(bytes _data) {\n require(_data.length >= MINIMUM_REQUEST_LENGTH, \"Invalid request length\");\n _;\n }\n\n}\n",
"vendor/Ownable.sol":"pragma solidity ^0.4.24;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipRenounced(address indexed previousOwner);\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n constructor() public {\n owner = msg.sender;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n /**\n * @dev Allows the current owner to relinquish control of the contract.\n * @notice Renouncing to ownership will leave the contract without an owner.\n * It will not be possible to call the functions with the `onlyOwner`\n * modifier anymore.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipRenounced(owner);\n owner = address(0);\n }\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function transferOwnership(address _newOwner) public onlyOwner {\n _transferOwnership(_newOwner);\n }\n\n /**\n * @dev Transfers control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function _transferOwnership(address _newOwner) internal {\n require(_newOwner != address(0));\n emit OwnershipTransferred(owner, _newOwner);\n owner = _newOwner;\n }\n}\n",
"vendor/SafeMathChainlink.sol":"pragma solidity ^0.4.11;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMathChainlink {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n // Gas optimization: this is cheaper than asserting 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (_a == 0) {\n return 0;\n }\n\n c = _a * _b;\n assert(c / _a == _b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 _a, uint256 _b) internal pure returns (uint256) {\n // assert(_b > 0); // Solidity automatically throws when dividing by 0\n // uint256 c = _a / _b;\n // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold\n return _a / _b;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {\n assert(_b <= _a);\n return _a - _b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {\n c = _a + _b;\n assert(c >= _a);\n return c;\n }\n}\n",
"metadata":"{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"}],\"name\":\"OwnershipRenounced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"renounceOwnership()\":{\"details\":\"Allows the current owner to relinquish control of the contract.\"},\"transferOwnership(address)\":{\"details\":\"Allows the current owner to transfer control of the contract to a newOwner.\",\"params\":{\"_newOwner\":\"The address to transfer ownership to.\"}}},\"title\":\"Ownable\"},\"userdoc\":{\"methods\":{\"renounceOwnership()\":{\"notice\":\"Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore.\"}}}},\"settings\":{\"compilationTarget\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/Ownable.sol\":{\"keccak256\":\"0x84c7090c27cf3657b73d9e26b6b316975fa0bd233b8169f254de0c3b3acfaefc\",\"urls\":[\"bzzr://b983355647976c1daa5de581a1b6a41be9c5adc17cce257b8679649db78f8a11\"]}},\"version\":1}",
"userdoc":{
"methods":{
"renounceOwnership()":{
"notice":"Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore."
}
}
}
},
"sources":{
"vendor/Ownable.sol":{
"id":38
}
},
"sourceCodes":{
"vendor/Ownable.sol":"pragma solidity ^0.4.24;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipRenounced(address indexed previousOwner);\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n constructor() public {\n owner = msg.sender;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n /**\n * @dev Allows the current owner to relinquish control of the contract.\n * @notice Renouncing to ownership will leave the contract without an owner.\n * It will not be possible to call the functions with the `onlyOwner`\n * modifier anymore.\n */\n function renounceOwnership() public onlyOwner {\n emit OwnershipRenounced(owner);\n owner = address(0);\n }\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function transferOwnership(address _newOwner) public onlyOwner {\n _transferOwnership(_newOwner);\n }\n\n /**\n * @dev Transfers control of the contract to a newOwner.\n * @param _newOwner The address to transfer ownership to.\n */\n function _transferOwnership(address _newOwner) internal {\n require(_newOwner != address(0));\n emit OwnershipTransferred(owner, _newOwner);\n owner = _newOwner;\n }\n}\n"
"metadata":"{\"compiler\":{\"version\":\"0.4.24+commit.e67f0147\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"name\":\"contentType\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"x\",\"type\":\"bytes32\"},{\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"content\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"contentType\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setMultihash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"setContent\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"name\":\"x\",\"type\":\"bytes32\"},{\"name\":\"y\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"multihash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"ensAddr\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"ContentChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"key\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"MultihashChanged\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"return\":\"contentType The content type of the return valuedata The ABI data\"},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"return\":\"The associated address.\"},\"content(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"return\":\"The associated content hash.\"},\"multihash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"return\":\"The associated multihash.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"return\":\"The associated name.\"},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"return\":\"x, y the X and Y coordinates of the curve point for the public key.\"},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"addr\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setContent(bytes32,bytes32)\":{\"params\":{\"hash\":\"The content hash to set\",\"node\":\"The node to update.\"}},\"setMultihash(bytes32,bytes)\":{\"params\":{\"hash\":\"The multihash to set\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"name\":\"The name to set.\",\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"supportsInterface(bytes4)\":{\"params\":{\"interfaceID\":\"The ID of the interface to check for.\"},\"return\":\"True if the contract implements the requested interface.\"},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"return\":\"The associated text data.\"}}},\"userdoc\":{\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"content(bytes32)\":{\"notice\":\"Returns the content hash associated with an ENS node. Note that this resource type is not standardized, and will likely change in future to a resource type based on multihash.\"},\"multihash(bytes32)\":{\"notice\":\"Returns the multihash associated with an ENS node.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"Sets the ABI associated with an ENS node. Nodes may have one ABI of each content type. To remove an ABI, set it to the empty string.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContent(bytes32,bytes32)\":{\"notice\":\"Sets the content hash associated with an ENS node. May only be called by the owner of that node in the ENS registry. Note that this resource type is not standardized, and will likely change in future to a resource type based on multihash.\"},\"setMultihash(bytes32,bytes)\":{\"notice\":\"Sets the multihash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setName(bytes32,string)\":{\"notice\":\"Sets the name associated with an ENS node, for reverse records. May only be called by the owner of that node in the ENS registry.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"Sets the text data associated with an ENS node and key. May only be called by the owner of that node in the ENS registry.\"},\"supportsInterface(bytes4)\":{\"notice\":\"Returns true if the resolver implements the interface specified by the provided hash.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"}}}},\"settings\":{\"compilationTarget\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/ENS.sol\":{\"keccak256\":\"0xcc83b20d8d1b27c26281cef49d7dd8543534b07b2107603f32778be9be04d6e1\",\"urls\":[\"bzzr://85af7df26c00d317d3091ff1df8085c3bea6bd66ed24db378377ad6786da5d58\"]},\"/home/thomas/workspace/chainlink/evm-contracts/src/v0.4/vendor/PublicResolver.sol\":{\"keccak256\":\"0x47ecd49cafa49fd9ca9155e5caedfed378dde0f32640da22c9d99434e15aed8b\",\"urls\":[\"bzzr://a57731602e17d5e6a3032ef7a1c2e040169ac9564e28663c5c38b4a2fd373e7f\"]}},\"version\":1}",
"userdoc":{
"methods":{
"ABI(bytes32,uint256)":{
"notice":"Returns the ABI associated with an ENS node. Defined in EIP205."
},
"addr(bytes32)":{
"notice":"Returns the address associated with an ENS node."
},
"content(bytes32)":{
"notice":"Returns the content hash associated with an ENS node. Note that this resource type is not standardized, and will likely change in future to a resource type based on multihash."
},
"multihash(bytes32)":{
"notice":"Returns the multihash associated with an ENS node."
},
"name(bytes32)":{
"notice":"Returns the name associated with an ENS node, for reverse records. Defined in EIP181."
},
"pubkey(bytes32)":{
"notice":"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619."
},
"setABI(bytes32,uint256,bytes)":{
"notice":"Sets the ABI associated with an ENS node. Nodes may have one ABI of each content type. To remove an ABI, set it to the empty string."
},
"setAddr(bytes32,address)":{
"notice":"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry."
},
"setContent(bytes32,bytes32)":{
"notice":"Sets the content hash associated with an ENS node. May only be called by the owner of that node in the ENS registry. Note that this resource type is not standardized, and will likely change in future to a resource type based on multihash."
},
"setMultihash(bytes32,bytes)":{
"notice":"Sets the multihash associated with an ENS node. May only be called by the owner of that node in the ENS registry."
},
"setName(bytes32,string)":{
"notice":"Sets the name associated with an ENS node, for reverse records. May only be called by the owner of that node in the ENS registry."
},
"setPubkey(bytes32,bytes32,bytes32)":{
"notice":"Sets the SECP256k1 public key associated with an ENS node."
},
"setText(bytes32,string,string)":{
"notice":"Sets the text data associated with an ENS node and key. May only be called by the owner of that node in the ENS registry."
},
"supportsInterface(bytes4)":{
"notice":"Returns true if the resolver implements the interface specified by the provided hash."
},
"text(bytes32,string)":{
"notice":"Returns the text data associated with an ENS node and key."
}
}
}
},
"sources":{
"vendor/PublicResolver.sol":{
"id":39
},
"vendor/ENS.sol":{
"id":35
}
},
"sourceCodes":{
"vendor/PublicResolver.sol":"pragma solidity ^0.4.24;\n\nimport \"./ENS.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver {\n\n bytes4 constant INTERFACE_META_ID = 0x01ffc9a7;\n bytes4 constant ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant CONTENT_INTERFACE_ID = 0xd8389dc5;\n bytes4 constant NAME_INTERFACE_ID = 0x691f3431;\n bytes4 constant ABI_INTERFACE_ID = 0x2203ab56;\n bytes4 constant PUBKEY_INTERFACE_ID = 0xc8690233;\n bytes4 constant TEXT_INTERFACE_ID = 0x59d1d43c;\n bytes4 constant MULTIHASH_INTERFACE_ID = 0xe89401a1;\n\n event AddrChanged(bytes32 indexed node, address a);\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n event NameChanged(bytes32 indexed node, string name);\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n event TextChanged(bytes32 indexed node, string indexedKey, string key);\n event MultihashChanged(bytes32 indexed node, bytes hash);\n\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n struct Record {\n address addr;\n bytes32 content;\n string name;\n PublicKey pubkey;\n mapping(string=>string) text;\n mapping(uint256=>bytes) abis;\n bytes multihash;\n }\n\n ENS ens;\n\n mapping (bytes32 => Record) records;\n\n modifier only_owner(bytes32 node) {\n require(ens.owner(node) == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The ENS registrar contract.\n */\n constructor(ENS ensAddr) public {\n ens = ensAddr;\n }\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param addr The address to set.\n */\n function setAddr(bytes32 node, address addr) public only_owner(node) {\n records[node].addr = addr;\n emit AddrChanged(node, addr);\n }\n\n /**\n * Sets the content hash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * Note that this resource type is not standardized, and will likely change\n * in future to a resource type based on multihash.\n * @param node The node to update.\n * @param hash The content hash to set\n */\n function setContent(bytes32 node, bytes32 hash) public only_owner(node) {\n records[node].content = hash;\n emit ContentChanged(node, hash);\n }\n\n /**\n * Sets the multihash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The multihash to set\n */\n function setMultihash(bytes32 node, bytes hash) public only_owner(node) {\n records[node].multihash = hash;\n emit MultihashChanged(node, hash);\n }\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param name The name to set.\n */\n function setName(bytes32 node, string name) public only_owner(node) {\n records[node].name = name;\n emit NameChanged(node, name);\n }\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes data) public only_owner(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n records[node].abis[contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) public only_owner(node) {\n records[node].pubkey = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string key, string value) public only_owner(node) {\n records[node].text[key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string key) public view returns (string) {\n return records[node].text[key];\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x, y the X and Y coordinates of the curve point for the public key.\n */\n function pubkey(bytes32 node) public view returns (bytes32 x, bytes32 y) {\n return (records[node].pubkey.x, records[node].pubkey.y);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) public view returns (uint256 contentType, bytes data) {\n Record storage record = records[node];\n for (contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && record.abis[contentType].length > 0) {\n data = record.abis[contentType];\n return;\n }\n }\n contentType = 0;\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) public view returns (string) {\n return records[node].name;\n }\n\n /**\n * Returns the content hash associated with an ENS node.\n * Note that this resource type is not standardized, and will likely change\n * in future to a resource type based on multihash.\n * @param node The ENS node to query.\n * @return The associated content hash.\n */\n function content(bytes32 node) public view returns (bytes32) {\n return records[node].content;\n }\n\n /**\n * Returns the multihash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated multihash.\n */\n function multihash(bytes32 node) public view returns (bytes) {\n return records[node].multihash;\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address) {\n return records[node].addr;\n }\n\n /**\n * Returns true if the resolver implements the interface specified by the provided hash.\n * @param interfaceID The ID of the interface to check for.\n * @return True if the contract implements the requested interface.\n */\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == ADDR_INTERFACE_ID ||\n interfaceID == CONTENT_INTERFACE_ID ||\n interfaceID == NAME_INTERFACE_ID ||\n interfaceID == ABI_INTERFACE_ID ||\n interfaceID == PUBKEY_INTERFACE_ID ||\n interfaceID == TEXT_INTERFACE_ID ||\n interfaceID == MULTIHASH_INTERFACE_ID ||\n interfaceID == INTERFACE_META_ID;\n }\n}\n",
"vendor/ENS.sol":"pragma solidity ^0.4.24;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public;\n function setResolver(bytes32 node, address resolver) public;\n function setOwner(bytes32 node, address owner) public;\n function setTTL(bytes32 node, uint64 ttl) public;\n function owner(bytes32 node) public view returns (address);\n function resolver(bytes32 node) public view returns (address);\n function ttl(bytes32 node) public view returns (uint64);\n\n}\n"