UNPKG

@0xcert/ethereum-erc20-contracts

Version:

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

643 lines 22.4 kB
{ "Token": { "abi": [ { "inputs": [], "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": "608060405234801561001057600080fd5b50600060208190527f67be87c3ff9960ca1e9cfac5cab2ff4747269cf9ed20c9b7306235ac35a491c5805460ff1990811660019081179092557f9047944217cf7a5a57cc49e67181a64066b571778b37f1b501b5b2483c404e7480548216831790557fda3cefe610fb16fb609e83632d9bfe397c73a53e0e3889c3c671f29203793f8280548216831790557f0648b88cb4f83f2d3a24d50bb67a4b7e9cfc7f04811e84ba831e24e1b44237e2805482168317905563313ce56760e01b9092527f57c3f48cc00ca48466de578a46bac144b80c7e62e6b209102e549439d6cf9afa80549092161790556107c5806101076000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063313ce56711610066578063313ce5671461011c57806370a082311461013157806395d89b4114610144578063a9059cbb1461014c578063dd62ed3e1461015f5761009e565b806301ffc9a7146100a357806306fdde03146100cc578063095ea7b3146100e157806318160ddd146100f457806323b872dd14610109575b600080fd5b6100b66100b1366004610672565b610172565b6040516100c3919061069a565b60405180910390f35b6100d4610195565b6040516100c391906106a5565b6100b66100ef366004610649565b610227565b6100fc610291565b6040516100c391906106f8565b6100b661011736600461060e565b610297565b61012461045d565b6040516100c39190610701565b6100fc61013f3660046105bb565b610466565b6100d4610481565b6100b661015a366004610649565b610490565b6100fc61016d3660046105dc565b610579565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b6060600180546101a49061073e565b80601f01602080910402602001604051908101604052809291908181526020018280546101d09061073e565b801561021d5780601f106101f25761010080835404028352916020019161021d565b820191906000526020600020905b81548152906001019060200180831161020057829003601f168201915b5050505050905090565b3360008181526006602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906102809086906106f8565b60405180910390a350600192915050565b60045490565b6001600160a01b0383166000908152600560209081526040808320548151808301909252600682526530303130303160d01b92820192909252908311156102fa5760405162461bcd60e51b81526004016102f191906106a5565b60405180910390fd5b506001600160a01b03841660009081526006602081815260408084203385528252928390205483518085019094529183526518181898181960d11b908301528311156103595760405162461bcd60e51b81526004016102f191906106a5565b506001600160a01b03841660009081526005602052604090205461037e908390610727565b6001600160a01b0380861660009081526005602052604080822093909355908516815220546103ae90839061070f565b6001600160a01b0380851660009081526005602090815260408083209490945591871681526006825282812033825290915220546103ed908390610727565b6001600160a01b0380861660008181526006602090815260408083203384529091529081902093909355915190851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061044b9086906106f8565b60405180910390a35060019392505050565b60035460ff1690565b6001600160a01b031660009081526005602052604090205490565b6060600280546101a49061073e565b336000908152600560209081526040808320548151808301909252600682526530303130303160d01b92820192909252908311156104e15760405162461bcd60e51b81526004016102f191906106a5565b50336000908152600560205260409020546104fd908390610727565b33600090815260056020526040808220929092556001600160a01b0385168152205461052a90839061070f565b6001600160a01b0384166000818152600560205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906102809086906106f8565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b80356001600160a01b038116811461019057600080fd5b6000602082840312156105cc578081fd5b6105d5826105a4565b9392505050565b600080604083850312156105ee578081fd5b6105f7836105a4565b9150610605602084016105a4565b90509250929050565b600080600060608486031215610622578081fd5b61062b846105a4565b9250610639602085016105a4565b9150604084013590509250925092565b6000806040838503121561065b578182fd5b610664836105a4565b946020939093013593505050565b600060208284031215610683578081fd5b81356001600160e01b0319811681146105d5578182fd5b901515815260200190565b6000602080835283518082850152825b818110156106d1578581018301518582016040015282016106b5565b818111156106e25783604083870101525b50601f01601f1916929092016040019392505050565b90815260200190565b60ff91909116815260200190565b6000821982111561072257610722610779565b500190565b60008282101561073957610739610779565b500390565b60028104600182168061075257607f821691505b6020821081141561077357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122044e90649313df6d3dfad74bde66ce5d244980a884d41b1273c746370a665ed9364736f6c63430008000033" }, "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": [], "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 interface uses the official ERC-20 specification from https://eips.ethereum.org/EIPS/eip-20 and also implements every optional function.", "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." } }, "constructor": { "details": "Contract constructor." }, "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." } } }, "stateVariables": { "NOT_ENOUGH_BALANCE": { "details": "Error constants." }, "allowed": { "details": "Token allowance mapping." }, "balances": { "details": "Balance information map." }, "tokenDecimals": { "details": "Number of decimals." }, "tokenName": { "details": "Token name." }, "tokenSymbol": { "details": "Token symbol." }, "tokenTotalSupply": { "details": "Total supply of tokens." } }, "title": "ERC20 standard token implementation.", "version": 1 }, "userdoc": { "kind": "user", "methods": {}, "version": 1 } }, "settings": { "compilationTarget": { "./src/contracts/token.sol": "Token" }, "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [] }, "sources": { "./src/contracts/token.sol": { "keccak256": "0x6d5df76adb6ff72274cb2cadf5fd931db1a1d32bc9e201e4cf27ebc07b4d6a25", "license": "MIT", "urls": [ "bzz-raw://143a2597228b9c5274a9c861fdcaea2f51c961e220e8ea04ab821e0d1c5f6a17", "dweb:/ipfs/QmYGsxbDXohjvAnGydM62BABugPrM8LKvLT6WVJyk2krGr" ] } }, "version": 1 } } }