UNPKG

@vporton/future-contracts

Version:

Ethereum accounts bid on future financing (essentially, transfer money from the future) - smart contracts

1,110 lines (1,109 loc) 398 kB
{ "contractName": "ERC1155WithTotals", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "operator", "type": "address" }, { "indexed": false, "internalType": "bool", "name": "approved", "type": "bool" } ], "name": "ApprovalForAll", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "operator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "indexed": false, "internalType": "uint256[]", "name": "values", "type": "uint256[]" } ], "name": "TransferBatch", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "operator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "TransferSingle", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "value", "type": "string" }, { "indexed": true, "internalType": "uint256", "name": "id", "type": "uint256" } ], "name": "URI", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint256", "name": "id", "type": "uint256" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "accounts", "type": "address[]" }, { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" } ], "name": "balanceOfBatch", "outputs": [ { "internalType": "uint256[]", "name": "", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "operator", "type": "address" } ], "name": "isApprovedForAll", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "safeBatchTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "id", "type": "uint256" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "safeTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "operator", "type": "address" }, { "internalType": "bool", "name": "approved", "type": "bool" } ], "name": "setApprovalForAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "uri", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "id", "type": "uint256" } ], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"constructor\":{\"params\":{\"uri_\":\"Description URI.\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}. Time complexity O(1), guaranteed to always use less than 30 000 gas.\"},\"totalSupply(uint256)\":{\"params\":{\"id\":\"Token ID.\"},\"returns\":{\"_0\":\"Total supply.\"}},\"uri(uint256)\":{\"details\":\"See {IERC1155MetadataURI-uri}. This implementation returns the same URI for *all* token types. It relies on the token type ID substitution mechanism https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. Clients calling this function must replace the `\\\\{id\\\\}` substring with the actual token type ID.\"}},\"title\":\"A base contract for an ERC-1155 contract with calculation of totals.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Construct a token contract with given description URI.\"},\"totalSupply(uint256)\":{\"notice\":\"Total supply of a token (conforms to `IERC1155Views`).\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155WithTotals.sol\":\"ERC1155WithTotals\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155.sol\":{\"keccak256\":\"0x7dcdf324fd4d2dec68846958865ae833956cb4ad80cd83cf6f107e7c33500bf6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5cddf52afd931cbf983100a0415f04e6646aa90d100fd91437d2a75e3b241206\",\"dweb:/ipfs/QmXXJ2qoC1rSsKdg5s87m3BPQ3RFGw2rNrNv7KygzGJ9zQ\"]},\"/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155WithTotals.sol\":{\"keccak256\":\"0x1d5fcf7a70d6f5dcd4ddf25caece633a9b4d17154fb98b5fc9a5ae4600b2db15\",\"license\":\"LGPL-3.0-or-later\",\"urls\":[\"bzz-raw://9638d138ecec5f7f6651cf690295fdaaa99023d58555360fa801ace5cac88a9d\",\"dweb:/ipfs/QmUWf56QEe5uSfpHB7inMUGzufNZSxyu8aszLzoYMZHMYf\"]},\"@openzeppelin/contracts/GSN/Context.sol\":{\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ded47ec7c96750f9bd04bbbc84f659992d4ba901cb7b532a52cd468272cf378f\",\"dweb:/ipfs/QmfBrGtQP7rZEqEg6Wz6jh2N2Kukpj1z5v3CGWmAqrzm96\"]},\"@openzeppelin/contracts/introspection/ERC165.sol\":{\"keccak256\":\"0xd6b90e604fb2eb2d641c7110c72440bf2dc999ec6ab8ff60f200e71ca75d1d90\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7b92d8ab83b21ff984b1f0d6d66897d5afb1f2052004cbcb133cea023e0ae468\",\"dweb:/ipfs/QmTarypkQrFp4UMjTh7Zzhz2nZLz5uPS4nJQtHDEuwBVe6\"]},\"@openzeppelin/contracts/introspection/IERC165.sol\":{\"keccak256\":\"0xf70bc25d981e4ec9673a995ad2995d5d493ea188d3d8f388bba9c227ce09fb82\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd970f51e3a77790c2f02b5b1759827c3b897c3d98c407b3631e8af32e3dc93c\",\"dweb:/ipfs/QmPF85Amgbqjk3SNZKsPCsqCw8JfwYEPMnnhvMJUyX58je\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x3b21f2c8d626de3b9925ae33e972d8bf5c8b1bffb3f4ee94daeed7d0679036e6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7f8d45329fecbf0836ad7543330c3ecd0f8d0ffa42d4016278c3eb2215fdcdfe\",\"dweb:/ipfs/QmXWLT7GcnHtA5NiD6MFi2CV3EWJY4wv5mLNnypqYDrxL3\"]},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"keccak256\":\"0x61321d2c86346045bf394885ee3afeecc65f9daad2694bc19110967588fd7b5d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1703b877203e0447ede72dcf73f1c4f2089b415bd1c44877904128a64fafed5b\",\"dweb:/ipfs/QmaZoYDo2FWtKcwCc9zuabU6zri8KV9xJrhU614d93sLid\"]},\"@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol\":{\"keccak256\":\"0xd918cca1b659f588a6d12d05fd7196179a8b1eac9133d7f77da7ef3133e13256\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7c75d578f42e2e2e427b934e6c41cc759be2d0a52155868308e915328c8feb2b\",\"dweb:/ipfs/QmbFNHtWAoNhe82Hy6yKTePWJRczqzp1APSBfLS9XfAN6e\"]},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"keccak256\":\"0x2690a9b7f4f7489b8d25a4fc6bffc02ec3971fb41ed6c8b59adef2833bdab07c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8148c99452b6793ac9599abdc8bdaf4eeb47f34590beea8aa01089be14e2990c\",\"dweb:/ipfs/QmNdenmZ4EDfH9TuBas3pHeGuZvDNo2rsfgUj6ka8vuH37\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xa6a15ddddcbf29d2922a1e0d4151b5d2d33da24b93cc9ebc12390e0d855532f8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7c119bcaecfa853d564ac88d312777f75fa1126a3bca88a3371adb0ad9f35cb0\",\"dweb:/ipfs/QmY9UPuXeSKq86Zh38fE43VGQPhKMN34mkuFSFqPcr6nvZ\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: LGPL-3.0-or-later\npragma solidity ^0.7.1;\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { ERC1155 } from \"./ERC1155.sol\";\n\n/// @title A base contract for an ERC-1155 contract with calculation of totals.\nabstract contract ERC1155WithTotals is ERC1155 {\n using SafeMath for uint256;\n\n // Mapping (token => total).\n mapping(uint256 => uint256) private totalBalances;\n\n /// Construct a token contract with given description URI.\n /// @param uri_ Description URI.\n constructor (string memory uri_) ERC1155(uri_) { }\n\n // Overrides //\n\n // Need also update totals - commented out\n // function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual override {\n // return super._mintBatch(_originalAddress(to), ids, amounts, data);\n // }\n\n // Need also update totals - commented out\n // function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override {\n // return super._burnBatch(_originalAddress(account), ids, amounts);\n // }\n\n /// Total supply of a token (conforms to `IERC1155Views`).\n /// @param id Token ID.\n /// @return Total supply.\n function totalSupply(uint256 id) public view returns (uint256) {\n return totalBalances[id];\n }\n\n /// Mint a token.\n /// @param to Whom to mint to.\n /// @param id Token ID.\n /// @param value Amount to mint.\n /// @param data Additional data.\n function _mint(address to, uint256 id, uint256 value, bytes memory data) internal override {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n _doMint(to, id, value);\n emit TransferSingle(msg.sender, address(0), to, id, value);\n\n _doSafeTransferAcceptanceCheck(msg.sender, address(0), to, id, value, data);\n }\n\n /// Mint zero or more tokens.\n /// @param to Whom to mint to.\n /// @param ids Token IDs.\n /// @param values Amounts to mint.\n /// @param data Additional data.\n function _batchMint(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {\n require(to != address(0), \"ERC1155: batch mint to the zero address\");\n require(ids.length == values.length, \"ERC1155: IDs and values must have same lengths\");\n\n for(uint i = 0; i < ids.length; i++) {\n _doMint(to, ids[i], values[i]);\n }\n\n emit TransferBatch(msg.sender, address(0), to, ids, values);\n\n _doSafeBatchTransferAcceptanceCheck(msg.sender, address(0), to, ids, values, data);\n }\n\n /// Burn a token.\n /// @param owner Whose tokens to burn.\n /// @param id Token ID.\n /// @param value Amount to mint.\n function _burn(address owner, uint256 id, uint256 value) internal override {\n _doBurn(owner, id, value);\n emit TransferSingle(msg.sender, owner, address(0), id, value);\n }\n\n /// Burn zero or more tokens.\n /// @param owner Whose tokens to burn.\n /// @param ids Token IDs.\n /// @param values Amounts to mint.\n function _batchBurn(address owner, uint256[] memory ids, uint256[] memory values) internal {\n require(ids.length == values.length, \"ERC1155: IDs and values must have same lengths\");\n\n for(uint i = 0; i < ids.length; i++) {\n _doBurn(owner, ids[i], values[i]);\n }\n\n emit TransferBatch(msg.sender, owner, address(0), ids, values);\n }\n\n function _doMint(address to, uint256 id, uint256 value) private {\n totalBalances[id] = totalBalances[id].add(value);\n _balances[id][to] = _balances[id][to] + value; // The previous didn't overflow, therefore this doesn't overflow.\n }\n\n function _doBurn(address from, uint256 id, uint256 value) private {\n _balances[id][from] = _balances[id][from].sub(value);\n totalBalances[id] = totalBalances[id] - value; // The previous didn't overflow, therefore this doesn't overflow.\n }\n}", "sourcePath": "/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155WithTotals.sol", "ast": { "absolutePath": "/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155WithTotals.sol", "exportedSymbols": { "ERC1155": [ 3296 ], "ERC1155WithTotals": [ 3656 ], "SafeMath": [ 4589 ] }, "id": 3657, "license": "LGPL-3.0-or-later", "nodeType": "SourceUnit", "nodes": [ { "id": 3325, "literals": [ "solidity", "^", "0.7", ".1" ], "nodeType": "PragmaDirective", "src": "46:23:7" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "@openzeppelin/contracts/math/SafeMath.sol", "id": 3326, "nodeType": "ImportDirective", "scope": 3657, "sourceUnit": 4590, "src": "70:51:7", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/user/Projects/future-contracts/contracts/ERC1155/ERC1155.sol", "file": "./ERC1155.sol", "id": 3328, "nodeType": "ImportDirective", "scope": 3657, "sourceUnit": 3297, "src": "122:40:7", "symbolAliases": [ { "foreign": { "id": 3327, "name": "ERC1155", "nodeType": "Identifier", "overloadedDeclarations": [], "src": "131:7:7", "typeDescriptions": {} } } ], "unitAlias": "" }, { "abstract": true, "baseContracts": [ { "baseName": { "id": 3330, "name": "ERC1155", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3296, "src": "283:7:7", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC1155_$3296", "typeString": "contract ERC1155" } }, "id": 3331, "nodeType": "InheritanceSpecifier", "src": "283:7:7" } ], "contractDependencies": [ 3296, 4324, 4381, 4393, 4790, 4805 ], "contractKind": "contract", "documentation": { "id": 3329, "nodeType": "StructuredDocumentation", "src": "164:80:7", "text": "@title A base contract for an ERC-1155 contract with calculation of totals." }, "fullyImplemented": true, "id": 3656, "linearizedBaseContracts": [ 3656, 3296, 4805, 4790, 4381, 4393, 4324 ], "name": "ERC1155WithTotals", "nodeType": "ContractDefinition", "nodes": [ { "id": 3334, "libraryName": { "id": 3332, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4589, "src": "303:8:7", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$4589", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "297:27:7", "typeName": { "id": 3333, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "316:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "constant": false, "id": 3338, "mutability": "mutable", "name": "totalBalances", "nodeType": "VariableDeclaration", "scope": 3656, "src": "363:49:7", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "typeName": { "id": 3337, "keyType": { "id": 3335, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "371:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Mapping", "src": "363:27:7", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" }, "valueType": { "id": 3336, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "382:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, "visibility": "private" }, { "body": { "id": 3347, "nodeType": "Block", "src": "566:3:7", "statements": [] }, "documentation": { "id": 3339, "nodeType": "StructuredDocumentation", "src": "419:95:7", "text": "Construct a token contract with given description URI.\n @param uri_ Description URI." }, "id": 3348, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "id": 3344, "name": "uri_", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3341, "src": "560:4:7", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } } ], "id": 3345, "modifierName": { "id": 3343, "name": "ERC1155", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3296, "src": "552:7:7", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_ERC1155_$3296_$", "typeString": "type(contract ERC1155)" } }, "nodeType": "ModifierInvocation", "src": "552:13:7" } ], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 3342, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3341, "mutability": "mutable", "name": "uri_", "nodeType": "VariableDeclaration", "scope": 3348, "src": "532:18:7", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 3340, "name": "string", "nodeType": "ElementaryTypeName", "src": "532:6:7", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "visibility": "internal" } ], "src": "531:20:7" }, "returnParameters": { "id": 3346, "nodeType": "ParameterList", "parameters": [], "src": "566:0:7" }, "scope": 3656, "src": "519:50:7", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 3360, "nodeType": "Block", "src": "1303:41:7", "statements": [ { "expression": { "baseExpression": { "id": 3356, "name": "totalBalances", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3338, "src": "1320:13:7", "typeDescriptions": { "typeIdentifier": "t_mapping$_t_uint256_$_t_uint256_$", "typeString": "mapping(uint256 => uint256)" } }, "id": 3358, "indexExpression": { "id": 3357, "name": "id", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3351, "src": "1334:2:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1320:17:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 3355, "id": 3359, "nodeType": "Return", "src": "1313:24:7" } ] }, "documentation": { "id": 3349, "nodeType": "StructuredDocumentation", "src": "1119:116:7", "text": "Total supply of a token (conforms to `IERC1155Views`).\n @param id Token ID.\n @return Total supply." }, "functionSelector": "bd85b039", "id": 3361, "implemented": true, "kind": "function", "modifiers": [], "name": "totalSupply", "nodeType": "FunctionDefinition", "parameters": { "id": 3352, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3351, "mutability": "mutable", "name": "id", "nodeType": "VariableDeclaration", "scope": 3361, "src": "1261:10:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3350, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1261:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "1260:12:7" }, "returnParameters": { "id": 3355, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3354, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "scope": 3361, "src": "1294:7:7", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3353, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1294:7:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "1293:9:7" }, "scope": 3656, "src": "1240:104:7", "stateMutability": "view", "virtual": false, "visibility": "public" }, { "baseFunctions": [ 2844 ], "body": { "id": 3415, "nodeType": "Block", "src": "1600:266:7", "statements": [ { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3380, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 3375, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3364, "src": "1618:2:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "arguments": [ { "hexValue": "30", "id": 3378, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1632:1:7", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 3377, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1624:7:7", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 3376, "name": "address", "nodeType": "ElementaryTypeName", "src": "1624:7:7", "typeDescriptions": {} } }, "id": 3379, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1624:10:7", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "1618:16:7", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "hexValue": "455243313135353a206d696e7420746f20746865207a65726f2061646472657373", "id": 3381, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1636:35:7", "typeDescriptions": { "typeIdentifier": "t_stringliteral_ebf031a1b7ee1d0b3a7752b450a3268e8b6c334561b48c1c0ba0f5bac05749f2", "typeString": "literal_string \"ERC1155: mint to the zero address\"" }, "value": "ERC1155: mint to the zero address" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_ebf031a1b7ee1d0b3a7752b450a3268e8b6c334561b48c1c0ba0f5bac05749f2", "typeString": "literal_string \"ERC1155: mint to the zero address\"" } ], "id": 3374, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "1610:7:7", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 3382, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1610:62:7", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3383, "nodeType": "ExpressionStatement", "src": "1610:62:7" }, { "expression": { "arguments": [ { "id": 3385, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3364, "src": "1691:2:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "id": 3386, "name": "id", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3366, "src": "1695:2:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { "id": 3387, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3368, "src": "1699:5:7", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 3384, "name": "_doMint", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3620, "src": "1683:7:7", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$_t_uint256_$returns$__$", "typeString": "function (address,uint256,uint256)" } }, "id": 3388, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1683:22:7", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3389, "nodeType": "ExpressionStatement", "src": "1683:22:7" }, { "eventCall": { "arguments": [ { "expression": { "id": 3391, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4294967281, "src": "1735:3:7", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 3392, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "src": "1735:10:7", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "arguments": [ { "hexValue": "30", "id": 3395, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1755:1:7", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 3394, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1747:7:7", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 3393, "name": "address", "nodeType": "ElementaryTypeName", "src": "1747:7:7", "typeDescriptions": {} } }, "id": 3396, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1747:10:7", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "id": 3397, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3364, "src": "1759:2:7", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "id": 3398,