mirror of
https://github.com/PatrickAlphaC/dungeons-and-dragons-nft.git
synced 2021-05-29 14:48:35 +03:00
3388 lines
156 KiB
JSON
3388 lines
156 KiB
JSON
{
|
|
"contractName": "VRFConsumerBase",
|
|
"abi": [
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "address",
|
|
"name": "_vrfCoordinator",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "address",
|
|
"name": "_link",
|
|
"type": "address"
|
|
}
|
|
],
|
|
"stateMutability": "nonpayable",
|
|
"type": "constructor"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "bytes32",
|
|
"name": "",
|
|
"type": "bytes32"
|
|
}
|
|
],
|
|
"name": "nonces",
|
|
"outputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"stateMutability": "view",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "bytes32",
|
|
"name": "_keyHash",
|
|
"type": "bytes32"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "_fee",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "_seed",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "requestRandomness",
|
|
"outputs": [
|
|
{
|
|
"internalType": "bytes32",
|
|
"name": "requestId",
|
|
"type": "bytes32"
|
|
}
|
|
],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "bytes32",
|
|
"name": "requestId",
|
|
"type": "bytes32"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "randomness",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "rawFulfillRandomness",
|
|
"outputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
}
|
|
],
|
|
"metadata": "{\"compiler\":{\"version\":\"0.6.6+commit.6c089d02\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_vrfCoordinator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_link\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"requestId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"randomness\",\"type\":\"uint256\"}],\"name\":\"rawFulfillRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_keyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_seed\",\"type\":\"uint256\"}],\"name\":\"requestRandomness\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"requestId\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"PURPOSEReggie the Random Oracle (not his real job) wants to provide randomnessto Vera the verifier in such a way that Vera can be sure he's notmaking his output up to suit himself. Reggie provides Vera a public keyto which he knows the secret key. Each time Vera provides a seed toReggie, he gives back a value which is computed completelydeterministically from the seed and the secret key.Reggie provides a proof by which Vera can verify that the output wascorrectly computed once Reggie tells it to her, but without that proof,the output is indistinguishable to her from a uniform random samplefrom the output space.The purpose of this contract is to make it easy for unrelated contractsto talk to Vera the verifier about the work Reggie is doing, to providesimple access to a verifiable source of randomness. *****************************************************************************USAGECalling contracts must inherit from VRFConsumerInterface, and caninitialize VRFConsumerInterface's attributes in their constructor asshown:contract VRFConsumer {constuctor(<other arguments>, address _vrfCoordinator, address _link)VRFConsumerBase(_vrfCoordinator, _link) public {<initialization with other arguments goes here>}}The oracle will have given you an ID for the VRF keypair they havecommitted to (let's call it keyHash), and have told you the minimum LINKprice for VRF service. Make sure your contract has sufficient LINK, andcall requestRandomness(keyHash, fee, seed), where seed is the input youwant to generate randomness from.Once the VRFCoordinator has received and validated the oracle's responseto your request, it will call your contract's fulfillRandomness method.The randomness argument to fulfillRandomness is the actual random valuegenerated from your seed.The requestId argument is generated from the keyHash and the seed bymakeRequestId(keyHash, seed). If your contract could have concurrentrequests open, you can use the requestId to track which seed isassociated with which randomness. See VRFRequestIDBase.sol for moredetails.Colliding `requestId`s are cryptographically impossible as long as seedsdiffer. (Which is critical to making unpredictable randomness! See thenext section.) * *****************************************************************************SECURITY CONSIDERATIONSTo increase trust in your contract, the source of your seeds should behard for anyone to influence or predict. Any party who can influencethem could in principle collude with the oracle (who can instantlycompute the VRF output for any given seed) to bias the outcomes fromyour contract in their favor. For instance, the block hash is a naturalchoice of seed for many applications, but miners in control of asubstantial fraction of hashing power and with access to VRF outputscould check the result of prospective block hashes as they are mined,and decide not to publish a block if they don't like the outcome it willlead to.On the other hand, using block hashes as the seed makes it particularlyeasy to estimate the economic cost to a miner for this kind of cheating(namely, the block reward and transaction fees they forgo by refrainingfrom publishing a block.)\",\"methods\":{\"requestRandomness(bytes32,uint256,uint256)\":{\"details\":\"The source of the seed data must be something which the oraclecannot anticipate. See \\\"SECURITY CONSIDERATIONS\\\" above.The fulfillRandomness method receives the output, once it's providedby the Oracle, and verified by the vrfCoordinator.The _keyHash must already be registered with the VRFCoordinator, andthe _fee must exceed the fee specified during registration of the_keyHash.The returned requestId can be used to distinguish responses to *concurrent requests. It is passed as the first argument tofulfillRandomness.\",\"params\":{\"_fee\":\"The amount of LINK to send with the request\",\"_keyHash\":\"ID of public key against which randomness is generated\",\"_seed\":\"Random seed from which output randomness is determined\"},\"returns\":{\"requestId\":\"which will be returned with the response to this request\"}}}},\"userdoc\":{\"methods\":{\"requestRandomness(bytes32,uint256,uint256)\":{\"notice\":\"requestRandomness initiates a request for VRF output given _seed\"}},\"notice\":\"****************************************************************************Interface for contracts using VRF randomness *****************************************************************************\"}},\"settings\":{\"compilationTarget\":{\"@chainlink/contracts/src/v0.6/VRFConsumerBase.sol\":\"VRFConsumerBase\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@chainlink/contracts/src/v0.6/VRFConsumerBase.sol\":{\"keccak256\":\"0x183dc62c0b4490931e4c847e9e6a0a1e84d4f2ddfe2ab5cff44c7f1b2c848582\",\"urls\":[\"bzz-raw://d1c3ba3193145f2df8c10395887ee7f2e2ad33418fe8f0e86110e8321e6a70e0\",\"dweb:/ipfs/QmeiwQm3tioeLPUmCpJSWeKUi7LcB8gQgaFX34xwF7fqFW\"]},\"@chainlink/contracts/src/v0.6/VRFRequestIDBase.sol\":{\"keccak256\":\"0x49fd3481ccbfedaedc2072f3338a873009e497a15279c857239c59cbf417ab9a\",\"urls\":[\"bzz-raw://78114391bf17e3fcbaa66b5fe75458d1b0621f5ede7394ce5baaa6042ab922a5\",\"dweb:/ipfs/QmUkrvFsVuXPWjjUtT8SbDkicWcmEn6GsbXkoEsopj3g7y\"]},\"@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol\":{\"keccak256\":\"0xdbf46b45a4c9f38ba71a0391aed0e7b108854b619f292d907ae537228868bda6\",\"urls\":[\"bzz-raw://3ae40466809630c4731e2e3a697d6885727c577aaf260766c8a2f534ad3f6ee8\",\"dweb:/ipfs/QmTzpN5yP4Y5jvQ1ohfXFrce3sjzUiSChYJgZj9VvhVohG\"]},\"@chainlink/contracts/src/v0.6/vendor/SafeMath.sol\":{\"keccak256\":\"0x95dbe2dd5ab8682b99bc3d7d297b621d4237442da160f78d3323ee5c4a06ded3\",\"urls\":[\"bzz-raw://d753308ff4eb43fba6f9ede371a33f707c5818350770dcb078a7d78ac8251361\",\"dweb:/ipfs/Qme64eYKWoTQiP3WhqGHoMqrENNZ9L8SdBLQ2hx5SmzUda\"]}},\"version\":1}",
|
|
"bytecode": "0x",
|
|
"deployedBytecode": "0x",
|
|
"immutableReferences": {},
|
|
"sourceMap": "",
|
|
"deployedSourceMap": "",
|
|
"source": "pragma solidity ^0.6.0;\n\nimport { SafeMath as SafeMath_Chainlink } from \"./vendor/SafeMath.sol\";\n\nimport \"./interfaces/LinkTokenInterface.sol\";\n\nimport \"./VRFRequestIDBase.sol\";\n\n/** ****************************************************************************\n * @notice Interface for contracts using VRF randomness\n * *****************************************************************************\n * @dev PURPOSE\n *\n * @dev Reggie the Random Oracle (not his real job) wants to provide randomness\n * @dev to Vera the verifier in such a way that Vera can be sure he's not\n * @dev making his output up to suit himself. Reggie provides Vera a public key\n * @dev to which he knows the secret key. Each time Vera provides a seed to\n * @dev Reggie, he gives back a value which is computed completely\n * @dev deterministically from the seed and the secret key.\n *\n * @dev Reggie provides a proof by which Vera can verify that the output was\n * @dev correctly computed once Reggie tells it to her, but without that proof,\n * @dev the output is indistinguishable to her from a uniform random sample\n * @dev from the output space.\n *\n * @dev The purpose of this contract is to make it easy for unrelated contracts\n * @dev to talk to Vera the verifier about the work Reggie is doing, to provide\n * @dev simple access to a verifiable source of randomness.\n * *****************************************************************************\n * @dev USAGE\n *\n * @dev Calling contracts must inherit from VRFConsumerInterface, and can\n * @dev initialize VRFConsumerInterface's attributes in their constructor as\n * @dev shown:\n *\n * @dev contract VRFConsumer {\n * @dev constuctor(<other arguments>, address _vrfCoordinator, address _link)\n * @dev VRFConsumerBase(_vrfCoordinator, _link) public {\n * @dev <initialization with other arguments goes here>\n * @dev }\n * @dev }\n *\n * @dev The oracle will have given you an ID for the VRF keypair they have\n * @dev committed to (let's call it keyHash), and have told you the minimum LINK\n * @dev price for VRF service. Make sure your contract has sufficient LINK, and\n * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you\n * @dev want to generate randomness from.\n *\n * @dev Once the VRFCoordinator has received and validated the oracle's response\n * @dev to your request, it will call your contract's fulfillRandomness method.\n *\n * @dev The randomness argument to fulfillRandomness is the actual random value\n * @dev generated from your seed.\n *\n * @dev The requestId argument is generated from the keyHash and the seed by\n * @dev makeRequestId(keyHash, seed). If your contract could have concurrent\n * @dev requests open, you can use the requestId to track which seed is\n * @dev associated with which randomness. See VRFRequestIDBase.sol for more\n * @dev details.\n *\n * @dev Colliding `requestId`s are cryptographically impossible as long as seeds\n * @dev differ. (Which is critical to making unpredictable randomness! See the\n * @dev next section.)\n *\n * *****************************************************************************\n * @dev SECURITY CONSIDERATIONS\n *\n * @dev To increase trust in your contract, the source of your seeds should be\n * @dev hard for anyone to influence or predict. Any party who can influence\n * @dev them could in principle collude with the oracle (who can instantly\n * @dev compute the VRF output for any given seed) to bias the outcomes from\n * @dev your contract in their favor. For instance, the block hash is a natural\n * @dev choice of seed for many applications, but miners in control of a\n * @dev substantial fraction of hashing power and with access to VRF outputs\n * @dev could check the result of prospective block hashes as they are mined,\n * @dev and decide not to publish a block if they don't like the outcome it will\n * @dev lead to.\n *\n * @dev On the other hand, using block hashes as the seed makes it particularly\n * @dev easy to estimate the economic cost to a miner for this kind of cheating\n * @dev (namely, the block reward and transaction fees they forgo by refraining\n * @dev from publishing a block.)\n */\nabstract contract VRFConsumerBase is VRFRequestIDBase {\n\n using SafeMath_Chainlink for uint256;\n\n /**\n * @notice fulfillRandomness handles the VRF response. Your contract must\n * @notice implement it.\n *\n * @dev The VRFCoordinator expects a calling contract to have a method with\n * @dev this signature, and will trigger it once it has verified the proof\n * @dev associated with the randomness (It is triggered via a call to\n * @dev rawFulfillRandomness, below.)\n *\n * @param requestId The Id initially returned by requestRandomness\n * @param randomness the VRF output\n */\n function fulfillRandomness(bytes32 requestId, uint256 randomness)\n internal virtual;\n\n /**\n * @notice requestRandomness initiates a request for VRF output given _seed\n *\n * @dev The source of the seed data must be something which the oracle\n * @dev cannot anticipate. See \"SECURITY CONSIDERATIONS\" above.\n *\n * @dev The fulfillRandomness method receives the output, once it's provided\n * @dev by the Oracle, and verified by the vrfCoordinator.\n *\n * @dev The _keyHash must already be registered with the VRFCoordinator, and\n * @dev the _fee must exceed the fee specified during registration of the\n * @dev _keyHash.\n *\n * @param _keyHash ID of public key against which randomness is generated\n * @param _fee The amount of LINK to send with the request\n * @param _seed Random seed from which output randomness is determined\n *\n * @return requestId which will be returned with the response to this request\n *\n * @dev The returned requestId can be used to distinguish responses to *\n * @dev concurrent requests. It is passed as the first argument to\n * @dev fulfillRandomness.\n */\n function requestRandomness(bytes32 _keyHash, uint256 _fee, uint256 _seed)\n public returns (bytes32 requestId)\n {\n LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, _seed));\n // This is the seed actually passed to the VRF in VRFCoordinator\n uint256 vRFSeed = makeVRFInputSeed(_keyHash, _seed, address(this), nonces[_keyHash]);\n // nonces[_keyHash] must stay in sync with\n // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above\n // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest)\n nonces[_keyHash] = nonces[_keyHash].add(1); \n return makeRequestId(_keyHash, vRFSeed);\n }\n\n LinkTokenInterface internal LINK;\n address internal vrfCoordinator;\n\n // Nonces for each VRF key from which randomness has been requested.\n //\n // Must stay in sync with VRFCoordinator[_keyHash][this]\n mapping(bytes32 /* keyHash */ => uint256 /* nonce */) public nonces;\n constructor(address _vrfCoordinator, address _link) public {\n vrfCoordinator = _vrfCoordinator;\n LINK = LinkTokenInterface(_link);\n }\n\n // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF\n // proof. rawFulfillRandomness then calls fulfillRandomness, after validating\n // the origin of the call\n function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {\n require(msg.sender == vrfCoordinator, \"Only VRFCoordinator can fulfill\");\n fulfillRandomness(requestId, randomness);\n }\n}\n",
|
|
"sourcePath": "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol",
|
|
"ast": {
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol",
|
|
"exportedSymbols": {
|
|
"VRFConsumerBase": [
|
|
602
|
|
]
|
|
},
|
|
"id": 603,
|
|
"nodeType": "SourceUnit",
|
|
"nodes": [
|
|
{
|
|
"id": 481,
|
|
"literals": [
|
|
"solidity",
|
|
"^",
|
|
"0.6",
|
|
".0"
|
|
],
|
|
"nodeType": "PragmaDirective",
|
|
"src": "0:23:3"
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/vendor/SafeMath.sol",
|
|
"file": "./vendor/SafeMath.sol",
|
|
"id": 483,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 887,
|
|
"src": "25:71:3",
|
|
"symbolAliases": [
|
|
{
|
|
"foreign": {
|
|
"argumentTypes": null,
|
|
"id": 482,
|
|
"name": "SafeMath",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": null,
|
|
"src": "34:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": null,
|
|
"typeString": null
|
|
}
|
|
},
|
|
"local": "SafeMath_Chainlink"
|
|
}
|
|
],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol",
|
|
"file": "./interfaces/LinkTokenInterface.sol",
|
|
"id": 484,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 748,
|
|
"src": "98:45:3",
|
|
"symbolAliases": [],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/VRFRequestIDBase.sol",
|
|
"file": "./VRFRequestIDBase.sol",
|
|
"id": 485,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 653,
|
|
"src": "145:32:3",
|
|
"symbolAliases": [],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"abstract": true,
|
|
"baseContracts": [
|
|
{
|
|
"arguments": null,
|
|
"baseName": {
|
|
"contractScope": null,
|
|
"id": 487,
|
|
"name": "VRFRequestIDBase",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 652,
|
|
"src": "4181:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_VRFRequestIDBase_$652",
|
|
"typeString": "contract VRFRequestIDBase"
|
|
}
|
|
},
|
|
"id": 488,
|
|
"nodeType": "InheritanceSpecifier",
|
|
"src": "4181:16:3"
|
|
}
|
|
],
|
|
"contractDependencies": [
|
|
652
|
|
],
|
|
"contractKind": "contract",
|
|
"documentation": {
|
|
"id": 486,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "179:3964:3",
|
|
"text": "****************************************************************************\n@notice Interface for contracts using VRF randomness\n*****************************************************************************\n@dev PURPOSE\n * @dev Reggie the Random Oracle (not his real job) wants to provide randomness\n@dev to Vera the verifier in such a way that Vera can be sure he's not\n@dev making his output up to suit himself. Reggie provides Vera a public key\n@dev to which he knows the secret key. Each time Vera provides a seed to\n@dev Reggie, he gives back a value which is computed completely\n@dev deterministically from the seed and the secret key.\n * @dev Reggie provides a proof by which Vera can verify that the output was\n@dev correctly computed once Reggie tells it to her, but without that proof,\n@dev the output is indistinguishable to her from a uniform random sample\n@dev from the output space.\n * @dev The purpose of this contract is to make it easy for unrelated contracts\n@dev to talk to Vera the verifier about the work Reggie is doing, to provide\n@dev simple access to a verifiable source of randomness.\n*****************************************************************************\n@dev USAGE\n * @dev Calling contracts must inherit from VRFConsumerInterface, and can\n@dev initialize VRFConsumerInterface's attributes in their constructor as\n@dev shown:\n * @dev contract VRFConsumer {\n@dev constuctor(<other arguments>, address _vrfCoordinator, address _link)\n@dev VRFConsumerBase(_vrfCoordinator, _link) public {\n@dev <initialization with other arguments goes here>\n@dev }\n@dev }\n * @dev The oracle will have given you an ID for the VRF keypair they have\n@dev committed to (let's call it keyHash), and have told you the minimum LINK\n@dev price for VRF service. Make sure your contract has sufficient LINK, and\n@dev call requestRandomness(keyHash, fee, seed), where seed is the input you\n@dev want to generate randomness from.\n * @dev Once the VRFCoordinator has received and validated the oracle's response\n@dev to your request, it will call your contract's fulfillRandomness method.\n * @dev The randomness argument to fulfillRandomness is the actual random value\n@dev generated from your seed.\n * @dev The requestId argument is generated from the keyHash and the seed by\n@dev makeRequestId(keyHash, seed). If your contract could have concurrent\n@dev requests open, you can use the requestId to track which seed is\n@dev associated with which randomness. See VRFRequestIDBase.sol for more\n@dev details.\n * @dev Colliding `requestId`s are cryptographically impossible as long as seeds\n@dev differ. (Which is critical to making unpredictable randomness! See the\n@dev next section.)\n * *****************************************************************************\n@dev SECURITY CONSIDERATIONS\n * @dev To increase trust in your contract, the source of your seeds should be\n@dev hard for anyone to influence or predict. Any party who can influence\n@dev them could in principle collude with the oracle (who can instantly\n@dev compute the VRF output for any given seed) to bias the outcomes from\n@dev your contract in their favor. For instance, the block hash is a natural\n@dev choice of seed for many applications, but miners in control of a\n@dev substantial fraction of hashing power and with access to VRF outputs\n@dev could check the result of prospective block hashes as they are mined,\n@dev and decide not to publish a block if they don't like the outcome it will\n@dev lead to.\n * @dev On the other hand, using block hashes as the seed makes it particularly\n@dev easy to estimate the economic cost to a miner for this kind of cheating\n@dev (namely, the block reward and transaction fees they forgo by refraining\n@dev from publishing a block.)"
|
|
},
|
|
"fullyImplemented": false,
|
|
"id": 602,
|
|
"linearizedBaseContracts": [
|
|
602,
|
|
652
|
|
],
|
|
"name": "VRFConsumerBase",
|
|
"nodeType": "ContractDefinition",
|
|
"nodes": [
|
|
{
|
|
"id": 491,
|
|
"libraryName": {
|
|
"contractScope": null,
|
|
"id": 489,
|
|
"name": "SafeMath_Chainlink",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 886,
|
|
"src": "4209:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_SafeMath_$886",
|
|
"typeString": "library SafeMath"
|
|
}
|
|
},
|
|
"nodeType": "UsingForDirective",
|
|
"src": "4203:37:3",
|
|
"typeName": {
|
|
"id": 490,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4232:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"body": null,
|
|
"documentation": {
|
|
"id": 492,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "4244:496:3",
|
|
"text": "@notice fulfillRandomness handles the VRF response. Your contract must\n@notice implement it.\n * @dev The VRFCoordinator expects a calling contract to have a method with\n@dev this signature, and will trigger it once it has verified the proof\n@dev associated with the randomness (It is triggered via a call to\n@dev rawFulfillRandomness, below.)\n * @param requestId The Id initially returned by requestRandomness\n@param randomness the VRF output"
|
|
},
|
|
"id": 499,
|
|
"implemented": false,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "fulfillRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 497,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 494,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 499,
|
|
"src": "4770:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 493,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4770:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 496,
|
|
"mutability": "mutable",
|
|
"name": "randomness",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 499,
|
|
"src": "4789:18:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 495,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4789:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "4769:39:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 498,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "4829:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "4743:87:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": true,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 553,
|
|
"nodeType": "Block",
|
|
"src": "5986:541:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 514,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "6013:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 515,
|
|
"name": "_fee",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 504,
|
|
"src": "6029:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 518,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6046:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 519,
|
|
"name": "_seed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 506,
|
|
"src": "6056:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 516,
|
|
"name": "abi",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -1,
|
|
"src": "6035:3:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_magic_abi",
|
|
"typeString": "abi"
|
|
}
|
|
},
|
|
"id": 517,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"memberName": "encode",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": null,
|
|
"src": "6035:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$",
|
|
"typeString": "function () pure returns (bytes memory)"
|
|
}
|
|
},
|
|
"id": 520,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6035:27:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes_memory_ptr",
|
|
"typeString": "bytes memory"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_bytes_memory_ptr",
|
|
"typeString": "bytes memory"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 511,
|
|
"name": "LINK",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 556,
|
|
"src": "5992:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"id": 513,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "transferAndCall",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": 735,
|
|
"src": "5992:20:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$",
|
|
"typeString": "function (address,uint256,bytes memory) external returns (bool)"
|
|
}
|
|
},
|
|
"id": 521,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "5992:71:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
},
|
|
"id": 522,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "5992:71:3"
|
|
},
|
|
{
|
|
"assignments": [
|
|
524
|
|
],
|
|
"declarations": [
|
|
{
|
|
"constant": false,
|
|
"id": 524,
|
|
"mutability": "mutable",
|
|
"name": "vRFSeed",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 553,
|
|
"src": "6138:15:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 523,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6138:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"id": 536,
|
|
"initialValue": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 526,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6174:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 527,
|
|
"name": "_seed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 506,
|
|
"src": "6184:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 530,
|
|
"name": "this",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -28,
|
|
"src": "6199:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_VRFConsumerBase_$602",
|
|
"typeString": "contract VRFConsumerBase"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_contract$_VRFConsumerBase_$602",
|
|
"typeString": "contract VRFConsumerBase"
|
|
}
|
|
],
|
|
"id": 529,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"nodeType": "ElementaryTypeNameExpression",
|
|
"src": "6191:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_address_$",
|
|
"typeString": "type(address)"
|
|
},
|
|
"typeName": {
|
|
"id": 528,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6191:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": null,
|
|
"typeString": null
|
|
}
|
|
}
|
|
},
|
|
"id": 531,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6191:13:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 532,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6206:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 534,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 533,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6213:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6206:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 525,
|
|
"name": "makeVRFInputSeed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 632,
|
|
"src": "6157:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint256_$_t_address_$_t_uint256_$returns$_t_uint256_$",
|
|
"typeString": "function (bytes32,uint256,address,uint256) pure returns (uint256)"
|
|
}
|
|
},
|
|
"id": 535,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6157:66:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"nodeType": "VariableDeclarationStatement",
|
|
"src": "6138:85:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 546,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 537,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6434:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 539,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 538,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6441:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": true,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6434:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"hexValue": "31",
|
|
"id": 544,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"kind": "number",
|
|
"lValueRequested": false,
|
|
"nodeType": "Literal",
|
|
"src": "6474:1:3",
|
|
"subdenomination": null,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_rational_1_by_1",
|
|
"typeString": "int_const 1"
|
|
},
|
|
"value": "1"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_rational_1_by_1",
|
|
"typeString": "int_const 1"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 540,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6453:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 542,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 541,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6460:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6453:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"id": 543,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "add",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": 776,
|
|
"src": "6453:20:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
|
|
"typeString": "function (uint256,uint256) pure returns (uint256)"
|
|
}
|
|
},
|
|
"id": 545,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6453:23:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"src": "6434:42:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"id": 547,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6434:42:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 549,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6504:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 550,
|
|
"name": "vRFSeed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 524,
|
|
"src": "6514:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 548,
|
|
"name": "makeRequestId",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 651,
|
|
"src": "6490:13:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint256_$returns$_t_bytes32_$",
|
|
"typeString": "function (bytes32,uint256) pure returns (bytes32)"
|
|
}
|
|
},
|
|
"id": 551,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6490:32:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"functionReturnParameters": 510,
|
|
"id": 552,
|
|
"nodeType": "Return",
|
|
"src": "6483:39:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": {
|
|
"id": 500,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "4834:1034:3",
|
|
"text": "@notice requestRandomness initiates a request for VRF output given _seed\n * @dev The source of the seed data must be something which the oracle\n@dev cannot anticipate. See \"SECURITY CONSIDERATIONS\" above.\n * @dev The fulfillRandomness method receives the output, once it's provided\n@dev by the Oracle, and verified by the vrfCoordinator.\n * @dev The _keyHash must already be registered with the VRFCoordinator, and\n@dev the _fee must exceed the fee specified during registration of the\n@dev _keyHash.\n * @param _keyHash ID of public key against which randomness is generated\n@param _fee The amount of LINK to send with the request\n@param _seed Random seed from which output randomness is determined\n * @return requestId which will be returned with the response to this request\n * @dev The returned requestId can be used to distinguish responses to *\n@dev concurrent requests. It is passed as the first argument to\n@dev fulfillRandomness."
|
|
},
|
|
"functionSelector": "dc6cfe10",
|
|
"id": 554,
|
|
"implemented": true,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "requestRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 507,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 502,
|
|
"mutability": "mutable",
|
|
"name": "_keyHash",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5898:16:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 501,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5898:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 504,
|
|
"mutability": "mutable",
|
|
"name": "_fee",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5916:12:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 503,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5916:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 506,
|
|
"mutability": "mutable",
|
|
"name": "_seed",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5930:13:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 505,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5930:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "5897:47:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 510,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 509,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5965:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 508,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5965:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "5964:19:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "5871:656:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 556,
|
|
"mutability": "mutable",
|
|
"name": "LINK",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6531:32:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
},
|
|
"typeName": {
|
|
"contractScope": null,
|
|
"id": 555,
|
|
"name": "LinkTokenInterface",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 747,
|
|
"src": "6531:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 558,
|
|
"mutability": "mutable",
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6567:31:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 557,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6567:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"functionSelector": "9e317f12",
|
|
"id": 562,
|
|
"mutability": "mutable",
|
|
"name": "nonces",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6738:67:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
},
|
|
"typeName": {
|
|
"id": 561,
|
|
"keyType": {
|
|
"id": 559,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6746:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"nodeType": "Mapping",
|
|
"src": "6738:53:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
},
|
|
"valueType": {
|
|
"id": 560,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6771:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 579,
|
|
"nodeType": "Block",
|
|
"src": "6868:81:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 571,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 569,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "6874:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 570,
|
|
"name": "_vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 564,
|
|
"src": "6891:15:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "6874:32:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"id": 572,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6874:32:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 577,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 573,
|
|
"name": "LINK",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 556,
|
|
"src": "6912:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 575,
|
|
"name": "_link",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 566,
|
|
"src": "6938:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
],
|
|
"id": 574,
|
|
"name": "LinkTokenInterface",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 747,
|
|
"src": "6919:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_contract$_LinkTokenInterface_$747_$",
|
|
"typeString": "type(contract LinkTokenInterface)"
|
|
}
|
|
},
|
|
"id": 576,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6919:25:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"src": "6912:32:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"id": 578,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6912:32:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": null,
|
|
"id": 580,
|
|
"implemented": true,
|
|
"kind": "constructor",
|
|
"modifiers": [],
|
|
"name": "",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 567,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 564,
|
|
"mutability": "mutable",
|
|
"name": "_vrfCoordinator",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 580,
|
|
"src": "6821:23:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 563,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6821:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 566,
|
|
"mutability": "mutable",
|
|
"name": "_link",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 580,
|
|
"src": "6846:13:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 565,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6846:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "6820:40:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 568,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "6868:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "6809:140:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 600,
|
|
"nodeType": "Block",
|
|
"src": "7222:129:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"commonType": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"id": 591,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftExpression": {
|
|
"argumentTypes": null,
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 588,
|
|
"name": "msg",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -15,
|
|
"src": "7236:3:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_magic_message",
|
|
"typeString": "msg"
|
|
}
|
|
},
|
|
"id": 589,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "sender",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": null,
|
|
"src": "7236:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address_payable",
|
|
"typeString": "address payable"
|
|
}
|
|
},
|
|
"nodeType": "BinaryOperation",
|
|
"operator": "==",
|
|
"rightExpression": {
|
|
"argumentTypes": null,
|
|
"id": 590,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "7250:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "7236:28:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"hexValue": "4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c",
|
|
"id": 592,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"kind": "string",
|
|
"lValueRequested": false,
|
|
"nodeType": "Literal",
|
|
"src": "7266:33:3",
|
|
"subdenomination": null,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_stringliteral_aa31d97d949424087cac59e348924584a13a8784d3590fa798a0967391035445",
|
|
"typeString": "literal_string \"Only VRFCoordinator can fulfill\""
|
|
},
|
|
"value": "Only VRFCoordinator can fulfill"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_stringliteral_aa31d97d949424087cac59e348924584a13a8784d3590fa798a0967391035445",
|
|
"typeString": "literal_string \"Only VRFCoordinator can fulfill\""
|
|
}
|
|
],
|
|
"id": 587,
|
|
"name": "require",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [
|
|
-18,
|
|
-18
|
|
],
|
|
"referencedDeclaration": -18,
|
|
"src": "7228:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
|
"typeString": "function (bool,string memory) pure"
|
|
}
|
|
},
|
|
"id": 593,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "7228:72:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 594,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "7228:72:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 596,
|
|
"name": "requestId",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 582,
|
|
"src": "7324:9:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 597,
|
|
"name": "randomness",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 584,
|
|
"src": "7335:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 595,
|
|
"name": "fulfillRandomness",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 499,
|
|
"src": "7306:17:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$returns$__$",
|
|
"typeString": "function (bytes32,uint256)"
|
|
}
|
|
},
|
|
"id": 598,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "7306:40:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 599,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "7306:40:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": null,
|
|
"functionSelector": "94985ddd",
|
|
"id": 601,
|
|
"implemented": true,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "rawFulfillRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 585,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 582,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 601,
|
|
"src": "7174:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 581,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "7174:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 584,
|
|
"mutability": "mutable",
|
|
"name": "randomness",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 601,
|
|
"src": "7193:18:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 583,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "7193:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "7173:39:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 586,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "7222:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "7144:207:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "external"
|
|
}
|
|
],
|
|
"scope": 603,
|
|
"src": "4144:3209:3"
|
|
}
|
|
],
|
|
"src": "0:7354:3"
|
|
},
|
|
"legacyAST": {
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol",
|
|
"exportedSymbols": {
|
|
"VRFConsumerBase": [
|
|
602
|
|
]
|
|
},
|
|
"id": 603,
|
|
"nodeType": "SourceUnit",
|
|
"nodes": [
|
|
{
|
|
"id": 481,
|
|
"literals": [
|
|
"solidity",
|
|
"^",
|
|
"0.6",
|
|
".0"
|
|
],
|
|
"nodeType": "PragmaDirective",
|
|
"src": "0:23:3"
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/vendor/SafeMath.sol",
|
|
"file": "./vendor/SafeMath.sol",
|
|
"id": 483,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 887,
|
|
"src": "25:71:3",
|
|
"symbolAliases": [
|
|
{
|
|
"foreign": {
|
|
"argumentTypes": null,
|
|
"id": 482,
|
|
"name": "SafeMath",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": null,
|
|
"src": "34:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": null,
|
|
"typeString": null
|
|
}
|
|
},
|
|
"local": "SafeMath_Chainlink"
|
|
}
|
|
],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol",
|
|
"file": "./interfaces/LinkTokenInterface.sol",
|
|
"id": 484,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 748,
|
|
"src": "98:45:3",
|
|
"symbolAliases": [],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"absolutePath": "@chainlink/contracts/src/v0.6/VRFRequestIDBase.sol",
|
|
"file": "./VRFRequestIDBase.sol",
|
|
"id": 485,
|
|
"nodeType": "ImportDirective",
|
|
"scope": 603,
|
|
"sourceUnit": 653,
|
|
"src": "145:32:3",
|
|
"symbolAliases": [],
|
|
"unitAlias": ""
|
|
},
|
|
{
|
|
"abstract": true,
|
|
"baseContracts": [
|
|
{
|
|
"arguments": null,
|
|
"baseName": {
|
|
"contractScope": null,
|
|
"id": 487,
|
|
"name": "VRFRequestIDBase",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 652,
|
|
"src": "4181:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_VRFRequestIDBase_$652",
|
|
"typeString": "contract VRFRequestIDBase"
|
|
}
|
|
},
|
|
"id": 488,
|
|
"nodeType": "InheritanceSpecifier",
|
|
"src": "4181:16:3"
|
|
}
|
|
],
|
|
"contractDependencies": [
|
|
652
|
|
],
|
|
"contractKind": "contract",
|
|
"documentation": {
|
|
"id": 486,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "179:3964:3",
|
|
"text": "****************************************************************************\n@notice Interface for contracts using VRF randomness\n*****************************************************************************\n@dev PURPOSE\n * @dev Reggie the Random Oracle (not his real job) wants to provide randomness\n@dev to Vera the verifier in such a way that Vera can be sure he's not\n@dev making his output up to suit himself. Reggie provides Vera a public key\n@dev to which he knows the secret key. Each time Vera provides a seed to\n@dev Reggie, he gives back a value which is computed completely\n@dev deterministically from the seed and the secret key.\n * @dev Reggie provides a proof by which Vera can verify that the output was\n@dev correctly computed once Reggie tells it to her, but without that proof,\n@dev the output is indistinguishable to her from a uniform random sample\n@dev from the output space.\n * @dev The purpose of this contract is to make it easy for unrelated contracts\n@dev to talk to Vera the verifier about the work Reggie is doing, to provide\n@dev simple access to a verifiable source of randomness.\n*****************************************************************************\n@dev USAGE\n * @dev Calling contracts must inherit from VRFConsumerInterface, and can\n@dev initialize VRFConsumerInterface's attributes in their constructor as\n@dev shown:\n * @dev contract VRFConsumer {\n@dev constuctor(<other arguments>, address _vrfCoordinator, address _link)\n@dev VRFConsumerBase(_vrfCoordinator, _link) public {\n@dev <initialization with other arguments goes here>\n@dev }\n@dev }\n * @dev The oracle will have given you an ID for the VRF keypair they have\n@dev committed to (let's call it keyHash), and have told you the minimum LINK\n@dev price for VRF service. Make sure your contract has sufficient LINK, and\n@dev call requestRandomness(keyHash, fee, seed), where seed is the input you\n@dev want to generate randomness from.\n * @dev Once the VRFCoordinator has received and validated the oracle's response\n@dev to your request, it will call your contract's fulfillRandomness method.\n * @dev The randomness argument to fulfillRandomness is the actual random value\n@dev generated from your seed.\n * @dev The requestId argument is generated from the keyHash and the seed by\n@dev makeRequestId(keyHash, seed). If your contract could have concurrent\n@dev requests open, you can use the requestId to track which seed is\n@dev associated with which randomness. See VRFRequestIDBase.sol for more\n@dev details.\n * @dev Colliding `requestId`s are cryptographically impossible as long as seeds\n@dev differ. (Which is critical to making unpredictable randomness! See the\n@dev next section.)\n * *****************************************************************************\n@dev SECURITY CONSIDERATIONS\n * @dev To increase trust in your contract, the source of your seeds should be\n@dev hard for anyone to influence or predict. Any party who can influence\n@dev them could in principle collude with the oracle (who can instantly\n@dev compute the VRF output for any given seed) to bias the outcomes from\n@dev your contract in their favor. For instance, the block hash is a natural\n@dev choice of seed for many applications, but miners in control of a\n@dev substantial fraction of hashing power and with access to VRF outputs\n@dev could check the result of prospective block hashes as they are mined,\n@dev and decide not to publish a block if they don't like the outcome it will\n@dev lead to.\n * @dev On the other hand, using block hashes as the seed makes it particularly\n@dev easy to estimate the economic cost to a miner for this kind of cheating\n@dev (namely, the block reward and transaction fees they forgo by refraining\n@dev from publishing a block.)"
|
|
},
|
|
"fullyImplemented": false,
|
|
"id": 602,
|
|
"linearizedBaseContracts": [
|
|
602,
|
|
652
|
|
],
|
|
"name": "VRFConsumerBase",
|
|
"nodeType": "ContractDefinition",
|
|
"nodes": [
|
|
{
|
|
"id": 491,
|
|
"libraryName": {
|
|
"contractScope": null,
|
|
"id": 489,
|
|
"name": "SafeMath_Chainlink",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 886,
|
|
"src": "4209:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_SafeMath_$886",
|
|
"typeString": "library SafeMath"
|
|
}
|
|
},
|
|
"nodeType": "UsingForDirective",
|
|
"src": "4203:37:3",
|
|
"typeName": {
|
|
"id": 490,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4232:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"body": null,
|
|
"documentation": {
|
|
"id": 492,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "4244:496:3",
|
|
"text": "@notice fulfillRandomness handles the VRF response. Your contract must\n@notice implement it.\n * @dev The VRFCoordinator expects a calling contract to have a method with\n@dev this signature, and will trigger it once it has verified the proof\n@dev associated with the randomness (It is triggered via a call to\n@dev rawFulfillRandomness, below.)\n * @param requestId The Id initially returned by requestRandomness\n@param randomness the VRF output"
|
|
},
|
|
"id": 499,
|
|
"implemented": false,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "fulfillRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 497,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 494,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 499,
|
|
"src": "4770:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 493,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4770:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 496,
|
|
"mutability": "mutable",
|
|
"name": "randomness",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 499,
|
|
"src": "4789:18:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 495,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "4789:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "4769:39:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 498,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "4829:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "4743:87:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": true,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 553,
|
|
"nodeType": "Block",
|
|
"src": "5986:541:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 514,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "6013:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 515,
|
|
"name": "_fee",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 504,
|
|
"src": "6029:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 518,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6046:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 519,
|
|
"name": "_seed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 506,
|
|
"src": "6056:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 516,
|
|
"name": "abi",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -1,
|
|
"src": "6035:3:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_magic_abi",
|
|
"typeString": "abi"
|
|
}
|
|
},
|
|
"id": 517,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"memberName": "encode",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": null,
|
|
"src": "6035:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$",
|
|
"typeString": "function () pure returns (bytes memory)"
|
|
}
|
|
},
|
|
"id": 520,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6035:27:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes_memory_ptr",
|
|
"typeString": "bytes memory"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_bytes_memory_ptr",
|
|
"typeString": "bytes memory"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 511,
|
|
"name": "LINK",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 556,
|
|
"src": "5992:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"id": 513,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "transferAndCall",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": 735,
|
|
"src": "5992:20:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$",
|
|
"typeString": "function (address,uint256,bytes memory) external returns (bool)"
|
|
}
|
|
},
|
|
"id": 521,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "5992:71:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
},
|
|
"id": 522,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "5992:71:3"
|
|
},
|
|
{
|
|
"assignments": [
|
|
524
|
|
],
|
|
"declarations": [
|
|
{
|
|
"constant": false,
|
|
"id": 524,
|
|
"mutability": "mutable",
|
|
"name": "vRFSeed",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 553,
|
|
"src": "6138:15:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 523,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6138:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"id": 536,
|
|
"initialValue": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 526,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6174:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 527,
|
|
"name": "_seed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 506,
|
|
"src": "6184:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 530,
|
|
"name": "this",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -28,
|
|
"src": "6199:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_VRFConsumerBase_$602",
|
|
"typeString": "contract VRFConsumerBase"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_contract$_VRFConsumerBase_$602",
|
|
"typeString": "contract VRFConsumerBase"
|
|
}
|
|
],
|
|
"id": 529,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"nodeType": "ElementaryTypeNameExpression",
|
|
"src": "6191:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_address_$",
|
|
"typeString": "type(address)"
|
|
},
|
|
"typeName": {
|
|
"id": 528,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6191:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": null,
|
|
"typeString": null
|
|
}
|
|
}
|
|
},
|
|
"id": 531,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6191:13:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 532,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6206:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 534,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 533,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6213:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6206:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 525,
|
|
"name": "makeVRFInputSeed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 632,
|
|
"src": "6157:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint256_$_t_address_$_t_uint256_$returns$_t_uint256_$",
|
|
"typeString": "function (bytes32,uint256,address,uint256) pure returns (uint256)"
|
|
}
|
|
},
|
|
"id": 535,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6157:66:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"nodeType": "VariableDeclarationStatement",
|
|
"src": "6138:85:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 546,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 537,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6434:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 539,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 538,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6441:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": true,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6434:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"hexValue": "31",
|
|
"id": 544,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"kind": "number",
|
|
"lValueRequested": false,
|
|
"nodeType": "Literal",
|
|
"src": "6474:1:3",
|
|
"subdenomination": null,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_rational_1_by_1",
|
|
"typeString": "int_const 1"
|
|
},
|
|
"value": "1"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_rational_1_by_1",
|
|
"typeString": "int_const 1"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"baseExpression": {
|
|
"argumentTypes": null,
|
|
"id": 540,
|
|
"name": "nonces",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 562,
|
|
"src": "6453:6:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
}
|
|
},
|
|
"id": 542,
|
|
"indexExpression": {
|
|
"argumentTypes": null,
|
|
"id": 541,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6460:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"isConstant": false,
|
|
"isLValue": true,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"nodeType": "IndexAccess",
|
|
"src": "6453:16:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"id": 543,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "add",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": 776,
|
|
"src": "6453:20:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
|
|
"typeString": "function (uint256,uint256) pure returns (uint256)"
|
|
}
|
|
},
|
|
"id": 545,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6453:23:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"src": "6434:42:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"id": 547,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6434:42:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 549,
|
|
"name": "_keyHash",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 502,
|
|
"src": "6504:8:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 550,
|
|
"name": "vRFSeed",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 524,
|
|
"src": "6514:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 548,
|
|
"name": "makeRequestId",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 651,
|
|
"src": "6490:13:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint256_$returns$_t_bytes32_$",
|
|
"typeString": "function (bytes32,uint256) pure returns (bytes32)"
|
|
}
|
|
},
|
|
"id": 551,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6490:32:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"functionReturnParameters": 510,
|
|
"id": 552,
|
|
"nodeType": "Return",
|
|
"src": "6483:39:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": {
|
|
"id": 500,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "4834:1034:3",
|
|
"text": "@notice requestRandomness initiates a request for VRF output given _seed\n * @dev The source of the seed data must be something which the oracle\n@dev cannot anticipate. See \"SECURITY CONSIDERATIONS\" above.\n * @dev The fulfillRandomness method receives the output, once it's provided\n@dev by the Oracle, and verified by the vrfCoordinator.\n * @dev The _keyHash must already be registered with the VRFCoordinator, and\n@dev the _fee must exceed the fee specified during registration of the\n@dev _keyHash.\n * @param _keyHash ID of public key against which randomness is generated\n@param _fee The amount of LINK to send with the request\n@param _seed Random seed from which output randomness is determined\n * @return requestId which will be returned with the response to this request\n * @dev The returned requestId can be used to distinguish responses to *\n@dev concurrent requests. It is passed as the first argument to\n@dev fulfillRandomness."
|
|
},
|
|
"functionSelector": "dc6cfe10",
|
|
"id": 554,
|
|
"implemented": true,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "requestRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 507,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 502,
|
|
"mutability": "mutable",
|
|
"name": "_keyHash",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5898:16:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 501,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5898:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 504,
|
|
"mutability": "mutable",
|
|
"name": "_fee",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5916:12:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 503,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5916:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 506,
|
|
"mutability": "mutable",
|
|
"name": "_seed",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5930:13:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 505,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5930:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "5897:47:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 510,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 509,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 554,
|
|
"src": "5965:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 508,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "5965:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "5964:19:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "5871:656:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 556,
|
|
"mutability": "mutable",
|
|
"name": "LINK",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6531:32:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
},
|
|
"typeName": {
|
|
"contractScope": null,
|
|
"id": 555,
|
|
"name": "LinkTokenInterface",
|
|
"nodeType": "UserDefinedTypeName",
|
|
"referencedDeclaration": 747,
|
|
"src": "6531:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 558,
|
|
"mutability": "mutable",
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6567:31:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 557,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6567:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"functionSelector": "9e317f12",
|
|
"id": 562,
|
|
"mutability": "mutable",
|
|
"name": "nonces",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 602,
|
|
"src": "6738:67:3",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
},
|
|
"typeName": {
|
|
"id": 561,
|
|
"keyType": {
|
|
"id": 559,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6746:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"nodeType": "Mapping",
|
|
"src": "6738:53:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$",
|
|
"typeString": "mapping(bytes32 => uint256)"
|
|
},
|
|
"valueType": {
|
|
"id": 560,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6771:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 579,
|
|
"nodeType": "Block",
|
|
"src": "6868:81:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 571,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 569,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "6874:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 570,
|
|
"name": "_vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 564,
|
|
"src": "6891:15:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "6874:32:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"id": 572,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6874:32:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 577,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"argumentTypes": null,
|
|
"id": 573,
|
|
"name": "LINK",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 556,
|
|
"src": "6912:4:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 575,
|
|
"name": "_link",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 566,
|
|
"src": "6938:5:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
],
|
|
"id": 574,
|
|
"name": "LinkTokenInterface",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 747,
|
|
"src": "6919:18:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_contract$_LinkTokenInterface_$747_$",
|
|
"typeString": "type(contract LinkTokenInterface)"
|
|
}
|
|
},
|
|
"id": 576,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "6919:25:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"src": "6912:32:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_LinkTokenInterface_$747",
|
|
"typeString": "contract LinkTokenInterface"
|
|
}
|
|
},
|
|
"id": 578,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "6912:32:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": null,
|
|
"id": 580,
|
|
"implemented": true,
|
|
"kind": "constructor",
|
|
"modifiers": [],
|
|
"name": "",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 567,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 564,
|
|
"mutability": "mutable",
|
|
"name": "_vrfCoordinator",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 580,
|
|
"src": "6821:23:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 563,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6821:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 566,
|
|
"mutability": "mutable",
|
|
"name": "_link",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 580,
|
|
"src": "6846:13:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 565,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "6846:7:3",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "6820:40:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 568,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "6868:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "6809:140:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "public"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 600,
|
|
"nodeType": "Block",
|
|
"src": "7222:129:3",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"commonType": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"id": 591,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftExpression": {
|
|
"argumentTypes": null,
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"id": 588,
|
|
"name": "msg",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": -15,
|
|
"src": "7236:3:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_magic_message",
|
|
"typeString": "msg"
|
|
}
|
|
},
|
|
"id": 589,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"memberName": "sender",
|
|
"nodeType": "MemberAccess",
|
|
"referencedDeclaration": null,
|
|
"src": "7236:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address_payable",
|
|
"typeString": "address payable"
|
|
}
|
|
},
|
|
"nodeType": "BinaryOperation",
|
|
"operator": "==",
|
|
"rightExpression": {
|
|
"argumentTypes": null,
|
|
"id": 590,
|
|
"name": "vrfCoordinator",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 558,
|
|
"src": "7250:14:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "7236:28:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"hexValue": "4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c",
|
|
"id": 592,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"kind": "string",
|
|
"lValueRequested": false,
|
|
"nodeType": "Literal",
|
|
"src": "7266:33:3",
|
|
"subdenomination": null,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_stringliteral_aa31d97d949424087cac59e348924584a13a8784d3590fa798a0967391035445",
|
|
"typeString": "literal_string \"Only VRFCoordinator can fulfill\""
|
|
},
|
|
"value": "Only VRFCoordinator can fulfill"
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_stringliteral_aa31d97d949424087cac59e348924584a13a8784d3590fa798a0967391035445",
|
|
"typeString": "literal_string \"Only VRFCoordinator can fulfill\""
|
|
}
|
|
],
|
|
"id": 587,
|
|
"name": "require",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [
|
|
-18,
|
|
-18
|
|
],
|
|
"referencedDeclaration": -18,
|
|
"src": "7228:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
|
"typeString": "function (bool,string memory) pure"
|
|
}
|
|
},
|
|
"id": 593,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "7228:72:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 594,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "7228:72:3"
|
|
},
|
|
{
|
|
"expression": {
|
|
"argumentTypes": null,
|
|
"arguments": [
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 596,
|
|
"name": "requestId",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 582,
|
|
"src": "7324:9:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
{
|
|
"argumentTypes": null,
|
|
"id": 597,
|
|
"name": "randomness",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 584,
|
|
"src": "7335:10:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
{
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
],
|
|
"id": 595,
|
|
"name": "fulfillRandomness",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 499,
|
|
"src": "7306:17:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$returns$__$",
|
|
"typeString": "function (bytes32,uint256)"
|
|
}
|
|
},
|
|
"id": 598,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "7306:40:3",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 599,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "7306:40:3"
|
|
}
|
|
]
|
|
},
|
|
"documentation": null,
|
|
"functionSelector": "94985ddd",
|
|
"id": 601,
|
|
"implemented": true,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "rawFulfillRandomness",
|
|
"nodeType": "FunctionDefinition",
|
|
"overrides": null,
|
|
"parameters": {
|
|
"id": 585,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [
|
|
{
|
|
"constant": false,
|
|
"id": 582,
|
|
"mutability": "mutable",
|
|
"name": "requestId",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 601,
|
|
"src": "7174:17:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
},
|
|
"typeName": {
|
|
"id": 581,
|
|
"name": "bytes32",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "7174:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bytes32",
|
|
"typeString": "bytes32"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"constant": false,
|
|
"id": 584,
|
|
"mutability": "mutable",
|
|
"name": "randomness",
|
|
"nodeType": "VariableDeclaration",
|
|
"overrides": null,
|
|
"scope": 601,
|
|
"src": "7193:18:3",
|
|
"stateVariable": false,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
},
|
|
"typeName": {
|
|
"id": 583,
|
|
"name": "uint256",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "7193:7:3",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_uint256",
|
|
"typeString": "uint256"
|
|
}
|
|
},
|
|
"value": null,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"src": "7173:39:3"
|
|
},
|
|
"returnParameters": {
|
|
"id": 586,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "7222:0:3"
|
|
},
|
|
"scope": 602,
|
|
"src": "7144:207:3",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "external"
|
|
}
|
|
],
|
|
"scope": 603,
|
|
"src": "4144:3209:3"
|
|
}
|
|
],
|
|
"src": "0:7354:3"
|
|
},
|
|
"compiler": {
|
|
"name": "solc",
|
|
"version": "0.6.6+commit.6c089d02.Emscripten.clang"
|
|
},
|
|
"networks": {},
|
|
"schemaVersion": "3.2.5",
|
|
"updatedAt": "2020-10-28T15:56:43.353Z",
|
|
"devdoc": {
|
|
"details": "PURPOSEReggie the Random Oracle (not his real job) wants to provide randomnessto Vera the verifier in such a way that Vera can be sure he's notmaking his output up to suit himself. Reggie provides Vera a public keyto which he knows the secret key. Each time Vera provides a seed toReggie, he gives back a value which is computed completelydeterministically from the seed and the secret key.Reggie provides a proof by which Vera can verify that the output wascorrectly computed once Reggie tells it to her, but without that proof,the output is indistinguishable to her from a uniform random samplefrom the output space.The purpose of this contract is to make it easy for unrelated contractsto talk to Vera the verifier about the work Reggie is doing, to providesimple access to a verifiable source of randomness. *****************************************************************************USAGECalling contracts must inherit from VRFConsumerInterface, and caninitialize VRFConsumerInterface's attributes in their constructor asshown:contract VRFConsumer {constuctor(<other arguments>, address _vrfCoordinator, address _link)VRFConsumerBase(_vrfCoordinator, _link) public {<initialization with other arguments goes here>}}The oracle will have given you an ID for the VRF keypair they havecommitted to (let's call it keyHash), and have told you the minimum LINKprice for VRF service. Make sure your contract has sufficient LINK, andcall requestRandomness(keyHash, fee, seed), where seed is the input youwant to generate randomness from.Once the VRFCoordinator has received and validated the oracle's responseto your request, it will call your contract's fulfillRandomness method.The randomness argument to fulfillRandomness is the actual random valuegenerated from your seed.The requestId argument is generated from the keyHash and the seed bymakeRequestId(keyHash, seed). If your contract could have concurrentrequests open, you can use the requestId to track which seed isassociated with which randomness. See VRFRequestIDBase.sol for moredetails.Colliding `requestId`s are cryptographically impossible as long as seedsdiffer. (Which is critical to making unpredictable randomness! See thenext section.) * *****************************************************************************SECURITY CONSIDERATIONSTo increase trust in your contract, the source of your seeds should behard for anyone to influence or predict. Any party who can influencethem could in principle collude with the oracle (who can instantlycompute the VRF output for any given seed) to bias the outcomes fromyour contract in their favor. For instance, the block hash is a naturalchoice of seed for many applications, but miners in control of asubstantial fraction of hashing power and with access to VRF outputscould check the result of prospective block hashes as they are mined,and decide not to publish a block if they don't like the outcome it willlead to.On the other hand, using block hashes as the seed makes it particularlyeasy to estimate the economic cost to a miner for this kind of cheating(namely, the block reward and transaction fees they forgo by refrainingfrom publishing a block.)",
|
|
"methods": {
|
|
"requestRandomness(bytes32,uint256,uint256)": {
|
|
"details": "The source of the seed data must be something which the oraclecannot anticipate. See \"SECURITY CONSIDERATIONS\" above.The fulfillRandomness method receives the output, once it's providedby the Oracle, and verified by the vrfCoordinator.The _keyHash must already be registered with the VRFCoordinator, andthe _fee must exceed the fee specified during registration of the_keyHash.The returned requestId can be used to distinguish responses to *concurrent requests. It is passed as the first argument tofulfillRandomness.",
|
|
"params": {
|
|
"_fee": "The amount of LINK to send with the request",
|
|
"_keyHash": "ID of public key against which randomness is generated",
|
|
"_seed": "Random seed from which output randomness is determined"
|
|
},
|
|
"returns": {
|
|
"requestId": "which will be returned with the response to this request"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"userdoc": {
|
|
"methods": {
|
|
"requestRandomness(bytes32,uint256,uint256)": {
|
|
"notice": "requestRandomness initiates a request for VRF output given _seed"
|
|
}
|
|
},
|
|
"notice": "****************************************************************************Interface for contracts using VRF randomness *****************************************************************************"
|
|
}
|
|
} |