UNPKG

@ethsub/sol

Version:
1,074 lines (1,073 loc) 239 kB
{ "contractName": "ERC20Safe", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"ChainSafe Systems.\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Manages deposited ERC20s.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"This contract is intended to be used with ERC20Handler contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/ERC20Safe.sol\":\"ERC20Safe\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"keccak256\":\"0x4fc155a2f7837603d69a13cfa481eb5e7f5e02cb77e2ec9edbac30986db37988\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0855147e38b5e36288a8df73b8da49132f14ec7abb19041b0c98872263643aaa\",\"dweb:/ipfs/QmSrSysyFUYQq7hbJaJXG7EyZW6ezDBzEJx3SABp6eiJSS\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://526dc85e1f9b9b45830e202568d267d93dde7a4fcccf4ad7798dadcd92304d3c\",\"dweb:/ipfs/QmaoXMB972J3cSDLtBq3xBo4jLwqD2uzXTwujtSPqkYVhR\"]},\"@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol\":{\"keccak256\":\"0xa7c607ed4a0b2bebb811a398838ce4b5165e490f420a06337478eb2ba8c90cfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7eaf468e140d3430711cb859fbb41b097093069a75bfe4ab19e515c59f8b78ea\",\"dweb:/ipfs/QmYvdoCh8TAX7ucpMZspPpHpQZSuNe8cQTrbZyUcy3caqc\"]},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"keccak256\":\"0xca0c2396dbeb3503b51abf4248ebf77a1461edad513c01529df51850a012bee3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://991b44ff44e0496e8554a90f4c0512c28faed45104d40430019f3c67ea67740e\",\"dweb:/ipfs/Qmc3nRapVbcctELoZS5qe17zLkFB3bETBfwzCTMF1CSuGE\"]},\"@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol\":{\"keccak256\":\"0x9c0eb3b0e11d2480d49991dc384f1e5f9c9b9967cc81944d50916a9b9c6c4984\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://99e4033d778624992e86f0b6d801a4f6d7b5c0cd5c79c1296be90a051ad5f5af\",\"dweb:/ipfs/QmShYmkUqh6pDEeoWadZ24icmCr4C2Xys1uE5boivPmbwf\"]},\"@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol\":{\"keccak256\":\"0xa22af140ae7ec1f8f2f3bed5869cd0d548dfaac66343f0efc7324ff34aaf1254\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fed479feda7354e89c095fde0927dcb581f460257bf93b7db54b2b902b4bbd48\",\"dweb:/ipfs/QmSDUhS2AQvTGXHwaxDgAXtwXKCgQh2kp1nwhwUgr2hQZK\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x5f02220344881ce43204ae4a6281145a67bc52c2bb1290a791857df3d19d78f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://24427744bd3e6cb73c17010119af12a318289c0253a4d9acb8576c9fb3797b08\",\"dweb:/ipfs/QmTLDqpKRBuxGxRAmjgXt9AkXyACW3MtKzi7PYjm5iMfGC\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://256c8c8af5eb072bc473226ab2b2187149b8fc04f5f4a4820db22527f5ce8e3c\",\"dweb:/ipfs/QmRvi5BhnL7Rxf85KrJhwM6RRhukm4tzoctRdgQEheNyiN\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ded47ec7c96750f9bd04bbbc84f659992d4ba901cb7b532a52cd468272cf378f\",\"dweb:/ipfs/QmfBrGtQP7rZEqEg6Wz6jh2N2Kukpj1z5v3CGWmAqrzm96\"]},\"@openzeppelin/contracts/utils/EnumerableSet.sol\":{\"keccak256\":\"0x1562cd9922fbf739edfb979f506809e2743789cbde3177515542161c3d04b164\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4580d57781513d98870d9738c7d39094336e0a70cdb90d68dad549c6ced466ec\",\"dweb:/ipfs/Qmf9YZzzRFuvMnav9dgmeRUpdYMMECiZX8w25sHWVbA18V\"]},\"@openzeppelin/contracts/utils/Pausable.sol\":{\"keccak256\":\"0x212fb1b1d4beaf74354dad9bc329f44ee3c5375ef1c32acff76b4ecefc10f1d8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d21c68cb321d1c8d0fa39fd9ecb6bbe3b2f26623b0f38af280a010c916c85f23\",\"dweb:/ipfs/Qmf2P51HRC4ekDHLYfbXu5SXR33gXrWtq6oKSmfyWqVRuC\"]},\"project:/contracts/ERC20Safe.sol\":{\"keccak256\":\"0x8f93dfbdf43c6ba17ef5742ff544a7f78b97ef66817fee1532f099a9fd57d194\",\"license\":\"LGPL-3.0-only\",\"urls\":[\"bzz-raw://58517fef09d9e89ce7dc685bf6d90b125155add35e3c9834b6859389047e7961\",\"dweb:/ipfs/Qma6q2ZMDaNKTa6D8Ppsoe71xWieABmPEeynU6nbkXTnKX\"]}},\"version\":1}", "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220e291a2b1ef56f11598861c0d4b6b07a895288459c0ae0365fbe6c080ced7b19864736f6c634300060c0033", "deployedBytecode": "0x6080604052600080fdfea2646970667358221220e291a2b1ef56f11598861c0d4b6b07a895288459c0ae0365fbe6c080ced7b19864736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "464:3159:38:-:0;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "464:3159:38:-:0;;;;;", "source": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity 0.6.12;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol\";\n\n/**\n @title Manages deposited ERC20s.\n @author ChainSafe Systems.\n @notice This contract is intended to be used with ERC20Handler contract.\n */\ncontract ERC20Safe {\n using SafeMath for uint256;\n\n /**\n @notice Used to gain custody of deposited token.\n @param tokenAddress Address of ERC20 to transfer.\n @param owner Address of current token owner.\n @param recipient Address to transfer tokens to.\n @param amount Amount of tokens to transfer.\n */\n function lockERC20(address tokenAddress, address owner, address recipient, uint256 amount) internal {\n IERC20 erc20 = IERC20(tokenAddress);\n _safeTransferFrom(erc20, owner, recipient, amount);\n }\n\n /**\n @notice Transfers custody of token to recipient.\n @param tokenAddress Address of ERC20 to transfer.\n @param recipient Address to transfer tokens to.\n @param amount Amount of tokens to transfer.\n */\n function releaseERC20(address tokenAddress, address recipient, uint256 amount) internal {\n IERC20 erc20 = IERC20(tokenAddress);\n _safeTransfer(erc20, recipient, amount);\n }\n\n /**\n @notice Used to create new ERC20s.\n @param tokenAddress Address of ERC20 to transfer.\n @param recipient Address to mint token to.\n @param amount Amount of token to mint.\n */\n function mintERC20(address tokenAddress, address recipient, uint256 amount) internal {\n ERC20PresetMinterPauser erc20 = ERC20PresetMinterPauser(tokenAddress);\n erc20.mint(recipient, amount);\n\n }\n\n /**\n @notice Used to burn ERC20s.\n @param tokenAddress Address of ERC20 to burn.\n @param owner Current owner of tokens.\n @param amount Amount of tokens to burn.\n */\n function burnERC20(address tokenAddress, address owner, uint256 amount) internal {\n ERC20Burnable erc20 = ERC20Burnable(tokenAddress);\n erc20.burnFrom(owner, amount);\n }\n\n /**\n @notice used to transfer ERC20s safely\n @param token Token instance to transfer\n @param to Address to transfer token to\n @param value Amount of token to transfer\n */\n function _safeTransfer(IERC20 token, address to, uint256 value) private {\n _safeCall(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n\n /**\n @notice used to transfer ERC20s safely\n @param token Token instance to transfer\n @param from Address to transfer token from\n @param to Address to transfer token to\n @param value Amount of token to transfer\n */\n function _safeTransferFrom(IERC20 token, address from, address to, uint256 value) private {\n _safeCall(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n @notice used to make calls to ERC20s safely\n @param token Token instance call targets\n @param data encoded call data\n */\n function _safeCall(IERC20 token, bytes memory data) private { \n (bool success, bytes memory returndata) = address(token).call(data);\n require(success, \"ERC20: call failed\");\n\n if (returndata.length > 0) {\n\n require(abi.decode(returndata, (bool)), \"ERC20: operation did not succeed\");\n }\n }\n\n}\n", "sourcePath": "/home/sigo/w/deer/ethsub/packages/sol/contracts/ERC20Safe.sol", "ast": { "absolutePath": "project:/contracts/ERC20Safe.sol", "exportedSymbols": { "ERC20Safe": [ 7751 ] }, "id": 7752, "license": "LGPL-3.0-only", "nodeType": "SourceUnit", "nodes": [ { "id": 7553, "literals": [ "solidity", "0.6", ".12" ], "nodeType": "PragmaDirective", "src": "42:23:38" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "@openzeppelin/contracts/math/SafeMath.sol", "id": 7554, "nodeType": "ImportDirective", "scope": 7752, "sourceUnit": 938, "src": "67:51:38", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "id": 7555, "nodeType": "ImportDirective", "scope": 7752, "sourceUnit": 3320, "src": "119:56:38", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol", "file": "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol", "id": 7556, "nodeType": "ImportDirective", "scope": 7752, "sourceUnit": 1255, "src": "176:69:38", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol", "file": "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol", "id": 7557, "nodeType": "ImportDirective", "scope": 7752, "sourceUnit": 3205, "src": "246:63:38", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": { "id": 7558, "nodeType": "StructuredDocumentation", "src": "311:152:38", "text": "@title Manages deposited ERC20s.\n@author ChainSafe Systems.\n@notice This contract is intended to be used with ERC20Handler contract." }, "fullyImplemented": true, "id": 7751, "linearizedBaseContracts": [ 7751 ], "name": "ERC20Safe", "nodeType": "ContractDefinition", "nodes": [ { "id": 7561, "libraryName": { "contractScope": null, "id": 7559, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 937, "src": "495:8:38", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$937", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "489:27:38", "typeName": { "id": 7560, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "508:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "body": { "id": 7586, "nodeType": "Block", "src": "914:112:38", "statements": [ { "assignments": [ 7574 ], "declarations": [ { "constant": false, "id": 7574, "mutability": "mutable", "name": "erc20", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7586, "src": "924:12:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" }, "typeName": { "contractScope": null, "id": 7573, "name": "IERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3319, "src": "924:6:38", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, "value": null, "visibility": "internal" } ], "id": 7578, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7576, "name": "tokenAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7564, "src": "946:12:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 7575, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3319, "src": "939:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$3319_$", "typeString": "type(contract IERC20)" } }, "id": 7577, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "939:20:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, "nodeType": "VariableDeclarationStatement", "src": "924:35:38" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7580, "name": "erc20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7574, "src": "987:5:38", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, { "argumentTypes": null, "id": 7581, "name": "owner", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7566, "src": "994:5:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 7582, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7568, "src": "1001:9:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 7583, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7570, "src": "1012:6:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 7579, "name": "_safeTransferFrom", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7707, "src": "969:17:38", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$3319_$_t_address_$_t_address_$_t_uint256_$returns$__$", "typeString": "function (contract IERC20,address,address,uint256)" } }, "id": 7584, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "969:50:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 7585, "nodeType": "ExpressionStatement", "src": "969:50:38" } ] }, "documentation": { "id": 7562, "nodeType": "StructuredDocumentation", "src": "522:287:38", "text": "@notice Used to gain custody of deposited token.\n@param tokenAddress Address of ERC20 to transfer.\n@param owner Address of current token owner.\n@param recipient Address to transfer tokens to.\n@param amount Amount of tokens to transfer." }, "id": 7587, "implemented": true, "kind": "function", "modifiers": [], "name": "lockERC20", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 7571, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7564, "mutability": "mutable", "name": "tokenAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7587, "src": "833:20:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7563, "name": "address", "nodeType": "ElementaryTypeName", "src": "833:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7566, "mutability": "mutable", "name": "owner", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7587, "src": "855:13:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7565, "name": "address", "nodeType": "ElementaryTypeName", "src": "855:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7568, "mutability": "mutable", "name": "recipient", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7587, "src": "870:17:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7567, "name": "address", "nodeType": "ElementaryTypeName", "src": "870:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7570, "mutability": "mutable", "name": "amount", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7587, "src": "889:14:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7569, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "889:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "832:72:38" }, "returnParameters": { "id": 7572, "nodeType": "ParameterList", "parameters": [], "src": "914:0:38" }, "scope": 7751, "src": "814:212:38", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 7609, "nodeType": "Block", "src": "1359:101:38", "statements": [ { "assignments": [ 7598 ], "declarations": [ { "constant": false, "id": 7598, "mutability": "mutable", "name": "erc20", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7609, "src": "1369:12:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" }, "typeName": { "contractScope": null, "id": 7597, "name": "IERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3319, "src": "1369:6:38", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, "value": null, "visibility": "internal" } ], "id": 7602, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7600, "name": "tokenAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7590, "src": "1391:12:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 7599, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3319, "src": "1384:6:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$3319_$", "typeString": "type(contract IERC20)" } }, "id": 7601, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1384:20:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, "nodeType": "VariableDeclarationStatement", "src": "1369:35:38" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7604, "name": "erc20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7598, "src": "1428:5:38", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" } }, { "argumentTypes": null, "id": 7605, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7592, "src": "1435:9:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 7606, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7594, "src": "1446:6:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20_$3319", "typeString": "contract IERC20" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 7603, "name": "_safeTransfer", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7681, "src": "1414:13:38", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$3319_$_t_address_$_t_uint256_$returns$__$", "typeString": "function (contract IERC20,address,uint256)" } }, "id": 7607, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1414:39:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 7608, "nodeType": "ExpressionStatement", "src": "1414:39:38" } ] }, "documentation": { "id": 7588, "nodeType": "StructuredDocumentation", "src": "1032:234:38", "text": "@notice Transfers custody of token to recipient.\n@param tokenAddress Address of ERC20 to transfer.\n@param recipient Address to transfer tokens to.\n@param amount Amount of tokens to transfer." }, "id": 7610, "implemented": true, "kind": "function", "modifiers": [], "name": "releaseERC20", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 7595, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7590, "mutability": "mutable", "name": "tokenAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7610, "src": "1293:20:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7589, "name": "address", "nodeType": "ElementaryTypeName", "src": "1293:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7592, "mutability": "mutable", "name": "recipient", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7610, "src": "1315:17:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7591, "name": "address", "nodeType": "ElementaryTypeName", "src": "1315:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7594, "mutability": "mutable", "name": "amount", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7610, "src": "1334:14:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7593, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1334:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1292:57:38" }, "returnParameters": { "id": 7596, "nodeType": "ParameterList", "parameters": [], "src": "1359:0:38" }, "scope": 7751, "src": "1271:189:38", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 7633, "nodeType": "Block", "src": "1766:126:38", "statements": [ { "assignments": [ 7621 ], "declarations": [ { "constant": false, "id": 7621, "mutability": "mutable", "name": "erc20", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7633, "src": "1776:29:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20PresetMinterPauser_$1254", "typeString": "contract ERC20PresetMinterPauser" }, "typeName": { "contractScope": null, "id": 7620, "name": "ERC20PresetMinterPauser", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1254, "src": "1776:23:38", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20PresetMinterPauser_$1254", "typeString": "contract ERC20PresetMinterPauser" } }, "value": null, "visibility": "internal" } ], "id": 7625, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7623, "name": "tokenAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7613, "src": "1832:12:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" } ], "id": 7622, "name": "ERC20PresetMinterPauser", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1254, "src": "1808:23:38", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_ERC20PresetMinterPauser_$1254_$", "typeString": "type(contract ERC20PresetMinterPauser)" } }, "id": 7624, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1808:37:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20PresetMinterPauser_$1254", "typeString": "contract ERC20PresetMinterPauser" } }, "nodeType": "VariableDeclarationStatement", "src": "1776:69:38" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 7629, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7615, "src": "1866:9:38", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 7630, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7617, "src": "1877:6:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 7626, "name": "erc20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7621, "src": "1855:5:38", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20PresetMinterPauser_$1254", "typeString": "contract ERC20PresetMinterPauser" } }, "id": 7628, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "mint", "nodeType": "MemberAccess", "referencedDeclaration": 1198, "src": "1855:10:38", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256) external" } }, "id": 7631, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1855:29:38", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 7632, "nodeType": "ExpressionStatement", "src": "1855:29:38" } ] }, "documentation": { "id": 7611, "nodeType": "StructuredDocumentation", "src": "1466:210:38", "text": "@notice Used to create new ERC20s.\n@param tokenAddress Address of ERC20 to transfer.\n@param recipient Address to mint token to.\n@param amount Amount of token to mint." }, "id": 7634, "implemented": true, "kind": "function", "modifiers": [], "name": "mintERC20", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 7618, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 7613, "mutability": "mutable", "name": "tokenAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7634, "src": "1700:20:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7612, "name": "address", "nodeType": "ElementaryTypeName", "src": "1700:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7615, "mutability": "mutable", "name": "recipient", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7634, "src": "1722:17:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 7614, "name": "address", "nodeType": "ElementaryTypeName", "src": "1722:7:38", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 7617, "mutability": "mutable", "name": "amount", "nodeType": "VariableDeclaration", "overrides": null, "scope": 7634, "src": "1741:14:38", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 7616, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1741:7:38", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "1699:57:38" }, "returnParameters": { "id": 7619, "nodeType": "ParameterList",