在线合约IDE :Remix - Ethereum IDE

  1. 代码编译后可以复制ABI和bytecode

  2. 在目录contracts/artifacts 出现*.json文件, ABI内容在JSON文件中可以找到“abi:”

  3. Bytecode和ABI可以认为是智能合约源代码的两种外在表现形式,其中Bytecode是给机器执行的,而ABI是给DApp 开发者用的用自然语言描述的合约接口规范。 简单地将,智能合约可以理解为把“合同”变为代码,然后编译成Bytecode和ABI,Bytecode用来部署,ABI用来调用。

  4. 比如Token合约,适合于以太主网或测试网

    https://goerli.etherscan.io/address/0x405ef60935c9ff11c034a56dfc85452bf3cf0656#code
    

    Bytecode:

    60806040526000600560146101000a81548160ff0219169083151502179055506001600560156101000a81548160ff0219169083151502179055503480156200004757600080fd5b506040518060400160405280600c81526020017f49546f6b656e20546f6b656e00000000000000000000000000000000000000008152506040518060400160405280600381526020017f49544b000000000000000000000000000000000000000000000000000000000081525081818160039081620000c7919062000458565b508060049081620000d9919062000458565b5050506000620000ee620001d660201b60201c565b905080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35033600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506200053f565b600033905090565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200026057607f821691505b60208210810362000276576200027562000218565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620002e07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002a1565b620002ec8683620002a1565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000339620003336200032d8462000304565b6200030e565b62000304565b9050919050565b6000819050919050565b620003558362000318565b6200036d620003648262000340565b848454620002ae565b825550505050565b600090565b6200038462000375565b620003918184846200034a565b505050565b5b81811015620003b957620003ad6000826200037a565b60018101905062000397565b5050565b601f8211156200040857620003d2816200027c565b620003dd8462000291565b81016020851015620003ed578190505b62000405620003fc8562000291565b83018262000396565b50505b505050565b600082821c905092915050565b60006200042d600019846008026200040d565b1980831691505092915050565b60006200044883836200041a565b9150826002028217905092915050565b6200046382620001de565b67ffffffffffffffff8111156200047f576200047e620001e9565b5b6200048b825462000247565b62000498828285620003bd565b600060209050601f831160018114620004d05760008415620004bb578287015190505b620004c785826200043a565b86555062000537565b601f198416620004e0866200027c565b60005b828110156200050a57848901518255600182019150602085019450602081019050620004e3565b868310156200052a578489015162000526601f8916826200041a565b8355505b6001600288020188555050505b505050505050565b61296f806200054f6000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80636e9821c2116100de5780639dc29fac11610097578063d4d0d6e611610071578063d4d0d6e61461044f578063d55e62a01461046b578063dd62ed3e14610487578063f2fde38b146104b75761018e565b80639dc29fac146103d3578063a457c2d7146103ef578063a9059cbb1461041f5761018e565b80636e9821c21461032357806370a0823114610353578063715018a6146103835780638456cb591461038d5780638da5cb5b1461039757806395d89b41146103b55761018e565b8063323be1c51161014b57806340c10f191161012557806340c10f19146102c15780634be8b05e146102dd578063570ca735146102e75780635c975abb146103055761018e565b8063323be1c51461026957806339509351146102875780633f4ba83a146102b75761018e565b806306fdde0314610193578063095ea7b3146101b157806318160ddd146101e157806323b872dd146101ff57806329605e771461022f578063313ce5671461024b575b600080fd5b61019b6104d3565b6040516101a89190611df6565b60405180910390f35b6101cb60048036038101906101c69190611eb1565b610565565b6040516101d89190611f0c565b60405180910390f35b6101e9610583565b6040516101f69190611f36565b60405180910390f35b61021960048036038101906102149190611f51565b61058d565b6040516102269190611f0c565b60405180910390f35b61024960048036038101906102449190611fa4565b6105fa565b005b61025361073d565b6040516102609190611fed565b60405180910390f35b610271610746565b60405161027e9190611f0c565b60405180910390f35b6102a1600480360381019061029c9190611eb1565b610759565b6040516102ae9190611f0c565b60405180910390f35b6102bf610805565b005b6102db60048036038101906102d69190611eb1565b610903565b005b6102e56109da565b005b6102ef610aba565b6040516102fc9190612017565b60405180910390f35b61030d610ae0565b60405161031a9190611f0c565b60405180910390f35b61033d60048036038101906103389190611fa4565b610af3565b60405161034a9190611f0c565b60405180910390f35b61036d60048036038101906103689190611fa4565b610b13565b60405161037a9190611f36565b60405180910390f35b61038b610b5b565b005b610395610c98565b005b61039f610dd4565b6040516103ac9190612017565b60405180910390f35b6103bd610dfe565b6040516103ca9190611df6565b60405180910390f35b6103ed60048036038101906103e89190611eb1565b610e90565b005b61040960048036038101906104049190611eb1565b610f67565b6040516104169190611f0c565b60405180910390f35b61043960048036038101906104349190611eb1565b61105b565b6040516104469190611f0c565b60405180910390f35b61046960048036038101906104649190611fa4565b6110c6565b005b61048560048036038101906104809190611fa4565b6111b1565b005b6104a1600480360381019061049c9190612032565b61129c565b6040516104ae9190611f36565b60405180910390f35b6104d160048036038101906104cc9190611fa4565b611323565b005b6060600380546104e2906120a1565b80601f016020809104026020016040519081016040528092919081815260200182805461050e906120a1565b801561055b5780601f106105305761010080835404028352916020019161055b565b820191906000526020600020905b81548152906001019060200180831161053e57829003601f168201915b5050505050905090565b60006105796105726114ce565b84846114d6565b6001905092915050565b6000600254905090565b6000600560149054906101000a900460ff1615806105dd57506105ae610dd4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6105e657600080fd5b6105f184848461169f565b90509392505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461068a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106819061211e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036106f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f09061218a565b60405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006012905090565b600560159054906101000a900460ff1681565b60006107fb6107666114ce565b8484600160006107746114ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107f691906121d9565b6114d6565b6001905092915050565b61080d6114ce565b73ffffffffffffffffffffffffffffffffffffffff1661082b610dd4565b73ffffffffffffffffffffffffffffffffffffffff1614610881576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087890612259565b60405180910390fd5b600560149054906101000a900460ff1661089a57600080fd5b60011515600560149054906101000a900460ff161515146108ba57600080fd5b6000600560146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061098d575061095e610dd4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6109cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c3906122c5565b60405180910390fd5b6109d682826117a0565b5050565b6109e26114ce565b73ffffffffffffffffffffffffffffffffffffffff16610a00610dd4565b73ffffffffffffffffffffffffffffffffffffffff1614610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90612259565b60405180910390fd5b6000600560146101000a81548160ff0219169083151502179055506000600560156101000a81548160ff0219169083151502179055507faff39f66825d4448497d384dee3f4a3adf00a622960add00806503ae4ccee01c60405160405180910390a1565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560149054906101000a900460ff1681565b60076020528060005260406000206000915054906101000a900460ff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b636114ce565b73ffffffffffffffffffffffffffffffffffffffff16610b81610dd4565b73ffffffffffffffffffffffffffffffffffffffff1614610bd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bce90612259565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ca06114ce565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610dd4565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b90612259565b60405180910390fd5b600560149054906101000a900460ff161580610d625750610d33610dd4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d6b57600080fd5b60011515600560159054906101000a900460ff16151514610d8b57600080fd5b6001600560146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610e0d906120a1565b80601f0160208091040260200160405190810160405280929190818152602001828054610e39906120a1565b8015610e865780601f10610e5b57610100808354040283529160200191610e86565b820191906000526020600020905b815481529060010190602001808311610e6957829003601f168201915b5050505050905090565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610f1a5750610eeb610dd4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f50906122c5565b60405180910390fd5b610f6382826118f3565b5050565b60008060016000610f766114ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102a90612357565b60405180910390fd5b61105061103e6114ce565b85858461104b9190612377565b6114d6565b600191505092915050565b6000600560149054906101000a900460ff1615806110ab575061107c610dd4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6110b457600080fd5b6110be8383611ac6565b905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611156576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114d9061211e565b60405180910390fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611241576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112389061211e565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61132b6114ce565b73ffffffffffffffffffffffffffffffffffffffff16611349610dd4565b73ffffffffffffffffffffffffffffffffffffffff161461139f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139690612259565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361140e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114059061241d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611545576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153c906124af565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036115b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ab90612541565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116929190611f36565b60405180910390a3505050565b60006116ac848484611ae4565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006116f76114ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176e906125d3565b60405180910390fd5b611794856117836114ce565b858461178f9190612377565b6114d6565b60019150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361180f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118069061263f565b60405180910390fd5b61181b60008383611d61565b806002600082825461182d91906121d9565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461188291906121d9565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516118e79190611f36565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611962576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611959906126d1565b60405180910390fd5b61196e82600083611d61565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156119f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119eb90612763565b60405180910390fd5b8181611a009190612377565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160026000828254611a549190612377565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611ab99190611f36565b60405180910390a3505050565b6000611ada611ad36114ce565b8484611ae4565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611b53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4a906127f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611bc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb990612887565b60405180910390fd5b611bcd838383611d61565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611c53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4a90612919565b60405180910390fd5b8181611c5f9190612377565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611cef91906121d9565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611d539190611f36565b60405180910390a350505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611da0578082015181840152602081019050611d85565b60008484015250505050565b6000601f19601f8301169050919050565b6000611dc882611d66565b611dd28185611d71565b9350611de2818560208601611d82565b611deb81611dac565b840191505092915050565b60006020820190508181036000830152611e108184611dbd565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611e4882611e1d565b9050919050565b611e5881611e3d565b8114611e6357600080fd5b50565b600081359050611e7581611e4f565b92915050565b6000819050919050565b611e8e81611e7b565b8114611e9957600080fd5b50565b600081359050611eab81611e85565b92915050565b60008060408385031215611ec857611ec7611e18565b5b6000611ed685828601611e66565b9250506020611ee785828601611e9c565b9150509250929050565b60008115159050919050565b611f0681611ef1565b82525050565b6000602082019050611f216000830184611efd565b92915050565b611f3081611e7b565b82525050565b6000602082019050611f4b6000830184611f27565b92915050565b600080600060608486031215611f6a57611f69611e18565b5b6000611f7886828701611e66565b9350506020611f8986828701611e66565b9250506040611f9a86828701611e9c565b9150509250925092565b600060208284031215611fba57611fb9611e18565b5b6000611fc884828501611e66565b91505092915050565b600060ff82169050919050565b611fe781611fd1565b82525050565b60006020820190506120026000830184611fde565b92915050565b61201181611e3d565b82525050565b600060208201905061202c6000830184612008565b92915050565b6000806040838503121561204957612048611e18565b5b600061205785828601611e66565b925050602061206885828601611e66565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806120b957607f821691505b6020821081036120cc576120cb612072565b5b50919050565b7f6f70657261746f72206f6e6c7900000000000000000000000000000000000000600082015250565b6000612108600d83611d71565b9150612113826120d2565b602082019050919050565b60006020820190508181036000830152612137816120fb565b9050919050565b7f7a65726f206f70657261746f7200000000000000000000000000000000000000600082015250565b6000612174600d83611d71565b915061217f8261213e565b602082019050919050565b600060208201905081810360008301526121a381612167565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006121e482611e7b565b91506121ef83611e7b565b9250828201905080821115612207576122066121aa565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612243602083611d71565b915061224e8261220d565b602082019050919050565b6000602082019050818103600083015261227281612236565b9050919050565b7f6e6f742074727573746564000000000000000000000000000000000000000000600082015250565b60006122af600b83611d71565b91506122ba82612279565b602082019050919050565b600060208201905081810360008301526122de816122a2565b9050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000612341602583611d71565b915061234c826122e5565b604082019050919050565b6000602082019050818103600083015261237081612334565b9050919050565b600061238282611e7b565b915061238d83611e7b565b92508282039050818111156123a5576123a46121aa565b5b92915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612407602683611d71565b9150612412826123ab565b604082019050919050565b60006020820190508181036000830152612436816123fa565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612499602483611d71565b91506124a48261243d565b604082019050919050565b600060208201905081810360008301526124c88161248c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061252b602283611d71565b9150612536826124cf565b604082019050919050565b6000602082019050818103600083015261255a8161251e565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006125bd602883611d71565b91506125c882612561565b604082019050919050565b600060208201905081810360008301526125ec816125b0565b9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000612629601f83611d71565b9150612634826125f3565b602082019050919050565b600060208201905081810360008301526126588161261c565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006126bb602183611d71565b91506126c68261265f565b604082019050919050565b600060208201905081810360008301526126ea816126ae565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b600061274d602283611d71565b9150612758826126f1565b604082019050919050565b6000602082019050818103600083015261277c81612740565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006127df602583611d71565b91506127ea82612783565b604082019050919050565b6000602082019050818103600083015261280e816127d2565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612871602383611d71565b915061287c82612815565b604082019050919050565b600060208201905081810360008301526128a081612864565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612903602683611d71565b915061290e826128a7565b604082019050919050565b60006020820190508181036000830152612932816128f6565b905091905056fea26469706673582212204a7863eaf1356d31ebcde1f857460488027fa654b04d02059d764f5d7118e79b64736f6c63430008110033
    

    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":[],"name":"NotPausable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","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"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canPause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notPausable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","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":"","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":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator","type":"address"}],"name":"transferOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"trusted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
    
    

    Solidity Code:

    // SPDX-License-Identifier: MIT
    
    pragma solidity ^0.8.0;
    
    /*
     * @dev Provides information about the current execution context, including the
     * sender of the transaction and its data. While these are generally available
     * via msg.sender and msg.data, they should not be accessed in such a direct
     * manner, since when dealing with meta-transactions the account sending and
     * paying for execution may not be the actual sender (as far as an application
     * is concerned).
     *
     * This contract is only required for intermediate, library-like contracts.
     */
    abstract contract Context {
        function _msgSender() internal view virtual returns (address) {
            return msg.sender;
        }
    
        function _msgData() internal view virtual returns (bytes calldata) {
            this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
            return msg.data;
        }
    }
    
    
    /**
     * @dev Interface of the ERC20 standard as defined in the EIP.
     */
    interface IERC20 {
        /**
         * @dev Returns the amount of tokens in existence.
         */
        function totalSupply() external view returns (uint256);
    
        /**
         * @dev Returns the amount of tokens owned by `account`.
         */
        function balanceOf(address account) external view returns (uint256);
    
        /**
         * @dev Moves `amount` tokens from the caller's account to `recipient`.
         *
         * Returns a boolean value indicating whether the operation succeeded.
         *
         * Emits a {Transfer} event.
         */
        function transfer(address recipient, uint256 amount) external returns (bool);
    
        /**
         * @dev Returns the remaining number of tokens that `spender` will be
         * allowed to spend on behalf of `owner` through {transferFrom}. This is
         * zero by default.
         *
         * This value changes when {approve} or {transferFrom} are called.
         */
        function allowance(address owner, address spender) external view returns (uint256);
    
        /**
         * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
         *
         * Returns a boolean value indicating whether the operation succeeded.
         *
         * IMPORTANT: Beware that changing an allowance with this method brings the risk
         * that someone may use both the old and the new allowance by unfortunate
         * transaction ordering. One possible solution to mitigate this race
         * condition is to first reduce the spender's allowance to 0 and set the
         * desired value afterwards:
         * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
         *
         * Emits an {Approval} event.
         */
        function approve(address spender, uint256 amount) external returns (bool);
    
        /**
         * @dev Moves `amount` tokens from `sender` to `recipient` using the
         * allowance mechanism. `amount` is then deducted from the caller's
         * allowance.
         *
         * Returns a boolean value indicating whether the operation succeeded.
         *
         * Emits a {Transfer} event.
         */
        function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    
        /**
         * @dev Emitted when `value` tokens are moved from one account (`from`) to
         * another (`to`).
         *
         * Note that `value` may be zero.
         */
        event Transfer(address indexed from, address indexed to, uint256 value);
    
        /**
         * @dev Emitted when the allowance of a `spender` for an `owner` is set by
         * a call to {approve}. `value` is the new allowance.
         */
        event Approval(address indexed owner, address indexed spender, uint256 value);
    }
    
    
    /**
     * @dev Contract module which provides a basic access control mechanism, where
     * there is an account (an owner) that can be granted exclusive access to
     * specific functions.
     *
     * By default, the owner account will be the one that deploys the contract. This
     * can later be changed with {transferOwnership}.
     *
     * This module is used through inheritance. It will make available the modifier
     * `onlyOwner`, which can be applied to your functions to restrict their use to
     * the owner.
     */
    abstract contract Ownable is Context {
        address private _owner;
    
        event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    
        /**
         * @dev Initializes the contract setting the deployer as the initial owner.
         */
        constructor () {
            address msgSender = _msgSender();
            _owner = msgSender;
            emit OwnershipTransferred(address(0), msgSender);
        }
    
        /**
         * @dev Returns the address of the current owner.
         */
        function owner() public view virtual returns (address) {
            return _owner;
        }
    
        /**
         * @dev Throws if called by any account other than the owner.
         */
        modifier onlyOwner() {
            require(owner() == _msgSender(), "Ownable: caller is not the owner");
            _;
        }
    
        /**
         * @dev Leaves the contract without owner. It will not be possible to call
         * `onlyOwner` functions anymore. Can only be called by the current owner.
         *
         * NOTE: Renouncing ownership will leave the contract without an owner,
         * thereby removing any functionality that is only available to the owner.
         */
        function renounceOwnership() public virtual onlyOwner {
            emit OwnershipTransferred(_owner, address(0));
            _owner = address(0);
        }
    
        /**
         * @dev Transfers ownership of the contract to a new account (`newOwner`).
         * Can only be called by the current owner.
         */
        function transferOwnership(address newOwner) public virtual onlyOwner {
            require(newOwner != address(0), "Ownable: new owner is the zero address");
            emit OwnershipTransferred(_owner, newOwner);
            _owner = newOwner;
        }
    }
    
    /**
     * @title Pausable
     * @dev Base contract which allows children to implement an emergency stop mechanism.
     */
    contract Pausable is Ownable {
      event Pause();
      event Unpause();
      event NotPausable();
    
      bool public paused = false;
      bool public canPause = true;
    
      /**
       * @dev Modifier to make a function callable only when the contract is not paused.
       */
      modifier whenNotPaused() {
        require(!paused || msg.sender == owner());
        _;
      }
    
      /**
       * @dev Modifier to make a function callable only when the contract is paused.
       */
      modifier whenPaused() {
        require(paused);
        _;
      }
    
      /**
         * @dev called by the owner to pause, triggers stopped state
      **/
      function pause() onlyOwner whenNotPaused public {
        require(canPause == true);
        paused = true;
        emit Pause();
      }
    
      /**
       * @dev called by the owner to unpause, returns to normal state
       */
      function unpause() onlyOwner whenPaused public {
        require(paused == true);
        paused = false;
        emit Unpause();
      }
      
      /**
       * @dev Prevent the token from ever being paused again
       **/
      function notPausable() onlyOwner public {
        paused = false;
        canPause = false;
        emit NotPausable();
      }
    }
    
    /**
     * @dev Implementation of the {IERC20} interface.
     *
     * This implementation is agnostic to the way tokens are created. This means
     * that a supply mechanism has to be added in a derived contract using {_mint}.
     * For a generic mechanism see {ERC20PresetMinterPauser}.
     *
     * TIP: For a detailed writeup see our guide
     * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
     * to implement supply mechanisms].
     *
     * We have followed general OpenZeppelin guidelines: functions revert instead
     * of returning `false` on failure. This behavior is nonetheless conventional
     * and does not conflict with the expectations of ERC20 applications.
     *
     * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
     * This allows applications to reconstruct the allowance for all accounts just
     * by listening to said events. Other implementations of the EIP may not emit
     * these events, as it isn't required by the specification.
     *
     * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
     * functions have been added to mitigate the well-known issues around setting
     * allowances. See {IERC20-approve}.
     */
    contract ERC20 is Context, IERC20 {
        mapping (address => uint256) private _balances;
    
        mapping (address => mapping (address => uint256)) private _allowances;
    
        uint256 private _totalSupply;
    
        string private _name;
        string private _symbol;
    
        /**
         * @dev Sets the values for {name} and {symbol}.
         *
         * The defaut value of {decimals} is 18. To select a different value for
         * {decimals} you should overload it.
         *
         * All three of these values are immutable: they can only be set once during
         * construction.
         */
        constructor (string memory name_, string memory symbol_) {
            _name = name_;
            _symbol = symbol_;
        }
    
        /**
         * @dev Returns the name of the token.
         */
        function name() public view virtual returns (string memory) {
            return _name;
        }
    
        /**
         * @dev Returns the symbol of the token, usually a shorter version of the
         * name.
         */
        function symbol() public view virtual returns (string memory) {
            return _symbol;
        }
    
        /**
         * @dev Returns the number of decimals used to get its user representation.
         * For example, if `decimals` equals `2`, a balance of `505` tokens should
         * be displayed to a user as `5,05` (`505 / 10 ** 2`).
         *
         * Tokens usually opt for a value of 18, imitating the relationship between
         * Ether and Wei. This is the value {ERC20} uses, unless this function is
         * overloaded;
         *
         * NOTE: This information is only used for _display_ purposes: it in
         * no way affects any of the arithmetic of the contract, including
         * {IERC20-balanceOf} and {IERC20-transfer}.
         */
        function decimals() public view virtual returns (uint8) {
            return 18;
        }
    
        /**
         * @dev See {IERC20-totalSupply}.
         */
        function totalSupply() public view virtual override returns (uint256) {
            return _totalSupply;
        }
    
        /**
         * @dev See {IERC20-balanceOf}.
         */
        function balanceOf(address account) public view virtual override returns (uint256) {
            return _balances[account];
        }
    
        /**
         * @dev See {IERC20-transfer}.
         *
         * Requirements:
         *
         * - `recipient` cannot be the zero address.
         * - the caller must have a balance of at least `amount`.
         */
        function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
            _transfer(_msgSender(), recipient, amount);
            return true;
        }
    
        /**
         * @dev See {IERC20-allowance}.
         */
        function allowance(address owner, address spender) public view virtual override returns (uint256) {
            return _allowances[owner][spender];
        }
    
        /**
         * @dev See {IERC20-approve}.
         *
         * Requirements:
         *
         * - `spender` cannot be the zero address.
         */
        function approve(address spender, uint256 amount) public virtual override returns (bool) {
            _approve(_msgSender(), spender, amount);
            return true;
        }
    
        /**
         * @dev See {IERC20-transferFrom}.
         *
         * Emits an {Approval} event indicating the updated allowance. This is not
         * required by the EIP. See the note at the beginning of {ERC20}.
         *
         * Requirements:
         *
         * - `sender` and `recipient` cannot be the zero address.
         * - `sender` must have a balance of at least `amount`.
         * - the caller must have allowance for ``sender``'s tokens of at least
         * `amount`.
         */
        function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
            _transfer(sender, recipient, amount);
    
            uint256 currentAllowance = _allowances[sender][_msgSender()];
            require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
            _approve(sender, _msgSender(), currentAllowance - amount);
    
            return true;
        }
    
        /**
         * @dev Atomically increases the allowance granted to `spender` by the caller.
         *
         * This is an alternative to {approve} that can be used as a mitigation for
         * problems described in {IERC20-approve}.
         *
         * Emits an {Approval} event indicating the updated allowance.
         *
         * Requirements:
         *
         * - `spender` cannot be the zero address.
         */
        function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
            _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
            return true;
        }
    
        /**
         * @dev Atomically decreases the allowance granted to `spender` by the caller.
         *
         * This is an alternative to {approve} that can be used as a mitigation for
         * problems described in {IERC20-approve}.
         *
         * Emits an {Approval} event indicating the updated allowance.
         *
         * Requirements:
         *
         * - `spender` cannot be the zero address.
         * - `spender` must have allowance for the caller of at least
         * `subtractedValue`.
         */
        function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
            uint256 currentAllowance = _allowances[_msgSender()][spender];
            require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
    
            return true;
        }
    
        /**
         * @dev Moves tokens `amount` from `sender` to `recipient`.
         *
         * This is internal function is equivalent to {transfer}, and can be used to
         * e.g. implement automatic token fees, slashing mechanisms, etc.
         *
         * Emits a {Transfer} event.
         *
         * Requirements:
         *
         * - `sender` cannot be the zero address.
         * - `recipient` cannot be the zero address.
         * - `sender` must have a balance of at least `amount`.
         */
        function _transfer(address sender, address recipient, uint256 amount) internal virtual {
            require(sender != address(0), "ERC20: transfer from the zero address");
            require(recipient != address(0), "ERC20: transfer to the zero address");
    
            _beforeTokenTransfer(sender, recipient, amount);
    
            uint256 senderBalance = _balances[sender];
            require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
            _balances[sender] = senderBalance - amount;
            _balances[recipient] += amount;
    
            emit Transfer(sender, recipient, amount);
        }
    
        /** @dev Creates `amount` tokens and assigns them to `account`, increasing
         * the total supply.
         *
         * Emits a {Transfer} event with `from` set to the zero address.
         *
         * Requirements:
         *
         * - `to` cannot be the zero address.
         */
        function _mint(address account, uint256 amount) internal virtual {
            require(account != address(0), "ERC20: mint to the zero address");
    
            _beforeTokenTransfer(address(0), account, amount);
    
            _totalSupply += amount;
            _balances[account] += amount;
            emit Transfer(address(0), account, amount);
        }
    
        /**
         * @dev Destroys `amount` tokens from `account`, reducing the
         * total supply.
         *
         * Emits a {Transfer} event with `to` set to the zero address.
         *
         * Requirements:
         *
         * - `account` cannot be the zero address.
         * - `account` must have at least `amount` tokens.
         */
        function _burn(address account, uint256 amount) internal virtual {
            require(account != address(0), "ERC20: burn from the zero address");
    
            _beforeTokenTransfer(account, address(0), amount);
    
            uint256 accountBalance = _balances[account];
            require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
            _balances[account] = accountBalance - amount;
            _totalSupply -= amount;
    
            emit Transfer(account, address(0), amount);
        }
    
        /**
         * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
         *
         * This internal function is equivalent to `approve`, and can be used to
         * e.g. set automatic allowances for certain subsystems, etc.
         *
         * Emits an {Approval} event.
         *
         * Requirements:
         *
         * - `owner` cannot be the zero address.
         * - `spender` cannot be the zero address.
         */
        function _approve(address owner, address spender, uint256 amount) internal virtual {
            require(owner != address(0), "ERC20: approve from the zero address");
            require(spender != address(0), "ERC20: approve to the zero address");
    
            _allowances[owner][spender] = amount;
            emit Approval(owner, spender, amount);
        }
    
        /**
         * @dev Hook that is called before any transfer of tokens. This includes
         * minting and burning.
         *
         * Calling conditions:
         *
         * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
         * will be to transferred to `to`.
         * - when `from` is zero, `amount` tokens will be minted for `to`.
         * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
         * - `from` and `to` are never both zero.
         *
         * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
         */
        function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
    }
    
    
    contract OperableToken is ERC20, Ownable, Pausable {
      address public operator;
      mapping(address=>bool) public trusted;
    
      modifier onlyTrusted {
          require(trusted[msg.sender] || msg.sender == owner(), "not trusted");
          _;
      }
      modifier onlyOperator {
          require(msg.sender == operator, "operator only");
          _;
      }
    
      constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        operator = msg.sender;
      }
    
      function transferOperator(address newOperator) public onlyOperator {
        require(newOperator != address(0), "zero operator");
        operator = newOperator;
      }
    
      function addTrusted(address user) public onlyOperator {
          trusted[user] = true;
      }
    
      function removeTrusted(address user) public onlyOperator {
          trusted[user] = false;
      }
    
      function mint(address account, uint amount) public onlyTrusted {
        _mint(account, amount);
      }
    
      function burn(address account, uint amount) public onlyTrusted {
        _burn(account, amount);
      }
    
      /**
       * @dev Transfer tokens when not paused
       */
      function transfer(address _to, uint256 _value) public whenNotPaused override returns (bool) {
        return super.transfer(_to, _value);
      }
        
      /**
       * @dev transferFrom function to tansfer tokens when token is not paused
       **/
      function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused override returns (bool) {
        return super.transferFrom(_from, _to, _value);
      }
    }
    
    contract IToken is OperableToken {
      constructor() OperableToken("IToken Token", "ITK") {}
    }
    
  5.  此Bytecode在二层ZKSync网络无法使用。
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐