UNPKG

@0xcert/ethereum-erc20-contracts

Version:

Smart contract implementation of the ERC-20 standard on the Ethereum blockchain.

658 lines 24.1 kB
{ "TokenMock": { "abi": [ { "inputs": [ { "internalType": "string", "name": "_name", "type": "string" }, { "internalType": "string", "name": "_symbol", "type": "string" }, { "internalType": "uint8", "name": "_decimals", "type": "uint8" }, { "internalType": "uint256", "name": "_supply", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "_remaining", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_spender", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "_balance", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint8", "name": "_decimals", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "name", "outputs": [ { "internalType": "string", "name": "_name", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "_interfaceID", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "symbol", "outputs": [ { "internalType": "string", "name": "_symbol", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "_totalSupply", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_from", "type": "address" }, { "internalType": "address", "name": "_to", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ], "evm": { "bytecode": { "object": "60806040523480156200001157600080fd5b5060405162000bb638038062000bb68339810160408190526200003491620002fe565b600060208181527f67be87c3ff9960ca1e9cfac5cab2ff4747269cf9ed20c9b7306235ac35a491c58054600160ff1991821681179092557f9047944217cf7a5a57cc49e67181a64066b571778b37f1b501b5b2483c404e7480548216831790557fda3cefe610fb16fb609e83632d9bfe397c73a53e0e3889c3c671f29203793f8280548216831790557f0648b88cb4f83f2d3a24d50bb67a4b7e9cfc7f04811e84ba831e24e1b44237e2805482168317905563313ce56760e01b9093527f57c3f48cc00ca48466de578a46bac144b80c7e62e6b209102e549439d6cf9afa8054909316811790925585516200012d9291870190620001ad565b50825162000143906002906020860190620001ad565b506003805460ff191660ff8416179055600481905533600081815260056020526040808220849055517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200019b90859062000385565b60405180910390a350505050620003e1565b828054620001bb906200038e565b90600052602060002090601f016020900481019282620001df57600085556200022a565b82601f10620001fa57805160ff19168380011785556200022a565b828001600101855582156200022a579182015b828111156200022a5782518255916020019190600101906200020d565b50620002389291506200023c565b5090565b5b808211156200023857600081556001016200023d565b600082601f83011262000264578081fd5b81516001600160401b0380821115620002815762000281620003cb565b6040516020601f8401601f1916820181018381118382101715620002a957620002a9620003cb565b6040528382528584018101871015620002c0578485fd5b8492505b83831015620002e35785830181015182840182015291820191620002c4565b83831115620002f457848185840101525b5095945050505050565b6000806000806080858703121562000314578384fd5b84516001600160401b03808211156200032b578586fd5b620003398883890162000253565b955060208701519150808211156200034f578485fd5b506200035e8782880162000253565b935050604085015160ff8116811462000375578283fd5b6060959095015193969295505050565b90815260200190565b600281046001821680620003a357607f821691505b60208210811415620003c557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6107c580620003f16000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063313ce56711610066578063313ce5671461011c57806370a082311461013157806395d89b4114610144578063a9059cbb1461014c578063dd62ed3e1461015f5761009e565b806301ffc9a7146100a357806306fdde03146100cc578063095ea7b3146100e157806318160ddd146100f457806323b872dd14610109575b600080fd5b6100b66100b1366004610672565b610172565b6040516100c3919061069a565b60405180910390f35b6100d4610195565b6040516100c391906106a5565b6100b66100ef366004610649565b610227565b6100fc610291565b6040516100c391906106f8565b6100b661011736600461060e565b610297565b61012461045d565b6040516100c39190610701565b6100fc61013f3660046105bb565b610466565b6100d4610481565b6100b661015a366004610649565b610490565b6100fc61016d3660046105dc565b610579565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b6060600180546101a49061073e565b80601f01602080910402602001604051908101604052809291908181526020018280546101d09061073e565b801561021d5780601f106101f25761010080835404028352916020019161021d565b820191906000526020600020905b81548152906001019060200180831161020057829003601f168201915b5050505050905090565b3360008181526006602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906102809086906106f8565b60405180910390a350600192915050565b60045490565b6001600160a01b0383166000908152600560209081526040808320548151808301909252600682526530303130303160d01b92820192909252908311156102fa5760405162461bcd60e51b81526004016102f191906106a5565b60405180910390fd5b506001600160a01b03841660009081526006602081815260408084203385528252928390205483518085019094529183526518181898181960d11b908301528311156103595760405162461bcd60e51b81526004016102f191906106a5565b506001600160a01b03841660009081526005602052604090205461037e908390610727565b6001600160a01b0380861660009081526005602052604080822093909355908516815220546103ae90839061070f565b6001600160a01b0380851660009081526005602090815260408083209490945591871681526006825282812033825290915220546103ed908390610727565b6001600160a01b0380861660008181526006602090815260408083203384529091529081902093909355915190851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061044b9086906106f8565b60405180910390a35060019392505050565b60035460ff1690565b6001600160a01b031660009081526005602052604090205490565b6060600280546101a49061073e565b336000908152600560209081526040808320548151808301909252600682526530303130303160d01b92820192909252908311156104e15760405162461bcd60e51b81526004016102f191906106a5565b50336000908152600560205260409020546104fd908390610727565b33600090815260056020526040808220929092556001600160a01b0385168152205461052a90839061070f565b6001600160a01b0384166000818152600560205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906102809086906106f8565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b80356001600160a01b038116811461019057600080fd5b6000602082840312156105cc578081fd5b6105d5826105a4565b9392505050565b600080604083850312156105ee578081fd5b6105f7836105a4565b9150610605602084016105a4565b90509250929050565b600080600060608486031215610622578081fd5b61062b846105a4565b9250610639602085016105a4565b9150604084013590509250925092565b6000806040838503121561065b578182fd5b610664836105a4565b946020939093013593505050565b600060208284031215610683578081fd5b81356001600160e01b0319811681146105d5578182fd5b901515815260200190565b6000602080835283518082850152825b818110156106d1578581018301518582016040015282016106b5565b818111156106e25783604083870101525b50601f01601f1916929092016040019392505050565b90815260200190565b60ff91909116815260200190565b6000821982111561072257610722610779565b500190565b60008282101561073957610739610779565b500390565b60028104600182168061075257607f821691505b6020821081141561077357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e027bb44df438e36b3e8ad818c9971424fe2b5ade1cab3cde7750218e4b9b4f264736f6c63430008000033" }, "methodIdentifiers": { "allowance(address,address)": "dd62ed3e", "approve(address,uint256)": "095ea7b3", "balanceOf(address)": "70a08231", "decimals()": "313ce567", "name()": "06fdde03", "supportsInterface(bytes4)": "01ffc9a7", "symbol()": "95d89b41", "totalSupply()": "18160ddd", "transfer(address,uint256)": "a9059cbb", "transferFrom(address,address,uint256)": "23b872dd" } }, "metadata": { "compiler": { "version": "0.8.0+commit.c7dfd78e" }, "language": "Solidity", "output": { "abi": [ { "inputs": [ { "internalType": "string", "name": "_name", "type": "string" }, { "internalType": "string", "name": "_symbol", "type": "string" }, { "internalType": "uint8", "name": "_decimals", "type": "uint8" }, { "internalType": "uint256", "name": "_supply", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "_remaining", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_spender", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "_balance", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint8", "name": "_decimals", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "name", "outputs": [ { "internalType": "string", "name": "_name", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "_interfaceID", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "symbol", "outputs": [ { "internalType": "string", "name": "_symbol", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "_totalSupply", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_from", "type": "address" }, { "internalType": "address", "name": "_to", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "_success", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" } ], "devdoc": { "details": "This is an example contract implementation of Token.", "kind": "dev", "methods": { "allowance(address,address)": { "details": "Returns the amount which _spender is still allowed to withdraw from _owner.", "params": { "_owner": "The address of the account owning tokens.", "_spender": "The address of the account able to transfer the tokens." } }, "approve(address,uint256)": { "details": "Allows _spender to withdraw from your account multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. To prevent attack vectors like the one described here: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit and discussed here: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729, clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to 0 before setting it to another value for the same spender. THOUGH The contract itself shouldn’t enforce it, to allow backwards compatibility with contracts deployed before.", "params": { "_spender": "The address of the account able to transfer the tokens.", "_value": "The amount of tokens to be approved for transfer." } }, "balanceOf(address)": { "details": "Returns the account balance of another account with address _owner.", "params": { "_owner": "The address from which the balance will be retrieved." } }, "decimals()": { "details": "Returns the number of decimals the token uses." }, "name()": { "details": "Returns the name of the token." }, "supportsInterface(bytes4)": { "details": "Function to check which interfaces are supported by this contract.", "params": { "_interfaceID": "Id of the interface." } }, "symbol()": { "details": "Returns the symbol of the token." }, "totalSupply()": { "details": "Returns the total token supply." }, "transfer(address,uint256)": { "details": "Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend.", "params": { "_to": "The address of the recipient.", "_value": "The amount of token to be transferred." } }, "transferFrom(address,address,uint256)": { "details": "Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.", "params": { "_from": "The address of the sender.", "_to": "The address of the recipient.", "_value": "The amount of token to be transferred." } } }, "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "./src/contracts/mocks/token-mock.sol": "TokenMock" }, "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "./src/contracts/mocks/token-mock.sol": { "keccak256": "0xc8e6c77508fd7d1240e6a12516a8a83668efd2190ac839bac6e4bc63b74c2582", "license": "MIT", "urls": [ "bzz-raw://64897901b22dc2ab7951970545e2da40d6dfed78af5030d89bc21c01306705c9", "dweb:/ipfs/QmZ1gWJxsPXzHNKSKbDSNH7QqMexuuMTdkXwQALkd7PZmk" ] } }, "version": 1 } } }