Address Contract Verified
Address
0xFF2d6934fb49e3e883Dc03871D081a1C21ad7984
Balance
0 ETH
Nonce
1
Code Size
11749 bytes
Creator
0xdBf1463C...Ece5 at tx 0x9cca9f5c...b41dbe
Indexed Transactions
0
Contract Bytecode
11749 bytes
0x608060405234801561001057600080fd5b50600436106102c85760003560e01c8063445a67971161017b57806391d14854116100d8578063aa2a7eea1161008c578063cf2c52cb11610071578063cf2c52cb14610632578063d547741f14610645578063dd62ed3e1461065857600080fd5b8063aa2a7eea1461060c578063c6be49e71461061f57600080fd5b8063a217fddf116100bd578063a217fddf146105de578063a457c2d7146105e6578063a9059cbb146105f957600080fd5b806391d148541461059057806395d89b41146105d657600080fd5b806370a082311161012f578063824c0d6611610114578063824c0d661461054357806388d695b2146105565780638f770ad01461056957600080fd5b806370a08231146104fa5780637669d4891461053057600080fd5b8063572b6c0511610160578063572b6c05146104985780635932a78e146104c757806362f629e7146104da57600080fd5b8063445a679714610440578063469048401461045357600080fd5b8063248a9ca31161022957806336568abe116101dd57806339509351116101c2578063395093511461041a57806340c10f191461042d57806342966c68146103bd57600080fd5b806336568abe146103f457806337ea010a1461040757600080fd5b80632e1a7d4d1161020e5780632e1a7d4d146103bd5780632f2ff15d146103d2578063313ce567146103e557600080fd5b8063248a9ca31461039157806324a9d853146103b457600080fd5b8063095ea7b31161028057806312b681981161026557806312b681981461036357806318160ddd1461037657806323b872dd1461037e57600080fd5b8063095ea7b3146103475780630e3d22021461035a57600080fd5b806306fdde03116102b157806306fdde0314610308578063075b6e331461031d57806308acece21461033457600080fd5b806301ffc9a7146102cd578063050b7883146102f5575b600080fd5b6102e06102db366004612662565b61069e565b60405190151581526020015b60405180910390f35b6102e06103033660046126f0565b6106fa565b610310610713565b6040516102ec9190612780565b61032660095481565b6040519081526020016102ec565b6102e06103423660046127fa565b6107a5565b6102e06103553660046127fa565b6107bc565b61032660085481565b6102e0610371366004612824565b6107de565b600254610326565b6102e061038c3660046128be565b6107fb565b61032661039f3660046128fa565b60009081526006602052604090206001015490565b61032660075481565b6103d06103cb3660046128fa565b610829565b005b6103d06103e0366004612913565b61083d565b604051601281526020016102ec565b6103d0610402366004612913565b610867565b6102e061041536600461293f565b61093c565b6102e06104283660046127fa565b6109d1565b6103d061043b3660046127fa565b610a30565b6103d061044e366004612972565b610ba4565b600a546104739073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ec565b6102e06104a6366004612972565b60055473ffffffffffffffffffffffffffffffffffffffff91821691161490565b6102e06104d536600461293f565b610cb9565b600b546104739073ffffffffffffffffffffffffffffffffffffffff1681565b610326610508366004612972565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6103d061053e36600461298d565b610ce5565b6102e0610551366004612824565b610de1565b6102e06105643660046126f0565b610df3565b6103267f00000000000000000000000000000000000000001027e72f1f1281308800000081565b6102e061059e366004612913565b600091825260066020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610310610e03565b610326600081565b6102e06105f43660046127fa565b610e12565b6102e06106073660046127fa565b610ef0565b6103d061061a366004612972565b610f08565b6102e061062d3660046128fa565b610f76565b6103d06106403660046129c6565b610f8d565b6103d0610653366004612913565b61104b565b610326610666366004612a49565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fea6162b20000000000000000000000000000000000000000000000000000000014806106f457506106f4826110cb565b92915050565b600061070a858585856001611162565b95945050505050565b60606003805461072290612a73565b80601f016020809104026020016040519081016040528092919081815260200182805461074e90612a73565b801561079b5780601f106107705761010080835404028352916020019161079b565b820191906000526020600020905b81548152906001019060200180831161077e57829003601f168201915b5050505050905090565b60006107b3838360006112fc565b50600192915050565b6000806107c76114f7565b90506107d4818585611501565b5060019392505050565b60006107f087878787878760006116b4565b979650505050505050565b6000806108066114f7565b90506108138582856119ef565b61081e858585611ac0565b506001949350505050565b61083a6108346114f7565b82611d73565b50565b60008281526006602052604090206001015461085881611f60565b6108628383611f71565b505050565b61086f6114f7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461092e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109388282612066565b5050565b60006109506109496114f7565b8585611ac0565b8373ffffffffffffffffffffffffffffffffffffffff1661096f6114f7565b73ffffffffffffffffffffffffffffffffffffffff167f9be86a1edd93f234e9c42b9ec0ff205d1b91b05eed309f225cc0a82f9365083085856040516109bf929190918252602082015260400190565b60405180910390a35060019392505050565b6000806109dc6114f7565b90506107d4818585610a21858973ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b610a2b9190612af5565b611501565b610a5c7fc9fc9949603a50f5cc3a96f774f1d68287789a241d2082dc81d0fb19a53bcf2b61059e6114f7565b80610a8e5750610a8e7fc9eb32e43bf5ecbceacf00b32281dfc5d6d700a0db676ea26ccf938a385ac3f761059e6114f7565b610af4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4e6f7420617574686f72697a656420746f206d696e742e0000000000000000006044820152606401610925565b600b5473ffffffffffffffffffffffffffffffffffffffff1615610b9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4d696e74696e672064697361626c6564207768656e20506f6c79676f6e20627260448201527f6964676520697320656e61626c65642e000000000000000000000000000000006064820152608401610925565b6109388282612159565b7fc9fc9949603a50f5cc3a96f774f1d68287789a241d2082dc81d0fb19a53bcf2b610bce81611f60565b73ffffffffffffffffffffffffffffffffffffffff8216610c71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f426164204368696c64436861696e4d616e6167657250726f787920616464726560448201527f73732e00000000000000000000000000000000000000000000000000000000006064820152608401610925565b50600b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000610cc584846107a5565b508373ffffffffffffffffffffffffffffffffffffffff1661096f6114f7565b7fc9fc9949603a50f5cc3a96f774f1d68287789a241d2082dc81d0fb19a53bcf2b610d0f81611f60565b73ffffffffffffffffffffffffffffffffffffffff8516610d8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f726563697069656e7420697320302061646472000000000000000000000000006044820152606401610925565b50600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9590951694909417909355600791909155600855600955565b60006107f087878787878760016116b4565b600061070a858585856000611162565b60606004805461072290612a73565b600080610e1d6114f7565b73ffffffffffffffffffffffffffffffffffffffff81811660009081526001602090815260408083209389168352929052205490915083811015610ee3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610925565b61081e8286868403611501565b600080610efb6114f7565b90506107d4818585611ac0565b7fc9fc9949603a50f5cc3a96f774f1d68287789a241d2082dc81d0fb19a53bcf2b610f3281611f60565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555050565b6000610f8560008360016112fc565b506001919050565b600b5473ffffffffffffffffffffffffffffffffffffffff16610fae6114f7565b73ffffffffffffffffffffffffffffffffffffffff161461102b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f41646472657373206e6f7420616c6c6f77656420746f206465706f7369742e006044820152606401610925565b6000611039828401846128fa565b90506110458482612159565b50505050565b60008281526006602052604090206001015461106681611f60565b6108628383612066565b60055460009073ffffffffffffffffffffffffffffffffffffffff1633036110bd57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b503390565b905090565b3390565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806106f457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146106f4565b6000846111cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f20726563697069656e7473000000000000000000000000000000000000006044820152606401610925565b848314611234576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f616d6f756e747320617267756d656e742073697a65206d69736d6174636865646044820152606401610925565b60005b858110156112ef5782156112935761128d87878381811061125a5761125a612b08565b905060200201602081019061126f9190612972565b86868481811061128157611281612b08565b905060200201356107a5565b506112dd565b6112db8787838181106112a8576112a8612b08565b90506020020160208101906112bd9190612972565b8686848181106112cf576112cf612b08565b90506020020135610ef0565b505b806112e781612b37565b915050611237565b5060019695505050505050565b60006113096105086114f7565b600a5490915073ffffffffffffffffffffffffffffffffffffffff166113b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f46656520726563697069656e74206e6f74207365742c2063616e6e6f7420757360448201527f65207472616e73666572576974684665650000000000000000000000000000006064820152608401610925565b82811015611441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63652e000000000000000000000000000000000000000000000000006064820152608401610925565b6000600854612710600754866114579190612b6f565b6114619190612bac565b61146b9190612af5565b9050600060095482111561148157600954611483565b815b90506114af6114906114f7565b600a5473ffffffffffffffffffffffffffffffffffffffff1683611ac0565b83156114d4576114cf6114c06114f7565b6114ca8388612be7565b611d73565b6114ef565b6114ef6114df6114f7565b876114ea8489612be7565b611ac0565b505050505050565b60006110c2611070565b73ffffffffffffffffffffffffffffffffffffffff83166115a3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff8216611646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008661171d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f20726563697069656e7473000000000000000000000000000000000000006044820152606401610925565b868514611786576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f616d6f756e747320617267756d656e742073697a65206d69736d6174636865646044820152606401610925565b8683146117ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f7265667320617267756d656e742073697a65206d69736d6174636865640000006044820152606401610925565b60005b878110156119815782156118425761183c89898381811061181557611815612b08565b905060200201602081019061182a9190612972565b88888481811061128157611281612b08565b50611880565b61187e89898381811061185757611857612b08565b905060200201602081019061186c9190612972565b8888848181106112cf576112cf612b08565b505b600085858381811061189457611894612b08565b90506020020135111561196f578888828181106118b3576118b3612b08565b90506020020160208101906118c89190612972565b73ffffffffffffffffffffffffffffffffffffffff166118e66114f7565b73ffffffffffffffffffffffffffffffffffffffff167f9be86a1edd93f234e9c42b9ec0ff205d1b91b05eed309f225cc0a82f9365083089898581811061192f5761192f612b08565b9050602002013588888681811061194857611948612b08565b90506020020135604051611966929190918252602082015260400190565b60405180910390a35b8061197981612b37565b9150506117f2565b5061198a6114f7565b73ffffffffffffffffffffffffffffffffffffffff167fa91f78721ec724c5d8f9e089dcea4047a178a40bbff32381b463c701f37aabd88989898989896040516119d996959493929190612c45565b60405180910390a2506001979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146110455781811015611ab3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610925565b6110458484848403611501565b73ffffffffffffffffffffffffffffffffffffffff8316611b63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff8216611c06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015611cbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290611d00908490612af5565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611d6691815260200190565b60405180910390a3611045565b73ffffffffffffffffffffffffffffffffffffffff8216611e16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610925565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120838303905560028054849290611f08908490612be7565b909155505060405182815260009073ffffffffffffffffffffffffffffffffffffffff8516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b61083a81611f6c6114f7565b612226565b600082815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661093857600082815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556120086114f7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561093857600082815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556120fb6114f7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b7f00000000000000000000000000000000000000001027e72f1f128130880000001561221c577f00000000000000000000000000000000000000001027e72f1f12813088000000816121aa60025490565b6121b49190612af5565b111561221c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f455243323020737570706c7920636170206578636565646564000000000000006044820152606401610925565b61093882826122f8565b600082815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109385761227e8173ffffffffffffffffffffffffffffffffffffffff166014612418565b612289836020612418565b60405160200161229a929190612cca565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261092591600401612780565b73ffffffffffffffffffffffffffffffffffffffff8216612375576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610925565b80600260008282546123879190612af5565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906123c1908490612af5565b909155505060405181815273ffffffffffffffffffffffffffffffffffffffff8316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606000612427836002612b6f565b612432906002612af5565b67ffffffffffffffff81111561244a5761244a612d4b565b6040519080825280601f01601f191660200182016040528015612474576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106124ab576124ab612b08565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061250e5761250e612b08565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061254a846002612b6f565b612555906001612af5565b90505b60018111156125f2577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061259657612596612b08565b1a60f81b8282815181106125ac576125ac612b08565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936125eb81612d7a565b9050612558565b50831561265b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610925565b9392505050565b60006020828403121561267457600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461265b57600080fd5b60008083601f8401126126b657600080fd5b50813567ffffffffffffffff8111156126ce57600080fd5b6020830191508360208260051b85010111156126e957600080fd5b9250929050565b6000806000806040858703121561270657600080fd5b843567ffffffffffffffff8082111561271e57600080fd5b61272a888389016126a4565b9096509450602087013591508082111561274357600080fd5b50612750878288016126a4565b95989497509550505050565b60005b8381101561277757818101518382015260200161275f565b50506000910152565b602081526000825180602084015261279f81604085016020870161275c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146127f557600080fd5b919050565b6000806040838503121561280d57600080fd5b612816836127d1565b946020939093013593505050565b6000806000806000806060878903121561283d57600080fd5b863567ffffffffffffffff8082111561285557600080fd5b6128618a838b016126a4565b9098509650602089013591508082111561287a57600080fd5b6128868a838b016126a4565b9096509450604089013591508082111561289f57600080fd5b506128ac89828a016126a4565b979a9699509497509295939492505050565b6000806000606084860312156128d357600080fd5b6128dc846127d1565b92506128ea602085016127d1565b9150604084013590509250925092565b60006020828403121561290c57600080fd5b5035919050565b6000806040838503121561292657600080fd5b82359150612936602084016127d1565b90509250929050565b60008060006060848603121561295457600080fd5b61295d846127d1565b95602085013595506040909401359392505050565b60006020828403121561298457600080fd5b61265b826127d1565b600080600080608085870312156129a357600080fd5b6129ac856127d1565b966020860135965060408601359560600135945092505050565b6000806000604084860312156129db57600080fd5b6129e4846127d1565b9250602084013567ffffffffffffffff80821115612a0157600080fd5b818601915086601f830112612a1557600080fd5b813581811115612a2457600080fd5b876020828501011115612a3657600080fd5b6020830194508093505050509250925092565b60008060408385031215612a5c57600080fd5b612a65836127d1565b9150612936602084016127d1565b600181811c90821680612a8757607f821691505b602082108103612ac0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156106f4576106f4612ac6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612b6857612b68612ac6565b5060010190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ba757612ba7612ac6565b500290565b600082612be2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156106f4576106f4612ac6565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115612c2c57600080fd5b8260051b80836020870137939093016020019392505050565b6060808252810186905260008760808301825b89811015612c935773ffffffffffffffffffffffffffffffffffffffff612c7e846127d1565b16825260209283019290910190600101612c58565b508381036020850152612ca781888a612bfa565b9150508281036040840152612cbd818587612bfa565b9998505050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612d0281601785016020880161275c565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612d3f81602884016020880161275c565b01602801949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600081612d8957612d89612ac6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea264697066735822122020e262f784693384faebff7a0be7ea1ba07bcce2250fd88775993f930e0365b064736f6c63430008100033
Verified Source Code Full Match
Compiler: v0.8.16+commit.07a7930e
EVM: london
Optimization: Yes (1000000 runs)
ERC20_Game_Currency.sol 224 lines
// SPDX-License-Identifier: Commons-Clause-1.0
// __ __ _ ___ _
// | \/ |___| |_ __ _| __|_ _| |__
// | |\/| / -_) _/ _` | _/ _` | '_ \
// |_| |_\___|\__\__,_|_|\__,_|_.__/
//
// Launch your crypto game or gamefi project's blockchain
// infrastructure & game APIs fast with https://trymetafab.com
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./IERC20_Game_Currency.sol";
import "../common/ERC2771Context_Upgradeable.sol";
import "../common/Roles.sol";
contract ERC20_Game_Currency is IERC20_Game_Currency, ERC20, ERC2771Context_Upgradeable, Roles, AccessControl {
uint256 public feeBps;
uint256 public feeFixed;
uint256 public feeCap;
address public feeRecipient;
address public childChainManagerProxy;
uint256 public immutable supplyCap;
constructor(string memory _name, string memory _symbol, uint256 _supplyCap, address _forwarder)
ERC20(_name, _symbol)
ERC2771Context_Upgradeable(_forwarder) {
feeRecipient = _msgSender();
supplyCap = _supplyCap;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(OWNER_ROLE, _msgSender());
}
function mint(address _to, uint256 _amount) external canMint {
require(childChainManagerProxy == address(0), "Minting disabled when Polygon bridge is enabled.");
_mint(_to, _amount);
}
function burn(uint256 _amount) external {
_burn(_msgSender(), _amount);
}
function transferWithRef(address recipient, uint256 amount, uint256 ref) external returns (bool) {
_transfer(_msgSender(), recipient, amount);
emit TransferRef(_msgSender(), recipient, amount, ref);
return true;
}
/**
* @dev Support for transfer batching
*/
function batchTransfer(address[] calldata recipients, uint256[] calldata amounts) external returns (bool) {
return _batchTransfer(recipients, amounts, false);
}
function batchTransferWithRefs(address[] calldata recipients, uint256[] calldata amounts, uint256[] calldata refs) external returns (bool) {
return _batchTransferWithRefs(recipients, amounts, refs, false);
}
function batchTransferWithFees(address[] calldata recipients, uint256[] calldata amounts) external returns (bool) {
return _batchTransfer(recipients, amounts, true);
}
function batchTransferWithFeesRefs(address[] calldata recipients, uint256[] calldata amounts, uint256[] calldata refs) external returns (bool) {
return _batchTransferWithRefs(recipients, amounts, refs, true);
}
function _batchTransfer(address[] calldata recipients, uint256[] calldata amounts, bool withFee) private returns (bool) {
require(recipients.length > 0, "No recipients");
require(recipients.length == amounts.length, "amounts argument size mismatched");
for (uint256 i = 0; i < recipients.length; i++) {
if (withFee) {
transferWithFee(recipients[i], amounts[i]);
} else {
transfer(recipients[i], amounts[i]);
}
}
return true;
}
function _batchTransferWithRefs(address[] calldata recipients, uint256[] calldata amounts, uint256[] calldata refs, bool withFee) private returns (bool) {
require(recipients.length > 0, "No recipients");
require(recipients.length == amounts.length, "amounts argument size mismatched");
require(recipients.length == refs.length, "refs argument size mismatched");
for (uint256 i = 0; i < recipients.length; i++) {
if (withFee) {
transferWithFee(recipients[i], amounts[i]);
} else {
transfer(recipients[i], amounts[i]);
}
if (refs[i] > 0) {
emit TransferRef(_msgSender(), recipients[i], amounts[i], refs[i]);
}
}
emit BatchTransferRef(_msgSender(), recipients, amounts, refs);
return true;
}
/**
* @dev Support for Polygon bridge
*/
function deposit(address user, bytes calldata depositData) external {
require(_msgSender() == childChainManagerProxy, "Address not allowed to deposit.");
uint256 amount = abi.decode(depositData, (uint256));
_mint(user, amount);
}
function withdraw(uint256 amount) external {
_burn(_msgSender(), amount);
}
function updateChildChainManager(address _childChainManagerProxy) external onlyRole(OWNER_ROLE) {
require(_childChainManagerProxy != address(0), "Bad ChildChainManagerProxy address.");
childChainManagerProxy = _childChainManagerProxy;
}
/**
* @dev Support for fee based transfers, typically used with gasless transactions
*/
function burnWithFee(uint256 amount) external returns (bool) {
_transferWithFee(address(0), amount, true);
return true;
}
function transferWithFee(address recipient, uint256 amount) public returns (bool) {
_transferWithFee(recipient, amount, false);
return true;
}
function transferWithFeeRef(address recipient, uint256 amount, uint256 ref) external returns (bool) {
transferWithFee(recipient, amount);
emit TransferRef(_msgSender(), recipient, amount, ref);
return true;
}
function _transferWithFee(address recipient, uint256 amount, bool isBurn) private {
uint256 senderBalance = balanceOf(_msgSender());
require(feeRecipient != address(0), "Fee recipient not set, cannot use transferWithFee");
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance.");
uint256 percentageFee = amount * feeBps / 10000 + feeFixed;
uint256 fee = percentageFee <= feeCap ? percentageFee : feeCap;
_transfer(_msgSender(), feeRecipient, fee);
if (isBurn) {
_burn(_msgSender(), amount - fee);
} else {
_transfer(_msgSender(), recipient, amount - fee);
}
}
function setFees(address recipient, uint256 _feeBps, uint256 _feeFixed, uint256 _feeCap) external onlyRole(OWNER_ROLE) {
require(recipient != address(0), "recipient is 0 addr");
feeRecipient = recipient;
feeBps = _feeBps;
feeFixed = _feeFixed;
feeCap = _feeCap;
}
/**
* @dev Support for gasless transactions
*/
function upgradeTrustedForwarder(address _newTrustedForwarder) external onlyRole(OWNER_ROLE) {
_upgradeTrustedForwarder(_newTrustedForwarder);
}
function _msgSender() internal view override(Context, ERC2771Context_Upgradeable) returns (address) {
return super._msgSender();
}
function _msgData() internal view override(Context, ERC2771Context_Upgradeable) returns (bytes calldata) {
return super._msgData();
}
/**
* @dev Support for optional supply cap
*/
function _mint(address _account, uint256 _amount) internal virtual override {
if (supplyCap > 0) {
require(ERC20.totalSupply() + _amount <= supplyCap, "ERC20 supply cap exceeded");
}
super._mint(_account, _amount);
}
/**
* @dev ERC165
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, IERC165) returns (bool) {
return interfaceId == type(IERC20_Game_Currency).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Modifiers
*/
modifier canMint {
require(hasRole(OWNER_ROLE, _msgSender()) || hasRole(MINTER_ROLE, _msgSender()), "Not authorized to mint.");
_;
}
}
ERC2771Context_Upgradeable.sol 52 lines
// SPDX-License-Identifier: Commons-Clause-1.0
// __ __ _ ___ _
// | \/ |___| |_ __ _| __|_ _| |__
// | |\/| / -_) _/ _` | _/ _` | '_ \
// |_| |_\___|\__\__,_|_|\__,_|_.__/
//
// Launch your crypto game or gamefi project's blockchain
// infrastructure & game APIs fast with https://trymetafab.com
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Context variant with ERC2771 support and upgradeable trusted forwarder.
*/
abstract contract ERC2771Context_Upgradeable is Context {
address private trustedForwarder;
constructor(address _trustedForwarder) {
trustedForwarder = _trustedForwarder;
}
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
return forwarder == trustedForwarder;
}
function _upgradeTrustedForwarder(address _trustedForwarder) internal {
trustedForwarder = _trustedForwarder;
}
function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
/// @solidity memory-safe-assembly
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return super._msgSender();
}
}
function _msgData() internal view virtual override returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return super._msgData();
}
}
}
AccessControl.sol 247 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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) {
return msg.data;
}
}
IAccessControl.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IERC20_Game_Currency.sol 43 lines
// SPDX-License-Identifier: Commons-Clause-1.0
// __ __ _ ___ _
// | \/ |___| |_ __ _| __|_ _| |__
// | |\/| / -_) _/ _` | _/ _` | '_ \
// |_| |_\___|\__\__,_|_|\__,_|_.__/
//
// Launch your crypto game or gamefi project's blockchain
// infrastructure & game APIs fast with https://trymetafab.com
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC20_Game_Currency is IERC20, IERC165 {
// events
event TransferRef(address indexed sender, address indexed recipient, uint256 amount, uint256 ref);
event BatchTransferRef(address indexed sender, address[] recipients, uint256[] amounts, uint256[] refs);
// autogenerated getters
function feeBps() external view returns (uint);
function feeFixed() external view returns (uint);
function feeCap() external view returns (uint);
function feeRecipient() external view returns (address);
function childChainManagerProxy() external view returns (address);
function supplyCap() external view returns (uint256);
// functions
function mint(address _to, uint256 _amount) external;
function burn(uint256 _amount) external;
function transferWithRef(address recipient, uint256 amount, uint256 ref) external returns (bool);
function batchTransfer(address[] calldata recipients, uint256[] calldata amounts) external returns (bool);
function batchTransferWithRefs(address[] calldata recipients, uint256[] calldata amounts, uint256[] calldata refs) external returns (bool);
function batchTransferWithFees(address[] calldata recipients, uint256[] calldata amounts) external returns (bool);
function batchTransferWithFeesRefs(address[] calldata recipients, uint256[] calldata amounts, uint256[] calldata refs) external returns (bool);
function deposit(address user, bytes calldata depositData) external;
function withdraw(uint256 amount) external;
function updateChildChainManager(address _childChainManagerProxy) external;
function burnWithFee(uint256 amount) external returns (bool);
function transferWithFee(address recipient, uint256 amount) external returns (bool);
function transferWithFeeRef(address recipient, uint256 amount, uint256 ref) external returns (bool);
function setFees(address recipient, uint _feeBps, uint _feeFixed, uint _feeCap) external;
}
Roles.sol 15 lines
// SPDX-License-Identifier: Commons-Clause-1.0
// __ __ _ ___ _
// | \/ |___| |_ __ _| __|_ _| |__
// | |\/| / -_) _/ _` | _/ _` | '_ \
// |_| |_\___|\__\__,_|_|\__,_|_.__/
//
// Launch your crypto game or gamefi project's blockchain
// infrastructure & game APIs fast with https://trymetafab.com
pragma solidity ^0.8.16;
contract Roles {
bytes32 internal constant MINTER_ROLE = keccak256("METAFAB_MINTER_ROLE");
bytes32 internal constant OWNER_ROLE = keccak256("METAFAB_OWNER_ROLE");
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
ERC20.sol 383 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @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 Contracts guidelines: functions revert
* instead 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, IERC20Metadata {
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 default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two 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 override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override 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
* overridden;
*
* 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 override 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:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, 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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, 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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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:
*
* - `account` 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);
_afterTokenTransfer(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");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - 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 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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
uint256 amount
) external returns (bool);
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
Read Contract
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
childChainManagerProxy 0x62f629e7 → address
decimals 0x313ce567 → uint8
feeBps 0x24a9d853 → uint256
feeCap 0x075b6e33 → uint256
feeFixed 0x0e3d2202 → uint256
feeRecipient 0x46904840 → address
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
isTrustedForwarder 0x572b6c05 → bool
name 0x06fdde03 → string
supplyCap 0x8f770ad0 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 23 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
batchTransfer 0x88d695b2
address[] recipients
uint256[] amounts
returns: bool
batchTransferWithFees 0x050b7883
address[] recipients
uint256[] amounts
returns: bool
batchTransferWithFeesRefs 0x824c0d66
address[] recipients
uint256[] amounts
uint256[] refs
returns: bool
batchTransferWithRefs 0x12b68198
address[] recipients
uint256[] amounts
uint256[] refs
returns: bool
burn 0x42966c68
uint256 _amount
burnWithFee 0xc6be49e7
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
deposit 0xcf2c52cb
address user
bytes depositData
grantRole 0x2f2ff15d
bytes32 role
address account
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address _to
uint256 _amount
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
setFees 0x7669d489
address recipient
uint256 _feeBps
uint256 _feeFixed
uint256 _feeCap
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferWithFee 0x08acece2
address recipient
uint256 amount
returns: bool
transferWithFeeRef 0x5932a78e
address recipient
uint256 amount
uint256 ref
returns: bool
transferWithRef 0x37ea010a
address recipient
uint256 amount
uint256 ref
returns: bool
updateChildChainManager 0x445a6797
address _childChainManagerProxy
upgradeTrustedForwarder 0xaa2a7eea
address _newTrustedForwarder
withdraw 0x2e1a7d4d
uint256 amount
Recent Transactions
No transactions found for this address