diff --git a/app/app.go b/app/app.go index 88b0ebe..f4637f0 100644 --- a/app/app.go +++ b/app/app.go @@ -705,6 +705,7 @@ func NewMinitiaApp( appCodec, runtime.NewKVStoreService(keys[evmtypes.StoreKey]), accountKeeper, + bankKeeper, communityPoolKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), diff --git a/app/ibc-hooks/common_test.go b/app/ibc-hooks/common_test.go index 758bbe4..85a5808 100644 --- a/app/ibc-hooks/common_test.go +++ b/app/ibc-hooks/common_test.go @@ -302,6 +302,7 @@ func _createTestInput( appCodec, runtime.NewKVStoreService(keys[evmtypes.StoreKey]), accountKeeper, + bankKeeper, communityPoolKeeper, msgRouter, queryRouter, diff --git a/x/bank/keeper/common_test.go b/x/bank/keeper/common_test.go index aa19db5..99e3d9c 100644 --- a/x/bank/keeper/common_test.go +++ b/x/bank/keeper/common_test.go @@ -294,6 +294,7 @@ func _createTestInput( appCodec, runtime.NewKVStoreService(keys[evmtypes.StoreKey]), accountKeeper, + bankKeeper, communityPoolKeeper, msgRouter, queryRouter, diff --git a/x/evm/contracts/counter/Counter.go b/x/evm/contracts/counter/Counter.go index 9fc30f2..8d202ba 100644 --- a/x/evm/contracts/counter/Counter.go +++ b/x/evm/contracts/counter/Counter.go @@ -32,7 +32,7 @@ var ( // CounterMetaData contains all meta data concerning the Counter contract. var CounterMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldCount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newCount\",\"type\":\"uint256\"}],\"name\":\"increased\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"callback_id\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"name\":\"ibc_ack\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"callback_id\",\"type\":\"uint64\"}],\"name\":\"ibc_timeout\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"increase\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"path\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"req\",\"type\":\"string\"}],\"name\":\"query_cosmos\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"result\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040526107ef806100115f395ff3fe608060405260043610610049575f3560e01c806306661abd1461004d5780630d4f1f9d1461007757806331a503f01461009f578063cad23554146100c7578063e8927fbc14610103575b5f80fd5b348015610058575f80fd5b5061006161010d565b60405161006e919061027d565b60405180910390f35b348015610082575f80fd5b5061009d60048036038101906100989190610319565b610112565b005b3480156100aa575f80fd5b506100c560048036038101906100c09190610357565b610159565b005b3480156100d2575f80fd5b506100ed60048036038101906100e891906104be565b61017d565b6040516100fa91906105ae565b60405180910390f35b61010b610206565b005b5f5481565b801561013e578167ffffffffffffffff165f8082825461013291906105fb565b92505081905550610155565b5f8081548092919061014f9061062e565b91905055505b5050565b8067ffffffffffffffff165f8082825461017391906105fb565b9250508190555050565b606060f173ffffffffffffffffffffffffffffffffffffffff1663cad2355484846040518363ffffffff1660e01b81526004016101bb929190610675565b5f604051808303815f875af11580156101d6573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906101fe9190610718565b905092915050565b5f808154809291906102179061062e565b91905055507f61996fe196f72cb598c483e896a1221263a28bb630480aa89495f737d4a8e3df60015f5461024b919061075f565b5f5460405161025b929190610792565b60405180910390a1565b5f819050919050565b61027781610265565b82525050565b5f6020820190506102905f83018461026e565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f67ffffffffffffffff82169050919050565b6102c3816102a7565b81146102cd575f80fd5b50565b5f813590506102de816102ba565b92915050565b5f8115159050919050565b6102f8816102e4565b8114610302575f80fd5b50565b5f81359050610313816102ef565b92915050565b5f806040838503121561032f5761032e61029f565b5b5f61033c858286016102d0565b925050602061034d85828601610305565b9150509250929050565b5f6020828403121561036c5761036b61029f565b5b5f610379848285016102d0565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103d08261038a565b810181811067ffffffffffffffff821117156103ef576103ee61039a565b5b80604052505050565b5f610401610296565b905061040d82826103c7565b919050565b5f67ffffffffffffffff82111561042c5761042b61039a565b5b6104358261038a565b9050602081019050919050565b828183375f83830152505050565b5f61046261045d84610412565b6103f8565b90508281526020810184848401111561047e5761047d610386565b5b610489848285610442565b509392505050565b5f82601f8301126104a5576104a4610382565b5b81356104b5848260208601610450565b91505092915050565b5f80604083850312156104d4576104d361029f565b5b5f83013567ffffffffffffffff8111156104f1576104f06102a3565b5b6104fd85828601610491565b925050602083013567ffffffffffffffff81111561051e5761051d6102a3565b5b61052a85828601610491565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561056b578082015181840152602081019050610550565b5f8484015250505050565b5f61058082610534565b61058a818561053e565b935061059a81856020860161054e565b6105a38161038a565b840191505092915050565b5f6020820190508181035f8301526105c68184610576565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61060582610265565b915061061083610265565b9250828201905080821115610628576106276105ce565b5b92915050565b5f61063882610265565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361066a576106696105ce565b5b600182019050919050565b5f6040820190508181035f83015261068d8185610576565b905081810360208301526106a18184610576565b90509392505050565b5f6106bc6106b784610412565b6103f8565b9050828152602081018484840111156106d8576106d7610386565b5b6106e384828561054e565b509392505050565b5f82601f8301126106ff576106fe610382565b5b815161070f8482602086016106aa565b91505092915050565b5f6020828403121561072d5761072c61029f565b5b5f82015167ffffffffffffffff81111561074a576107496102a3565b5b610756848285016106eb565b91505092915050565b5f61076982610265565b915061077483610265565b925082820390508181111561078c5761078b6105ce565b5b92915050565b5f6040820190506107a55f83018561026e565b6107b2602083018461026e565b939250505056fea2646970667358221220430ddfd244f3b0cac1ffcd58548c7a45cf36c9755c8a73b361424d043147130e64736f6c63430008180033", + Bin: "0x60806040526107ef806100115f395ff3fe608060405260043610610049575f3560e01c806306661abd1461004d5780630d4f1f9d1461007757806331a503f01461009f578063cad23554146100c7578063e8927fbc14610103575b5f80fd5b348015610058575f80fd5b5061006161010d565b60405161006e919061027d565b60405180910390f35b348015610082575f80fd5b5061009d60048036038101906100989190610319565b610112565b005b3480156100aa575f80fd5b506100c560048036038101906100c09190610357565b610159565b005b3480156100d2575f80fd5b506100ed60048036038101906100e891906104be565b61017d565b6040516100fa91906105ae565b60405180910390f35b61010b610206565b005b5f5481565b801561013e578167ffffffffffffffff165f8082825461013291906105fb565b92505081905550610155565b5f8081548092919061014f9061062e565b91905055505b5050565b8067ffffffffffffffff165f8082825461017391906105fb565b9250508190555050565b606060f173ffffffffffffffffffffffffffffffffffffffff1663cad2355484846040518363ffffffff1660e01b81526004016101bb929190610675565b5f604051808303815f875af11580156101d6573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906101fe9190610718565b905092915050565b5f808154809291906102179061062e565b91905055507f61996fe196f72cb598c483e896a1221263a28bb630480aa89495f737d4a8e3df60015f5461024b919061075f565b5f5460405161025b929190610792565b60405180910390a1565b5f819050919050565b61027781610265565b82525050565b5f6020820190506102905f83018461026e565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f67ffffffffffffffff82169050919050565b6102c3816102a7565b81146102cd575f80fd5b50565b5f813590506102de816102ba565b92915050565b5f8115159050919050565b6102f8816102e4565b8114610302575f80fd5b50565b5f81359050610313816102ef565b92915050565b5f806040838503121561032f5761032e61029f565b5b5f61033c858286016102d0565b925050602061034d85828601610305565b9150509250929050565b5f6020828403121561036c5761036b61029f565b5b5f610379848285016102d0565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103d08261038a565b810181811067ffffffffffffffff821117156103ef576103ee61039a565b5b80604052505050565b5f610401610296565b905061040d82826103c7565b919050565b5f67ffffffffffffffff82111561042c5761042b61039a565b5b6104358261038a565b9050602081019050919050565b828183375f83830152505050565b5f61046261045d84610412565b6103f8565b90508281526020810184848401111561047e5761047d610386565b5b610489848285610442565b509392505050565b5f82601f8301126104a5576104a4610382565b5b81356104b5848260208601610450565b91505092915050565b5f80604083850312156104d4576104d361029f565b5b5f83013567ffffffffffffffff8111156104f1576104f06102a3565b5b6104fd85828601610491565b925050602083013567ffffffffffffffff81111561051e5761051d6102a3565b5b61052a85828601610491565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561056b578082015181840152602081019050610550565b5f8484015250505050565b5f61058082610534565b61058a818561053e565b935061059a81856020860161054e565b6105a38161038a565b840191505092915050565b5f6020820190508181035f8301526105c68184610576565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61060582610265565b915061061083610265565b9250828201905080821115610628576106276105ce565b5b92915050565b5f61063882610265565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361066a576106696105ce565b5b600182019050919050565b5f6040820190508181035f83015261068d8185610576565b905081810360208301526106a18184610576565b90509392505050565b5f6106bc6106b784610412565b6103f8565b9050828152602081018484840111156106d8576106d7610386565b5b6106e384828561054e565b509392505050565b5f82601f8301126106ff576106fe610382565b5b815161070f8482602086016106aa565b91505092915050565b5f6020828403121561072d5761072c61029f565b5b5f82015167ffffffffffffffff81111561074a576107496102a3565b5b610756848285016106eb565b91505092915050565b5f61076982610265565b915061077483610265565b925082820390508181111561078c5761078b6105ce565b5b92915050565b5f6040820190506107a55f83018561026e565b6107b2602083018461026e565b939250505056fea264697066735822122081bf0b643251cf23de1a3c843371e64452b6e0d66cbf945d915ecc9b168d1b3a64736f6c63430008180033", } // CounterABI is the input ABI used to generate the binding from. diff --git a/x/evm/contracts/custom_erc20/CustomERC20.go b/x/evm/contracts/custom_erc20/CustomERC20.go index 63c074e..7d476fd 100644 --- a/x/evm/contracts/custom_erc20/CustomERC20.go +++ b/x/evm/contracts/custom_erc20/CustomERC20.go @@ -31,8 +31,8 @@ var ( // CustomErc20MetaData contains all meta data concerning the CustomErc20 contract. var CustomErc20MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"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\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"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\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801562000010575f80fd5b5060405162001bae38038062001bae8339818101604052810190620000369190620002ef565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060f273ffffffffffffffffffffffffffffffffffffffff16635e6c57596040518163ffffffff1660e01b81526004016020604051808303815f875af1158015620000c1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000e79190620003c0565b508260039081620000f9919062000627565b5081600490816200010b919062000627565b508060055f6101000a81548160ff021916908360ff1602179055505050506200070b565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620001908262000148565b810181811067ffffffffffffffff82111715620001b257620001b162000158565b5b80604052505050565b5f620001c66200012f565b9050620001d4828262000185565b919050565b5f67ffffffffffffffff821115620001f657620001f562000158565b5b620002018262000148565b9050602081019050919050565b5f5b838110156200022d57808201518184015260208101905062000210565b5f8484015250505050565b5f6200024e6200024884620001d9565b620001bb565b9050828152602081018484840111156200026d576200026c62000144565b5b6200027a8482856200020e565b509392505050565b5f82601f83011262000299576200029862000140565b5b8151620002ab84826020860162000238565b91505092915050565b5f60ff82169050919050565b620002cb81620002b4565b8114620002d6575f80fd5b50565b5f81519050620002e981620002c0565b92915050565b5f805f6060848603121562000309576200030862000138565b5b5f84015167ffffffffffffffff8111156200032957620003286200013c565b5b620003378682870162000282565b935050602084015167ffffffffffffffff8111156200035b576200035a6200013c565b5b620003698682870162000282565b92505060406200037c86828701620002d9565b9150509250925092565b5f8115159050919050565b6200039c8162000386565b8114620003a7575f80fd5b50565b5f81519050620003ba8162000391565b92915050565b5f60208284031215620003d857620003d762000138565b5b5f620003e784828501620003aa565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200043f57607f821691505b602082108103620004555762000454620003fa565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620004b97fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200047c565b620004c586836200047c565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6200050f620005096200050384620004dd565b620004e6565b620004dd565b9050919050565b5f819050919050565b6200052a83620004ef565b62000542620005398262000516565b84845462000488565b825550505050565b5f90565b620005586200054a565b620005658184846200051f565b505050565b5b818110156200058c57620005805f826200054e565b6001810190506200056b565b5050565b601f821115620005db57620005a5816200045b565b620005b0846200046d565b81016020851015620005c0578190505b620005d8620005cf856200046d565b8301826200056a565b50505b505050565b5f82821c905092915050565b5f620005fd5f1984600802620005e0565b1980831691505092915050565b5f620006178383620005ec565b9150826002028217905092915050565b6200063282620003f0565b67ffffffffffffffff8111156200064e576200064d62000158565b5b6200065a825462000427565b6200066782828562000590565b5f60209050601f8311600181146200069d575f841562000688578287015190505b6200069485826200060a565b86555062000703565b601f198416620006ad866200045b565b5f5b82811015620006d657848901518255600182019150602085019450602081019050620006af565b86831015620006f65784890151620006f2601f891682620005ec565b8355505b6001600288020188555050505b505050505050565b61149580620007195f395ff3fe608060405234801561000f575f80fd5b50600436106100e8575f3560e01c806370a082311161008a5780639dc29fac116100645780639dc29fac1461025e578063a9059cbb1461027a578063dd62ed3e146102aa578063f2fde38b146102da576100e8565b806370a08231146101f25780638da5cb5b1461022257806395d89b4114610240576100e8565b806318160ddd116100c657806318160ddd1461016a57806323b872dd14610188578063313ce567146101b857806340c10f19146101d6576100e8565b806301ffc9a7146100ec57806306fdde031461011c578063095ea7b31461013a575b5f80fd5b6101066004803603810190610101919061100a565b6102f6565b604051610113919061104f565b60405180910390f35b61012461036f565b60405161013191906110f2565b60405180910390f35b610154600480360381019061014f919061119f565b6103fb565b604051610161919061104f565b60405180910390f35b6101726104e8565b60405161017f91906111ec565b60405180910390f35b6101a2600480360381019061019d9190611205565b6104ee565b6040516101af919061104f565b60405180910390f35b6101c061078e565b6040516101cd9190611270565b60405180910390f35b6101f060048036038101906101eb919061119f565b6107a0565b005b61020c60048036038101906102079190611289565b610804565b60405161021991906111ec565b60405180910390f35b61022a610819565b60405161023791906112c3565b60405180910390f35b61024861083c565b60405161025591906110f2565b60405180910390f35b6102786004803603810190610273919061119f565b6108c8565b005b610294600480360381019061028f919061119f565b61092c565b6040516102a1919061104f565b60405180910390f35b6102c460048036038101906102bf91906112dc565b610b3d565b6040516102d191906111ec565b60405180910390f35b6102f460048036038101906102ef9190611289565b610b5d565b005b5f7f942e8b22000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610368575061036782610ca5565b5b9050919050565b6003805461037c90611347565b80601f01602080910402602001604051908101604052809291908181526020018280546103a890611347565b80156103f35780601f106103ca576101008083540402835291602001916103f3565b820191905f5260205f20905b8154815290600101906020018083116103d657829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104d691906111ec565b60405180910390a36001905092915050565b60065481565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161052a91906112c3565b602060405180830381865afa158015610545573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061056991906113a1565b6105e95760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016105a791906112c3565b6020604051808303815f875af11580156105c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e791906113a1565b505b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461067091906113f9565b925050819055508260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106c391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610716919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161077a91906111ec565b60405180910390a360019150509392505050565b60055f9054906101000a900460ff1681565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107f6575f80fd5b6108008282610d0e565b5050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461084990611347565b80601f016020809104026020016040519081016040528092919081815260200182805461087590611347565b80156108c05780601f10610897576101008083540402835291602001916108c0565b820191905f5260205f20905b8154815290600101906020018083116108a357829003601f168201915b505050505081565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461091e575f80fd5b6109288282610edd565b5050565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161096891906112c3565b602060405180830381865afa158015610983573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a791906113a1565b610a275760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016109e591906112c3565b6020604051808303815f875af1158015610a01573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2591906113a1565b505b8260015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a7391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610ac6919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610b2a91906111ec565b60405180910390a3600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bb3575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bea575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610d4991906112c3565b602060405180830381865afa158015610d64573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8891906113a1565b610e085760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610dc691906112c3565b6020604051808303815f875af1158015610de2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0691906113a1565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610e54919061142c565b925050819055508160065f828254610e6c919061142c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ed091906111ec565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f2991906113f9565b925050819055508060065f828254610f4191906113f9565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610fa591906111ec565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fe981610fb5565b8114610ff3575f80fd5b50565b5f8135905061100481610fe0565b92915050565b5f6020828403121561101f5761101e610fb1565b5b5f61102c84828501610ff6565b91505092915050565b5f8115159050919050565b61104981611035565b82525050565b5f6020820190506110625f830184611040565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561109f578082015181840152602081019050611084565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6110c482611068565b6110ce8185611072565b93506110de818560208601611082565b6110e7816110aa565b840191505092915050565b5f6020820190508181035f83015261110a81846110ba565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61113b82611112565b9050919050565b61114b81611131565b8114611155575f80fd5b50565b5f8135905061116681611142565b92915050565b5f819050919050565b61117e8161116c565b8114611188575f80fd5b50565b5f8135905061119981611175565b92915050565b5f80604083850312156111b5576111b4610fb1565b5b5f6111c285828601611158565b92505060206111d38582860161118b565b9150509250929050565b6111e68161116c565b82525050565b5f6020820190506111ff5f8301846111dd565b92915050565b5f805f6060848603121561121c5761121b610fb1565b5b5f61122986828701611158565b935050602061123a86828701611158565b925050604061124b8682870161118b565b9150509250925092565b5f60ff82169050919050565b61126a81611255565b82525050565b5f6020820190506112835f830184611261565b92915050565b5f6020828403121561129e5761129d610fb1565b5b5f6112ab84828501611158565b91505092915050565b6112bd81611131565b82525050565b5f6020820190506112d65f8301846112b4565b92915050565b5f80604083850312156112f2576112f1610fb1565b5b5f6112ff85828601611158565b925050602061131085828601611158565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061135e57607f821691505b6020821081036113715761137061131a565b5b50919050565b61138081611035565b811461138a575f80fd5b50565b5f8151905061139b81611377565b92915050565b5f602082840312156113b6576113b5610fb1565b5b5f6113c38482850161138d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6114038261116c565b915061140e8361116c565b9250828203905081811115611426576114256113cc565b5b92915050565b5f6114368261116c565b91506114418361116c565b9250828201905080821115611459576114586113cc565b5b9291505056fea2646970667358221220b4dd1d8802dffa0485bc89cd679dc48dda5cbc64073a4cd2bcc4ac0dc6cf8c8f64736f6c63430008180033", + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"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\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"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\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sudoTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"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\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801562000010575f80fd5b5060405162001f1b38038062001f1b8339818101604052810190620000369190620002ef565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060f273ffffffffffffffffffffffffffffffffffffffff16635e6c57596040518163ffffffff1660e01b81526004016020604051808303815f875af1158015620000c1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000e79190620003c0565b508260039081620000f9919062000627565b5081600490816200010b919062000627565b508060055f6101000a81548160ff021916908360ff1602179055505050506200070b565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620001908262000148565b810181811067ffffffffffffffff82111715620001b257620001b162000158565b5b80604052505050565b5f620001c66200012f565b9050620001d4828262000185565b919050565b5f67ffffffffffffffff821115620001f657620001f562000158565b5b620002018262000148565b9050602081019050919050565b5f5b838110156200022d57808201518184015260208101905062000210565b5f8484015250505050565b5f6200024e6200024884620001d9565b620001bb565b9050828152602081018484840111156200026d576200026c62000144565b5b6200027a8482856200020e565b509392505050565b5f82601f83011262000299576200029862000140565b5b8151620002ab84826020860162000238565b91505092915050565b5f60ff82169050919050565b620002cb81620002b4565b8114620002d6575f80fd5b50565b5f81519050620002e981620002c0565b92915050565b5f805f6060848603121562000309576200030862000138565b5b5f84015167ffffffffffffffff8111156200032957620003286200013c565b5b620003378682870162000282565b935050602084015167ffffffffffffffff8111156200035b576200035a6200013c565b5b620003698682870162000282565b92505060406200037c86828701620002d9565b9150509250925092565b5f8115159050919050565b6200039c8162000386565b8114620003a7575f80fd5b50565b5f81519050620003ba8162000391565b92915050565b5f60208284031215620003d857620003d762000138565b5b5f620003e784828501620003aa565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200043f57607f821691505b602082108103620004555762000454620003fa565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620004b97fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200047c565b620004c586836200047c565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6200050f620005096200050384620004dd565b620004e6565b620004dd565b9050919050565b5f819050919050565b6200052a83620004ef565b62000542620005398262000516565b84845462000488565b825550505050565b5f90565b620005586200054a565b620005658184846200051f565b505050565b5b818110156200058c57620005805f826200054e565b6001810190506200056b565b5050565b601f821115620005db57620005a5816200045b565b620005b0846200046d565b81016020851015620005c0578190505b620005d8620005cf856200046d565b8301826200056a565b50505b505050565b5f82821c905092915050565b5f620005fd5f1984600802620005e0565b1980831691505092915050565b5f620006178383620005ec565b9150826002028217905092915050565b6200063282620003f0565b67ffffffffffffffff8111156200064e576200064d62000158565b5b6200065a825462000427565b6200066782828562000590565b5f60209050601f8311600181146200069d575f841562000688578287015190505b6200069485826200060a565b86555062000703565b601f198416620006ad866200045b565b5f5b82811015620006d657848901518255600182019150602085019450602081019050620006af565b86831015620006f65784890151620006f2601f891682620005ec565b8355505b6001600288020188555050505b505050505050565b61180280620007195f395ff3fe608060405234801561000f575f80fd5b50600436106100f3575f3560e01c806340c10f19116100955780639dc29fac116100645780639dc29fac14610285578063a9059cbb146102a1578063dd62ed3e146102d1578063f2fde38b14610301576100f3565b806340c10f19146101fd57806370a08231146102195780638da5cb5b1461024957806395d89b4114610267576100f3565b806318160ddd116100d157806318160ddd146101755780631988513b1461019357806323b872dd146101af578063313ce567146101df576100f3565b806301ffc9a7146100f757806306fdde0314610127578063095ea7b314610145575b5f80fd5b610111600480360381019061010c91906111b1565b61031d565b60405161011e91906111f6565b60405180910390f35b61012f610396565b60405161013c9190611299565b60405180910390f35b61015f600480360381019061015a9190611346565b610422565b60405161016c91906111f6565b60405180910390f35b61017d61050f565b60405161018a9190611393565b60405180910390f35b6101ad60048036038101906101a891906113ac565b610515565b005b6101c960048036038101906101c491906113ac565b610594565b6040516101d691906111f6565b60405180910390f35b6101e76106f4565b6040516101f49190611417565b60405180910390f35b61021760048036038101906102129190611346565b610706565b005b610233600480360381019061022e9190611430565b610825565b6040516102409190611393565b60405180910390f35b61025161083a565b60405161025e919061146a565b60405180910390f35b61026f61085d565b60405161027c9190611299565b60405180910390f35b61029f600480360381019061029a9190611346565b6108e9565b005b6102bb60048036038101906102b69190611346565b610a08565b6040516102c891906111f6565b60405180910390f35b6102eb60048036038101906102e69190611483565b610ad9565b6040516102f89190611393565b60405180910390f35b61031b60048036038101906103169190611430565b610af9565b005b5f7f8da6da19000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061038f575061038e82610c41565b5b9050919050565b600380546103a3906114ee565b80601f01602080910402602001604051908101604052809291908181526020018280546103cf906114ee565b801561041a5780601f106103f15761010080835404028352916020019161041a565b820191905f5260205f20905b8154815290600101906020018083116103fd57829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104fd9190611393565b60405180910390a36001905092915050565b60065481565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057b90611568565b60405180910390fd5b61058f838383610caa565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b81526004016105d0919061146a565b602060405180830381865afa1580156105eb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061060f91906115b0565b1561064f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106469061164b565b60405180910390fd5b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106d69190611696565b925050819055506106e8858585610caa565b60019150509392505050565b60055f9054906101000a900460ff1681565b8160f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b8152600401610741919061146a565b602060405180830381865afa15801561075c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061078091906115b0565b156107c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b790611713565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610816575f80fd5b6108208383610eb5565b505050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461086a906114ee565b80601f0160208091040260200160405190810160405280929190818152602001828054610896906114ee565b80156108e15780601f106108b8576101008083540402835291602001916108e1565b820191905f5260205f20905b8154815290600101906020018083116108c457829003601f168201915b505050505081565b8160f173ffffffffffffffffffffffffffffffffffffffff166360dc402f826040518263ffffffff1660e01b8152600401610924919061146a565b602060405180830381865afa15801561093f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061096391906115b0565b156109a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099a9061177b565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109f9575f80fd5b610a038383611084565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b8152600401610a44919061146a565b602060405180830381865afa158015610a5f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a8391906115b0565b15610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba9061164b565b60405180910390fd5b610ace338585610caa565b600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b4f575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610b86575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610ce5919061146a565b602060405180830381865afa158015610d00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d2491906115b0565b610da45760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610d62919061146a565b6020604051808303815f875af1158015610d7e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610da291906115b0565b505b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610df09190611696565b925050819055508160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610e439190611799565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ea79190611393565b60405180910390a350505050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610ef0919061146a565b602060405180830381865afa158015610f0b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f2f91906115b0565b610faf5760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610f6d919061146a565b6020604051808303815f875af1158015610f89573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fad91906115b0565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610ffb9190611799565b925050819055508160065f8282546110139190611799565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110779190611393565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546110d09190611696565b925050819055508060065f8282546110e89190611696565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161114c9190611393565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6111908161115c565b811461119a575f80fd5b50565b5f813590506111ab81611187565b92915050565b5f602082840312156111c6576111c5611158565b5b5f6111d38482850161119d565b91505092915050565b5f8115159050919050565b6111f0816111dc565b82525050565b5f6020820190506112095f8301846111e7565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561124657808201518184015260208101905061122b565b5f8484015250505050565b5f601f19601f8301169050919050565b5f61126b8261120f565b6112758185611219565b9350611285818560208601611229565b61128e81611251565b840191505092915050565b5f6020820190508181035f8301526112b18184611261565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112e2826112b9565b9050919050565b6112f2816112d8565b81146112fc575f80fd5b50565b5f8135905061130d816112e9565b92915050565b5f819050919050565b61132581611313565b811461132f575f80fd5b50565b5f813590506113408161131c565b92915050565b5f806040838503121561135c5761135b611158565b5b5f611369858286016112ff565b925050602061137a85828601611332565b9150509250929050565b61138d81611313565b82525050565b5f6020820190506113a65f830184611384565b92915050565b5f805f606084860312156113c3576113c2611158565b5b5f6113d0868287016112ff565b93505060206113e1868287016112ff565b92505060406113f286828701611332565b9150509250925092565b5f60ff82169050919050565b611411816113fc565b82525050565b5f60208201905061142a5f830184611408565b92915050565b5f6020828403121561144557611444611158565b5b5f611452848285016112ff565b91505092915050565b611464816112d8565b82525050565b5f60208201905061147d5f83018461145b565b92915050565b5f806040838503121561149957611498611158565b5b5f6114a6858286016112ff565b92505060206114b7858286016112ff565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061150557607f821691505b602082108103611518576115176114c1565b5b50919050565b7f45524332303a2063616c6c6572206973206e6f742074686520636861696e00005f82015250565b5f611552601e83611219565b915061155d8261151e565b602082019050919050565b5f6020820190508181035f83015261157f81611546565b9050919050565b61158f816111dc565b8114611599575f80fd5b50565b5f815190506115aa81611586565b92915050565b5f602082840312156115c5576115c4611158565b5b5f6115d28482850161159c565b91505092915050565b7f45524332303a207472616e7366657220746f20626c6f636b65642061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f611635602283611219565b9150611640826115db565b604082019050919050565b5f6020820190508181035f83015261166281611629565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6116a082611313565b91506116ab83611313565b92508282039050818111156116c3576116c2611669565b5b92915050565b7f45524332303a206d696e7420746f20626c6f636b6564206164647265737300005f82015250565b5f6116fd601e83611219565b9150611708826116c9565b602082019050919050565b5f6020820190508181035f83015261172a816116f1565b9050919050565b7f45524332303a206275726e2066726f6d206d6f64756c652061646472657373005f82015250565b5f611765601f83611219565b915061177082611731565b602082019050919050565b5f6020820190508181035f83015261179281611759565b9050919050565b5f6117a382611313565b91506117ae83611313565b92508282019050808211156117c6576117c5611669565b5b9291505056fea26469706673582212207cb456b1f272c3058457ae14b90cc057df7f6b452a44e5fce79e903c67692df164736f6c63430008180033", } // CustomErc20ABI is the input ABI used to generate the binding from. @@ -513,6 +513,27 @@ func (_CustomErc20 *CustomErc20TransactorSession) Mint(to common.Address, amount return _CustomErc20.Contract.Mint(&_CustomErc20.TransactOpts, to, amount) } +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_CustomErc20 *CustomErc20Transactor) SudoTransfer(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _CustomErc20.contract.Transact(opts, "sudoTransfer", sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_CustomErc20 *CustomErc20Session) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _CustomErc20.Contract.SudoTransfer(&_CustomErc20.TransactOpts, sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_CustomErc20 *CustomErc20TransactorSession) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _CustomErc20.Contract.SudoTransfer(&_CustomErc20.TransactOpts, sender, recipient, amount) +} + // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) diff --git a/x/evm/contracts/custom_erc20/CustomERC20.sol b/x/evm/contracts/custom_erc20/CustomERC20.sol index c955413..4baa995 100644 --- a/x/evm/contracts/custom_erc20/CustomERC20.sol +++ b/x/evm/contracts/custom_erc20/CustomERC20.sol @@ -4,9 +4,10 @@ pragma solidity ^0.8.24; import "../i_erc20/IERC20.sol"; import "../ownable/Ownable.sol"; import "../erc20_registry/ERC20Registry.sol"; +import "../erc20_acl/ERC20ACL.sol"; import {ERC165, IERC165} from "../erc165/ERC165.sol"; -contract CustomERC20 is IERC20, Ownable, ERC20Registry, ERC165 { +contract CustomERC20 is IERC20, Ownable, ERC20Registry, ERC165, ERC20ACL { event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, @@ -42,32 +43,14 @@ contract CustomERC20 is IERC20, Ownable, ERC20Registry, ERC165 { decimals = _decimals; } - function transfer( - address recipient, - uint256 amount - ) external register_erc20_store(recipient) returns (bool) { - balanceOf[msg.sender] -= amount; - balanceOf[recipient] += amount; - emit Transfer(msg.sender, recipient, amount); - return true; - } - - function approve(address spender, uint256 amount) external returns (bool) { - allowance[msg.sender][spender] = amount; - emit Approval(msg.sender, spender, amount); - return true; - } - - function transferFrom( + function _transfer( address sender, address recipient, uint256 amount - ) external register_erc20_store(recipient) returns (bool) { - allowance[sender][msg.sender] -= amount; + ) internal register_erc20_store(recipient) { balanceOf[sender] -= amount; balanceOf[recipient] += amount; emit Transfer(sender, recipient, amount); - return true; } function _mint( @@ -85,11 +68,46 @@ contract CustomERC20 is IERC20, Ownable, ERC20Registry, ERC165 { emit Transfer(from, address(0), amount); } - function mint(address to, uint256 amount) external onlyOwner { + function transfer( + address recipient, + uint256 amount + ) external transferable(recipient) returns (bool) { + _transfer(msg.sender, recipient, amount); + return true; + } + + function approve(address spender, uint256 amount) external returns (bool) { + allowance[msg.sender][spender] = amount; + emit Approval(msg.sender, spender, amount); + return true; + } + + function transferFrom( + address sender, + address recipient, + uint256 amount + ) external transferable(recipient) returns (bool) { + allowance[sender][msg.sender] -= amount; + _transfer(sender, recipient, amount); + return true; + } + + function mint(address to, uint256 amount) external mintable(to) onlyOwner { _mint(to, amount); } - function burn(address from, uint256 amount) external onlyOwner { + function burn( + address from, + uint256 amount + ) external burnable(from) onlyOwner { _burn(from, amount); } + + function sudoTransfer( + address sender, + address recipient, + uint256 amount + ) external onlyChain { + _transfer(sender, recipient, amount); + } } diff --git a/x/evm/contracts/erc20/ERC20.go b/x/evm/contracts/erc20/ERC20.go index 6ef3b2c..06f5b90 100644 --- a/x/evm/contracts/erc20/ERC20.go +++ b/x/evm/contracts/erc20/ERC20.go @@ -31,8 +31,8 @@ var ( // Erc20MetaData contains all meta data concerning the Erc20 contract. var Erc20MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"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\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"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\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801562000010575f80fd5b5060405162001ad138038062001ad183398181016040528101906200003691906200027c565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600390816200008691906200054a565b5081600490816200009891906200054a565b508060055f6101000a81548160ff021916908360ff1602179055505050506200062e565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6200011d82620000d5565b810181811067ffffffffffffffff821117156200013f576200013e620000e5565b5b80604052505050565b5f62000153620000bc565b905062000161828262000112565b919050565b5f67ffffffffffffffff821115620001835762000182620000e5565b5b6200018e82620000d5565b9050602081019050919050565b5f5b83811015620001ba5780820151818401526020810190506200019d565b5f8484015250505050565b5f620001db620001d58462000166565b62000148565b905082815260208101848484011115620001fa57620001f9620000d1565b5b620002078482856200019b565b509392505050565b5f82601f830112620002265762000225620000cd565b5b815162000238848260208601620001c5565b91505092915050565b5f60ff82169050919050565b620002588162000241565b811462000263575f80fd5b50565b5f8151905062000276816200024d565b92915050565b5f805f60608486031215620002965762000295620000c5565b5b5f84015167ffffffffffffffff811115620002b657620002b5620000c9565b5b620002c4868287016200020f565b935050602084015167ffffffffffffffff811115620002e857620002e7620000c9565b5b620002f6868287016200020f565b9250506040620003098682870162000266565b9150509250925092565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200036257607f821691505b6020821081036200037857620003776200031d565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003dc7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200039f565b620003e886836200039f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620004326200042c620004268462000400565b62000409565b62000400565b9050919050565b5f819050919050565b6200044d8362000412565b620004656200045c8262000439565b848454620003ab565b825550505050565b5f90565b6200047b6200046d565b6200048881848462000442565b505050565b5b81811015620004af57620004a35f8262000471565b6001810190506200048e565b5050565b601f821115620004fe57620004c8816200037e565b620004d38462000390565b81016020851015620004e3578190505b620004fb620004f28562000390565b8301826200048d565b50505b505050565b5f82821c905092915050565b5f620005205f198460080262000503565b1980831691505092915050565b5f6200053a83836200050f565b9150826002028217905092915050565b620005558262000313565b67ffffffffffffffff811115620005715762000570620000e5565b5b6200057d82546200034a565b6200058a828285620004b3565b5f60209050601f831160018114620005c0575f8415620005ab578287015190505b620005b785826200052d565b86555062000626565b601f198416620005d0866200037e565b5f5b82811015620005f957848901518255600182019150602085019450602081019050620005d2565b8683101562000619578489015162000615601f8916826200050f565b8355505b6001600288020188555050505b505050505050565b611495806200063c5f395ff3fe608060405234801561000f575f80fd5b50600436106100e8575f3560e01c806370a082311161008a5780639dc29fac116100645780639dc29fac1461025e578063a9059cbb1461027a578063dd62ed3e146102aa578063f2fde38b146102da576100e8565b806370a08231146101f25780638da5cb5b1461022257806395d89b4114610240576100e8565b806318160ddd116100c657806318160ddd1461016a57806323b872dd14610188578063313ce567146101b857806340c10f19146101d6576100e8565b806301ffc9a7146100ec57806306fdde031461011c578063095ea7b31461013a575b5f80fd5b6101066004803603810190610101919061100a565b6102f6565b604051610113919061104f565b60405180910390f35b61012461036f565b60405161013191906110f2565b60405180910390f35b610154600480360381019061014f919061119f565b6103fb565b604051610161919061104f565b60405180910390f35b6101726104e8565b60405161017f91906111ec565b60405180910390f35b6101a2600480360381019061019d9190611205565b6104ee565b6040516101af919061104f565b60405180910390f35b6101c061078e565b6040516101cd9190611270565b60405180910390f35b6101f060048036038101906101eb919061119f565b6107a0565b005b61020c60048036038101906102079190611289565b610804565b60405161021991906111ec565b60405180910390f35b61022a610819565b60405161023791906112c3565b60405180910390f35b61024861083c565b60405161025591906110f2565b60405180910390f35b6102786004803603810190610273919061119f565b6108c8565b005b610294600480360381019061028f919061119f565b61092c565b6040516102a1919061104f565b60405180910390f35b6102c460048036038101906102bf91906112dc565b610b3d565b6040516102d191906111ec565b60405180910390f35b6102f460048036038101906102ef9190611289565b610b5d565b005b5f7f942e8b22000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610368575061036782610ca5565b5b9050919050565b6003805461037c90611347565b80601f01602080910402602001604051908101604052809291908181526020018280546103a890611347565b80156103f35780601f106103ca576101008083540402835291602001916103f3565b820191905f5260205f20905b8154815290600101906020018083116103d657829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104d691906111ec565b60405180910390a36001905092915050565b60065481565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161052a91906112c3565b602060405180830381865afa158015610545573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061056991906113a1565b6105e95760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016105a791906112c3565b6020604051808303815f875af11580156105c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e791906113a1565b505b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461067091906113f9565b925050819055508260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106c391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610716919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161077a91906111ec565b60405180910390a360019150509392505050565b60055f9054906101000a900460ff1681565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107f6575f80fd5b6108008282610d0e565b5050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461084990611347565b80601f016020809104026020016040519081016040528092919081815260200182805461087590611347565b80156108c05780601f10610897576101008083540402835291602001916108c0565b820191905f5260205f20905b8154815290600101906020018083116108a357829003601f168201915b505050505081565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461091e575f80fd5b6109288282610edd565b5050565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161096891906112c3565b602060405180830381865afa158015610983573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a791906113a1565b610a275760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016109e591906112c3565b6020604051808303815f875af1158015610a01573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2591906113a1565b505b8260015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a7391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610ac6919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610b2a91906111ec565b60405180910390a3600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bb3575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bea575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610d4991906112c3565b602060405180830381865afa158015610d64573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8891906113a1565b610e085760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610dc691906112c3565b6020604051808303815f875af1158015610de2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0691906113a1565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610e54919061142c565b925050819055508160065f828254610e6c919061142c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ed091906111ec565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f2991906113f9565b925050819055508060065f828254610f4191906113f9565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610fa591906111ec565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fe981610fb5565b8114610ff3575f80fd5b50565b5f8135905061100481610fe0565b92915050565b5f6020828403121561101f5761101e610fb1565b5b5f61102c84828501610ff6565b91505092915050565b5f8115159050919050565b61104981611035565b82525050565b5f6020820190506110625f830184611040565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561109f578082015181840152602081019050611084565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6110c482611068565b6110ce8185611072565b93506110de818560208601611082565b6110e7816110aa565b840191505092915050565b5f6020820190508181035f83015261110a81846110ba565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61113b82611112565b9050919050565b61114b81611131565b8114611155575f80fd5b50565b5f8135905061116681611142565b92915050565b5f819050919050565b61117e8161116c565b8114611188575f80fd5b50565b5f8135905061119981611175565b92915050565b5f80604083850312156111b5576111b4610fb1565b5b5f6111c285828601611158565b92505060206111d38582860161118b565b9150509250929050565b6111e68161116c565b82525050565b5f6020820190506111ff5f8301846111dd565b92915050565b5f805f6060848603121561121c5761121b610fb1565b5b5f61122986828701611158565b935050602061123a86828701611158565b925050604061124b8682870161118b565b9150509250925092565b5f60ff82169050919050565b61126a81611255565b82525050565b5f6020820190506112835f830184611261565b92915050565b5f6020828403121561129e5761129d610fb1565b5b5f6112ab84828501611158565b91505092915050565b6112bd81611131565b82525050565b5f6020820190506112d65f8301846112b4565b92915050565b5f80604083850312156112f2576112f1610fb1565b5b5f6112ff85828601611158565b925050602061131085828601611158565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061135e57607f821691505b6020821081036113715761137061131a565b5b50919050565b61138081611035565b811461138a575f80fd5b50565b5f8151905061139b81611377565b92915050565b5f602082840312156113b6576113b5610fb1565b5b5f6113c38482850161138d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6114038261116c565b915061140e8361116c565b9250828203905081811115611426576114256113cc565b5b92915050565b5f6114368261116c565b91506114418361116c565b9250828201905080821115611459576114586113cc565b5b9291505056fea264697066735822122067e09fb1c8f6c6d1f6c87e9baac07eeef8b81a3218e526c7e72f157bf344e58564736f6c63430008180033", + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"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\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"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\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sudoBurn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sudoMint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sudoTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"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\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801562000010575f80fd5b5060405162001f8638038062001f8683398181016040528101906200003691906200027c565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600390816200008691906200054a565b5081600490816200009891906200054a565b508060055f6101000a81548160ff021916908360ff1602179055505050506200062e565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6200011d82620000d5565b810181811067ffffffffffffffff821117156200013f576200013e620000e5565b5b80604052505050565b5f62000153620000bc565b905062000161828262000112565b919050565b5f67ffffffffffffffff821115620001835762000182620000e5565b5b6200018e82620000d5565b9050602081019050919050565b5f5b83811015620001ba5780820151818401526020810190506200019d565b5f8484015250505050565b5f620001db620001d58462000166565b62000148565b905082815260208101848484011115620001fa57620001f9620000d1565b5b620002078482856200019b565b509392505050565b5f82601f830112620002265762000225620000cd565b5b815162000238848260208601620001c5565b91505092915050565b5f60ff82169050919050565b620002588162000241565b811462000263575f80fd5b50565b5f8151905062000276816200024d565b92915050565b5f805f60608486031215620002965762000295620000c5565b5b5f84015167ffffffffffffffff811115620002b657620002b5620000c9565b5b620002c4868287016200020f565b935050602084015167ffffffffffffffff811115620002e857620002e7620000c9565b5b620002f6868287016200020f565b9250506040620003098682870162000266565b9150509250925092565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200036257607f821691505b6020821081036200037857620003776200031d565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003dc7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200039f565b620003e886836200039f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620004326200042c620004268462000400565b62000409565b62000400565b9050919050565b5f819050919050565b6200044d8362000412565b620004656200045c8262000439565b848454620003ab565b825550505050565b5f90565b6200047b6200046d565b6200048881848462000442565b505050565b5b81811015620004af57620004a35f8262000471565b6001810190506200048e565b5050565b601f821115620004fe57620004c8816200037e565b620004d38462000390565b81016020851015620004e3578190505b620004fb620004f28562000390565b8301826200048d565b50505b505050565b5f82821c905092915050565b5f620005205f198460080262000503565b1980831691505092915050565b5f6200053a83836200050f565b9150826002028217905092915050565b620005558262000313565b67ffffffffffffffff811115620005715762000570620000e5565b5b6200057d82546200034a565b6200058a828285620004b3565b5f60209050601f831160018114620005c0575f8415620005ab578287015190505b620005b785826200052d565b86555062000626565b601f198416620005d0866200037e565b5f5b82811015620005f957848901518255600182019150602085019450602081019050620005d2565b8683101562000619578489015162000615601f8916826200050f565b8355505b6001600288020188555050505b505050505050565b61194a806200063c5f395ff3fe608060405234801561000f575f80fd5b5060043610610109575f3560e01c806340c10f19116100a05780639dc29fac1161006f5780639dc29fac146102b7578063a9059cbb146102d3578063dd62ed3e14610303578063f2fde38b14610333578063fe1195ec1461034f57610109565b806340c10f191461022f57806370a082311461024b5780638da5cb5b1461027b57806395d89b411461029957610109565b80631988513b116100dc5780631988513b146101a957806323b872dd146101c55780632d688ca8146101f5578063313ce5671461021157610109565b806301ffc9a71461010d57806306fdde031461013d578063095ea7b31461015b57806318160ddd1461018b575b5f80fd5b610127600480360381019061012291906112f9565b61036b565b604051610134919061133e565b60405180910390f35b6101456103e4565b60405161015291906113e1565b60405180910390f35b6101756004803603810190610170919061148e565b610470565b604051610182919061133e565b60405180910390f35b61019361055d565b6040516101a091906114db565b60405180910390f35b6101c360048036038101906101be91906114f4565b610563565b005b6101df60048036038101906101da91906114f4565b6105e2565b6040516101ec919061133e565b60405180910390f35b61020f600480360381019061020a919061148e565b610742565b005b6102196107bf565b604051610226919061155f565b60405180910390f35b6102496004803603810190610244919061148e565b6107d1565b005b61026560048036038101906102609190611578565b6108f0565b60405161027291906114db565b60405180910390f35b610283610905565b60405161029091906115b2565b60405180910390f35b6102a1610928565b6040516102ae91906113e1565b60405180910390f35b6102d160048036038101906102cc919061148e565b6109b4565b005b6102ed60048036038101906102e8919061148e565b610ad3565b6040516102fa919061133e565b60405180910390f35b61031d600480360381019061031891906115cb565b610ba4565b60405161032a91906114db565b60405180910390f35b61034d60048036038101906103489190611578565b610bc4565b005b6103696004803603810190610364919061148e565b610d0c565b005b5f7f8da6da19000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103dd57506103dc82610d89565b5b9050919050565b600380546103f190611636565b80601f016020809104026020016040519081016040528092919081815260200182805461041d90611636565b80156104685780601f1061043f57610100808354040283529160200191610468565b820191905f5260205f20905b81548152906001019060200180831161044b57829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161054b91906114db565b60405180910390a36001905092915050565b60065481565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c9906116b0565b60405180910390fd5b6105dd838383610df2565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b815260040161061e91906115b2565b602060405180830381865afa158015610639573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061065d91906116f8565b1561069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490611793565b60405180910390fd5b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461072491906117de565b92505081905550610736858585610df2565b60019150509392505050565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a8906116b0565b60405180910390fd5b6107bb8282610ffd565b5050565b60055f9054906101000a900460ff1681565b8160f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b815260040161080c91906115b2565b602060405180830381865afa158015610827573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084b91906116f8565b1561088b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108829061185b565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e1575f80fd5b6108eb8383610ffd565b505050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461093590611636565b80601f016020809104026020016040519081016040528092919081815260200182805461096190611636565b80156109ac5780601f10610983576101008083540402835291602001916109ac565b820191905f5260205f20905b81548152906001019060200180831161098f57829003601f168201915b505050505081565b8160f173ffffffffffffffffffffffffffffffffffffffff166360dc402f826040518263ffffffff1660e01b81526004016109ef91906115b2565b602060405180830381865afa158015610a0a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2e91906116f8565b15610a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a65906118c3565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ac4575f80fd5b610ace83836111cc565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b8152600401610b0f91906115b2565b602060405180830381865afa158015610b2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b4e91906116f8565b15610b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8590611793565b60405180910390fd5b610b99338585610df2565b600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c51575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d72906116b0565b60405180910390fd5b610d8582826111cc565b5050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610e2d91906115b2565b602060405180830381865afa158015610e48573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e6c91906116f8565b610eec5760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610eaa91906115b2565b6020604051808303815f875af1158015610ec6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eea91906116f8565b505b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f3891906117de565b925050819055508160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f8b91906118e1565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610fef91906114db565b60405180910390a350505050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161103891906115b2565b602060405180830381865afa158015611053573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061107791906116f8565b6110f75760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016110b591906115b2565b6020604051808303815f875af11580156110d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110f591906116f8565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461114391906118e1565b925050819055508160065f82825461115b91906118e1565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111bf91906114db565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461121891906117de565b925050819055508060065f82825461123091906117de565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161129491906114db565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6112d8816112a4565b81146112e2575f80fd5b50565b5f813590506112f3816112cf565b92915050565b5f6020828403121561130e5761130d6112a0565b5b5f61131b848285016112e5565b91505092915050565b5f8115159050919050565b61133881611324565b82525050565b5f6020820190506113515f83018461132f565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561138e578082015181840152602081019050611373565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6113b382611357565b6113bd8185611361565b93506113cd818560208601611371565b6113d681611399565b840191505092915050565b5f6020820190508181035f8301526113f981846113a9565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61142a82611401565b9050919050565b61143a81611420565b8114611444575f80fd5b50565b5f8135905061145581611431565b92915050565b5f819050919050565b61146d8161145b565b8114611477575f80fd5b50565b5f8135905061148881611464565b92915050565b5f80604083850312156114a4576114a36112a0565b5b5f6114b185828601611447565b92505060206114c28582860161147a565b9150509250929050565b6114d58161145b565b82525050565b5f6020820190506114ee5f8301846114cc565b92915050565b5f805f6060848603121561150b5761150a6112a0565b5b5f61151886828701611447565b935050602061152986828701611447565b925050604061153a8682870161147a565b9150509250925092565b5f60ff82169050919050565b61155981611544565b82525050565b5f6020820190506115725f830184611550565b92915050565b5f6020828403121561158d5761158c6112a0565b5b5f61159a84828501611447565b91505092915050565b6115ac81611420565b82525050565b5f6020820190506115c55f8301846115a3565b92915050565b5f80604083850312156115e1576115e06112a0565b5b5f6115ee85828601611447565b92505060206115ff85828601611447565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061164d57607f821691505b6020821081036116605761165f611609565b5b50919050565b7f45524332303a2063616c6c6572206973206e6f742074686520636861696e00005f82015250565b5f61169a601e83611361565b91506116a582611666565b602082019050919050565b5f6020820190508181035f8301526116c78161168e565b9050919050565b6116d781611324565b81146116e1575f80fd5b50565b5f815190506116f2816116ce565b92915050565b5f6020828403121561170d5761170c6112a0565b5b5f61171a848285016116e4565b91505092915050565b7f45524332303a207472616e7366657220746f20626c6f636b65642061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f61177d602283611361565b915061178882611723565b604082019050919050565b5f6020820190508181035f8301526117aa81611771565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117e88261145b565b91506117f38361145b565b925082820390508181111561180b5761180a6117b1565b5b92915050565b7f45524332303a206d696e7420746f20626c6f636b6564206164647265737300005f82015250565b5f611845601e83611361565b915061185082611811565b602082019050919050565b5f6020820190508181035f83015261187281611839565b9050919050565b7f45524332303a206275726e2066726f6d206d6f64756c652061646472657373005f82015250565b5f6118ad601f83611361565b91506118b882611879565b602082019050919050565b5f6020820190508181035f8301526118da816118a1565b9050919050565b5f6118eb8261145b565b91506118f68361145b565b925082820190508082111561190e5761190d6117b1565b5b9291505056fea264697066735822122092a15d9b61c6a6de22122c9c81d375bc99e3984e299e75efa4ffe4653b8ae00d64736f6c63430008180033", } // Erc20ABI is the input ABI used to generate the binding from. @@ -513,6 +513,69 @@ func (_Erc20 *Erc20TransactorSession) Mint(to common.Address, amount *big.Int) ( return _Erc20.Contract.Mint(&_Erc20.TransactOpts, to, amount) } +// SudoBurn is a paid mutator transaction binding the contract method 0xfe1195ec. +// +// Solidity: function sudoBurn(address from, uint256 amount) returns() +func (_Erc20 *Erc20Transactor) SudoBurn(opts *bind.TransactOpts, from common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "sudoBurn", from, amount) +} + +// SudoBurn is a paid mutator transaction binding the contract method 0xfe1195ec. +// +// Solidity: function sudoBurn(address from, uint256 amount) returns() +func (_Erc20 *Erc20Session) SudoBurn(from common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoBurn(&_Erc20.TransactOpts, from, amount) +} + +// SudoBurn is a paid mutator transaction binding the contract method 0xfe1195ec. +// +// Solidity: function sudoBurn(address from, uint256 amount) returns() +func (_Erc20 *Erc20TransactorSession) SudoBurn(from common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoBurn(&_Erc20.TransactOpts, from, amount) +} + +// SudoMint is a paid mutator transaction binding the contract method 0x2d688ca8. +// +// Solidity: function sudoMint(address to, uint256 amount) returns() +func (_Erc20 *Erc20Transactor) SudoMint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "sudoMint", to, amount) +} + +// SudoMint is a paid mutator transaction binding the contract method 0x2d688ca8. +// +// Solidity: function sudoMint(address to, uint256 amount) returns() +func (_Erc20 *Erc20Session) SudoMint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoMint(&_Erc20.TransactOpts, to, amount) +} + +// SudoMint is a paid mutator transaction binding the contract method 0x2d688ca8. +// +// Solidity: function sudoMint(address to, uint256 amount) returns() +func (_Erc20 *Erc20TransactorSession) SudoMint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoMint(&_Erc20.TransactOpts, to, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_Erc20 *Erc20Transactor) SudoTransfer(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.contract.Transact(opts, "sudoTransfer", sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_Erc20 *Erc20Session) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoTransfer(&_Erc20.TransactOpts, sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_Erc20 *Erc20TransactorSession) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _Erc20.Contract.SudoTransfer(&_Erc20.TransactOpts, sender, recipient, amount) +} + // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) diff --git a/x/evm/contracts/erc20/ERC20.sol b/x/evm/contracts/erc20/ERC20.sol index 6730a3a..e81c2eb 100644 --- a/x/evm/contracts/erc20/ERC20.sol +++ b/x/evm/contracts/erc20/ERC20.sol @@ -4,9 +4,10 @@ pragma solidity ^0.8.24; import "../i_erc20/IERC20.sol"; import "../ownable/Ownable.sol"; import "../erc20_registry/ERC20Registry.sol"; +import "../erc20_acl/ERC20ACL.sol"; import {ERC165, IERC165} from "../erc165/ERC165.sol"; -contract ERC20 is IERC20, Ownable, ERC20Registry, ERC165 { +contract ERC20 is IERC20, Ownable, ERC20Registry, ERC165, ERC20ACL { event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, @@ -39,13 +40,36 @@ contract ERC20 is IERC20, Ownable, ERC20Registry, ERC165 { decimals = _decimals; } - function transfer( + function _transfer( + address sender, address recipient, uint256 amount - ) external register_erc20_store(recipient) returns (bool) { - balanceOf[msg.sender] -= amount; + ) internal register_erc20_store(recipient) { + balanceOf[sender] -= amount; balanceOf[recipient] += amount; - emit Transfer(msg.sender, recipient, amount); + emit Transfer(sender, recipient, amount); + } + + function _mint( + address to, + uint256 amount + ) internal register_erc20_store(to) { + balanceOf[to] += amount; + totalSupply += amount; + emit Transfer(address(0), to, amount); + } + + function _burn(address from, uint256 amount) internal { + balanceOf[from] -= amount; + totalSupply -= amount; + emit Transfer(from, address(0), amount); + } + + function transfer( + address recipient, + uint256 amount + ) external transferable(recipient) returns (bool) { + _transfer(msg.sender, recipient, amount); return true; } @@ -59,34 +83,36 @@ contract ERC20 is IERC20, Ownable, ERC20Registry, ERC165 { address sender, address recipient, uint256 amount - ) external register_erc20_store(recipient) returns (bool) { + ) external transferable(recipient) returns (bool) { allowance[sender][msg.sender] -= amount; - balanceOf[sender] -= amount; - balanceOf[recipient] += amount; - emit Transfer(sender, recipient, amount); + _transfer(sender, recipient, amount); return true; } - function _mint( - address to, + function mint(address to, uint256 amount) external mintable(to) onlyOwner { + _mint(to, amount); + } + + function burn( + address from, uint256 amount - ) internal register_erc20_store(to) { - balanceOf[to] += amount; - totalSupply += amount; - emit Transfer(address(0), to, amount); + ) external burnable(from) onlyOwner { + _burn(from, amount); } - function _burn(address from, uint256 amount) internal { - balanceOf[from] -= amount; - totalSupply -= amount; - emit Transfer(from, address(0), amount); + function sudoTransfer( + address sender, + address recipient, + uint256 amount + ) external onlyChain { + _transfer(sender, recipient, amount); } - function mint(address to, uint256 amount) external onlyOwner { + function sudoMint(address to, uint256 amount) external onlyChain { _mint(to, amount); } - function burn(address from, uint256 amount) external onlyOwner { + function sudoBurn(address from, uint256 amount) external onlyChain { _burn(from, amount); } } diff --git a/x/evm/contracts/erc20_acl/ERC20ACL.go b/x/evm/contracts/erc20_acl/ERC20ACL.go new file mode 100644 index 0000000..7880a08 --- /dev/null +++ b/x/evm/contracts/erc20_acl/ERC20ACL.go @@ -0,0 +1,203 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package erc20_acl + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// Erc20AclMetaData contains all meta data concerning the Erc20Acl contract. +var Erc20AclMetaData = &bind.MetaData{ + ABI: "[]", + Bin: "0x6080604052348015600e575f80fd5b50603e80601a5f395ff3fe60806040525f80fdfea264697066735822122097f44a6309abb239e19ee1005989fb200d740afc2223e4d6c0fb82a45f806dec64736f6c63430008180033", +} + +// Erc20AclABI is the input ABI used to generate the binding from. +// Deprecated: Use Erc20AclMetaData.ABI instead. +var Erc20AclABI = Erc20AclMetaData.ABI + +// Erc20AclBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use Erc20AclMetaData.Bin instead. +var Erc20AclBin = Erc20AclMetaData.Bin + +// DeployErc20Acl deploys a new Ethereum contract, binding an instance of Erc20Acl to it. +func DeployErc20Acl(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Erc20Acl, error) { + parsed, err := Erc20AclMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(Erc20AclBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Erc20Acl{Erc20AclCaller: Erc20AclCaller{contract: contract}, Erc20AclTransactor: Erc20AclTransactor{contract: contract}, Erc20AclFilterer: Erc20AclFilterer{contract: contract}}, nil +} + +// Erc20Acl is an auto generated Go binding around an Ethereum contract. +type Erc20Acl struct { + Erc20AclCaller // Read-only binding to the contract + Erc20AclTransactor // Write-only binding to the contract + Erc20AclFilterer // Log filterer for contract events +} + +// Erc20AclCaller is an auto generated read-only Go binding around an Ethereum contract. +type Erc20AclCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Erc20AclTransactor is an auto generated write-only Go binding around an Ethereum contract. +type Erc20AclTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Erc20AclFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type Erc20AclFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// Erc20AclSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type Erc20AclSession struct { + Contract *Erc20Acl // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// Erc20AclCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type Erc20AclCallerSession struct { + Contract *Erc20AclCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// Erc20AclTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type Erc20AclTransactorSession struct { + Contract *Erc20AclTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// Erc20AclRaw is an auto generated low-level Go binding around an Ethereum contract. +type Erc20AclRaw struct { + Contract *Erc20Acl // Generic contract binding to access the raw methods on +} + +// Erc20AclCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type Erc20AclCallerRaw struct { + Contract *Erc20AclCaller // Generic read-only contract binding to access the raw methods on +} + +// Erc20AclTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type Erc20AclTransactorRaw struct { + Contract *Erc20AclTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewErc20Acl creates a new instance of Erc20Acl, bound to a specific deployed contract. +func NewErc20Acl(address common.Address, backend bind.ContractBackend) (*Erc20Acl, error) { + contract, err := bindErc20Acl(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Erc20Acl{Erc20AclCaller: Erc20AclCaller{contract: contract}, Erc20AclTransactor: Erc20AclTransactor{contract: contract}, Erc20AclFilterer: Erc20AclFilterer{contract: contract}}, nil +} + +// NewErc20AclCaller creates a new read-only instance of Erc20Acl, bound to a specific deployed contract. +func NewErc20AclCaller(address common.Address, caller bind.ContractCaller) (*Erc20AclCaller, error) { + contract, err := bindErc20Acl(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &Erc20AclCaller{contract: contract}, nil +} + +// NewErc20AclTransactor creates a new write-only instance of Erc20Acl, bound to a specific deployed contract. +func NewErc20AclTransactor(address common.Address, transactor bind.ContractTransactor) (*Erc20AclTransactor, error) { + contract, err := bindErc20Acl(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &Erc20AclTransactor{contract: contract}, nil +} + +// NewErc20AclFilterer creates a new log filterer instance of Erc20Acl, bound to a specific deployed contract. +func NewErc20AclFilterer(address common.Address, filterer bind.ContractFilterer) (*Erc20AclFilterer, error) { + contract, err := bindErc20Acl(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &Erc20AclFilterer{contract: contract}, nil +} + +// bindErc20Acl binds a generic wrapper to an already deployed contract. +func bindErc20Acl(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := Erc20AclMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Erc20Acl *Erc20AclRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Erc20Acl.Contract.Erc20AclCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Erc20Acl *Erc20AclRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Erc20Acl.Contract.Erc20AclTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Erc20Acl *Erc20AclRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Erc20Acl.Contract.Erc20AclTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Erc20Acl *Erc20AclCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Erc20Acl.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Erc20Acl *Erc20AclTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Erc20Acl.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Erc20Acl *Erc20AclTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Erc20Acl.Contract.contract.Transact(opts, method, params...) +} diff --git a/x/evm/contracts/erc20_acl/ERC20ACL.sol b/x/evm/contracts/erc20_acl/ERC20ACL.sol new file mode 100644 index 0000000..a4e48a4 --- /dev/null +++ b/x/evm/contracts/erc20_acl/ERC20ACL.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import "../i_cosmos/ICosmos.sol"; + +/// @dev CHAIN_ADDRESS is the address of the chain signer. +address constant CHAIN_ADDRESS = 0x0000000000000000000000000000000000000001; + +/** + * @title ERC20ACL + */ +contract ERC20ACL { + modifier onlyChain() { + require(msg.sender == CHAIN_ADDRESS, "ERC20: caller is not the chain"); + _; + } + + // check if the sender is a module address + modifier burnable(address from) { + require( + !COSMOS_CONTRACT.is_module_address(from), + "ERC20: burn from module address" + ); + + _; + } + + // check if the recipient is a blocked address + modifier mintable(address to) { + require( + !COSMOS_CONTRACT.is_blocked_address(to), + "ERC20: mint to blocked address" + ); + + _; + } + + // check if an recipient is blocked in bank module + modifier transferable(address to) { + require( + !COSMOS_CONTRACT.is_blocked_address(to), + "ERC20: transfer to blocked address" + ); + + _; + } +} diff --git a/x/evm/contracts/erc20_factory/ERC20Factory.go b/x/evm/contracts/erc20_factory/ERC20Factory.go index f4f93d9..234e282 100644 --- a/x/evm/contracts/erc20_factory/ERC20Factory.go +++ b/x/evm/contracts/erc20_factory/ERC20Factory.go @@ -32,7 +32,7 @@ var ( // Erc20FactoryMetaData contains all meta data concerning the Erc20Factory contract. var Erc20FactoryMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"erc20\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ERC20Created\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"}],\"name\":\"createERC20\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f80fd5b506120e98061001d5f395ff3fe608060405234801562000010575f80fd5b50600436106200002c575f3560e01c806306ef1a861462000030575b5f80fd5b6200004e6004803603810190620000489190620003a5565b62000066565b6040516200005d91906200047f565b60405180910390f35b5f808484846040516200007990620001f3565b62000087939291906200052f565b604051809103905ff080158015620000a1573d5f803e3d5ffd5b50905060f273ffffffffffffffffffffffffffffffffffffffff1663d126274a826040518263ffffffff1660e01b8152600401620000e091906200047f565b6020604051808303815f875af1158015620000fd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001239190620005b2565b508073ffffffffffffffffffffffffffffffffffffffff1663f2fde38b336040518263ffffffff1660e01b81526004016200015f91906200047f565b5f604051808303815f87803b15801562000177575f80fd5b505af11580156200018a573d5f803e3d5ffd5b505050503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f85e892981b234101136bc30081e0a5c44345bebc0940193230c20a43b279e2d160405160405180910390a3809150509392505050565b611ad180620005e383390190565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b62000262826200021a565b810181811067ffffffffffffffff821117156200028457620002836200022a565b5b80604052505050565b5f6200029862000201565b9050620002a6828262000257565b919050565b5f67ffffffffffffffff821115620002c857620002c76200022a565b5b620002d3826200021a565b9050602081019050919050565b828183375f83830152505050565b5f62000304620002fe84620002ab565b6200028d565b90508281526020810184848401111562000323576200032262000216565b5b62000330848285620002e0565b509392505050565b5f82601f8301126200034f576200034e62000212565b5b813562000361848260208601620002ee565b91505092915050565b5f60ff82169050919050565b62000381816200036a565b81146200038c575f80fd5b50565b5f813590506200039f8162000376565b92915050565b5f805f60608486031215620003bf57620003be6200020a565b5b5f84013567ffffffffffffffff811115620003df57620003de6200020e565b5b620003ed8682870162000338565b935050602084013567ffffffffffffffff8111156200041157620004106200020e565b5b6200041f8682870162000338565b925050604062000432868287016200038f565b9150509250925092565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f62000467826200043c565b9050919050565b62000479816200045b565b82525050565b5f602082019050620004945f8301846200046e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015620004d3578082015181840152602081019050620004b6565b5f8484015250505050565b5f620004ea826200049a565b620004f68185620004a4565b935062000508818560208601620004b4565b62000513816200021a565b840191505092915050565b62000529816200036a565b82525050565b5f6060820190508181035f830152620005498186620004de565b905081810360208301526200055f8185620004de565b90506200057060408301846200051e565b949350505050565b5f8115159050919050565b6200058e8162000578565b811462000599575f80fd5b50565b5f81519050620005ac8162000583565b92915050565b5f60208284031215620005ca57620005c96200020a565b5b5f620005d9848285016200059c565b9150509291505056fe608060405234801562000010575f80fd5b5060405162001ad138038062001ad183398181016040528101906200003691906200027c565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600390816200008691906200054a565b5081600490816200009891906200054a565b508060055f6101000a81548160ff021916908360ff1602179055505050506200062e565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6200011d82620000d5565b810181811067ffffffffffffffff821117156200013f576200013e620000e5565b5b80604052505050565b5f62000153620000bc565b905062000161828262000112565b919050565b5f67ffffffffffffffff821115620001835762000182620000e5565b5b6200018e82620000d5565b9050602081019050919050565b5f5b83811015620001ba5780820151818401526020810190506200019d565b5f8484015250505050565b5f620001db620001d58462000166565b62000148565b905082815260208101848484011115620001fa57620001f9620000d1565b5b620002078482856200019b565b509392505050565b5f82601f830112620002265762000225620000cd565b5b815162000238848260208601620001c5565b91505092915050565b5f60ff82169050919050565b620002588162000241565b811462000263575f80fd5b50565b5f8151905062000276816200024d565b92915050565b5f805f60608486031215620002965762000295620000c5565b5b5f84015167ffffffffffffffff811115620002b657620002b5620000c9565b5b620002c4868287016200020f565b935050602084015167ffffffffffffffff811115620002e857620002e7620000c9565b5b620002f6868287016200020f565b9250506040620003098682870162000266565b9150509250925092565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200036257607f821691505b6020821081036200037857620003776200031d565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003dc7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200039f565b620003e886836200039f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620004326200042c620004268462000400565b62000409565b62000400565b9050919050565b5f819050919050565b6200044d8362000412565b620004656200045c8262000439565b848454620003ab565b825550505050565b5f90565b6200047b6200046d565b6200048881848462000442565b505050565b5b81811015620004af57620004a35f8262000471565b6001810190506200048e565b5050565b601f821115620004fe57620004c8816200037e565b620004d38462000390565b81016020851015620004e3578190505b620004fb620004f28562000390565b8301826200048d565b50505b505050565b5f82821c905092915050565b5f620005205f198460080262000503565b1980831691505092915050565b5f6200053a83836200050f565b9150826002028217905092915050565b620005558262000313565b67ffffffffffffffff811115620005715762000570620000e5565b5b6200057d82546200034a565b6200058a828285620004b3565b5f60209050601f831160018114620005c0575f8415620005ab578287015190505b620005b785826200052d565b86555062000626565b601f198416620005d0866200037e565b5f5b82811015620005f957848901518255600182019150602085019450602081019050620005d2565b8683101562000619578489015162000615601f8916826200050f565b8355505b6001600288020188555050505b505050505050565b611495806200063c5f395ff3fe608060405234801561000f575f80fd5b50600436106100e8575f3560e01c806370a082311161008a5780639dc29fac116100645780639dc29fac1461025e578063a9059cbb1461027a578063dd62ed3e146102aa578063f2fde38b146102da576100e8565b806370a08231146101f25780638da5cb5b1461022257806395d89b4114610240576100e8565b806318160ddd116100c657806318160ddd1461016a57806323b872dd14610188578063313ce567146101b857806340c10f19146101d6576100e8565b806301ffc9a7146100ec57806306fdde031461011c578063095ea7b31461013a575b5f80fd5b6101066004803603810190610101919061100a565b6102f6565b604051610113919061104f565b60405180910390f35b61012461036f565b60405161013191906110f2565b60405180910390f35b610154600480360381019061014f919061119f565b6103fb565b604051610161919061104f565b60405180910390f35b6101726104e8565b60405161017f91906111ec565b60405180910390f35b6101a2600480360381019061019d9190611205565b6104ee565b6040516101af919061104f565b60405180910390f35b6101c061078e565b6040516101cd9190611270565b60405180910390f35b6101f060048036038101906101eb919061119f565b6107a0565b005b61020c60048036038101906102079190611289565b610804565b60405161021991906111ec565b60405180910390f35b61022a610819565b60405161023791906112c3565b60405180910390f35b61024861083c565b60405161025591906110f2565b60405180910390f35b6102786004803603810190610273919061119f565b6108c8565b005b610294600480360381019061028f919061119f565b61092c565b6040516102a1919061104f565b60405180910390f35b6102c460048036038101906102bf91906112dc565b610b3d565b6040516102d191906111ec565b60405180910390f35b6102f460048036038101906102ef9190611289565b610b5d565b005b5f7f942e8b22000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610368575061036782610ca5565b5b9050919050565b6003805461037c90611347565b80601f01602080910402602001604051908101604052809291908181526020018280546103a890611347565b80156103f35780601f106103ca576101008083540402835291602001916103f3565b820191905f5260205f20905b8154815290600101906020018083116103d657829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516104d691906111ec565b60405180910390a36001905092915050565b60065481565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161052a91906112c3565b602060405180830381865afa158015610545573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061056991906113a1565b6105e95760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016105a791906112c3565b6020604051808303815f875af11580156105c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e791906113a1565b505b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461067091906113f9565b925050819055508260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106c391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610716919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161077a91906111ec565b60405180910390a360019150509392505050565b60055f9054906101000a900460ff1681565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107f6575f80fd5b6108008282610d0e565b5050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461084990611347565b80601f016020809104026020016040519081016040528092919081815260200182805461087590611347565b80156108c05780601f10610897576101008083540402835291602001916108c0565b820191905f5260205f20905b8154815290600101906020018083116108a357829003601f168201915b505050505081565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461091e575f80fd5b6109288282610edd565b5050565b5f8260f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161096891906112c3565b602060405180830381865afa158015610983573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a791906113a1565b610a275760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016109e591906112c3565b6020604051808303815f875af1158015610a01573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2591906113a1565b505b8260015f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a7391906113f9565b925050819055508260015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610ac6919061142c565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610b2a91906111ec565b60405180910390a3600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bb3575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bea575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610d4991906112c3565b602060405180830381865afa158015610d64573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d8891906113a1565b610e085760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610dc691906112c3565b6020604051808303815f875af1158015610de2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0691906113a1565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610e54919061142c565b925050819055508160065f828254610e6c919061142c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ed091906111ec565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f2991906113f9565b925050819055508060065f828254610f4191906113f9565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610fa591906111ec565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fe981610fb5565b8114610ff3575f80fd5b50565b5f8135905061100481610fe0565b92915050565b5f6020828403121561101f5761101e610fb1565b5b5f61102c84828501610ff6565b91505092915050565b5f8115159050919050565b61104981611035565b82525050565b5f6020820190506110625f830184611040565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561109f578082015181840152602081019050611084565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6110c482611068565b6110ce8185611072565b93506110de818560208601611082565b6110e7816110aa565b840191505092915050565b5f6020820190508181035f83015261110a81846110ba565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61113b82611112565b9050919050565b61114b81611131565b8114611155575f80fd5b50565b5f8135905061116681611142565b92915050565b5f819050919050565b61117e8161116c565b8114611188575f80fd5b50565b5f8135905061119981611175565b92915050565b5f80604083850312156111b5576111b4610fb1565b5b5f6111c285828601611158565b92505060206111d38582860161118b565b9150509250929050565b6111e68161116c565b82525050565b5f6020820190506111ff5f8301846111dd565b92915050565b5f805f6060848603121561121c5761121b610fb1565b5b5f61122986828701611158565b935050602061123a86828701611158565b925050604061124b8682870161118b565b9150509250925092565b5f60ff82169050919050565b61126a81611255565b82525050565b5f6020820190506112835f830184611261565b92915050565b5f6020828403121561129e5761129d610fb1565b5b5f6112ab84828501611158565b91505092915050565b6112bd81611131565b82525050565b5f6020820190506112d65f8301846112b4565b92915050565b5f80604083850312156112f2576112f1610fb1565b5b5f6112ff85828601611158565b925050602061131085828601611158565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061135e57607f821691505b6020821081036113715761137061131a565b5b50919050565b61138081611035565b811461138a575f80fd5b50565b5f8151905061139b81611377565b92915050565b5f602082840312156113b6576113b5610fb1565b5b5f6113c38482850161138d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6114038261116c565b915061140e8361116c565b9250828203905081811115611426576114256113cc565b5b92915050565b5f6114368261116c565b91506114418361116c565b9250828201905080821115611459576114586113cc565b5b9291505056fea264697066735822122067e09fb1c8f6c6d1f6c87e9baac07eeef8b81a3218e526c7e72f157bf344e58564736f6c63430008180033a2646970667358221220012e95eae571f8b8aa7d90dba694698d6bbe3e987c2b4c972f8e03c0a07e47fe64736f6c63430008180033", + Bin: "0x608060405234801561000f575f80fd5b5061259e8061001d5f395ff3fe608060405234801562000010575f80fd5b50600436106200002c575f3560e01c806306ef1a861462000030575b5f80fd5b6200004e6004803603810190620000489190620003a5565b62000066565b6040516200005d91906200047f565b60405180910390f35b5f808484846040516200007990620001f3565b62000087939291906200052f565b604051809103905ff080158015620000a1573d5f803e3d5ffd5b50905060f273ffffffffffffffffffffffffffffffffffffffff1663d126274a826040518263ffffffff1660e01b8152600401620000e091906200047f565b6020604051808303815f875af1158015620000fd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001239190620005b2565b508073ffffffffffffffffffffffffffffffffffffffff1663f2fde38b336040518263ffffffff1660e01b81526004016200015f91906200047f565b5f604051808303815f87803b15801562000177575f80fd5b505af11580156200018a573d5f803e3d5ffd5b505050503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f85e892981b234101136bc30081e0a5c44345bebc0940193230c20a43b279e2d160405160405180910390a3809150509392505050565b611f8680620005e383390190565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b62000262826200021a565b810181811067ffffffffffffffff821117156200028457620002836200022a565b5b80604052505050565b5f6200029862000201565b9050620002a6828262000257565b919050565b5f67ffffffffffffffff821115620002c857620002c76200022a565b5b620002d3826200021a565b9050602081019050919050565b828183375f83830152505050565b5f62000304620002fe84620002ab565b6200028d565b90508281526020810184848401111562000323576200032262000216565b5b62000330848285620002e0565b509392505050565b5f82601f8301126200034f576200034e62000212565b5b813562000361848260208601620002ee565b91505092915050565b5f60ff82169050919050565b62000381816200036a565b81146200038c575f80fd5b50565b5f813590506200039f8162000376565b92915050565b5f805f60608486031215620003bf57620003be6200020a565b5b5f84013567ffffffffffffffff811115620003df57620003de6200020e565b5b620003ed8682870162000338565b935050602084013567ffffffffffffffff8111156200041157620004106200020e565b5b6200041f8682870162000338565b925050604062000432868287016200038f565b9150509250925092565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f62000467826200043c565b9050919050565b62000479816200045b565b82525050565b5f602082019050620004945f8301846200046e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015620004d3578082015181840152602081019050620004b6565b5f8484015250505050565b5f620004ea826200049a565b620004f68185620004a4565b935062000508818560208601620004b4565b62000513816200021a565b840191505092915050565b62000529816200036a565b82525050565b5f6060820190508181035f830152620005498186620004de565b905081810360208301526200055f8185620004de565b90506200057060408301846200051e565b949350505050565b5f8115159050919050565b6200058e8162000578565b811462000599575f80fd5b50565b5f81519050620005ac8162000583565b92915050565b5f60208284031215620005ca57620005c96200020a565b5b5f620005d9848285016200059c565b9150509291505056fe608060405234801562000010575f80fd5b5060405162001f8638038062001f8683398181016040528101906200003691906200027c565b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600390816200008691906200054a565b5081600490816200009891906200054a565b508060055f6101000a81548160ff021916908360ff1602179055505050506200062e565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6200011d82620000d5565b810181811067ffffffffffffffff821117156200013f576200013e620000e5565b5b80604052505050565b5f62000153620000bc565b905062000161828262000112565b919050565b5f67ffffffffffffffff821115620001835762000182620000e5565b5b6200018e82620000d5565b9050602081019050919050565b5f5b83811015620001ba5780820151818401526020810190506200019d565b5f8484015250505050565b5f620001db620001d58462000166565b62000148565b905082815260208101848484011115620001fa57620001f9620000d1565b5b620002078482856200019b565b509392505050565b5f82601f830112620002265762000225620000cd565b5b815162000238848260208601620001c5565b91505092915050565b5f60ff82169050919050565b620002588162000241565b811462000263575f80fd5b50565b5f8151905062000276816200024d565b92915050565b5f805f60608486031215620002965762000295620000c5565b5b5f84015167ffffffffffffffff811115620002b657620002b5620000c9565b5b620002c4868287016200020f565b935050602084015167ffffffffffffffff811115620002e857620002e7620000c9565b5b620002f6868287016200020f565b9250506040620003098682870162000266565b9150509250925092565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200036257607f821691505b6020821081036200037857620003776200031d565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003dc7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200039f565b620003e886836200039f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620004326200042c620004268462000400565b62000409565b62000400565b9050919050565b5f819050919050565b6200044d8362000412565b620004656200045c8262000439565b848454620003ab565b825550505050565b5f90565b6200047b6200046d565b6200048881848462000442565b505050565b5b81811015620004af57620004a35f8262000471565b6001810190506200048e565b5050565b601f821115620004fe57620004c8816200037e565b620004d38462000390565b81016020851015620004e3578190505b620004fb620004f28562000390565b8301826200048d565b50505b505050565b5f82821c905092915050565b5f620005205f198460080262000503565b1980831691505092915050565b5f6200053a83836200050f565b9150826002028217905092915050565b620005558262000313565b67ffffffffffffffff811115620005715762000570620000e5565b5b6200057d82546200034a565b6200058a828285620004b3565b5f60209050601f831160018114620005c0575f8415620005ab578287015190505b620005b785826200052d565b86555062000626565b601f198416620005d0866200037e565b5f5b82811015620005f957848901518255600182019150602085019450602081019050620005d2565b8683101562000619578489015162000615601f8916826200050f565b8355505b6001600288020188555050505b505050505050565b61194a806200063c5f395ff3fe608060405234801561000f575f80fd5b5060043610610109575f3560e01c806340c10f19116100a05780639dc29fac1161006f5780639dc29fac146102b7578063a9059cbb146102d3578063dd62ed3e14610303578063f2fde38b14610333578063fe1195ec1461034f57610109565b806340c10f191461022f57806370a082311461024b5780638da5cb5b1461027b57806395d89b411461029957610109565b80631988513b116100dc5780631988513b146101a957806323b872dd146101c55780632d688ca8146101f5578063313ce5671461021157610109565b806301ffc9a71461010d57806306fdde031461013d578063095ea7b31461015b57806318160ddd1461018b575b5f80fd5b610127600480360381019061012291906112f9565b61036b565b604051610134919061133e565b60405180910390f35b6101456103e4565b60405161015291906113e1565b60405180910390f35b6101756004803603810190610170919061148e565b610470565b604051610182919061133e565b60405180910390f35b61019361055d565b6040516101a091906114db565b60405180910390f35b6101c360048036038101906101be91906114f4565b610563565b005b6101df60048036038101906101da91906114f4565b6105e2565b6040516101ec919061133e565b60405180910390f35b61020f600480360381019061020a919061148e565b610742565b005b6102196107bf565b604051610226919061155f565b60405180910390f35b6102496004803603810190610244919061148e565b6107d1565b005b61026560048036038101906102609190611578565b6108f0565b60405161027291906114db565b60405180910390f35b610283610905565b60405161029091906115b2565b60405180910390f35b6102a1610928565b6040516102ae91906113e1565b60405180910390f35b6102d160048036038101906102cc919061148e565b6109b4565b005b6102ed60048036038101906102e8919061148e565b610ad3565b6040516102fa919061133e565b60405180910390f35b61031d600480360381019061031891906115cb565b610ba4565b60405161032a91906114db565b60405180910390f35b61034d60048036038101906103489190611578565b610bc4565b005b6103696004803603810190610364919061148e565b610d0c565b005b5f7f8da6da19000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103dd57506103dc82610d89565b5b9050919050565b600380546103f190611636565b80601f016020809104026020016040519081016040528092919081815260200182805461041d90611636565b80156104685780601f1061043f57610100808354040283529160200191610468565b820191905f5260205f20905b81548152906001019060200180831161044b57829003601f168201915b505050505081565b5f8160025f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161054b91906114db565b60405180910390a36001905092915050565b60065481565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c9906116b0565b60405180910390fd5b6105dd838383610df2565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b815260040161061e91906115b2565b602060405180830381865afa158015610639573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061065d91906116f8565b1561069d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069490611793565b60405180910390fd5b8260025f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461072491906117de565b92505081905550610736858585610df2565b60019150509392505050565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a8906116b0565b60405180910390fd5b6107bb8282610ffd565b5050565b60055f9054906101000a900460ff1681565b8160f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b815260040161080c91906115b2565b602060405180830381865afa158015610827573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061084b91906116f8565b1561088b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108829061185b565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e1575f80fd5b6108eb8383610ffd565b505050565b6001602052805f5260405f205f915090505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004805461093590611636565b80601f016020809104026020016040519081016040528092919081815260200182805461096190611636565b80156109ac5780601f10610983576101008083540402835291602001916109ac565b820191905f5260205f20905b81548152906001019060200180831161098f57829003601f168201915b505050505081565b8160f173ffffffffffffffffffffffffffffffffffffffff166360dc402f826040518263ffffffff1660e01b81526004016109ef91906115b2565b602060405180830381865afa158015610a0a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2e91906116f8565b15610a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a65906118c3565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ac4575f80fd5b610ace83836111cc565b505050565b5f8260f173ffffffffffffffffffffffffffffffffffffffff1663f2af9ac9826040518263ffffffff1660e01b8152600401610b0f91906115b2565b602060405180830381865afa158015610b2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b4e91906116f8565b15610b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8590611793565b60405180910390fd5b610b99338585610df2565b600191505092915050565b6002602052815f5260405f20602052805f5260405f205f91509150505481565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a575f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c51575f80fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d72906116b0565b60405180910390fd5b610d8582826111cc565b5050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b8152600401610e2d91906115b2565b602060405180830381865afa158015610e48573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e6c91906116f8565b610eec5760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b8152600401610eaa91906115b2565b6020604051808303815f875af1158015610ec6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eea91906116f8565b505b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f3891906117de565b925050819055508160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610f8b91906118e1565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610fef91906114db565b60405180910390a350505050565b8160f273ffffffffffffffffffffffffffffffffffffffff16634e25ab64826040518263ffffffff1660e01b815260040161103891906115b2565b602060405180830381865afa158015611053573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061107791906116f8565b6110f75760f273ffffffffffffffffffffffffffffffffffffffff1663ceeae52a826040518263ffffffff1660e01b81526004016110b591906115b2565b6020604051808303815f875af11580156110d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110f591906116f8565b505b8160015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461114391906118e1565b925050819055508160065f82825461115b91906118e1565b925050819055508273ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111bf91906114db565b60405180910390a3505050565b8060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461121891906117de565b925050819055508060065f82825461123091906117de565b925050819055505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161129491906114db565b60405180910390a35050565b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6112d8816112a4565b81146112e2575f80fd5b50565b5f813590506112f3816112cf565b92915050565b5f6020828403121561130e5761130d6112a0565b5b5f61131b848285016112e5565b91505092915050565b5f8115159050919050565b61133881611324565b82525050565b5f6020820190506113515f83018461132f565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b8381101561138e578082015181840152602081019050611373565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6113b382611357565b6113bd8185611361565b93506113cd818560208601611371565b6113d681611399565b840191505092915050565b5f6020820190508181035f8301526113f981846113a9565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61142a82611401565b9050919050565b61143a81611420565b8114611444575f80fd5b50565b5f8135905061145581611431565b92915050565b5f819050919050565b61146d8161145b565b8114611477575f80fd5b50565b5f8135905061148881611464565b92915050565b5f80604083850312156114a4576114a36112a0565b5b5f6114b185828601611447565b92505060206114c28582860161147a565b9150509250929050565b6114d58161145b565b82525050565b5f6020820190506114ee5f8301846114cc565b92915050565b5f805f6060848603121561150b5761150a6112a0565b5b5f61151886828701611447565b935050602061152986828701611447565b925050604061153a8682870161147a565b9150509250925092565b5f60ff82169050919050565b61155981611544565b82525050565b5f6020820190506115725f830184611550565b92915050565b5f6020828403121561158d5761158c6112a0565b5b5f61159a84828501611447565b91505092915050565b6115ac81611420565b82525050565b5f6020820190506115c55f8301846115a3565b92915050565b5f80604083850312156115e1576115e06112a0565b5b5f6115ee85828601611447565b92505060206115ff85828601611447565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061164d57607f821691505b6020821081036116605761165f611609565b5b50919050565b7f45524332303a2063616c6c6572206973206e6f742074686520636861696e00005f82015250565b5f61169a601e83611361565b91506116a582611666565b602082019050919050565b5f6020820190508181035f8301526116c78161168e565b9050919050565b6116d781611324565b81146116e1575f80fd5b50565b5f815190506116f2816116ce565b92915050565b5f6020828403121561170d5761170c6112a0565b5b5f61171a848285016116e4565b91505092915050565b7f45524332303a207472616e7366657220746f20626c6f636b65642061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f61177d602283611361565b915061178882611723565b604082019050919050565b5f6020820190508181035f8301526117aa81611771565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117e88261145b565b91506117f38361145b565b925082820390508181111561180b5761180a6117b1565b5b92915050565b7f45524332303a206d696e7420746f20626c6f636b6564206164647265737300005f82015250565b5f611845601e83611361565b915061185082611811565b602082019050919050565b5f6020820190508181035f83015261187281611839565b9050919050565b7f45524332303a206275726e2066726f6d206d6f64756c652061646472657373005f82015250565b5f6118ad601f83611361565b91506118b882611879565b602082019050919050565b5f6020820190508181035f8301526118da816118a1565b9050919050565b5f6118eb8261145b565b91506118f68361145b565b925082820190508082111561190e5761190d6117b1565b5b9291505056fea264697066735822122092a15d9b61c6a6de22122c9c81d375bc99e3984e299e75efa4ffe4653b8ae00d64736f6c63430008180033a26469706673582212206b99826e9ebc2324919b3d174bd14ff76ea5b93ccaabee698691b0cfa3c3064964736f6c63430008180033", } // Erc20FactoryABI is the input ABI used to generate the binding from. diff --git a/x/evm/contracts/erc20_factory/ERC20Factory.sol b/x/evm/contracts/erc20_factory/ERC20Factory.sol index fd6bcf1..256e1b9 100644 --- a/x/evm/contracts/erc20_factory/ERC20Factory.sol +++ b/x/evm/contracts/erc20_factory/ERC20Factory.sol @@ -13,7 +13,7 @@ contract ERC20Factory is ERC20Registry { uint8 decimals ) external returns (address) { ERC20 erc20 = new ERC20(name, symbol, decimals); - + // register the ERC20 contract with the ERC20 registry ERC20_REGISTRY_CONTRACT.register_erc20_from_factory(address(erc20)); @@ -23,4 +23,4 @@ contract ERC20Factory is ERC20Registry { emit ERC20Created(address(erc20), msg.sender); return address(erc20); } -} \ No newline at end of file +} diff --git a/x/evm/contracts/erc20_registry/ERC20Registry.go b/x/evm/contracts/erc20_registry/ERC20Registry.go index 1c04298..aa33a90 100644 --- a/x/evm/contracts/erc20_registry/ERC20Registry.go +++ b/x/evm/contracts/erc20_registry/ERC20Registry.go @@ -32,7 +32,7 @@ var ( // Erc20RegistryMetaData contains all meta data concerning the Erc20Registry contract. var Erc20RegistryMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x6080604052348015600e575f80fd5b50603e80601a5f395ff3fe60806040525f80fdfea2646970667358221220c802e40a4afa60da789a5d872a091e646d00a323e178e0e14735ead4c5341a3764736f6c63430008180033", + Bin: "0x6080604052348015600e575f80fd5b50603e80601a5f395ff3fe60806040525f80fdfea26469706673582212203334da44d9942138944b21288eb47737e3fa0f320ba83d5b36d61f53ae69101664736f6c63430008180033", } // Erc20RegistryABI is the input ABI used to generate the binding from. diff --git a/x/evm/contracts/erc20_registry/ERC20Registry.sol b/x/evm/contracts/erc20_registry/ERC20Registry.sol index a7610cd..962efc4 100644 --- a/x/evm/contracts/erc20_registry/ERC20Registry.sol +++ b/x/evm/contracts/erc20_registry/ERC20Registry.sol @@ -14,14 +14,8 @@ contract ERC20Registry { } modifier register_erc20_store(address account) { - if ( - !ERC20_REGISTRY_CONTRACT.is_erc20_store_registered( - account - ) - ) { - ERC20_REGISTRY_CONTRACT.register_erc20_store( - account - ); + if (!ERC20_REGISTRY_CONTRACT.is_erc20_store_registered(account)) { + ERC20_REGISTRY_CONTRACT.register_erc20_store(account); } _; diff --git a/x/evm/contracts/i_cosmos/ICosmos.go b/x/evm/contracts/i_cosmos/ICosmos.go index abd6155..be536d3 100644 --- a/x/evm/contracts/i_cosmos/ICosmos.go +++ b/x/evm/contracts/i_cosmos/ICosmos.go @@ -31,7 +31,7 @@ var ( // ICosmosMetaData contains all meta data concerning the ICosmos contract. var ICosmosMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"msg\",\"type\":\"string\"}],\"name\":\"execute_cosmos\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"dummy\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"path\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"req\",\"type\":\"string\"}],\"name\":\"query_cosmos\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"result\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"evm_address\",\"type\":\"address\"}],\"name\":\"to_cosmos_address\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"erc20_address\",\"type\":\"address\"}],\"name\":\"to_denom\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"name\":\"to_erc20\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"erc20_address\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"}],\"name\":\"to_evm_address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"evm_address\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"msg\",\"type\":\"string\"}],\"name\":\"execute_cosmos\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"dummy\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"is_blocked_address\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"blocked\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"is_module_address\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"module\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"path\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"req\",\"type\":\"string\"}],\"name\":\"query_cosmos\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"result\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"evm_address\",\"type\":\"address\"}],\"name\":\"to_cosmos_address\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"erc20_address\",\"type\":\"address\"}],\"name\":\"to_denom\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"name\":\"to_erc20\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"erc20_address\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"cosmos_address\",\"type\":\"string\"}],\"name\":\"to_evm_address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"evm_address\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ICosmosABI is the input ABI used to generate the binding from. @@ -180,6 +180,68 @@ func (_ICosmos *ICosmosTransactorRaw) Transact(opts *bind.TransactOpts, method s return _ICosmos.Contract.contract.Transact(opts, method, params...) } +// IsBlockedAddress is a free data retrieval call binding the contract method 0xf2af9ac9. +// +// Solidity: function is_blocked_address(address account) view returns(bool blocked) +func (_ICosmos *ICosmosCaller) IsBlockedAddress(opts *bind.CallOpts, account common.Address) (bool, error) { + var out []interface{} + err := _ICosmos.contract.Call(opts, &out, "is_blocked_address", account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsBlockedAddress is a free data retrieval call binding the contract method 0xf2af9ac9. +// +// Solidity: function is_blocked_address(address account) view returns(bool blocked) +func (_ICosmos *ICosmosSession) IsBlockedAddress(account common.Address) (bool, error) { + return _ICosmos.Contract.IsBlockedAddress(&_ICosmos.CallOpts, account) +} + +// IsBlockedAddress is a free data retrieval call binding the contract method 0xf2af9ac9. +// +// Solidity: function is_blocked_address(address account) view returns(bool blocked) +func (_ICosmos *ICosmosCallerSession) IsBlockedAddress(account common.Address) (bool, error) { + return _ICosmos.Contract.IsBlockedAddress(&_ICosmos.CallOpts, account) +} + +// IsModuleAddress is a free data retrieval call binding the contract method 0x60dc402f. +// +// Solidity: function is_module_address(address account) view returns(bool module) +func (_ICosmos *ICosmosCaller) IsModuleAddress(opts *bind.CallOpts, account common.Address) (bool, error) { + var out []interface{} + err := _ICosmos.contract.Call(opts, &out, "is_module_address", account) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsModuleAddress is a free data retrieval call binding the contract method 0x60dc402f. +// +// Solidity: function is_module_address(address account) view returns(bool module) +func (_ICosmos *ICosmosSession) IsModuleAddress(account common.Address) (bool, error) { + return _ICosmos.Contract.IsModuleAddress(&_ICosmos.CallOpts, account) +} + +// IsModuleAddress is a free data retrieval call binding the contract method 0x60dc402f. +// +// Solidity: function is_module_address(address account) view returns(bool module) +func (_ICosmos *ICosmosCallerSession) IsModuleAddress(account common.Address) (bool, error) { + return _ICosmos.Contract.IsModuleAddress(&_ICosmos.CallOpts, account) +} + // ExecuteCosmos is a paid mutator transaction binding the contract method 0xd46f64e6. // // Solidity: function execute_cosmos(string msg) returns(bool dummy) diff --git a/x/evm/contracts/i_cosmos/ICosmos.sol b/x/evm/contracts/i_cosmos/ICosmos.sol index e1e7923..eaa420f 100644 --- a/x/evm/contracts/i_cosmos/ICosmos.sol +++ b/x/evm/contracts/i_cosmos/ICosmos.sol @@ -8,6 +8,12 @@ address constant COSMOS_ADDRESS = 0x00000000000000000000000000000000000000f1; ICosmos constant COSMOS_CONTRACT = ICosmos(COSMOS_ADDRESS); interface ICosmos { + // check if an address is blocked in bank module + function is_blocked_address(address account) external view returns (bool blocked); + + // check if an address is a module account + function is_module_address(address account) external view returns (bool module); + // convert an EVM address to a Cosmos address function to_cosmos_address( address evm_address diff --git a/x/evm/contracts/i_erc20/IERC20.go b/x/evm/contracts/i_erc20/IERC20.go index c330704..4c0093a 100644 --- a/x/evm/contracts/i_erc20/IERC20.go +++ b/x/evm/contracts/i_erc20/IERC20.go @@ -31,7 +31,7 @@ var ( // IErc20MetaData contains all meta data concerning the IErc20 contract. var IErc20MetaData = &bind.MetaData{ - ABI: "[{\"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\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"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\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sudoTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"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\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // IErc20ABI is the input ABI used to generate the binding from. @@ -418,6 +418,27 @@ func (_IErc20 *IErc20TransactorSession) Approve(spender common.Address, amount * return _IErc20.Contract.Approve(&_IErc20.TransactOpts, spender, amount) } +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_IErc20 *IErc20Transactor) SudoTransfer(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _IErc20.contract.Transact(opts, "sudoTransfer", sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_IErc20 *IErc20Session) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _IErc20.Contract.SudoTransfer(&_IErc20.TransactOpts, sender, recipient, amount) +} + +// SudoTransfer is a paid mutator transaction binding the contract method 0x1988513b. +// +// Solidity: function sudoTransfer(address sender, address recipient, uint256 amount) returns() +func (_IErc20 *IErc20TransactorSession) SudoTransfer(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _IErc20.Contract.SudoTransfer(&_IErc20.TransactOpts, sender, recipient, amount) +} + // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) diff --git a/x/evm/contracts/i_erc20/IERC20.sol b/x/evm/contracts/i_erc20/IERC20.sol index 5636654..89087c8 100644 --- a/x/evm/contracts/i_erc20/IERC20.sol +++ b/x/evm/contracts/i_erc20/IERC20.sol @@ -24,4 +24,11 @@ interface IERC20 is IERC165 { address recipient, uint256 amount ) external returns (bool); + + // Custom ERC20 contracts also should have sudo transfer method + function sudoTransfer( + address sender, + address recipient, + uint256 amount + ) external; } diff --git a/x/evm/keeper/address_test.go b/x/evm/keeper/address_test.go index e8a4794..99eb5f9 100644 --- a/x/evm/keeper/address_test.go +++ b/x/evm/keeper/address_test.go @@ -30,7 +30,7 @@ func Test_AllowLongCosmosAddress(t *testing.T) { require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) // mint erc20 - mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100))) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) // mint native coin err = erc20Keeper.MintCoins(ctx, addr, sdk.NewCoins( diff --git a/x/evm/keeper/common_test.go b/x/evm/keeper/common_test.go index 8fcd8ee..819a55f 100644 --- a/x/evm/keeper/common_test.go +++ b/x/evm/keeper/common_test.go @@ -252,6 +252,7 @@ func _createTestInput( appCodec, runtime.NewKVStoreService(keys[evmtypes.StoreKey]), accountKeeper, + bankKeeper, communityPoolKeeper, msgRouter, queryRouter, diff --git a/x/evm/keeper/erc20.go b/x/evm/keeper/erc20.go index 39aebfc..9954ca0 100644 --- a/x/evm/keeper/erc20.go +++ b/x/evm/keeper/erc20.go @@ -76,7 +76,7 @@ func (k ERC20Keeper) BurnCoins(ctx context.Context, addr sdk.AccAddress, amount return err } - inputBz, err := k.ERC20ABI.Pack("burn", evmAddr, coin.Amount.BigInt()) + inputBz, err := k.ERC20ABI.Pack("sudoBurn", evmAddr, coin.Amount.BigInt()) if err != nil { return types.ErrFailedToPackABI.Wrap(err.Error()) } @@ -332,7 +332,7 @@ func (k ERC20Keeper) MintCoins(ctx context.Context, addr sdk.AccAddress, amount if err != nil { return err } - inputBz, err := k.ERC20ABI.Pack("mint", evmAddr, coin.Amount.BigInt()) + inputBz, err := k.ERC20ABI.Pack("sudoMint", evmAddr, coin.Amount.BigInt()) if err != nil { return types.ErrFailedToPackABI.Wrap(err.Error()) } @@ -364,13 +364,13 @@ func (k ERC20Keeper) SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toA return err } - inputBz, err := k.ERC20ABI.Pack("transfer", evmToAddr, coin.Amount.BigInt()) + inputBz, err := k.ERC20ABI.Pack("sudoTransfer", evmFromAddr, evmToAddr, coin.Amount.BigInt()) if err != nil { return types.ErrFailedToPackABI.Wrap(err.Error()) } // ignore the return values - _, _, err = k.EVMCall(ctx, evmFromAddr, contractAddr, inputBz, nil) + _, _, err = k.EVMCall(ctx, types.StdAddress, contractAddr, inputBz, nil) if err != nil { return err } diff --git a/x/evm/keeper/erc20_stores.go b/x/evm/keeper/erc20_stores.go index d553428..b8f2ca8 100644 --- a/x/evm/keeper/erc20_stores.go +++ b/x/evm/keeper/erc20_stores.go @@ -56,6 +56,12 @@ func (k ERC20StoresKeeper) Register(ctx context.Context, contractAddr common.Add return types.ErrCustomERC20NotAllowed } + if found, err := k.ERC20s.Has(ctx, contractAddr.Bytes()); err != nil { + return err + } else if found { + return nil + } + // default action is to allow all custom erc20s // but if allowedCustomERC20s is set, only allow those if len(params.AllowedCustomERC20s) > 0 { @@ -68,12 +74,6 @@ func (k ERC20StoresKeeper) Register(ctx context.Context, contractAddr common.Add } } - if found, err := k.ERC20s.Has(ctx, contractAddr.Bytes()); err != nil { - return err - } else if found { - return nil - } - return k.ERC20s.Set(ctx, contractAddr.Bytes()) } diff --git a/x/evm/keeper/erc20_test.go b/x/evm/keeper/erc20_test.go index 4e7ab8e..07da50b 100644 --- a/x/evm/keeper/erc20_test.go +++ b/x/evm/keeper/erc20_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/initia-labs/minievm/x/evm/contracts/erc20" @@ -29,7 +30,25 @@ func deployERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller common return common.BytesToAddress(ret[12:]) } -func mintERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, recipient common.Address, amount sdk.Coin) { +func burnERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, from common.Address, amount sdk.Coin, expectErr bool) { + abi, err := erc20.Erc20MetaData.GetAbi() + require.NoError(t, err) + + inputBz, err := abi.Pack("burn", from, amount.Amount.BigInt()) + require.NoError(t, err) + + erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) + require.NoError(t, err) + + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil) + if expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } +} + +func mintERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, recipient common.Address, amount sdk.Coin, expectErr bool) { abi, err := erc20.Erc20MetaData.GetAbi() require.NoError(t, err) @@ -40,7 +59,99 @@ func mintERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, recipie require.NoError(t, err) _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil) + if expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } +} + +func transferERC20(t *testing.T, ctx sdk.Context, input TestKeepers, caller, recipient common.Address, amount sdk.Coin, expectErr bool) { + abi, err := erc20.Erc20MetaData.GetAbi() + require.NoError(t, err) + + inputBz, err := abi.Pack("transfer", recipient, amount.Amount.BigInt()) + require.NoError(t, err) + + erc20ContractAddr, err := types.DenomToContractAddr(ctx, &input.EVMKeeper, amount.Denom) + require.NoError(t, err) + + _, _, err = input.EVMKeeper.EVMCall(ctx, caller, erc20ContractAddr, inputBz, nil) + if expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + +} + +func Test_TransferToModuleAccount(t *testing.T) { + ctx, input := createDefaultTestInput(t) + + _, _, addr := keyPubAddr() + evmAddr := common.BytesToAddress(addr.Bytes()) + + input.Faucet.Fund(ctx, addr, sdk.NewCoin("foo", math.NewInt(100))) + + feeCollectorAddr := authtypes.NewModuleAddress(authtypes.FeeCollectorName) + transferERC20(t, ctx, input, evmAddr, common.BytesToAddress(feeCollectorAddr.Bytes()), sdk.NewCoin("foo", math.NewInt(50)), true) + + _, _, addr2 := keyPubAddr() + evmAddr2 := common.BytesToAddress(addr2.Bytes()) + transferERC20(t, ctx, input, evmAddr, evmAddr2, sdk.NewCoin("foo", math.NewInt(50)), false) +} + +func Test_MintToModuleAccount(t *testing.T) { + ctx, input := createDefaultTestInput(t) + + _, _, addr := keyPubAddr() + evmAddr := common.BytesToAddress(addr.Bytes()) + + // deploy erc20 contract + fooContractAddr := deployERC20(t, ctx, input, evmAddr, "foo") + fooDenom, err := types.ContractAddrToDenom(ctx, &input.EVMKeeper, fooContractAddr) require.NoError(t, err) + require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) + + feeCollectorAddr := authtypes.NewModuleAddress(authtypes.FeeCollectorName) + mintERC20(t, ctx, input, evmAddr, common.BytesToAddress(feeCollectorAddr.Bytes()), sdk.NewCoin(fooDenom, math.NewInt(50)), true) + + _, _, addr2 := keyPubAddr() + evmAddr2 := common.BytesToAddress(addr2.Bytes()) + mintERC20(t, ctx, input, evmAddr, evmAddr2, sdk.NewCoin(fooDenom, math.NewInt(50)), false) +} + +func Test_BurnFromModuleAccount(t *testing.T) { + ctx, input := createDefaultTestInput(t) + + // register fee collector module account + input.AccountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) + + _, _, addr := keyPubAddr() + evmAddr := common.BytesToAddress(addr.Bytes()) + _, _, addr2 := keyPubAddr() + evmAddr2 := common.BytesToAddress(addr2.Bytes()) + + erc20Keeper, err := keeper.NewERC20Keeper(&input.EVMKeeper) + require.NoError(t, err) + + // deploy erc20 contract + fooContractAddr := deployERC20(t, ctx, input, evmAddr, "foo") + fooDenom, err := types.ContractAddrToDenom(ctx, &input.EVMKeeper, fooContractAddr) + require.NoError(t, err) + require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) + + // mint coins + feeCollectorAddr := authtypes.NewModuleAddress(authtypes.FeeCollectorName) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) + erc20Keeper.SendCoins(ctx, addr, feeCollectorAddr, sdk.NewCoins(sdk.NewCoin(fooDenom, math.NewInt(50)))) + erc20Keeper.SendCoins(ctx, addr, addr2, sdk.NewCoins(sdk.NewCoin(fooDenom, math.NewInt(50)))) + + // should not be able to burn from module account + burnERC20(t, ctx, input, evmAddr, common.BytesToAddress(feeCollectorAddr.Bytes()), sdk.NewCoin(fooDenom, math.NewInt(50)), true) + + // should be able to burn from other account + burnERC20(t, ctx, input, evmAddr, evmAddr2, sdk.NewCoin(fooDenom, math.NewInt(50)), false) } func Test_MintBurn(t *testing.T) { @@ -72,7 +183,7 @@ func Test_MintBurn(t *testing.T) { require.NoError(t, err) // mint erc20 - mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100))) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) amount, err := erc20Keeper.GetBalance(ctx, addr, "bar") require.NoError(t, err) @@ -151,7 +262,7 @@ func Test_GetSupply(t *testing.T) { require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) // mint erc20 - mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100))) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) // mint native coin err = erc20Keeper.MintCoins(ctx, addr, sdk.NewCoins( @@ -258,8 +369,8 @@ func Test_IterateAccountBalances(t *testing.T) { require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) // mint erc20 - mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100))) - mintERC20(t, ctx, input, evmAddr, evmAddr2, sdk.NewCoin(fooDenom, math.NewInt(200))) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) + mintERC20(t, ctx, input, evmAddr, evmAddr2, sdk.NewCoin(fooDenom, math.NewInt(200)), false) // mint native coin err = erc20Keeper.MintCoins(ctx, addr, sdk.NewCoins( diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 92ae13c..3fe275b 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -22,6 +22,7 @@ type Keeper struct { storeService corestoretypes.KVStoreService accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper communityPoolKeeper types.CommunityPoolKeeper erc20Keeper types.IERC20Keeper erc20StoresKeeper types.IERC20StoresKeeper @@ -65,6 +66,7 @@ func NewKeeper( cdc codec.Codec, storeService corestoretypes.KVStoreService, accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, communityPoolKeeper types.CommunityPoolKeeper, msgRouter baseapp.MessageRouter, grpcRouter *baseapp.GRPCQueryRouter, @@ -84,6 +86,7 @@ func NewKeeper( storeService: storeService, accountKeeper: accountKeeper, + bankKeeper: bankKeeper, communityPoolKeeper: communityPoolKeeper, msgRouter: msgRouter, diff --git a/x/evm/keeper/precompiles.go b/x/evm/keeper/precompiles.go index d2504b0..cd1a844 100644 --- a/x/evm/keeper/precompiles.go +++ b/x/evm/keeper/precompiles.go @@ -28,6 +28,7 @@ func (k *Keeper) loadPrecompiles() error { k.cdc, k.ac, k.accountKeeper, + k.bankKeeper, k, k.grpcRouter, k.queryCosmosWhitelist, diff --git a/x/evm/keeper/query_server_test.go b/x/evm/keeper/query_server_test.go index a288532..879e124 100644 --- a/x/evm/keeper/query_server_test.go +++ b/x/evm/keeper/query_server_test.go @@ -29,7 +29,7 @@ func Test_Query_Call(t *testing.T) { require.Equal(t, "evm/"+fooContractAddr.Hex()[2:], fooDenom) // mint erc20 - mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100))) + mintERC20(t, ctx, input, evmAddr, evmAddr, sdk.NewCoin(fooDenom, math.NewInt(100)), false) abi, err := erc20.Erc20MetaData.GetAbi() require.NoError(t, err) diff --git a/x/evm/precompiles/cosmos/contract.go b/x/evm/precompiles/cosmos/contract.go index 5f055e1..6e7d59c 100644 --- a/x/evm/precompiles/cosmos/contract.go +++ b/x/evm/precompiles/cosmos/contract.go @@ -34,6 +34,7 @@ type CosmosPrecompile struct { ac address.Codec ak types.AccountKeeper + bk types.BankKeeper edk types.ERC20DenomKeeper grpcRouter types.GRPCRouter @@ -44,6 +45,7 @@ func NewCosmosPrecompile( cdc codec.Codec, ac address.Codec, ak types.AccountKeeper, + bk types.BankKeeper, edk types.ERC20DenomKeeper, grpcRouter types.GRPCRouter, queryWhitelist types.QueryCosmosWhitelist, @@ -58,6 +60,7 @@ func NewCosmosPrecompile( cdc: cdc, ac: ac, ak: ak, + bk: bk, edk: edk, grpcRouter: grpcRouter, queryWhitelist: queryWhitelist, @@ -69,6 +72,20 @@ func (e CosmosPrecompile) WithContext(ctx context.Context) vm.PrecompiledContrac return e } +func (e CosmosPrecompile) originAddress(ctx context.Context, addrBz []byte) (sdk.AccAddress, error) { + account := e.ak.GetAccount(ctx, addrBz) + if shorthandCallerAccount, ok := account.(types.ShorthandAccountI); ok { + addr, err := shorthandCallerAccount.GetOriginalAddress(e.ac) + if err != nil { + return nil, types.ErrPrecompileFailed.Wrap(err.Error()) + } + + addrBz = addr.Bytes() + } + + return addrBz, nil +} + // ExtendedRun implements vm.ExtendedPrecompiledContract. func (e CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) { method, err := e.ABI.MethodById(input) @@ -87,6 +104,50 @@ func (e CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppl ctx.GasMeter().ConsumeGas(storetypes.Gas(len(input))*GAS_PER_BYTE, "input bytes") switch method.Name { + case METHOD_IS_BLOCKED_ADDRESS: + ctx.GasMeter().ConsumeGas(IS_BLOCKED_ADDRESS_GAS, "is_blocked_address") + + var isBlockedAddressArguments IsBlockedAddressArguments + if err := method.Inputs.Copy(&isBlockedAddressArguments, args); err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } + + // convert shorthand account to original address + addr, err := e.originAddress(ctx, isBlockedAddressArguments.Address.Bytes()) + if err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } + + isBlocked := e.bk.BlockedAddr(addr) + + // abi encode the response + resBz, err = method.Outputs.Pack(isBlocked) + if err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } + case METHOD_IS_MODULE_ADDRESS: + ctx.GasMeter().ConsumeGas(IS_MODULE_ADDRESS_GAS, "is_blocked_address") + + var isModuleAddressArguments IsModuleAddressArguments + if err := method.Inputs.Copy(&isModuleAddressArguments, args); err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } + + // convert shorthand account to original address + addr, err := e.originAddress(ctx, isModuleAddressArguments.Address.Bytes()) + if err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } + + // check if the address is a module account + account := e.ak.GetAccount(ctx, addr) + _, isModuleAccount := account.(sdk.ModuleAccountI) + + // abi encode the response + resBz, err = method.Outputs.Pack(isModuleAccount) + if err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) + } case METHOD_TO_COSMOS_ADDRESS: ctx.GasMeter().ConsumeGas(TO_COSMOS_ADDRESS_GAS, "to_cosmos_address") @@ -151,18 +212,10 @@ func (e CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppl return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } - callerAddr := caller.Address().Bytes() - callerAccount := e.ak.GetAccount(ctx, callerAddr) - - // if the caller is a shorthand account, then use shorthand account's original address - // as the caller address. - if shorthandCallerAccount, ok := callerAccount.(types.ShorthandAccountI); ok { - addr, err := shorthandCallerAccount.GetOriginalAddress(e.ac) - if err != nil { - return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) - } - - callerAddr = addr.Bytes() + // convert shorthand account to original address + callerAddr, err := e.originAddress(ctx, caller.Address().Bytes()) + if err != nil { + return nil, ctx.GasMeter().GasConsumedToLimit(), types.ErrPrecompileFailed.Wrap(err.Error()) } for _, signer := range signers { diff --git a/x/evm/precompiles/cosmos/contract_test.go b/x/evm/precompiles/cosmos/contract_test.go index 18a88f4..0cc1b83 100644 --- a/x/evm/precompiles/cosmos/contract_test.go +++ b/x/evm/precompiles/cosmos/contract_test.go @@ -38,7 +38,7 @@ import ( oracletypes "github.com/skip-mev/slinky/x/oracle/types" ) -func setup() (sdk.Context, codec.Codec, address.Codec, types.AccountKeeper) { +func setup() (sdk.Context, codec.Codec, address.Codec, types.AccountKeeper, types.BankKeeper) { kv := db.NewMemDB() cms := store.NewCommitMultiStore(kv, log.NewNopLogger(), storemetrics.NewNoOpMetrics()) @@ -56,13 +56,107 @@ func setup() (sdk.Context, codec.Codec, address.Codec, types.AccountKeeper) { cdc := codec.NewProtoCodec(interfaceRegistry) ac := codecaddress.NewBech32Codec("init") - return ctx, cdc, ac, &MockAccountKeeper{accounts: make(map[string]sdk.AccountI)} + return ctx, cdc, ac, + &MockAccountKeeper{ac: ac, accounts: make(map[string]sdk.AccountI)}, + &MockBankKeeper{ac: ac, blockedAddresses: make(map[string]bool)} +} + +func Test_CosmosPrecompile_IsBlockedAddress(t *testing.T) { + ctx, cdc, ac, ak, bk := setup() + + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, nil, nil) + require.NoError(t, err) + + cosmosPrecompile = cosmosPrecompile.WithContext(ctx).(precompiles.CosmosPrecompile) + + evmAddr := common.HexToAddress("0x1") + cosmosAddr, err := ac.BytesToString(evmAddr.Bytes()) + require.NoError(t, err) + + abi, err := contracts.ICosmosMetaData.GetAbi() + require.NoError(t, err) + + // is blocked address + inputBz, err := abi.Pack(precompiles.METHOD_IS_BLOCKED_ADDRESS, evmAddr) + require.NoError(t, err) + + // out of gas panic + require.Panics(t, func() { + _, _, _ = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS-1, true) + }) + + retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) + require.NoError(t, err) + + ret, err := abi.Unpack(precompiles.METHOD_IS_BLOCKED_ADDRESS, retBz) + require.NoError(t, err) + require.False(t, ret[0].(bool)) + + // block address + bk.(*MockBankKeeper).blockedAddresses[cosmosAddr] = true + + // is blocked address + inputBz, err = abi.Pack(precompiles.METHOD_IS_BLOCKED_ADDRESS, evmAddr) + require.NoError(t, err) + + retBz, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_BLOCKED_ADDRESS_GAS+uint64(len(inputBz)), true) + require.NoError(t, err) + + ret, err = abi.Unpack(precompiles.METHOD_IS_BLOCKED_ADDRESS, retBz) + require.NoError(t, err) + require.True(t, ret[0].(bool)) +} + +func Test_CosmosPrecompile_IsModuleAddress(t *testing.T) { + ctx, cdc, ac, ak, bk := setup() + + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, nil, nil) + require.NoError(t, err) + + cosmosPrecompile = cosmosPrecompile.WithContext(ctx).(precompiles.CosmosPrecompile) + + evmAddr := common.HexToAddress("0x1") + cosmosAddr, err := ac.BytesToString(evmAddr.Bytes()) + require.NoError(t, err) + + abi, err := contracts.ICosmosMetaData.GetAbi() + require.NoError(t, err) + + // is module address + inputBz, err := abi.Pack(precompiles.METHOD_IS_MODULE_ADDRESS, evmAddr) + require.NoError(t, err) + + // out of gas panic + require.Panics(t, func() { + _, _, _ = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS-1, true) + }) + + retBz, _, err := cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) + require.NoError(t, err) + + ret, err := abi.Unpack(precompiles.METHOD_IS_MODULE_ADDRESS, retBz) + require.NoError(t, err) + require.False(t, ret[0].(bool)) + + // module address + ak.(*MockAccountKeeper).accounts[cosmosAddr] = authtypes.NewEmptyModuleAccount("test") + + // is module address + inputBz, err = abi.Pack(precompiles.METHOD_IS_MODULE_ADDRESS, evmAddr) + require.NoError(t, err) + + retBz, _, err = cosmosPrecompile.ExtendedRun(vm.AccountRef(evmAddr), inputBz, precompiles.IS_MODULE_ADDRESS_GAS+uint64(len(inputBz)), true) + require.NoError(t, err) + + ret, err = abi.Unpack(precompiles.METHOD_IS_MODULE_ADDRESS, retBz) + require.NoError(t, err) + require.True(t, ret[0].(bool)) } func Test_CosmosPrecompile_ToCosmosAddress(t *testing.T) { - ctx, cdc, ac, ak := setup() + ctx, cdc, ac, ak, bk := setup() - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, nil, nil, nil) + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, nil, nil) require.NoError(t, err) cosmosPrecompile = cosmosPrecompile.WithContext(ctx).(precompiles.CosmosPrecompile) @@ -92,8 +186,8 @@ func Test_CosmosPrecompile_ToCosmosAddress(t *testing.T) { } func Test_CosmosPrecompile_ToEVMAddress(t *testing.T) { - ctx, cdc, ac, ak := setup() - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, nil, nil, nil) + ctx, cdc, ac, ak, bk := setup() + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, nil, nil) require.NoError(t, err) cosmosPrecompile = cosmosPrecompile.WithContext(ctx).(precompiles.CosmosPrecompile) @@ -123,8 +217,8 @@ func Test_CosmosPrecompile_ToEVMAddress(t *testing.T) { } func Test_ExecuteCosmos(t *testing.T) { - ctx, cdc, ac, ak := setup() - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, nil, nil, nil) + ctx, cdc, ac, ak, bk := setup() + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, nil, nil) require.NoError(t, err) cosmosPrecompile = cosmosPrecompile.WithContext(ctx).(precompiles.CosmosPrecompile) @@ -191,7 +285,7 @@ func Test_ExecuteCosmos(t *testing.T) { } func Test_QueryCosmos(t *testing.T) { - ctx, cdc, ac, ak := setup() + ctx, cdc, ac, ak, bk := setup() queryPath := "/slinky.oracle.v1.Query/Prices" expectedRet := oracletypes.GetPricesResponse{ @@ -205,7 +299,7 @@ func Test_QueryCosmos(t *testing.T) { }, }, } - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, nil, MockGRPCRouter{ + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, nil, MockGRPCRouter{ routes: map[string]baseapp.GRPCQueryHandler{ queryPath: func(ctx sdk.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error) { resBz, err := cdc.Marshal(&expectedRet) @@ -259,12 +353,12 @@ func Test_QueryCosmos(t *testing.T) { } func Test_ToDenom(t *testing.T) { - ctx, cdc, ac, ak := setup() + ctx, cdc, ac, ak, bk := setup() erc20Addr := common.HexToAddress("0x123") denom := "evm/0000000000000000000000000000000000000123" - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, &MockERC20DenomKeeper{ + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, &MockERC20DenomKeeper{ denomMap: map[string]common.Address{ denom: erc20Addr, }, @@ -301,12 +395,12 @@ func Test_ToDenom(t *testing.T) { } func Test_ToErc20(t *testing.T) { - ctx, cdc, ac, ak := setup() + ctx, cdc, ac, ak, bk := setup() erc20Addr := common.HexToAddress("0x123") denom := "evm/0000000000000000000000000000000000000123" - cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, &MockERC20DenomKeeper{ + cosmosPrecompile, err := precompiles.NewCosmosPrecompile(cdc, ac, ak, bk, &MockERC20DenomKeeper{ denomMap: map[string]common.Address{ denom: erc20Addr, }, @@ -346,17 +440,20 @@ var _ types.AccountKeeper = &MockAccountKeeper{} // mock account keeper for testing type MockAccountKeeper struct { + ac address.Codec accounts map[string]sdk.AccountI } // GetAccount implements types.AccountKeeper. func (k MockAccountKeeper) GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI { - return k.accounts[addr.String()] + str, _ := k.ac.BytesToString(addr.Bytes()) + return k.accounts[str] } // HasAccount implements types.AccountKeeper. func (k MockAccountKeeper) HasAccount(ctx context.Context, addr sdk.AccAddress) bool { - _, ok := k.accounts[addr.String()] + str, _ := k.ac.BytesToString(addr.Bytes()) + _, ok := k.accounts[str] return ok } @@ -378,7 +475,22 @@ func (k MockAccountKeeper) NextAccountNumber(ctx context.Context) uint64 { // SetAccount implements types.AccountKeeper. func (k MockAccountKeeper) SetAccount(ctx context.Context, acc sdk.AccountI) { - k.accounts[acc.GetAddress().String()] = acc + str, _ := k.ac.BytesToString(acc.GetAddress().Bytes()) + k.accounts[str] = acc +} + +var _ types.BankKeeper = &MockBankKeeper{} + +// mock bank keeper for testing +type MockBankKeeper struct { + ac address.Codec + blockedAddresses map[string]bool +} + +// BlockedAddr implements types.BankKeeper. +func (k MockBankKeeper) BlockedAddr(addr sdk.AccAddress) bool { + str, _ := k.ac.BytesToString(addr.Bytes()) + return k.blockedAddresses[str] } var _ types.GRPCRouter = MockGRPCRouter{} diff --git a/x/evm/precompiles/cosmos/types.go b/x/evm/precompiles/cosmos/types.go index 5b37d98..c1e88f0 100644 --- a/x/evm/precompiles/cosmos/types.go +++ b/x/evm/precompiles/cosmos/types.go @@ -6,6 +6,16 @@ import ( "github.com/ethereum/go-ethereum/common" ) +// IsBlockedAddressArguments is the arguments for the is_blocked_address method. +type IsBlockedAddressArguments struct { + Address common.Address `abi:"address"` +} + +// IsModuleAddressArguments is the arguments for the is_module_address method. +type IsModuleAddressArguments struct { + Address common.Address `abi:"address"` +} + // ToCosmosAddressArguments is the arguments for the to_cosmos_address method. type ToCosmosAddressArguments struct { EVMAddress common.Address `abi:"evm_address"` @@ -38,20 +48,30 @@ type ToERC20Arguments struct { } const ( + IS_BLOCKED_ADDRESS_GAS storetypes.Gas = 100 + IS_MODULE_ADDRESS_GAS storetypes.Gas = 200 + TO_COSMOS_ADDRESS_GAS storetypes.Gas = 200 TO_EVM_ADDRESS_GAS storetypes.Gas = 200 - TO_DENOM_GAS storetypes.Gas = 100 - TO_ERC20_GAS storetypes.Gas = 100 - EXECUTE_COSMOS_GAS storetypes.Gas = 200 - QUERY_COSMOS_GAS storetypes.Gas = 200 - GAS_PER_BYTE storetypes.Gas = 1 + + TO_DENOM_GAS storetypes.Gas = 100 + TO_ERC20_GAS storetypes.Gas = 100 + + EXECUTE_COSMOS_GAS storetypes.Gas = 200 + QUERY_COSMOS_GAS storetypes.Gas = 200 + GAS_PER_BYTE storetypes.Gas = 1 ) const ( + METHOD_IS_BLOCKED_ADDRESS = "is_blocked_address" + METHOD_IS_MODULE_ADDRESS = "is_module_address" + METHOD_TO_COSMOS_ADDRESS = "to_cosmos_address" METHOD_TO_EVM_ADDRESS = "to_evm_address" - METHOD_EXECUTE_COSMOS = "execute_cosmos" - METHOD_QUERY_COSMOS = "query_cosmos" - METHOD_TO_DENOM = "to_denom" - METHOD_TO_ERC20 = "to_erc20" + + METHOD_EXECUTE_COSMOS = "execute_cosmos" + METHOD_QUERY_COSMOS = "query_cosmos" + + METHOD_TO_DENOM = "to_denom" + METHOD_TO_ERC20 = "to_erc20" ) diff --git a/x/evm/types/expected_keeper.go b/x/evm/types/expected_keeper.go index c4155f9..b6a8362 100644 --- a/x/evm/types/expected_keeper.go +++ b/x/evm/types/expected_keeper.go @@ -25,6 +25,11 @@ type AccountKeeper interface { NextAccountNumber(ctx context.Context) uint64 } +// BankKeeper is expected keeper for bank module +type BankKeeper interface { + BlockedAddr(addr sdk.AccAddress) bool +} + type CommunityPoolKeeper interface { // FundCommunityPool allows an account to directly fund the community fund pool. FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error