UNPKG

@ethsub/sol

Version:
1,050 lines 149 kB
{ "contractName": "HandlerHelpers", "abi": [ { "inputs": [ { "internalType": "address", "name": "bridgeAddress", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "_bridgeAddress", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "_burnList", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "_contractWhitelist", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "name": "_resourceIDToTokenContractAddress", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "_tokenContractAddressToResourceID", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes32", "name": "resourceID", "type": "bytes32" }, { "internalType": "address", "name": "contractAddress", "type": "address" } ], "name": "setResource", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "contractAddress", "type": "address" } ], "name": "setBurnable", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"_bridgeAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_burnList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_contractWhitelist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"_resourceIDToTokenContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_tokenContractAddressToResourceID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"setBurnable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"resourceID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"setResource\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"ChainSafe Systems.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"bridgeAddress\":\"Contract address of previously deployed Bridge.\"}},\"setBurnable(address)\":{\"params\":{\"contractAddress\":\"Address of contract to be used when making or executing deposits.\"}},\"setResource(bytes32,address)\":{\"params\":{\"contractAddress\":\"Address of contract to be called when a deposit is made and a deposited is executed.\",\"resourceID\":\"ResourceID to be used when making deposits.\"}},\"withdraw(bytes)\":{\"params\":{\"data\":\"ABI-encoded withdrawal params relevant to the handler.\"}}},\"title\":\"Function used across handler contracts.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"setBurnable(address)\":{\"notice\":\"First verifies {contractAddress} is whitelisted, then sets {_burnList}[{contractAddress}] to true.\"},\"setResource(bytes32,address)\":{\"notice\":\"First verifies {_resourceIDToContractAddress}[{resourceID}] and {_contractAddressToResourceID}[{contractAddress}] are not already set, then sets {_resourceIDToContractAddress} with {contractAddress}, {_contractAddressToResourceID} with {resourceID}, and {_contractWhitelist} to true for {contractAddress}.\"},\"withdraw(bytes)\":{\"notice\":\"Withdraw funds from ERC safes.\"}},\"notice\":\"This contract is intended to be used with the Bridge contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/handlers/HandlerHelpers.sol\":\"HandlerHelpers\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/handlers/HandlerHelpers.sol\":{\"keccak256\":\"0x9418d0646c373e028595a4a3abf5ac93948ea64efa031f1531c70a0500882d09\",\"license\":\"LGPL-3.0-only\",\"urls\":[\"bzz-raw://43e30989056cc8c5f0d2a26cb3a7e8a5d0d51dd2c832fb8d751c353226254871\",\"dweb:/ipfs/QmRpXPeLz7Qjh5qxMW4PyC8qkjrpEJCeCiqfobZyg28y6S\"]},\"project:/contracts/interfaces/IERCHandler.sol\":{\"keccak256\":\"0x4384276611a789db6481e1158d92c280fe5990ec0c375df30dd5e8f8a97cbb4c\",\"license\":\"LGPL-3.0-only\",\"urls\":[\"bzz-raw://3af488536c6d8f6b3090ca9b5fa54718941604a30f58bd66db641a6599a9f296\",\"dweb:/ipfs/QmSm988tQV4XtkCQpTbf2SbdCHp8AcjYZhQLhftPFXrUf2\"]}},\"version\":1}", "bytecode": "0x60a060405234801561001057600080fd5b506040516105123803806105128339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b03166104a661006c60003980610291528061031052506104a66000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80636a70d0811161005b5780636a70d0811461019c5780637f79bea8146101d6578063b8fa3736146101fc578063c8ba6c871461022857610088565b806307b7ed991461008d5780630968f264146100b55780630a6d55d81461015b578063318c136e14610194575b600080fd5b6100b3600480360360208110156100a357600080fd5b50356001600160a01b0316610260565b005b6100b3600480360360208110156100cb57600080fd5b8101906020810181356401000000008111156100e657600080fd5b8201836020820111156100f857600080fd5b8035906020019184600183028401116401000000008311171561011a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610271945050505050565b6101786004803603602081101561017157600080fd5b5035610274565b604080516001600160a01b039092168252519081900360200190f35b61017861028f565b6101c2600480360360208110156101b257600080fd5b50356001600160a01b03166102b3565b604080519115158252519081900360200190f35b6101c2600480360360208110156101ec57600080fd5b50356001600160a01b03166102c8565b6100b36004803603604081101561021257600080fd5b50803590602001356001600160a01b03166102dd565b61024e6004803603602081101561023e57600080fd5b50356001600160a01b03166102f3565b60408051918252519081900360200190f35b610268610305565b61027181610384565b50565b6000602081905290815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6102e5610305565b6102ef82826103ff565b5050565b60016020526000908152604090205481565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610382576040805162461bcd60e51b815260206004820152601e60248201527f73656e646572206d7573742062652062726964676520636f6e74726163740000604482015290519081900360640190fd5b565b6001600160a01b03811660009081526002602052604090205460ff166103db5760405162461bcd60e51b815260040180806020018281038252602481526020018061044d6024913960400191505060405180910390fd5b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b60008281526020818152604080832080546001600160a01b039095166001600160a01b0319909516851790559282526001808252838320949094556002905220805460ff1916909117905556fe70726f766964656420636f6e7472616374206973206e6f742077686974656c6973746564a26469706673582212208a8d0d23698e2e74e3c62ce96269902621a962774d9fdccc4e8da3c9e4ad98a464736f6c634300060c0033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100885760003560e01c80636a70d0811161005b5780636a70d0811461019c5780637f79bea8146101d6578063b8fa3736146101fc578063c8ba6c871461022857610088565b806307b7ed991461008d5780630968f264146100b55780630a6d55d81461015b578063318c136e14610194575b600080fd5b6100b3600480360360208110156100a357600080fd5b50356001600160a01b0316610260565b005b6100b3600480360360208110156100cb57600080fd5b8101906020810181356401000000008111156100e657600080fd5b8201836020820111156100f857600080fd5b8035906020019184600183028401116401000000008311171561011a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610271945050505050565b6101786004803603602081101561017157600080fd5b5035610274565b604080516001600160a01b039092168252519081900360200190f35b61017861028f565b6101c2600480360360208110156101b257600080fd5b50356001600160a01b03166102b3565b604080519115158252519081900360200190f35b6101c2600480360360208110156101ec57600080fd5b50356001600160a01b03166102c8565b6100b36004803603604081101561021257600080fd5b50803590602001356001600160a01b03166102dd565b61024e6004803603602081101561023e57600080fd5b50356001600160a01b03166102f3565b60408051918252519081900360200190f35b610268610305565b61027181610384565b50565b6000602081905290815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6102e5610305565b6102ef82826103ff565b5050565b60016020526000908152604090205481565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610382576040805162461bcd60e51b815260206004820152601e60248201527f73656e646572206d7573742062652062726964676520636f6e74726163740000604482015290519081900360640190fd5b565b6001600160a01b03811660009081526002602052604090205460ff166103db5760405162461bcd60e51b815260040180806020018281038252602481526020018061044d6024913960400191505060405180910390fd5b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b60008281526020818152604080832080546001600160a01b039095166001600160a01b0319909516851790559282526001808252838320949094556002905220805460ff1916909117905556fe70726f766964656420636f6e7472616374206973206e6f742077686974656c6973746564a26469706673582212208a8d0d23698e2e74e3c62ce96269902621a962774d9fdccc4e8da3c9e4ad98a464736f6c634300060c0033", "immutableReferences": { "9652": [ { "length": 32, "start": 657 }, { "length": 32, "start": 784 } ] }, "sourceMap": "273:2584:48:-:0;;;970:112;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;970:112:48;1045:30;;;;-1:-1:-1;;;;;;1045:30:48;;;-1:-1:-1;;;;;273:2584:48;;;;;;;;", "deployedSourceMap": "273:2584:48:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2170:120;;;;;;;;;;;;;;;;-1:-1:-1;2170:120:48;-1:-1:-1;;;;;2170:120:48;;:::i;:::-;;2296:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2296:65:48;;-1:-1:-1;2296:65:48;;-1:-1:-1;;;;;2296:65:48:i;408:69::-;;;;;;;;;;;;;;;;-1:-1:-1;408:69:48;;:::i;:::-;;;;-1:-1:-1;;;;;408:69:48;;;;;;;;;;;;;;318:39;;;:::i;755:42::-;;;;;;;;;;;;;;;;-1:-1:-1;755:42:48;-1:-1:-1;;;;;755:42:48;;:::i;:::-;;;;;;;;;;;;;;;;;;652:51;;;;;;;;;;;;;;;;-1:-1:-1;652:51:48;-1:-1:-1;;;;;652:51:48;;:::i;1774:154::-;;;;;;;;;;;;;;;;-1:-1:-1;1774:154:48;;;;;;-1:-1:-1;;;;;1774:154:48;;:::i;528:69::-;;;;;;;;;;;;;;;;-1:-1:-1;528:69:48;-1:-1:-1;;;;;528:69:48;;:::i;:::-;;;;;;;;;;;;;;;;2170:120;836:13;:11;:13::i;:::-;2254:29:::1;2267:15;2254:12;:29::i;:::-;2170:120:::0;:::o;408:69::-;;;;;;;;;;;;;-1:-1:-1;;;;;408:69:48;;:::o;318:39::-;;;:::o;755:42::-;;;;;;;;;;;;;;;:::o;652:51::-;;;;;;;;;;;;;;;:::o;1774:154::-;836:13;:11;:13::i;:::-;1880:41:::1;1893:10;1905:15;1880:12;:41::i;:::-;1774:154:::0;;:::o;528:69::-;;;;;;;;;;;;;:::o;1088:124::-;1142:10;-1:-1:-1;;;;;1156:14:48;1142:28;;1134:71;;;;;-1:-1:-1;;;1134:71:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;1088:124::o;2655:200::-;-1:-1:-1;;;;;2729:35:48;;;;;;:18;:35;;;;;;;;2721:84;;;;-1:-1:-1;;;2721:84:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2815:26:48;;;;;:9;:26;;;;;:33;;-1:-1:-1;;2815:33:48;2844:4;2815:33;;;2655:200::o;2367:282::-;2453:33;:45;;;;;;;;;;;:63;;-1:-1:-1;;;;;2453:63:48;;;-1:-1:-1;;;;;;2453:63:48;;;;;;;2526:50;;;2453:63;2526:50;;;;;;:63;;;;2600:18;:35;;;:42;;-1:-1:-1;;2600:42:48;;;;;;2367:282::o", "source": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity 0.6.12;\n\nimport \"../interfaces/IERCHandler.sol\";\n\n/**\n @title Function used across handler contracts.\n @author ChainSafe Systems.\n @notice This contract is intended to be used with the Bridge contract.\n */\ncontract HandlerHelpers is IERCHandler {\n address public immutable _bridgeAddress;\n\n // resourceID => token contract address\n mapping (bytes32 => address) public _resourceIDToTokenContractAddress;\n\n // token contract address => resourceID\n mapping (address => bytes32) public _tokenContractAddressToResourceID;\n\n // token contract address => is whitelisted\n mapping (address => bool) public _contractWhitelist;\n\n // token contract address => is burnable\n mapping (address => bool) public _burnList;\n\n modifier onlyBridge() {\n _onlyBridge();\n _;\n }\n \n /**\n @param bridgeAddress Contract address of previously deployed Bridge.\n */\n constructor(\n address bridgeAddress\n ) public {\n _bridgeAddress = bridgeAddress;\n }\n\n function _onlyBridge() private view {\n require(msg.sender == _bridgeAddress, \"sender must be bridge contract\");\n }\n\n /**\n @notice First verifies {_resourceIDToContractAddress}[{resourceID}] and\n {_contractAddressToResourceID}[{contractAddress}] are not already set,\n then sets {_resourceIDToContractAddress} with {contractAddress},\n {_contractAddressToResourceID} with {resourceID},\n and {_contractWhitelist} to true for {contractAddress}.\n @param resourceID ResourceID to be used when making deposits.\n @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.\n */\n function setResource(bytes32 resourceID, address contractAddress) external override onlyBridge {\n\n _setResource(resourceID, contractAddress);\n }\n\n /**\n @notice First verifies {contractAddress} is whitelisted, then sets {_burnList}[{contractAddress}]\n to true.\n @param contractAddress Address of contract to be used when making or executing deposits.\n */\n function setBurnable(address contractAddress) external override onlyBridge{\n _setBurnable(contractAddress);\n }\n\n function withdraw(bytes memory data) external virtual override {}\n\n function _setResource(bytes32 resourceID, address contractAddress) internal {\n _resourceIDToTokenContractAddress[resourceID] = contractAddress;\n _tokenContractAddressToResourceID[contractAddress] = resourceID;\n\n _contractWhitelist[contractAddress] = true;\n }\n\n function _setBurnable(address contractAddress) internal {\n require(_contractWhitelist[contractAddress], \"provided contract is not whitelisted\");\n _burnList[contractAddress] = true;\n }\n}\n", "sourcePath": "/home/sigo/w/deer/ethsub/packages/sol/contracts/handlers/HandlerHelpers.sol", "ast": { "absolutePath": "project:/contracts/handlers/HandlerHelpers.sol", "exportedSymbols": { "HandlerHelpers": [ 9782 ] }, "id": 9783, "license": "LGPL-3.0-only", "nodeType": "SourceUnit", "nodes": [ { "id": 9646, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "42:23:48" }, { "absolutePath": "project:/contracts/interfaces/IERCHandler.sol", "file": "../interfaces/IERCHandler.sol", "id": 9647, "nodeType": "ImportDirective", "scope": 9783, "sourceUnit": 9841, "src": "67:39:48", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 9649, "name": "IERCHandler", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 9840, "src": "300:11:48", "typeDescriptions": { "typeIdentifier": "t_contract$_IERCHandler_$9840", "typeString": "contract IERCHandler" } }, "id": 9650, "nodeType": "InheritanceSpecifier", "src": "300:11:48" } ], "contractDependencies": [ 9840 ], "contractKind": "contract", "documentation": { "id": 9648, "nodeType": "StructuredDocumentation", "src": "108:164:48", "text": "@title Function used across handler contracts.\n@author ChainSafe Systems.\n@notice This contract is intended to be used with the Bridge contract." }, "fullyImplemented": true, "id": 9782, "linearizedBaseContracts": [ 9782, 9840 ], "name": "HandlerHelpers", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "318c136e", "id": 9652, "mutability": "immutable", "name": "_bridgeAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9782, "src": "318:39:48", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9651, "name": "address", "nodeType": "ElementaryTypeName", "src": "318:7:48", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "0a6d55d8", "id": 9656, "mutability": "mutable", "name": "_resourceIDToTokenContractAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9782, "src": "408:69:48", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$", "typeString": "mapping(bytes32 => address)" }, "typeName": { "id": 9655, "keyType": { "id": 9653, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "417:7:48", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Mapping", "src": "408:28:48", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_bytes32_$_t_address_$", "typeString": "mapping(bytes32 => address)" }, "valueType": { "id": 9654, "name": "address", "nodeType": "ElementaryTypeName", "src": "428:7:48", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "c8ba6c87", "id": 9660, "mutability": "mutable", "name": "_tokenContractAddressToResourceID", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9782, "src": "528:69:48", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bytes32_$", "typeString": "mapping(address => bytes32)" }, "typeName": { "id": 9659, "keyType": { "id": 9657, "name": "address", "nodeType": "ElementaryTypeName", "src": "537:7:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "528:28:48", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bytes32_$", "typeString": "mapping(address => bytes32)" }, "valueType": { "id": 9658, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "548:7:48", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "7f79bea8", "id": 9664, "mutability": "mutable", "name": "_contractWhitelist", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9782, "src": "652:51:48", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "typeName": { "id": 9663, "keyType": { "id": 9661, "name": "address", "nodeType": "ElementaryTypeName", "src": "661:7:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "652:25:48", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "valueType": { "id": 9662, "name": "bool", "nodeType": "ElementaryTypeName", "src": "672:4:48", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } }, "value": null, "visibility": "public" }, { "constant": false, "functionSelector": "6a70d081", "id": 9668, "mutability": "mutable", "name": "_burnList", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9782, "src": "755:42:48", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "typeName": { "id": 9667, "keyType": { "id": 9665, "name": "address", "nodeType": "ElementaryTypeName", "src": "764:7:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Mapping", "src": "755:25:48", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", "typeString": "mapping(address => bool)" }, "valueType": { "id": 9666, "name": "bool", "nodeType": "ElementaryTypeName", "src": "775:4:48", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } }, "value": null, "visibility": "public" }, { "body": { "id": 9674, "nodeType": "Block", "src": "826:41:48", "statements": [ { "expression": { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "id": 9670, "name": "_onlyBridge", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9698, "src": "836:11:48", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$__$returns$__$", "typeString": "function () view" } }, "id": 9671, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "836:13:48", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 9672, "nodeType": "ExpressionStatement", "src": "836:13:48" }, { "id": 9673, "nodeType": "PlaceholderStatement", "src": "859:1:48" } ] }, "documentation": null, "id": 9675, "name": "onlyBridge", "nodeType": "ModifierDefinition", "overrides": null, "parameters": { "id": 9669, "nodeType": "ParameterList", "parameters": [], "src": "823:2:48" }, "src": "804:63:48", "virtual": false, "visibility": "internal" }, { "body": { "id": 9685, "nodeType": "Block", "src": "1035:47:48", "statements": [ { "expression": { "argumentTypes": null, "id": 9683, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 9681, "name": "_bridgeAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9652, "src": "1045:14:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 9682, "name": "bridgeAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9678, "src": "1062:13:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1045:30:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 9684, "nodeType": "ExpressionStatement", "src": "1045:30:48" } ] }, "documentation": { "id": 9676, "nodeType": "StructuredDocumentation", "src": "877:88:48", "text": "@param bridgeAddress Contract address of previously deployed Bridge." }, "id": 9686, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 9679, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9678, "mutability": "mutable", "name": "bridgeAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9686, "src": "991:30:48", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9677, "name": "address", "nodeType": "ElementaryTypeName", "src": "991:7:48", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "981:46:48" }, "returnParameters": { "id": 9680, "nodeType": "ParameterList", "parameters": [], "src": "1035:0:48" }, "scope": 9782, "src": "970:112:48", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" }, { "body": { "id": 9697, "nodeType": "Block", "src": "1124:88:48", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 9693, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 9690, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, "src": "1142:3:48", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 9691, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1142:10:48", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "id": 9692, "name": "_bridgeAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9652, "src": "1156:14:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1142:28:48", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "73656e646572206d7573742062652062726964676520636f6e7472616374", "id": 9694, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1172:32:48", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_0febc0fc8991eb26dfaaceeb4d73d25b76da338550ed76c60410fec84388058e", "typeString": "literal_string \"sender must be bridge contract\"" }, "value": "sender must be bridge contract" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_0febc0fc8991eb26dfaaceeb4d73d25b76da338550ed76c60410fec84388058e", "typeString": "literal_string \"sender must be bridge contract\"" } ], "id": 9689, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "1134:7:48", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 9695, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1134:71:48", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 9696, "nodeType": "ExpressionStatement", "src": "1134:71:48" } ] }, "documentation": null, "id": 9698, "implemented": true, "kind": "function", "modifiers": [], "name": "_onlyBridge", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 9687, "nodeType": "ParameterList", "parameters": [], "src": "1108:2:48" }, "returnParameters": { "id": 9688, "nodeType": "ParameterList", "parameters": [], "src": "1124:0:48" }, "scope": 9782, "src": "1088:124:48", "stateMutability": "view", "virtual": false, "visibility": "private" }, { "baseFunctions": [ 9827 ], "body": { "id": 9714, "nodeType": "Block", "src": "1869:59:48", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 9710, "name": "resourceID", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9701, "src": "1893:10:48", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, { "argumentTypes": null, "id": 9711, "name": "contractAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9703, "src": "1905:15:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 9709, "name": "_setResource", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9762, "src": "1880:12:48", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", "typeString": "function (bytes32,address)" } }, "id": 9712, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1880:41:48", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 9713, "nodeType": "ExpressionStatement", "src": "1880:41:48" } ] }, "documentation": { "id": 9699, "nodeType": "StructuredDocumentation", "src": "1218:551:48", "text": "@notice First verifies {_resourceIDToContractAddress}[{resourceID}] and\n{_contractAddressToResourceID}[{contractAddress}] are not already set,\nthen sets {_resourceIDToContractAddress} with {contractAddress},\n{_contractAddressToResourceID} with {resourceID},\nand {_contractWhitelist} to true for {contractAddress}.\n@param resourceID ResourceID to be used when making deposits.\n@param contractAddress Address of contract to be called when a deposit is made and a deposited is executed." }, "functionSelector": "b8fa3736", "id": 9715, "implemented": true, "kind": "function", "modifiers": [ { "arguments": null, "id": 9707, "modifierName": { "argumentTypes": null, "id": 9706, "name": "onlyBridge", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9675, "src": "1858:10:48", "typeDescriptions": { "typeIdentifier": "t_modifier$__$", "typeString": "modifier ()" } }, "nodeType": "ModifierInvocation", "src": "1858:10:48" } ], "name": "setResource", "nodeType": "FunctionDefinition", "overrides": { "id": 9705, "nodeType": "OverrideSpecifier", "overrides": [], "src": "1849:8:48" }, "parameters": { "id": 9704, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 9701, "mutability": "mutable", "name": "resourceID", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9715, "src": "1795:18:48", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 9700, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1795:7:48", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 9703, "mutability": "mutable", "name": "contractAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 9715, "src": "1815:23:48", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 9702, "name": "address", "nodeType": "ElementaryTypeName", "src": "1815:7:48", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1794:45:48" }, "returnParameters": { "id": 9708, "nodeType": "ParameterList", "parameters": [], "src": "1869:0:48" }, "scope": 9782, "src": "1774:154:48", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "baseFunctions": [ 9833 ], "body": { "id": 9728, "nodeType": "Block", "src": "2244:46:48", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 9725, "name": "contractAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9718, "src": "2267:15:48", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 9724, "name": "_setBurnable", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 9781, "src": "2254:12:48", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", "typeString": "function (address)" } }, "id": 9726, "isConstant": false, "isLValue": false,