From 264ad934a255b823f0fe6a9290ede3083f529238 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Tue, 31 Dec 2024 00:29:45 +0100 Subject: [PATCH 1/7] feat: add precompile for calling bank to evm from evm --- .../contracts/IFunToken.sol/IFunToken.json | 58 +++++ .../TestERC20TransferThenPrecompileSend.json | 4 +- .../TestFunTokenPrecompileLocalGas.json | 4 +- .../TestInfiniteRecursionERC20.json | 4 +- .../TestNativeSendThenPrecompileSend.json | 4 +- .../TestPrecompileSelfCallRevert.json | 4 +- x/evm/embeds/contracts/IFunToken.sol | 33 +++ x/evm/precompile/funtoken.go | 229 ++++++++++++++++++ x/evm/precompile/funtoken_test.go | 129 ++++++++++ x/evm/precompile/precompile.go | 3 + 10 files changed, 462 insertions(+), 10 deletions(-) diff --git a/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json b/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json index 39c5d7aef..95639810e 100644 --- a/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json +++ b/x/evm/embeds/artifacts/contracts/IFunToken.sol/IFunToken.json @@ -126,6 +126,35 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "string", + "name": "to", + "type": "string" + }, + { + "internalType": "string", + "name": "bankDenom", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "bankMsgSend", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -155,6 +184,35 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "string", + "name": "bankDenom", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "to", + "type": "string" + } + ], + "name": "sendToEvm", + "outputs": [ + { + "internalType": "uint256", + "name": "sentAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json b/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json index 7e02b8803..29379be49 100644 --- a/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json +++ b/x/evm/embeds/artifacts/contracts/TestERC20TransferThenPrecompileSend.sol/TestERC20TransferThenPrecompileSend.json @@ -43,8 +43,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610c4c380380610c4c833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b35806101176000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220ac87f92bb48cb96c0379f7c364f408a4b71d1e0ac35283db4a4b8e4963d94c4564736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220ac87f92bb48cb96c0379f7c364f408a4b71d1e0ac35283db4a4b8e4963d94c4564736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610c4c380380610c4c833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b35806101176000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220783c8a20928bb49fa50669185a23660461b2187d96626a4b380620b32bbee5e864736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063264c325814610030575b600080fd5b61004a6004803603810190610045919061065c565b61004c565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b81526004016100a792919061074d565b6020604051808303816000875af11580156100c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ea91906107ae565b610129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161012090610838565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b815260040161018a939291906108e7565b6020604051808303816000875af11580156101a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd919061093a565b90508181146101db8261024d565b6101e48461024d565b6040516020016101f5929190610a61565b60405160208183030381529060405290610245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023c9190610aae565b60405180910390fd5b505050505050565b60606000600161025c8461031b565b01905060008167ffffffffffffffff81111561027b5761027a610531565b5b6040519080825280601f01601f1916602001820160405280156102ad5781602001600182028036833780820191505090505b509050600082602001820190505b600115610310578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161030457610303610ad0565b5b049450600085036102bb575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610379577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161036f5761036e610ad0565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106103b6576d04ee2d6d415b85acef810000000083816103ac576103ab610ad0565b5b0492506020810190505b662386f26fc1000083106103e557662386f26fc1000083816103db576103da610ad0565b5b0492506010810190505b6305f5e100831061040e576305f5e100838161040457610403610ad0565b5b0492506008810190505b612710831061043357612710838161042957610428610ad0565b5b0492506004810190505b60648310610456576064838161044c5761044b610ad0565b5b0492506002810190505b600a8310610465576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ad82610482565b9050919050565b6104bd816104a2565b81146104c857600080fd5b50565b6000813590506104da816104b4565b92915050565b6000819050919050565b6104f3816104e0565b81146104fe57600080fd5b50565b600081359050610510816104ea565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61056982610520565b810181811067ffffffffffffffff8211171561058857610587610531565b5b80604052505050565b600061059b61046e565b90506105a78282610560565b919050565b600067ffffffffffffffff8211156105c7576105c6610531565b5b6105d082610520565b9050602081019050919050565b82818337600083830152505050565b60006105ff6105fa846105ac565b610591565b90508281526020810184848401111561061b5761061a61051b565b5b6106268482856105dd565b509392505050565b600082601f83011261064357610642610516565b5b81356106538482602086016105ec565b91505092915050565b6000806000806080858703121561067657610675610478565b5b6000610684878288016104cb565b945050602061069587828801610501565b935050604085013567ffffffffffffffff8111156106b6576106b561047d565b5b6106c28782880161062e565b92505060606106d387828801610501565b91505092959194509250565b6000819050919050565b60006107046106ff6106fa84610482565b6106df565b610482565b9050919050565b6000610716826106e9565b9050919050565b60006107288261070b565b9050919050565b6107388161071d565b82525050565b610747816104e0565b82525050565b6000604082019050610762600083018561072f565b61076f602083018461073e565b9392505050565b60008115159050919050565b61078b81610776565b811461079657600080fd5b50565b6000815190506107a881610782565b92915050565b6000602082840312156107c4576107c3610478565b5b60006107d284828501610799565b91505092915050565b600082825260208201905092915050565b7f4552432d3230207472616e73666572206661696c656400000000000000000000600082015250565b60006108226016836107db565b915061082d826107ec565b602082019050919050565b6000602082019050818103600083015261085181610815565b9050919050565b600061086382610482565b9050919050565b61087381610858565b82525050565b600081519050919050565b60005b838110156108a2578082015181840152602081019050610887565b60008484015250505050565b60006108b982610879565b6108c381856107db565b93506108d3818560208601610884565b6108dc81610520565b840191505092915050565b60006060820190506108fc600083018661086a565b610909602083018561073e565b818103604083015261091b81846108ae565b9050949350505050565b600081519050610934816104ea565b92915050565b6000602082840312156109505761094f610478565b5b600061095e84828501610925565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109ce603f83610967565b91506109d982610972565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b6000610a1582610879565b610a1f8185610967565b9350610a2f818560208601610884565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a6c826109c1565b9150610a77826109e4565b600b82019150610a878285610a0a565b9150610a9282610a3b565b600982019150610aa28284610a0a565b91508190509392505050565b60006020820190508181036000830152610ac881846108ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220783c8a20928bb49fa50669185a23660461b2187d96626a4b380620b32bbee5e864736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json b/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json index 95e833a22..ebadfca2b 100644 --- a/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json +++ b/x/evm/embeds/artifacts/contracts/TestFunTokenPrecompileLocalGas.sol/TestFunTokenPrecompileLocalGas.json @@ -56,8 +56,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610b6a380380610b6a833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610a53806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212201e8ad92ef8f92a3e60b70a83c52bfc446727e39e482a331186bfeb6a9b0b461964736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea26469706673582212201e8ad92ef8f92a3e60b70a83c52bfc446727e39e482a331186bfeb6a9b0b461964736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610b6a380380610b6a833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610a53806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122003577abccdb4e4fd74f0d84bd94f7f82d4b8dde9478c7dcfbd70a8d6620304e964736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806359b6ed891461003b57806390d2b5e714610057575b600080fd5b6100556004803603810190610050919061066b565b610073565b005b610071600480360381019061006c91906106da565b610198565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf8360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687876040518563ffffffff1660e01b81526004016100d593929190610805565b60206040518083038160008887f11580156100f4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906101199190610858565b9050838114610127826102ba565b610130866102ba565b60405160200161014192919061097f565b60405160208183030381529060405290610191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018891906109cc565b60405180910390fd5b5050505050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040518463ffffffff1660e01b81526004016101f993929190610805565b6020604051808303816000875af1158015610218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023c9190610858565b905082811461024a826102ba565b610253856102ba565b60405160200161026492919061097f565b604051602081830303815290604052906102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab91906109cc565b60405180910390fd5b50505050565b6060600060016102c984610388565b01905060008167ffffffffffffffff8111156102e8576102e7610540565b5b6040519080825280601f01601f19166020018201604052801561031a5781602001600182028036833780820191505090505b509050600082602001820190505b60011561037d578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581610371576103706109ee565b5b04945060008503610328575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103e6577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103dc576103db6109ee565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310610423576d04ee2d6d415b85acef81000000008381610419576104186109ee565b5b0492506020810190505b662386f26fc10000831061045257662386f26fc100008381610448576104476109ee565b5b0492506010810190505b6305f5e100831061047b576305f5e1008381610471576104706109ee565b5b0492506008810190505b61271083106104a0576127108381610496576104956109ee565b5b0492506004810190505b606483106104c357606483816104b9576104b86109ee565b5b0492506002810190505b600a83106104d2576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b610502816104ef565b811461050d57600080fd5b50565b60008135905061051f816104f9565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105788261052f565b810181811067ffffffffffffffff8211171561059757610596610540565b5b80604052505050565b60006105aa6104db565b90506105b6828261056f565b919050565b600067ffffffffffffffff8211156105d6576105d5610540565b5b6105df8261052f565b9050602081019050919050565b82818337600083830152505050565b600061060e610609846105bb565b6105a0565b90508281526020810184848401111561062a5761062961052a565b5b6106358482856105ec565b509392505050565b600082601f83011261065257610651610525565b5b81356106628482602086016105fb565b91505092915050565b600080600060608486031215610684576106836104e5565b5b600061069286828701610510565b935050602084013567ffffffffffffffff8111156106b3576106b26104ea565b5b6106bf8682870161063d565b92505060406106d086828701610510565b9150509250925092565b600080604083850312156106f1576106f06104e5565b5b60006106ff85828601610510565b925050602083013567ffffffffffffffff8111156107205761071f6104ea565b5b61072c8582860161063d565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076182610736565b9050919050565b61077181610756565b82525050565b610780816104ef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156107c05780820151818401526020810190506107a5565b60008484015250505050565b60006107d782610786565b6107e18185610791565b93506107f18185602086016107a2565b6107fa8161052f565b840191505092915050565b600060608201905061081a6000830186610768565b6108276020830185610777565b818103604083015261083981846107cc565b9050949350505050565b600081519050610852816104f9565b92915050565b60006020828403121561086e5761086d6104e5565b5b600061087c84828501610843565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006108ec603f83610885565b91506108f782610890565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061093382610786565b61093d8185610885565b935061094d8185602086016107a2565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b600061098a826108df565b915061099582610902565b600b820191506109a58285610928565b91506109b082610959565b6009820191506109c08284610928565b91508190509392505050565b600060208201905081810360008301526109e681846107cc565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122003577abccdb4e4fd74f0d84bd94f7f82d4b8dde9478c7dcfbd70a8d6620304e964736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json b/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json index 536693168..4024afd53 100644 --- a/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json +++ b/x/evm/embeds/artifacts/contracts/TestInfiniteRecursionERC20.sol/TestInfiniteRecursionERC20.json @@ -309,8 +309,8 @@ "type": "function" } ], - "bytecode": "0x60806040523480156200001157600080fd5b5060405162001df438038062001df48339818101604052810190620000379190620003cc565b828281600390816200004a9190620006b1565b5080600490816200005c9190620006b1565b5050506200007b3369d3c21bcecceda10000006200008460201b60201c565b505050620008b3565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620000f6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000ed90620007f9565b60405180910390fd5b6200010a60008383620001f160201b60201c565b80600260008282546200011e91906200084a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620001d1919062000896565b60405180910390a3620001ed60008383620001f660201b60201c565b5050565b505050565b505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002648262000219565b810181811067ffffffffffffffff821117156200028657620002856200022a565b5b80604052505050565b60006200029b620001fb565b9050620002a9828262000259565b919050565b600067ffffffffffffffff821115620002cc57620002cb6200022a565b5b620002d78262000219565b9050602081019050919050565b60005b8381101562000304578082015181840152602081019050620002e7565b60008484015250505050565b6000620003276200032184620002ae565b6200028f565b90508281526020810184848401111562000346576200034562000214565b5b62000353848285620002e4565b509392505050565b600082601f8301126200037357620003726200020f565b5b81516200038584826020860162000310565b91505092915050565b600060ff82169050919050565b620003a6816200038e565b8114620003b257600080fd5b50565b600081519050620003c6816200039b565b92915050565b600080600060608486031215620003e857620003e762000205565b5b600084015167ffffffffffffffff8111156200040957620004086200020a565b5b62000417868287016200035b565b935050602084015167ffffffffffffffff8111156200043b576200043a6200020a565b5b62000449868287016200035b565b92505060406200045c86828701620003b5565b9150509250925092565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004b957607f821691505b602082108103620004cf57620004ce62000471565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620005397fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620004fa565b620005458683620004fa565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005926200058c62000586846200055d565b62000567565b6200055d565b9050919050565b6000819050919050565b620005ae8362000571565b620005c6620005bd8262000599565b84845462000507565b825550505050565b600090565b620005dd620005ce565b620005ea818484620005a3565b505050565b5b81811015620006125762000606600082620005d3565b600181019050620005f0565b5050565b601f82111562000661576200062b81620004d5565b6200063684620004ea565b8101602085101562000646578190505b6200065e6200065585620004ea565b830182620005ef565b50505b505050565b600082821c905092915050565b6000620006866000198460080262000666565b1980831691505092915050565b6000620006a1838362000673565b9150826002028217905092915050565b620006bc8262000466565b67ffffffffffffffff811115620006d857620006d76200022a565b5b620006e48254620004a0565b620006f182828562000616565b600060209050601f83116001811462000729576000841562000714578287015190505b62000720858262000693565b86555062000790565b601f1984166200073986620004d5565b60005b8281101562000763578489015182556001820191506020850194506020810190506200073c565b868310156200078357848901516200077f601f89168262000673565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000620007e1601f8362000798565b9150620007ee82620007a9565b602082019050919050565b600060208201905081810360008301526200081481620007d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000857826200055d565b915062000864836200055d565b92508282019050808211156200087f576200087e6200081b565b5b92915050565b62000890816200055d565b82525050565b6000602082019050620008ad600083018462000885565b92915050565b61153180620008c36000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea264697066735822122096c68f812e5de57f5cf1d71e46f7d6a21c025911ca1f9c5f849f3bb63235d4e764736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea264697066735822122096c68f812e5de57f5cf1d71e46f7d6a21c025911ca1f9c5f849f3bb63235d4e764736f6c63430008180033", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162001df438038062001df48339818101604052810190620000379190620003cc565b828281600390816200004a9190620006b1565b5080600490816200005c9190620006b1565b5050506200007b3369d3c21bcecceda10000006200008460201b60201c565b505050620008b3565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620000f6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000ed90620007f9565b60405180910390fd5b6200010a60008383620001f160201b60201c565b80600260008282546200011e91906200084a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620001d1919062000896565b60405180910390a3620001ed60008383620001f660201b60201c565b5050565b505050565b505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620002648262000219565b810181811067ffffffffffffffff821117156200028657620002856200022a565b5b80604052505050565b60006200029b620001fb565b9050620002a9828262000259565b919050565b600067ffffffffffffffff821115620002cc57620002cb6200022a565b5b620002d78262000219565b9050602081019050919050565b60005b8381101562000304578082015181840152602081019050620002e7565b60008484015250505050565b6000620003276200032184620002ae565b6200028f565b90508281526020810184848401111562000346576200034562000214565b5b62000353848285620002e4565b509392505050565b600082601f8301126200037357620003726200020f565b5b81516200038584826020860162000310565b91505092915050565b600060ff82169050919050565b620003a6816200038e565b8114620003b257600080fd5b50565b600081519050620003c6816200039b565b92915050565b600080600060608486031215620003e857620003e762000205565b5b600084015167ffffffffffffffff8111156200040957620004086200020a565b5b62000417868287016200035b565b935050602084015167ffffffffffffffff8111156200043b576200043a6200020a565b5b62000449868287016200035b565b92505060406200045c86828701620003b5565b9150509250925092565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004b957607f821691505b602082108103620004cf57620004ce62000471565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620005397fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620004fa565b620005458683620004fa565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005926200058c62000586846200055d565b62000567565b6200055d565b9050919050565b6000819050919050565b620005ae8362000571565b620005c6620005bd8262000599565b84845462000507565b825550505050565b600090565b620005dd620005ce565b620005ea818484620005a3565b505050565b5b81811015620006125762000606600082620005d3565b600181019050620005f0565b5050565b601f82111562000661576200062b81620004d5565b6200063684620004ea565b8101602085101562000646578190505b6200065e6200065585620004ea565b830182620005ef565b50505b505050565b600082821c905092915050565b6000620006866000198460080262000666565b1980831691505092915050565b6000620006a1838362000673565b9150826002028217905092915050565b620006bc8262000466565b67ffffffffffffffff811115620006d857620006d76200022a565b5b620006e48254620004a0565b620006f182828562000616565b600060209050601f83116001811462000729576000841562000714578287015190505b62000720858262000693565b86555062000790565b601f1984166200073986620004d5565b60005b8281101562000763578489015182556001820191506020850194506020810190506200073c565b868310156200078357848901516200077f601f89168262000673565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000620007e1601f8362000798565b9150620007ee82620007a9565b602082019050919050565b600060208201905081810360008301526200081481620007d2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000857826200055d565b915062000864836200055d565b92508282019050808211156200087f576200087e6200081b565b5b92915050565b62000890816200055d565b82525050565b6000602082019050620008ad600083018462000885565b92915050565b61153180620008c36000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea2646970667358221220989eb8d75426fcd7e05d5156716cf062c650c6b510d482c23a388dc04773deb864736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c57806395d89b411161006657806395d89b4114610202578063a457c2d714610220578063a9059cbb14610250578063dd62ed3e14610280576100cf565b806370a08231146101be5780637a7ffab0146101ee5780638cd64727146101f8576100cf565b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461012257806323b872dd14610140578063313ce56714610170578063395093511461018e575b600080fd5b6100dc6102b0565b6040516100e99190610c88565b60405180910390f35b61010c60048036038101906101079190610d43565b610342565b6040516101199190610d9e565b60405180910390f35b61012a610365565b6040516101379190610dc8565b60405180910390f35b61015a60048036038101906101559190610de3565b61036f565b6040516101679190610d9e565b60405180910390f35b61017861039e565b6040516101859190610e52565b60405180910390f35b6101a860048036038101906101a39190610d43565b6103a7565b6040516101b59190610d9e565b60405180910390f35b6101d860048036038101906101d39190610e6d565b6103de565b6040516101e59190610dc8565b60405180910390f35b6101f66104e2565b005b6102006104f1565b005b61020a6104fe565b6040516102179190610c88565b60405180910390f35b61023a60048036038101906102359190610d43565b610590565b6040516102479190610d9e565b60405180910390f35b61026a60048036038101906102659190610d43565b610607565b6040516102779190610d9e565b60405180910390f35b61029a60048036038101906102959190610e9a565b610694565b6040516102a79190610dc8565b60405180910390f35b6060600380546102bf90610f09565b80601f01602080910402602001604051908101604052809291908181526020018280546102eb90610f09565b80156103385780601f1061030d57610100808354040283529160200191610338565b820191906000526020600020905b81548152906001019060200180831161031b57829003601f168201915b5050505050905090565b60008061034d61071b565b905061035a818585610723565b600191505092915050565b6000600254905090565b60008061037a61071b565b90506103878582856108ec565b610392858585610978565b60019150509392505050565b60006012905090565b6000806103b261071b565b90506103d38185856103c48589610694565b6103ce9190610f69565b610723565b600191505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff16823060405160240161040c929190610fac565b6040516020818303038152906040527fb203bb99000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610496919061101c565b600060405180830381855afa9150503d80600081146104d1576040519150601f19603f3d011682016040523d82523d6000602084013e6104d6565b606091505b50505060009050919050565b6104ee60006001610607565b50565b6104fb60006103de565b50565b60606004805461050d90610f09565b80601f016020809104026020016040519081016040528092919081815260200182805461053990610f09565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b60008061059b61071b565b905060006105a98286610694565b9050838110156105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906110a5565b60405180910390fd5b6105fb8286868403610723565b60019250505092915050565b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf30846040518363ffffffff1660e01b8152600401610646929190611137565b6020604051808303816000875af1158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190611188565b506001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990611227565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f8906112b9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516108df9190610dc8565b60405180910390a3505050565b60006108f88484610694565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109725781811015610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90611325565b60405180910390fd5b6109718484848403610723565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109de906113b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4d90611449565b60405180910390fd5b610a61838383610bee565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade906114db565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd59190610dc8565b60405180910390a3610be8848484610bf3565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610c32578082015181840152602081019050610c17565b60008484015250505050565b6000601f19601f8301169050919050565b6000610c5a82610bf8565b610c648185610c03565b9350610c74818560208601610c14565b610c7d81610c3e565b840191505092915050565b60006020820190508181036000830152610ca28184610c4f565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610cda82610caf565b9050919050565b610cea81610ccf565b8114610cf557600080fd5b50565b600081359050610d0781610ce1565b92915050565b6000819050919050565b610d2081610d0d565b8114610d2b57600080fd5b50565b600081359050610d3d81610d17565b92915050565b60008060408385031215610d5a57610d59610caa565b5b6000610d6885828601610cf8565b9250506020610d7985828601610d2e565b9150509250929050565b60008115159050919050565b610d9881610d83565b82525050565b6000602082019050610db36000830184610d8f565b92915050565b610dc281610d0d565b82525050565b6000602082019050610ddd6000830184610db9565b92915050565b600080600060608486031215610dfc57610dfb610caa565b5b6000610e0a86828701610cf8565b9350506020610e1b86828701610cf8565b9250506040610e2c86828701610d2e565b9150509250925092565b600060ff82169050919050565b610e4c81610e36565b82525050565b6000602082019050610e676000830184610e43565b92915050565b600060208284031215610e8357610e82610caa565b5b6000610e9184828501610cf8565b91505092915050565b60008060408385031215610eb157610eb0610caa565b5b6000610ebf85828601610cf8565b9250506020610ed085828601610cf8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610f2157607f821691505b602082108103610f3457610f33610eda565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610f7482610d0d565b9150610f7f83610d0d565b9250828201905080821115610f9757610f96610f3a565b5b92915050565b610fa681610ccf565b82525050565b6000604082019050610fc16000830185610f9d565b610fce6020830184610f9d565b9392505050565b600081519050919050565b600081905092915050565b6000610ff682610fd5565b6110008185610fe0565b9350611010818560208601610c14565b80840191505092915050565b60006110288284610feb565b915081905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b600061108f602583610c03565b915061109a82611033565b604082019050919050565b600060208201905081810360008301526110be81611082565b9050919050565b7f6e696269317a616176767a78657a30656c756e64746e3332716e6b396c6b6d3860008201527f6b6d63737a34346737786c000000000000000000000000000000000000000000602082015250565b6000611121602b83610c03565b915061112c826110c5565b604082019050919050565b600060608201905061114c6000830185610f9d565b6111596020830184610db9565b818103604083015261116a81611114565b90509392505050565b60008151905061118281610d17565b92915050565b60006020828403121561119e5761119d610caa565b5b60006111ac84828501611173565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611211602483610c03565b915061121c826111b5565b604082019050919050565b6000602082019050818103600083015261124081611204565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006112a3602283610c03565b91506112ae82611247565b604082019050919050565b600060208201905081810360008301526112d281611296565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061130f601d83610c03565b915061131a826112d9565b602082019050919050565b6000602082019050818103600083015261133e81611302565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006113a1602583610c03565b91506113ac82611345565b604082019050919050565b600060208201905081810360008301526113d081611394565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611433602383610c03565b915061143e826113d7565b604082019050919050565b6000602082019050818103600083015261146281611426565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006114c5602683610c03565b91506114d082611469565b604082019050919050565b600060208201905081810360008301526114f4816114b8565b905091905056fea2646970667358221220989eb8d75426fcd7e05d5156716cf062c650c6b510d482c23a388dc04773deb864736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json b/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json index 7891904a1..a1ab5fbe0 100644 --- a/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json +++ b/x/evm/embeds/artifacts/contracts/TestNativeSendThenPrecompileSend.sol/TestNativeSendThenPrecompileSend.json @@ -61,8 +61,8 @@ "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610ca1380380610ca1833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b8a806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220537a99126d8c145114145f22552a791dfb3e2b30393022b159f7c2e0d8db2aa064736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220537a99126d8c145114145f22552a791dfb3e2b30393022b159f7c2e0d8db2aa064736f6c63430008180033", + "bytecode": "0x608060405234801561001057600080fd5b50604051610ca1380380610ca1833981810160405281019061003291906100db565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a88261007d565b9050919050565b6100b88161009d565b81146100c357600080fd5b50565b6000815190506100d5816100af565b92915050565b6000602082840312156100f1576100f0610078565b5b60006100ff848285016100c6565b91505092915050565b610b8a806101176000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220e60f92b2e19cc7592fc1d85fec6b0b86ef692945179286c794b70547e8dbf98f64736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630a04fd4d1461003b578063a4de557414610057575b600080fd5b610055600480360381019061005091906106e4565b610073565b005b610071600480360381019061006c919061079e565b610195565b005b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016100d4939291906108d0565b6020604051808303816000875af11580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610923565b905081811461012582610333565b61012e84610333565b60405160200161013f929190610a4a565b6040516020818303038152906040529061018f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101869190610a97565b60405180910390fd5b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505090508061020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020590610b05565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685876040518463ffffffff1660e01b815260040161026f939291906108d0565b6020604051808303816000875af115801561028e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b29190610923565b90508281146102c082610333565b6102c985610333565b6040516020016102da929190610a4a565b6040516020818303038152906040529061032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103219190610a97565b60405180910390fd5b50505050505050565b60606000600161034284610401565b01905060008167ffffffffffffffff81111561036157610360610583565b5b6040519080825280601f01601f1916602001820160405280156103935781602001600182028036833780820191505090505b509050600082602001820190505b6001156103f6578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85816103ea576103e9610b25565b5b049450600085036103a1575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061045f577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161045557610454610b25565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061049c576d04ee2d6d415b85acef8100000000838161049257610491610b25565b5b0492506020810190505b662386f26fc1000083106104cb57662386f26fc1000083816104c1576104c0610b25565b5b0492506010810190505b6305f5e10083106104f4576305f5e10083816104ea576104e9610b25565b5b0492506008810190505b612710831061051957612710838161050f5761050e610b25565b5b0492506004810190505b6064831061053c576064838161053257610531610b25565b5b0492506002810190505b600a831061054b576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105bb82610572565b810181811067ffffffffffffffff821117156105da576105d9610583565b5b80604052505050565b60006105ed610554565b90506105f982826105b2565b919050565b600067ffffffffffffffff82111561061957610618610583565b5b61062282610572565b9050602081019050919050565b82818337600083830152505050565b600061065161064c846105fe565b6105e3565b90508281526020810184848401111561066d5761066c61056d565b5b61067884828561062f565b509392505050565b600082601f83011261069557610694610568565b5b81356106a584826020860161063e565b91505092915050565b6000819050919050565b6106c1816106ae565b81146106cc57600080fd5b50565b6000813590506106de816106b8565b92915050565b600080604083850312156106fb576106fa61055e565b5b600083013567ffffffffffffffff81111561071957610718610563565b5b61072585828601610680565b9250506020610736858286016106cf565b9150509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061076b82610740565b9050919050565b61077b81610760565b811461078657600080fd5b50565b60008135905061079881610772565b92915050565b600080600080608085870312156107b8576107b761055e565b5b60006107c687828801610789565b94505060206107d7878288016106cf565b935050604085013567ffffffffffffffff8111156107f8576107f7610563565b5b61080487828801610680565b9250506060610815878288016106cf565b91505092959194509250565b600061082c82610740565b9050919050565b61083c81610821565b82525050565b61084b816106ae565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561088b578082015181840152602081019050610870565b60008484015250505050565b60006108a282610851565b6108ac818561085c565b93506108bc81856020860161086d565b6108c581610572565b840191505092915050565b60006060820190506108e56000830186610833565b6108f26020830185610842565b81810360408301526109048184610897565b9050949350505050565b60008151905061091d816106b8565b92915050565b6000602082840312156109395761093861055e565b5b60006109478482850161090e565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b60006109b7603f83610950565b91506109c28261095b565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b60006109fe82610851565b610a088185610950565b9350610a1881856020860161086d565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b6000610a55826109aa565b9150610a60826109cd565b600b82019150610a7082856109f3565b9150610a7b82610a24565b600982019150610a8b82846109f3565b91508190509392505050565b60006020820190508181036000830152610ab18184610897565b905092915050565b7f4661696c656420746f2073656e64206e617469766520746f6b656e0000000000600082015250565b6000610aef601b8361085c565b9150610afa82610ab9565b602082019050919050565b60006020820190508181036000830152610b1e81610ae2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220e60f92b2e19cc7592fc1d85fec6b0b86ef692945179286c794b70547e8dbf98f64736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json b/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json index d71d6dfa1..804e24f2f 100644 --- a/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json +++ b/x/evm/embeds/artifacts/contracts/TestPrecompileSelfCallRevert.sol/TestPrecompileSelfCallRevert.json @@ -71,8 +71,8 @@ "type": "function" } ], - "bytecode": "0x60806040526000600155604051610c8e380380610c8e833981810160405281019061002a91906100d3565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a082610075565b9050919050565b6100b081610095565b81146100bb57600080fd5b50565b6000815190506100cd816100a7565b92915050565b6000602082840312156100e9576100e8610070565b5b60006100f7848285016100be565b91505092915050565b610b7f8061010f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122005e9d030e05589bcbd7f2b8c2c7891d3ff3059be6d273b8aa94f18f14212d30964736f6c63430008180033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea264697066735822122005e9d030e05589bcbd7f2b8c2c7891d3ff3059be6d273b8aa94f18f14212d30964736f6c63430008180033", + "bytecode": "0x60806040526000600155604051610c8e380380610c8e833981810160405281019061002a91906100d3565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610100565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a082610075565b9050919050565b6100b081610095565b81146100bb57600080fd5b50565b6000815190506100cd816100a7565b92915050565b6000602082840312156100e9576100e8610070565b5b60006100f7848285016100be565b91505092915050565b610b7f8061010f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220a2e5a61ed58998444a550a88c5afdbdcb76b8e7319a21464aa11c42574c5f2ca64736f6c63430008180033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636ad4fe961461003b578063705964db14610057575b600080fd5b610055600480360381019061005091906106c1565b610073565b005b610071600480360381019061006c91906106c1565b610208565b005b8373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050506100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906107a1565b60405180910390fd5b600061080073ffffffffffffffffffffffffffffffffffffffff1663e77a47bf60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684866040518463ffffffff1660e01b81526004016101489392919061085f565b6020604051808303816000875af1158015610167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018b91906108b2565b9050818114610199856102b2565b6101a2846102b2565b6040516020016101b39291906109d9565b60405160208183030381529060405290610203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fa9190610a26565b60405180910390fd5b600080fd5b6001600081548092919061021b90610a77565b91905055503073ffffffffffffffffffffffffffffffffffffffff16636ad4fe96858585856040518563ffffffff1660e01b815260040161025f9493929190610ace565b600060405180830381600087803b15801561027957600080fd5b505af192505050801561028a575060015b6102ab57600160008154809291906102a190610a77565b91905055506102ac565b5b50505050565b6060600060016102c184610380565b01905060008167ffffffffffffffff8111156102e0576102df610596565b5b6040519080825280601f01601f1916602001820160405280156103125781602001600182028036833780820191505090505b509050600082602001820190505b600115610375578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a858161036957610368610b1a565b5b04945060008503610320575b819350505050919050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106103de577a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083816103d4576103d3610b1a565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061041b576d04ee2d6d415b85acef8100000000838161041157610410610b1a565b5b0492506020810190505b662386f26fc10000831061044a57662386f26fc1000083816104405761043f610b1a565b5b0492506010810190505b6305f5e1008310610473576305f5e100838161046957610468610b1a565b5b0492506008810190505b612710831061049857612710838161048e5761048d610b1a565b5b0492506004810190505b606483106104bb57606483816104b1576104b0610b1a565b5b0492506002810190505b600a83106104ca576001810190505b80915050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610512826104e7565b9050919050565b61052281610507565b811461052d57600080fd5b50565b60008135905061053f81610519565b92915050565b6000819050919050565b61055881610545565b811461056357600080fd5b50565b6000813590506105758161054f565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6105ce82610585565b810181811067ffffffffffffffff821117156105ed576105ec610596565b5b80604052505050565b60006106006104d3565b905061060c82826105c5565b919050565b600067ffffffffffffffff82111561062c5761062b610596565b5b61063582610585565b9050602081019050919050565b82818337600083830152505050565b600061066461065f84610611565b6105f6565b9050828152602081018484840111156106805761067f610580565b5b61068b848285610642565b509392505050565b600082601f8301126106a8576106a761057b565b5b81356106b8848260208601610651565b91505092915050565b600080600080608085870312156106db576106da6104dd565b5b60006106e987828801610530565b94505060206106fa87828801610566565b935050604085013567ffffffffffffffff81111561071b5761071a6104e2565b5b61072787828801610693565b925050606061073887828801610566565b91505092959194509250565b600082825260208201905092915050565b7f455448207472616e73666572206661696c656400000000000000000000000000600082015250565b600061078b601383610744565b915061079682610755565b602082019050919050565b600060208201905081810360008301526107ba8161077e565b9050919050565b60006107cc826104e7565b9050919050565b6107dc816107c1565b82525050565b6107eb81610545565b82525050565b600081519050919050565b60005b8381101561081a5780820151818401526020810190506107ff565b60008484015250505050565b6000610831826107f1565b61083b8185610744565b935061084b8185602086016107fc565b61085481610585565b840191505092915050565b600060608201905061087460008301866107d3565b61088160208301856107e2565b81810360408301526108938184610826565b9050949350505050565b6000815190506108ac8161054f565b92915050565b6000602082840312156108c8576108c76104dd565b5b60006108d68482850161089d565b91505092915050565b600081905092915050565b7f4946756e546f6b656e2e73656e64546f42616e6b20737563636565646564206260008201527f7574207472616e73666572726564207468652077726f6e6720616d6f756e7400602082015250565b6000610946603f836108df565b9150610951826108ea565b603f82019050919050565b7f73656e74416d6f756e7420000000000000000000000000000000000000000000815250565b600061098d826107f1565b61099781856108df565b93506109a78185602086016107fc565b80840191505092915050565b7f6578706563746564200000000000000000000000000000000000000000000000815250565b60006109e482610939565b91506109ef8261095c565b600b820191506109ff8285610982565b9150610a0a826109b3565b600982019150610a1a8284610982565b91508190509392505050565b60006020820190508181036000830152610a408184610826565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610a8282610545565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610ab457610ab3610a48565b5b600182019050919050565b610ac881610507565b82525050565b6000608082019050610ae36000830187610abf565b610af060208301866107e2565b8181036040830152610b028185610826565b9050610b1160608301846107e2565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220a2e5a61ed58998444a550a88c5afdbdcb76b8e7319a21464aa11c42574c5f2ca64736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/x/evm/embeds/contracts/IFunToken.sol b/x/evm/embeds/contracts/IFunToken.sol index 7a943ef98..f42d297db 100644 --- a/x/evm/embeds/contracts/IFunToken.sol +++ b/x/evm/embeds/contracts/IFunToken.sol @@ -52,4 +52,37 @@ interface IFunToken is INibiruEvm { function whoAmI( string calldata who ) external returns (NibiruAccount memory whoAddrs); + + /** + * @dev sendToEvm transfers the caller's bank coin `denom` to its ERC-20 representation on the EVM side. + * The `to` argument must be either an Ethereum hex address (0x...) or a Bech32 address. + * + * The underlying logic mints (or un-escrows) the ERC-20 tokens to the `to` address if + * the funtoken mapping was originally minted from a coin. + * + * @param bankDenom The bank denom of the coin to send from the caller to the EVM side. + * @param amount The number of coins to send. + * @param to The Ethereum hex or bech32 address receiving the ERC-20. + * @return sentAmount The number of ERC-20 tokens minted or un-escrowed. + */ + function sendToEvm( + string calldata bankDenom, + uint256 amount, + string calldata to + ) external returns (uint256 sentAmount); + + /** + * @dev bankMsgSend performs a `cosmos.bank.v1beta1.MsgSend` from the caller + * into the Cosmos side, akin to running the standard `bank` module's send operation. + * + * @param to The recipient address (hex or bech32). + * @param bankDenom The bank coin denom to send. + * @param amount The number of coins to send. + * @return success True if the bank send succeeded, false otherwise. + */ + function bankMsgSend( + string calldata to, + string calldata bankDenom, + uint256 amount + ) external returns (bool success); } diff --git a/x/evm/precompile/funtoken.go b/x/evm/precompile/funtoken.go index 272d96b18..bf2fc586a 100644 --- a/x/evm/precompile/funtoken.go +++ b/x/evm/precompile/funtoken.go @@ -42,6 +42,8 @@ const ( FunTokenMethod_balance PrecompileMethod = "balance" FunTokenMethod_bankBalance PrecompileMethod = "bankBalance" FunTokenMethod_whoAmI PrecompileMethod = "whoAmI" + FunTokenMethod_sendToEvm PrecompileMethod = "sendToEvm" + FunTokenMethod_bankMsgSend PrecompileMethod = "bankMsgSend" ) // Run runs the precompiled contract @@ -72,6 +74,10 @@ func (p precompileFunToken) Run( bz, err = p.bankBalance(startResult, contract) case FunTokenMethod_whoAmI: bz, err = p.whoAmI(startResult, contract) + case FunTokenMethod_sendToEvm: + bz, err = p.sendToEvm(startResult, contract.CallerAddress, readonly) + case FunTokenMethod_bankMsgSend: + bz, err = p.bankMsgSend(startResult, contract.CallerAddress, readonly) default: // Note that this code path should be impossible to reach since // "[decomposeInput]" parses methods directly from the ABI. @@ -520,3 +526,226 @@ func (p precompileFunToken) parseArgsWhoAmI(args []any) ( } return addrEth, addrBech32, nil } + +func (p precompileFunToken) sendToEvm( + startResult OnRunStartResult, + caller gethcommon.Address, + readOnly bool, +) ([]byte, error) { + ctx, method, args := startResult.CacheCtx, startResult.Method, startResult.Args + if err := assertNotReadonlyTx(readOnly, method); err != nil { + return nil, err + } + // parse call: (string bankDenom, uint256 amount, string to) + bankDenom, amount, toStr, err := parseArgsSendToEvm(args) + if err != nil { + return nil, ErrInvalidArgs(err) + } + + // load the FunToken mapping + // For bankDenom, check if there's an existing funtoken + funtokens := p.evmKeeper.FunTokens.Collect( + ctx, p.evmKeeper.FunTokens.Indexes.BankDenom.ExactMatch(ctx, bankDenom), + ) + if len(funtokens) == 0 { + return nil, fmt.Errorf("no funtoken found for bank denom \"%s\"", bankDenom) + } + funtoken := funtokens[0] + + if amount == nil || amount.Sign() != 1 { + return nil, fmt.Errorf("transfer amount must be positive") + } + + // parse the `to` argument as hex or bech32 address + toEthAddr, err := parseToAddr(toStr) + if err != nil { + return nil, fmt.Errorf("recipient address invalid: %w", err) + } + + // 1) remove (burn or escrow) the bank coin from caller + coinToSend := sdk.NewCoin(funtoken.BankDenom, math.NewIntFromBigInt(amount)) + senderBech32 := eth.EthAddrToNibiruAddr(caller) + + // bank send from account => module + if err := p.evmKeeper.Bank.SendCoinsFromAccountToModule( + ctx, senderBech32, evm.ModuleName, sdk.NewCoins(coinToSend), + ); err != nil { + return nil, fmt.Errorf("failed to send coins to module: %w", err) + } + + // 2) mint (or unescrow) the ERC20 + erc20Addr := funtoken.Erc20Addr.Address + actualAmt, err := p.mintOrUnescrowERC20( + ctx, caller, erc20Addr, toEthAddr, coinToSend.Amount.BigInt(), funtoken, + ) + if err != nil { + return nil, err + } + + // return the number of tokens minted + return method.Outputs.Pack(actualAmt) +} + +func (p precompileFunToken) mintOrUnescrowERC20( + ctx sdk.Context, + caller gethcommon.Address, + erc20Addr gethcommon.Address, + to gethcommon.Address, + amount *big.Int, + funtoken evm.FunToken, +) (*big.Int, error) { + // If funtoken is "IsMadeFromCoin", we own the ERC20 contract, so we can mint. + // If not, we do a transfer from EVM module to 'to' address using escrowed tokens. + if funtoken.IsMadeFromCoin { + mintResp, err := p.evmKeeper.ERC20().Mint( + erc20Addr, + evm.EVM_MODULE_ADDRESS, + to, + amount, + ctx, + ) + if err != nil { + return nil, fmt.Errorf("mint erc20 error: %w", err) + } + // For an owner-minted contract, the entire `amount` is minted. + _ = mintResp // do something if needed, or remove + return amount, nil + } else { + balBefore, err := p.evmKeeper.ERC20().BalanceOf(erc20Addr, to, ctx) + if err != nil { + return nil, fmt.Errorf("balanceOf to check erc20 error: %w", err) + } + _, transferResp, err := p.evmKeeper.ERC20().Transfer( + erc20Addr, evm.EVM_MODULE_ADDRESS, to, amount, ctx, + ) + if err != nil { + return nil, fmt.Errorf("erc20.transfer from module to user: %w", err) + } + _ = transferResp // do something if needed, or remove + + balAfter, err := p.evmKeeper.ERC20().BalanceOf(erc20Addr, to, ctx) + if err != nil { + return nil, fmt.Errorf("balanceOf to check erc20 error: %w", err) + } + actualReceived := new(big.Int).Sub(balAfter, balBefore) + if actualReceived.Sign() <= 0 { + return nil, fmt.Errorf("failed: no tokens were actually unescrowed") + } + return actualReceived, nil + } +} + +// parse the arguments: (string bankDenom, uint256 amount, string to) +func parseArgsSendToEvm(args []any) (bankDenom string, amount *big.Int, to string, err error) { + if e := assertNumArgs(args, 3); e != nil { + return "", nil, "", e + } + var ok bool + // 0) bankDenom + bankDenom, ok = args[0].(string) + if !ok { + err = ErrArgTypeValidation("string bankDenom", args[0]) + return + } + // 1) amount + amount, ok = args[1].(*big.Int) + if !ok { + err = ErrArgTypeValidation("uint256 amount", args[1]) + return + } + // 2) to + to, ok = args[2].(string) + if !ok { + err = ErrArgTypeValidation("string to", args[2]) + return + } + return +} + +// parse a user-specified address "toStr" that might be bech32 or hex +func parseToAddr(toStr string) (gethcommon.Address, error) { + // check if bech32 or hex + if err := eth.ValidateAddress(toStr); err == nil { + // hex address + return gethcommon.HexToAddress(toStr), nil + } + // else try bech32 + nibAddr, e := sdk.AccAddressFromBech32(toStr) + if e != nil { + return gethcommon.Address{}, fmt.Errorf("invalid bech32 or hex address: %w", e) + } + return eth.NibiruAddrToEthAddr(nibAddr), nil +} + +// ------------------- +// 2) bankMsgSend +// ------------------- + +func (p precompileFunToken) bankMsgSend( + startResult OnRunStartResult, + caller gethcommon.Address, + readOnly bool, +) ([]byte, error) { + ctx, method, args := startResult.CacheCtx, startResult.Method, startResult.Args + if err := assertNotReadonlyTx(readOnly, method); err != nil { + return nil, err + } + + // parse call: (string to, string denom, uint256 amount) + toStr, denom, amount, err := parseArgsBankMsgSend(args) + if err != nil { + return nil, ErrInvalidArgs(err) + } + if amount.Sign() != 1 { + return nil, fmt.Errorf("msgSend amount must be positive") + } + + // parse toStr (bech32 or hex) + toEthAddr, e := parseToAddr(toStr) + if e != nil { + return nil, e + } + fromBech32 := eth.EthAddrToNibiruAddr(caller) + toBech32 := eth.EthAddrToNibiruAddr(toEthAddr) + + // do the bank send + coin := sdk.NewCoins(sdk.NewCoin(denom, math.NewIntFromBigInt(amount))) + if err := p.evmKeeper.Bank.SendCoins( + ctx, fromBech32, toBech32, coin, + ); err != nil { + return nil, fmt.Errorf("bankMsgSend: %w", err) + } + // Return bool success + return method.Outputs.Pack(true) +} + +func parseArgsBankMsgSend(args []any) (toStr, denom string, amount *big.Int, err error) { + if e := assertNumArgs(args, 3); e != nil { + err = e + return + } + // 0) to + var ok bool + toStr, ok = args[0].(string) + if !ok { + err = ErrArgTypeValidation("string to", args[0]) + return + } + + // 1) denom + denom, ok = args[1].(string) + if !ok { + err = ErrArgTypeValidation("string bankDenom", args[1]) + return + } + + // 2) amount + tmpAmount, ok := args[2].(*big.Int) + if !ok { + err = ErrArgTypeValidation("uint256 amount", args[2]) + return + } + amount = tmpAmount + + return +} diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 0e03f2870..822a964b6 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -428,3 +428,132 @@ func (s *FuntokenSuite) TestPrecompileLocalGas() { ) s.Require().ErrorContains(err, "execution reverted") } + +func (s *FuntokenSuite) TestSendToEvm() { + deps := evmtest.NewTestDeps() + + s.T().Log("1) Create a new FunToken from coin 'unibi'") + bankDenom := "unibi" + funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) + erc20Addr := funtoken.Erc20Addr.Address + + s.T().Log("2) Fund the sender with some unibi on the bank side") + err := testapp.FundAccount( + deps.App.BankKeeper, + deps.Ctx, + deps.Sender.NibiruAddr, + sdk.NewCoins(sdk.NewCoin(bankDenom, sdk.NewInt(1234))), + ) + s.Require().NoError(err) + + s.T().Log("Check the user starts with 0 ERC20 tokens") + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, big.NewInt(0)) + + s.T().Log("3) Call the new method: sendToEvm(string bankDenom, uint256 amount, string to)") + callArgs := []any{ + bankDenom, + big.NewInt(1000), // amount + deps.Sender.EthAddr.Hex(), // 'to' can be bech32 or hex + } + + input, err := embeds.SmartContract_FunToken.ABI.Pack( + "sendToEvm", + callArgs..., + ) + s.Require().NoError(err) + + deps.ResetGasMeter() + _, ethTxResp, err := evmtest.CallContractTx( + &deps, + precompile.PrecompileAddr_FunToken, + input, + deps.Sender, + ) + s.Require().NoError(err) + s.Require().Empty(ethTxResp.VmError, "sendToEvm VMError") + + s.T().Log("4) The response returns the actual minted/unescrowed amount") + var actualMinted *big.Int + err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface( + &actualMinted, "sendToEvm", ethTxResp.Ret, + ) + s.Require().NoError(err) + s.Require().EqualValues(1000, actualMinted.Int64(), "expect 1000 minted to EVM") + + s.T().Log("Check the user lost 1000 unibi in bank") + wantBank := big.NewInt(234) // 1234 - 1000 => 234 + bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, bankDenom).Amount.BigInt() + s.EqualValues(wantBank, bankBal, "did user lose 1000 unibi from bank?") + + s.T().Log("Check the user gained 1000 in ERC20 representation") + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, big.NewInt(1000)) +} + +func (s *FuntokenSuite) TestBankMsgSend() { + deps := evmtest.NewTestDeps() + + s.T().Log("1) Create a new FunToken from coin 'unibi'") + bankDenom := "unibi" + funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) + s.Require().NotEmpty(funtoken.BankDenom) + + s.T().Log("2) Fund the sender with 500 unibi in the bank module") + startAmount := int64(500) + err := testapp.FundAccount( + deps.App.BankKeeper, + deps.Ctx, + deps.Sender.NibiruAddr, + sdk.NewCoins(sdk.NewCoin(bankDenom, sdk.NewInt(startAmount))), + ) + s.Require().NoError(err) + + senderBalBefore := deps.App.BankKeeper.GetBalance( + deps.Ctx, deps.Sender.NibiruAddr, bankDenom, + ).Amount.Int64() + + s.T().Log("3) Call bankMsgSend(to, bankDenom, amount) from the EVM") + toAddr := testutil.AccAddress() + callArgs := []any{ + toAddr.String(), // 'to', can be hex or bech32 + bankDenom, // 'bankDenom' + big.NewInt(200), // amount + } + input, err := embeds.SmartContract_FunToken.ABI.Pack( + "bankMsgSend", + callArgs..., + ) + s.Require().NoError(err) + + deps.ResetGasMeter() + _, ethTxResp, err := evmtest.CallContractTx( + &deps, + precompile.PrecompileAddr_FunToken, + input, + deps.Sender, + ) + s.Require().NoError(err) + s.Require().Empty(ethTxResp.VmError) + + s.T().Log("4) The return value for bankMsgSend is a single bool (true if success)") + var success bool + err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface( + &success, + "bankMsgSend", + ethTxResp.Ret, + ) + s.Require().NoError(err) + s.True(success, "bankMsgSend should return bool=true if no error") + + s.T().Log("Confirm the user lost 200 unibi") + wantSenderBal := senderBalBefore - 200 + gotSenderBal := deps.App.BankKeeper.GetBalance( + deps.Ctx, deps.Sender.NibiruAddr, bankDenom, + ).Amount.Int64() + s.EqualValues(wantSenderBal, gotSenderBal, "sender unibi after bankMsgSend") + + s.T().Log("Confirm the 'toAddr' gained 200 unibi") + gotRecipientBal := deps.App.BankKeeper.GetBalance( + deps.Ctx, toAddr, bankDenom, + ).Amount.Int64() + s.EqualValues(200, gotRecipientBal, "recipient unibi after bankMsgSend") +} diff --git a/x/evm/precompile/precompile.go b/x/evm/precompile/precompile.go index 2c1f754e7..b7df0e845 100644 --- a/x/evm/precompile/precompile.go +++ b/x/evm/precompile/precompile.go @@ -227,6 +227,9 @@ var isMutation map[PrecompileMethod]bool = map[PrecompileMethod]bool{ FunTokenMethod_bankBalance: false, FunTokenMethod_whoAmI: false, + FunTokenMethod_sendToEvm: true, + FunTokenMethod_bankMsgSend: true, + OracleMethod_queryExchangeRate: false, } From 393701875d354f4145a08ee4fb611276f69f4537 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Tue, 31 Dec 2024 00:30:44 +0100 Subject: [PATCH 2/7] chore: changelog --- CHANGELOG.md | 77 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79d291174..b34f9d787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,15 +43,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Nibiru EVM - [#2119](https://github.com/NibiruChain/nibiru/pull/2119) - fix(evm): Guarantee -that gas consumed during any send operation of the "NibiruBankKeeper" depends -only on the "bankkeeper.BaseKeeper"'s gas consumption. -- [#2120](https://github.com/NibiruChain/nibiru/pull/2120) - fix: Use canonical hexadecimal strings for Eip155 address encoding + that gas consumed during any send operation of the "NibiruBankKeeper" depends + only on the "bankkeeper.BaseKeeper"'s gas consumption. +- [#2120](https://github.com/NibiruChain/nibiru/pull/2120) - fix: Use canonical hexadecimal strings for Eip155 address encoding - [#2122](https://github.com/NibiruChain/nibiru/pull/2122) - test(evm): more bank extension tests and EVM ABCI integration tests to prevent regressions - [#2124](https://github.com/NibiruChain/nibiru/pull/2124) - refactor(evm): -Remove unnecessary argument in the `VerifyFee` function, which returns the token -payment required based on the effective fee from the tx data. Improve -documentation. -- [#2125](https://github.com/NibiruChain/nibiru/pull/2125) - feat(evm-precompile):Emit EVM events created to reflect the ABCI events that occur outside the EVM to make sure that block explorers and indexers can find indexed ABCI event information. + Remove unnecessary argument in the `VerifyFee` function, which returns the token + payment required based on the effective fee from the tx data. Improve + documentation. +- [#2125](https://github.com/NibiruChain/nibiru/pull/2125) - feat(evm-precompile):Emit EVM events created to reflect the ABCI events that occur outside the EVM to make sure that block explorers and indexers can find indexed ABCI event information. - [#2129](https://github.com/NibiruChain/nibiru/pull/2129) - fix(evm): issue with infinite recursion in erc20 funtoken contracts #### Nibiru EVM | Before Audit 2 - 2024-12-06 @@ -70,45 +70,45 @@ preparation for a second audit starting in November 2024. and the [related comments from @Unique-Divine and @berndartmueller](https://github.com/NibiruChain/nibiru/issues/2059#issuecomment-2408625724). - [#2084](https://github.com/NibiruChain/nibiru/pull/2084) - feat(evm-forge): foundry support and template for Nibiru EVM development - [#2086](https://github.com/NibiruChain/nibiru/pull/2086) - fix(evm-precomples): -Fix state consistency in precompile execution by ensuring proper journaling of -state changes in the StateDB. This pull request makes sure that state is -committed as expected, fixes the `StateDB.Commit` to follow its guidelines more -closely, and solves for a critical state inconsistency producible from the -FunToken.sol precompiled contract. It also aligns the precompiles to use -consistent setup and dynamic gas calculations, addressing the following tickets. + Fix state consistency in precompile execution by ensuring proper journaling of + state changes in the StateDB. This pull request makes sure that state is + committed as expected, fixes the `StateDB.Commit` to follow its guidelines more + closely, and solves for a critical state inconsistency producible from the + FunToken.sol precompiled contract. It also aligns the precompiles to use + consistent setup and dynamic gas calculations, addressing the following tickets. - - - - [#2088](https://github.com/NibiruChain/nibiru/pull/2088) - refactor(evm): remove outdated comment and improper error message text - [#2089](https://github.com/NibiruChain/nibiru/pull/2089) - better handling of gas consumption within erc20 contract execution - [#2090](https://github.com/NibiruChain/nibiru/pull/2090) - fix(evm): Account -for (1) ERC20 transfers with tokens that return false success values instead of -throwing an error and (2) ERC20 transfers with other operations that don't bring -about the expected resulting balance for the transfer recipient. + for (1) ERC20 transfers with tokens that return false success values instead of + throwing an error and (2) ERC20 transfers with other operations that don't bring + about the expected resulting balance for the transfer recipient. - [#2091](https://github.com/NibiruChain/nibiru/pull/2091) - feat(evm): add fun token creation fee validation - [#2093](https://github.com/NibiruChain/nibiru/pull/2093) - feat(evm): gas usage in precompiles: limits, local gas meters - [#2092](https://github.com/NibiruChain/nibiru/pull/2092) - feat(evm): add validation for wasm multi message execution - [#2094](https://github.com/NibiruChain/nibiru/pull/2094) - fix(evm): Following -from the changs in #2086, this pull request implements a new `JournalChange` -struct that saves a deep copy of the state multi store before each -state-modifying, Nibiru-specific precompiled contract is called (`OnRunStart`). -Additionally, we commit the `StateDB` there as well. This guarantees that the -non-EVM and EVM state will be in sync even if there are complex, multi-step -Ethereum transactions, such as in the case of an EthereumTx that influences the -`StateDB`, then calls a precompile that also changes non-EVM state, and then EVM -reverts inside of a try-catch. + from the changs in #2086, this pull request implements a new `JournalChange` + struct that saves a deep copy of the state multi store before each + state-modifying, Nibiru-specific precompiled contract is called (`OnRunStart`). + Additionally, we commit the `StateDB` there as well. This guarantees that the + non-EVM and EVM state will be in sync even if there are complex, multi-step + Ethereum transactions, such as in the case of an EthereumTx that influences the + `StateDB`, then calls a precompile that also changes non-EVM state, and then EVM + reverts inside of a try-catch. - [#2095](https://github.com/NibiruChain/nibiru/pull/2095) - fix(evm): This -change records NIBI (ether) transfers on the `StateDB` during precompiled -contract calls using the `NibiruBankKeeper`, which is struct extension of -the `bankkeeper.BaseKeeper` that is used throughout Nibiru. -The `NibiruBankKeeper` holds a reference to the current EVM `StateDB` and records -balance changes in wei as journal changes automatically. This guarantees that -commits and reversions of the `StateDB` do not misalign with the state of the -Bank module. This code change uses the `NibiruBankKeeper` on all modules that -depend on x/bank, such as the EVM and Wasm modules. + change records NIBI (ether) transfers on the `StateDB` during precompiled + contract calls using the `NibiruBankKeeper`, which is struct extension of + the `bankkeeper.BaseKeeper` that is used throughout Nibiru. + The `NibiruBankKeeper` holds a reference to the current EVM `StateDB` and records + balance changes in wei as journal changes automatically. This guarantees that + commits and reversions of the `StateDB` do not misalign with the state of the + Bank module. This code change uses the `NibiruBankKeeper` on all modules that + depend on x/bank, such as the EVM and Wasm modules. - [#2097](https://github.com/NibiruChain/nibiru/pull/2097) - feat(evm): Add new query to get dated price from the oracle precompile - [#2098](https://github.com/NibiruChain/nibiru/pull/2098) - test(evm): statedb -tests for race conditions within funtoken precompile + tests for race conditions within funtoken precompile - [#2100](https://github.com/NibiruChain/nibiru/pull/2100) - refactor: cleanup statedb and precompile sections - [#2101](https://github.com/NibiruChain/nibiru/pull/2101) - fix(evm): tx receipt proper marshalling - [#2105](https://github.com/NibiruChain/nibiru/pull/2105) - test(evm): precompile call with revert @@ -120,11 +120,11 @@ tests for race conditions within funtoken precompile - [#2114](https://github.com/NibiruChain/nibiru/pull/2114) - fix(evm): make gas cost zero in conditional bank keeper flow - [#2116](https://github.com/NibiruChain/nibiru/pull/2116) - fix(precompile-funtoken.go): Fixes a bug where the err != nil check is missing in the bankBalance precompile method - [#2117](https://github.com/NibiruChain/nibiru/pull/2117) - fix(oracle): The -timestamps resulting from ctx.WithBlock* don't actually correspond to the block -header information from specified blocks in the chain's history, so the oracle -exchange rates need a way to correctly retrieve this information. This change -fixes that discrepancy, giving the expected block timestamp for the EVM's oracle -precompiled contract. The change also simplifies and corrects the code in x/oracle. + timestamps resulting from ctx.WithBlock\* don't actually correspond to the block + header information from specified blocks in the chain's history, so the oracle + exchange rates need a way to correctly retrieve this information. This change + fixes that discrepancy, giving the expected block timestamp for the EVM's oracle + precompiled contract. The change also simplifies and corrects the code in x/oracle. #### Nibiru EVM | Before Audit 1 - 2024-10-18 @@ -204,6 +204,7 @@ precompiled contract. The change also simplifies and corrects the code in x/orac - [#2060](https://github.com/NibiruChain/nibiru/pull/2060) - fix(evm-precompiles): add assertNumArgs validation - [#2056](https://github.com/NibiruChain/nibiru/pull/2056) - feat(evm): add oracle precompile - [#2065](https://github.com/NibiruChain/nibiru/pull/2065) - refactor(evm)!: Refactor out dead code from the evm.Params +- [#2135](https://github.com/NibiruChain/nibiru/pull/2135) - feat(evm): add precompile for calling bank to evm from evm ### State Machine Breaking (Other) From 48e6f7ee11e82489f49c2fbbf7658cc3f52fd4f1 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Tue, 31 Dec 2024 00:34:58 +0100 Subject: [PATCH 3/7] chore: cleanup --- x/evm/precompile/funtoken.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/x/evm/precompile/funtoken.go b/x/evm/precompile/funtoken.go index bf2fc586a..8144d4637 100644 --- a/x/evm/precompile/funtoken.go +++ b/x/evm/precompile/funtoken.go @@ -576,7 +576,7 @@ func (p precompileFunToken) sendToEvm( // 2) mint (or unescrow) the ERC20 erc20Addr := funtoken.Erc20Addr.Address actualAmt, err := p.mintOrUnescrowERC20( - ctx, caller, erc20Addr, toEthAddr, coinToSend.Amount.BigInt(), funtoken, + ctx, erc20Addr, toEthAddr, coinToSend.Amount.BigInt(), funtoken, ) if err != nil { return nil, err @@ -588,7 +588,6 @@ func (p precompileFunToken) sendToEvm( func (p precompileFunToken) mintOrUnescrowERC20( ctx sdk.Context, - caller gethcommon.Address, erc20Addr gethcommon.Address, to gethcommon.Address, amount *big.Int, @@ -597,7 +596,7 @@ func (p precompileFunToken) mintOrUnescrowERC20( // If funtoken is "IsMadeFromCoin", we own the ERC20 contract, so we can mint. // If not, we do a transfer from EVM module to 'to' address using escrowed tokens. if funtoken.IsMadeFromCoin { - mintResp, err := p.evmKeeper.ERC20().Mint( + _, err := p.evmKeeper.ERC20().Mint( erc20Addr, evm.EVM_MODULE_ADDRESS, to, @@ -608,20 +607,18 @@ func (p precompileFunToken) mintOrUnescrowERC20( return nil, fmt.Errorf("mint erc20 error: %w", err) } // For an owner-minted contract, the entire `amount` is minted. - _ = mintResp // do something if needed, or remove return amount, nil } else { balBefore, err := p.evmKeeper.ERC20().BalanceOf(erc20Addr, to, ctx) if err != nil { return nil, fmt.Errorf("balanceOf to check erc20 error: %w", err) } - _, transferResp, err := p.evmKeeper.ERC20().Transfer( + _, _, err = p.evmKeeper.ERC20().Transfer( erc20Addr, evm.EVM_MODULE_ADDRESS, to, amount, ctx, ) if err != nil { return nil, fmt.Errorf("erc20.transfer from module to user: %w", err) } - _ = transferResp // do something if needed, or remove balAfter, err := p.evmKeeper.ERC20().BalanceOf(erc20Addr, to, ctx) if err != nil { @@ -677,10 +674,6 @@ func parseToAddr(toStr string) (gethcommon.Address, error) { return eth.NibiruAddrToEthAddr(nibAddr), nil } -// ------------------- -// 2) bankMsgSend -// ------------------- - func (p precompileFunToken) bankMsgSend( startResult OnRunStartResult, caller gethcommon.Address, From ddefea8f449081de696c45fe79c9cc71029d752e Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Thu, 2 Jan 2025 15:32:09 +0100 Subject: [PATCH 4/7] wip --- x/evm/precompile/funtoken_test.go | 193 ++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 822a964b6..381561998 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -557,3 +557,196 @@ func (s *FuntokenSuite) TestBankMsgSend() { ).Amount.Int64() s.EqualValues(200, gotRecipientBal, "recipient unibi after bankMsgSend") } + +func bigTokens(n int64) *big.Int { + e18 := big.NewInt(1_000_000_000_000_000_000) // 1e18 + return new(big.Int).Mul(big.NewInt(n), e18) +} + +func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { + deps := evmtest.NewTestDeps() + // Fund user so they can create funtoken from an ERC20 + createFunTokenFee := deps.EvmKeeper.FeeForCreateFunToken(deps.Ctx) + s.Require().NoError(testapp.FundAccount( + deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, + createFunTokenFee.Add(sdk.NewCoin("unibi", sdk.NewInt(10_000_000_000))), + )) + + // Deploy an ERC20 with 18 decimals + erc20Resp, err := evmtest.DeployContract(&deps, embeds.SmartContract_TestERC20) + s.Require().NoError(err, "failed to deploy test ERC20") + erc20Addr := erc20Resp.ContractAddr + + // create fun token from that erc20 + _, err = deps.EvmKeeper.CreateFunToken(sdk.WrapSDKContext(deps.Ctx), &evm.MsgCreateFunToken{ + Sender: deps.Sender.NibiruAddr.String(), + FromErc20: ð.EIP55Addr{Address: erc20Addr}, + }) + s.Require().NoError(err) + + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(0)) + + // Transfer 500 tokens => 500 * 10^18 raw + deployerAddr := gethcommon.HexToAddress(erc20Resp.EthTxMsg.From) + _, err = deps.EvmKeeper.CallContract( + deps.Ctx, + embeds.SmartContract_TestERC20.ABI, + deployerAddr, + &erc20Addr, + true, + keeper.Erc20GasLimitExecute, + "transfer", + deps.Sender.EthAddr, + bigTokens(500), // 500 in human sense + ) + s.Require().NoError(err) + + // Now user should have 500 tokens => raw is 500 * 10^18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(500)) + + // sendToBank: e.g. 100 tokens => 100 * 1e18 raw + input, err := embeds.SmartContract_FunToken.ABI.Pack( + string(precompile.FunTokenMethod_sendToBank), + []any{ + erc20Addr, // address + bigTokens(100), + deps.Sender.NibiruAddr.String(), + }..., + ) + s.Require().NoError(err) + _, resp, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input, deps.Sender) + s.Require().NoError(err) + s.Require().Empty(resp.VmError) + + // Expect user to have 400 tokens => 400 * 10^18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(400)) + // Bank side should see 100 + bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, "erc20/"+erc20Addr.Hex()) + s.Require().EqualValues(100, bankBal.Amount.Int64()) + + // Finally sendToEvm(100) + input2, err := embeds.SmartContract_FunToken.ABI.Pack( + "sendToEvm", + []any{ + bankBal.Denom, + big.NewInt(100), + deps.Sender.EthAddr.Hex(), + }..., + ) + s.Require().NoError(err) + _, resp2, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) + s.Require().NoError(err) + s.Require().Empty(resp2.VmError) + + // parse return => 100 + var actuallyUnescrowed *big.Int + err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface(&actuallyUnescrowed, "sendToEvm", resp2.Ret) + s.Require().NoError(err) + s.Require().EqualValues(100, actuallyUnescrowed.Int64()) + + // user has 500 tokens again => 500 * 1e18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(500)) + // no bank side left + balAfter := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, bankBal.Denom).Amount.Int64() + s.Require().EqualValues(0, balAfter) +} + +func (s *FuntokenSuite) TestSendToEvmFailures() { + deps := evmtest.NewTestDeps() + + s.T().Log("We do not create any funtoken => so len(funtokens) == 0 => fails") + callArgsNoFuntoken := []any{ + "unibi", // bankDenom + big.NewInt(1000), // amount + deps.Sender.EthAddr.Hex(), + } + input, err := embeds.SmartContract_FunToken.ABI.Pack( + "sendToEvm", + callArgsNoFuntoken..., + ) + s.Require().NoError(err) + + _, _, callErr := evmtest.CallContractTx( + &deps, + precompile.PrecompileAddr_FunToken, + input, + deps.Sender, + ) + s.Require().ErrorContains(callErr, "no funtoken found for bank denom \"unibi\"") + + s.T().Log("Try to pass a non-string argument => parseArg fails (bankDenom must be string)") + callArgsWrongType := []any{ + 12345, // int instead of string + big.NewInt(100), + deps.Sender.EthAddr.Hex(), + } + input2, err := embeds.SmartContract_FunToken.ABI.Pack("sendToEvm", callArgsWrongType...) + s.Require().NoError(err) + + _, _, callErr2 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) + s.Require().ErrorContains(callErr2, "type validation failed for (string bankDenom)") + + s.T().Log("Try negative amount => parseArgOK but revert in method check") + callArgsNegative := []any{ + "unibi", // bankDenom + big.NewInt(-5), // negative => should fail + deps.Sender.EthAddr.Hex(), + } + input3, err := embeds.SmartContract_FunToken.ABI.Pack("sendToEvm", callArgsNegative...) + s.Require().NoError(err) + _, _, callErr3 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input3, deps.Sender) + s.Require().ErrorContains(callErr3, "transfer amount must be positive") +} + +func (s *FuntokenSuite) TestBankMsgSendFailures() { + deps := evmtest.NewTestDeps() + + s.T().Log("Case: no funtoken needed, but we do need a valid from => caller has 0 funds => fails cosmos bank send") + callArgs := []any{ + testutil.AccAddress().String(), // 'to' + "unibi", // 'bankDenom' + big.NewInt(500), // amount + } + + input, err := embeds.SmartContract_FunToken.ABI.Pack( + "bankMsgSend", + callArgs..., + ) + s.Require().NoError(err) + + _, _, callErr := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input, deps.Sender) + s.Require().ErrorContains(callErr, "insufficient funds") // bank module error + + s.T().Log("Case: parseArg fails => 'to' is not a string") + callArgsWrongTo := []any{ + 333, // not a string + "unibi", // bankDenom + big.NewInt(100), // amount + } + input2, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsWrongTo...) + s.Require().NoError(err) + _, _, callErr2 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) + s.Require().ErrorContains(callErr2, "type validation failed for (string to)") + + s.T().Log("Case: parseArg fails => 'bankDenom' is not a string") + callArgsWrongDenom := []any{ + testutil.AccAddress().String(), + 9999, // not string + big.NewInt(100), + } + input3, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsWrongDenom...) + s.Require().NoError(err) + _, _, callErr3 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input3, deps.Sender) + s.Require().ErrorContains(callErr3, "type validation failed for (string bankDenom)") + + s.T().Log("Case: parseArg fails => negative or zero amount => must be positive") + callArgsZero := []any{ + testutil.AccAddress().String(), + "unibi", + big.NewInt(0), + } + input4, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsZero...) + s.Require().NoError(err) + _, _, callErr4 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input4, deps.Sender) + s.Require().ErrorContains(callErr4, "msgSend amount must be positive") +} From 1fd8a3242fa5d8f5b3c77eab3343a1a5d58093c4 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Thu, 2 Jan 2025 19:31:41 +0100 Subject: [PATCH 5/7] fix: fix test --- x/evm/precompile/funtoken_test.go | 149 +++++------------------------- 1 file changed, 25 insertions(+), 124 deletions(-) diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 381561998..aafd40a9c 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -565,11 +565,15 @@ func bigTokens(n int64) *big.Int { func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { deps := evmtest.NewTestDeps() + + bob := evmtest.NewEthPrivAcc() + alice := evmtest.NewEthPrivAcc() + // Fund user so they can create funtoken from an ERC20 createFunTokenFee := deps.EvmKeeper.FeeForCreateFunToken(deps.Ctx) s.Require().NoError(testapp.FundAccount( deps.App.BankKeeper, deps.Ctx, deps.Sender.NibiruAddr, - createFunTokenFee.Add(sdk.NewCoin("unibi", sdk.NewInt(10_000_000_000))), + createFunTokenFee, )) // Deploy an ERC20 with 18 decimals @@ -577,6 +581,9 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { s.Require().NoError(err, "failed to deploy test ERC20") erc20Addr := erc20Resp.ContractAddr + // the initial supply was sent to the deployer + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(1000000)) + // create fun token from that erc20 _, err = deps.EvmKeeper.CreateFunToken(sdk.WrapSDKContext(deps.Ctx), &evm.MsgCreateFunToken{ Sender: deps.Sender.NibiruAddr.String(), @@ -584,9 +591,7 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { }) s.Require().NoError(err) - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(0)) - - // Transfer 500 tokens => 500 * 10^18 raw + // Transfer 500 tokens to bob => 500 * 10^18 raw deployerAddr := gethcommon.HexToAddress(erc20Resp.EthTxMsg.From) _, err = deps.EvmKeeper.CallContract( deps.Ctx, @@ -596,13 +601,13 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { true, keeper.Erc20GasLimitExecute, "transfer", - deps.Sender.EthAddr, + bob.EthAddr, bigTokens(500), // 500 in human sense ) s.Require().NoError(err) // Now user should have 500 tokens => raw is 500 * 10^18 - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(500)) + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) // sendToBank: e.g. 100 tokens => 100 * 1e18 raw input, err := embeds.SmartContract_FunToken.ABI.Pack( @@ -610,143 +615,39 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { []any{ erc20Addr, // address bigTokens(100), - deps.Sender.NibiruAddr.String(), + alice.NibiruAddr.String(), }..., ) s.Require().NoError(err) - _, resp, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input, deps.Sender) + _, resp, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input, bob) s.Require().NoError(err) s.Require().Empty(resp.VmError) - // Expect user to have 400 tokens => 400 * 10^18 - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(400)) // Bank side should see 100 - bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, "erc20/"+erc20Addr.Hex()) - s.Require().EqualValues(100, bankBal.Amount.Int64()) + bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, alice.NibiruAddr, "erc20/"+erc20Addr.Hex()) + s.Require().EqualValues(bigTokens(100), bankBal.Amount.BigInt()) + + // Expect user to have 400 tokens => 400 * 10^18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(400)) // Finally sendToEvm(100) input2, err := embeds.SmartContract_FunToken.ABI.Pack( "sendToEvm", []any{ bankBal.Denom, - big.NewInt(100), - deps.Sender.EthAddr.Hex(), + bigTokens(100), + bob.EthAddr.Hex(), }..., ) s.Require().NoError(err) - _, resp2, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) + _, resp2, err := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, alice) s.Require().NoError(err) s.Require().Empty(resp2.VmError) - // parse return => 100 - var actuallyUnescrowed *big.Int - err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface(&actuallyUnescrowed, "sendToEvm", resp2.Ret) - s.Require().NoError(err) - s.Require().EqualValues(100, actuallyUnescrowed.Int64()) - - // user has 500 tokens again => 500 * 1e18 - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, bigTokens(500)) // no bank side left - balAfter := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, bankBal.Denom).Amount.Int64() - s.Require().EqualValues(0, balAfter) -} - -func (s *FuntokenSuite) TestSendToEvmFailures() { - deps := evmtest.NewTestDeps() - - s.T().Log("We do not create any funtoken => so len(funtokens) == 0 => fails") - callArgsNoFuntoken := []any{ - "unibi", // bankDenom - big.NewInt(1000), // amount - deps.Sender.EthAddr.Hex(), - } - input, err := embeds.SmartContract_FunToken.ABI.Pack( - "sendToEvm", - callArgsNoFuntoken..., - ) - s.Require().NoError(err) - - _, _, callErr := evmtest.CallContractTx( - &deps, - precompile.PrecompileAddr_FunToken, - input, - deps.Sender, - ) - s.Require().ErrorContains(callErr, "no funtoken found for bank denom \"unibi\"") + balAfter := deps.App.BankKeeper.GetBalance(deps.Ctx, alice.NibiruAddr, bankBal.Denom).Amount.BigInt() + s.Require().EqualValues(bigTokens(0), balAfter) - s.T().Log("Try to pass a non-string argument => parseArg fails (bankDenom must be string)") - callArgsWrongType := []any{ - 12345, // int instead of string - big.NewInt(100), - deps.Sender.EthAddr.Hex(), - } - input2, err := embeds.SmartContract_FunToken.ABI.Pack("sendToEvm", callArgsWrongType...) - s.Require().NoError(err) - - _, _, callErr2 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) - s.Require().ErrorContains(callErr2, "type validation failed for (string bankDenom)") - - s.T().Log("Try negative amount => parseArgOK but revert in method check") - callArgsNegative := []any{ - "unibi", // bankDenom - big.NewInt(-5), // negative => should fail - deps.Sender.EthAddr.Hex(), - } - input3, err := embeds.SmartContract_FunToken.ABI.Pack("sendToEvm", callArgsNegative...) - s.Require().NoError(err) - _, _, callErr3 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input3, deps.Sender) - s.Require().ErrorContains(callErr3, "transfer amount must be positive") -} - -func (s *FuntokenSuite) TestBankMsgSendFailures() { - deps := evmtest.NewTestDeps() - - s.T().Log("Case: no funtoken needed, but we do need a valid from => caller has 0 funds => fails cosmos bank send") - callArgs := []any{ - testutil.AccAddress().String(), // 'to' - "unibi", // 'bankDenom' - big.NewInt(500), // amount - } - - input, err := embeds.SmartContract_FunToken.ABI.Pack( - "bankMsgSend", - callArgs..., - ) - s.Require().NoError(err) - - _, _, callErr := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input, deps.Sender) - s.Require().ErrorContains(callErr, "insufficient funds") // bank module error - - s.T().Log("Case: parseArg fails => 'to' is not a string") - callArgsWrongTo := []any{ - 333, // not a string - "unibi", // bankDenom - big.NewInt(100), // amount - } - input2, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsWrongTo...) - s.Require().NoError(err) - _, _, callErr2 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input2, deps.Sender) - s.Require().ErrorContains(callErr2, "type validation failed for (string to)") - - s.T().Log("Case: parseArg fails => 'bankDenom' is not a string") - callArgsWrongDenom := []any{ - testutil.AccAddress().String(), - 9999, // not string - big.NewInt(100), - } - input3, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsWrongDenom...) - s.Require().NoError(err) - _, _, callErr3 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input3, deps.Sender) - s.Require().ErrorContains(callErr3, "type validation failed for (string bankDenom)") - - s.T().Log("Case: parseArg fails => negative or zero amount => must be positive") - callArgsZero := []any{ - testutil.AccAddress().String(), - "unibi", - big.NewInt(0), - } - input4, err := embeds.SmartContract_FunToken.ABI.Pack("bankMsgSend", callArgsZero...) - s.Require().NoError(err) - _, _, callErr4 := evmtest.CallContractTx(&deps, precompile.PrecompileAddr_FunToken, input4, deps.Sender) - s.Require().ErrorContains(callErr4, "msgSend amount must be positive") + // user has 500 tokens again => 500 * 1e18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) } From a142fa88a2fc36d55913b95bc299ac86fd9d8907 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Mon, 6 Jan 2025 09:17:26 +0100 Subject: [PATCH 6/7] fix: add burn method when coin is made from evm side --- x/evm/precompile/funtoken.go | 8 ++++++++ x/evm/precompile/funtoken_test.go | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/x/evm/precompile/funtoken.go b/x/evm/precompile/funtoken.go index 8144d4637..74134737b 100644 --- a/x/evm/precompile/funtoken.go +++ b/x/evm/precompile/funtoken.go @@ -573,6 +573,14 @@ func (p precompileFunToken) sendToEvm( return nil, fmt.Errorf("failed to send coins to module: %w", err) } + // burn if funtoken was created from EVM side + if !funtoken.IsMadeFromCoin { + err := p.evmKeeper.Bank.BurnCoins(ctx, evm.ModuleName, sdk.NewCoins(coinToSend)) + if err != nil { + return nil, fmt.Errorf("failed to burn coins: %w", err) + } + } + // 2) mint (or unescrow) the ERC20 erc20Addr := funtoken.Erc20Addr.Address actualAmt, err := p.mintOrUnescrowERC20( diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index aafd40a9c..212a5cad0 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -485,6 +485,11 @@ func (s *FuntokenSuite) TestSendToEvm() { bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, bankDenom).Amount.BigInt() s.EqualValues(wantBank, bankBal, "did user lose 1000 unibi from bank?") + // check the evm module account balance + wantEvm := big.NewInt(1000) + evmBal := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankDenom).Amount.BigInt() + s.EqualValues(wantEvm, evmBal, "did evm module gain 1000 unibi?") + s.T().Log("Check the user gained 1000 in ERC20 representation") evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, big.NewInt(1000)) } @@ -559,7 +564,7 @@ func (s *FuntokenSuite) TestBankMsgSend() { } func bigTokens(n int64) *big.Int { - e18 := big.NewInt(1_000_000_000_000_000_000) // 1e18 + e18 := big.NewInt(1e18) // 1e18 return new(big.Int).Mul(big.NewInt(n), e18) } @@ -648,6 +653,13 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { balAfter := deps.App.BankKeeper.GetBalance(deps.Ctx, alice.NibiruAddr, bankBal.Denom).Amount.BigInt() s.Require().EqualValues(bigTokens(0), balAfter) + // check bob has 500 tokens again => 500 * 1e18 + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) + + // check evm module account's balance + evmBal := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankBal.Denom).Amount.BigInt() + s.Require().EqualValues(bigTokens(0), evmBal) + // user has 500 tokens again => 500 * 1e18 evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) } From 20bc50b643a258a6f4ac11f9e2db7eea100734f9 Mon Sep 17 00:00:00 2001 From: matthiasmatt Date: Tue, 7 Jan 2025 17:59:35 +0100 Subject: [PATCH 7/7] fix: fix tests --- x/evm/precompile/funtoken.go | 20 +++-- x/evm/precompile/funtoken_test.go | 144 ++++++++++++++++-------------- 2 files changed, 91 insertions(+), 73 deletions(-) diff --git a/x/evm/precompile/funtoken.go b/x/evm/precompile/funtoken.go index 74134737b..1b65fd0ed 100644 --- a/x/evm/precompile/funtoken.go +++ b/x/evm/precompile/funtoken.go @@ -527,6 +527,9 @@ func (p precompileFunToken) parseArgsWhoAmI(args []any) ( return addrEth, addrBech32, nil } +// SendToEvm: Implements "IFunToken.sendToEvm" +// Transfers the caller's bank coin `denom` to its ERC-20 representation on +// the EVM side. func (p precompileFunToken) sendToEvm( startResult OnRunStartResult, caller gethcommon.Address, @@ -573,14 +576,6 @@ func (p precompileFunToken) sendToEvm( return nil, fmt.Errorf("failed to send coins to module: %w", err) } - // burn if funtoken was created from EVM side - if !funtoken.IsMadeFromCoin { - err := p.evmKeeper.Bank.BurnCoins(ctx, evm.ModuleName, sdk.NewCoins(coinToSend)) - if err != nil { - return nil, fmt.Errorf("failed to burn coins: %w", err) - } - } - // 2) mint (or unescrow) the ERC20 erc20Addr := funtoken.Erc20Addr.Address actualAmt, err := p.mintOrUnescrowERC20( @@ -590,6 +585,15 @@ func (p precompileFunToken) sendToEvm( return nil, err } + if !funtoken.IsMadeFromCoin { + // If the tokens is from an ERC20, we need to burn the cosmos coin + // and unescrow the ERC20 tokens to the recipient. + err := p.evmKeeper.Bank.BurnCoins(ctx, evm.ModuleName, sdk.NewCoins(coinToSend)) + if err != nil { + return nil, fmt.Errorf("failed to burn coins: %w", err) + } + } + // return the number of tokens minted return method.Outputs.Pack(actualAmt) } diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 212a5cad0..53f1b247f 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -432,12 +432,13 @@ func (s *FuntokenSuite) TestPrecompileLocalGas() { func (s *FuntokenSuite) TestSendToEvm() { deps := evmtest.NewTestDeps() - s.T().Log("1) Create a new FunToken from coin 'unibi'") - bankDenom := "unibi" + s.T().Log("1) Create a new FunToken from coin 'ulibi'") + bankDenom := "ulibi" funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) + fmt.Println(funtoken) erc20Addr := funtoken.Erc20Addr.Address - s.T().Log("2) Fund the sender with some unibi on the bank side") + s.T().Log("2) Fund the sender with some ulibi on the bank side") err := testapp.FundAccount( deps.App.BankKeeper, deps.Ctx, @@ -472,6 +473,9 @@ func (s *FuntokenSuite) TestSendToEvm() { s.Require().NoError(err) s.Require().Empty(ethTxResp.VmError, "sendToEvm VMError") + // 1000 tokens are escrowed on module address + s.EqualValues(1000, deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankDenom).Amount.BigInt().Int64()) + s.T().Log("4) The response returns the actual minted/unescrowed amount") var actualMinted *big.Int err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface( @@ -480,87 +484,76 @@ func (s *FuntokenSuite) TestSendToEvm() { s.Require().NoError(err) s.Require().EqualValues(1000, actualMinted.Int64(), "expect 1000 minted to EVM") - s.T().Log("Check the user lost 1000 unibi in bank") + s.T().Log("Check the user lost 1000 ulibi in bank") wantBank := big.NewInt(234) // 1234 - 1000 => 234 bankBal := deps.App.BankKeeper.GetBalance(deps.Ctx, deps.Sender.NibiruAddr, bankDenom).Amount.BigInt() - s.EqualValues(wantBank, bankBal, "did user lose 1000 unibi from bank?") + s.EqualValues(wantBank, bankBal, "did user lose 1000 ulibi from bank?") // check the evm module account balance wantEvm := big.NewInt(1000) evmBal := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankDenom).Amount.BigInt() - s.EqualValues(wantEvm, evmBal, "did evm module gain 1000 unibi?") + s.EqualValues(wantEvm, evmBal, "did evm module properly mint ulibi?") s.T().Log("Check the user gained 1000 in ERC20 representation") evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, deps.Sender.EthAddr, big.NewInt(1000)) -} - -func (s *FuntokenSuite) TestBankMsgSend() { - deps := evmtest.NewTestDeps() - - s.T().Log("1) Create a new FunToken from coin 'unibi'") - bankDenom := "unibi" - funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) - s.Require().NotEmpty(funtoken.BankDenom) - - s.T().Log("2) Fund the sender with 500 unibi in the bank module") - startAmount := int64(500) - err := testapp.FundAccount( - deps.App.BankKeeper, - deps.Ctx, - deps.Sender.NibiruAddr, - sdk.NewCoins(sdk.NewCoin(bankDenom, sdk.NewInt(startAmount))), - ) - s.Require().NoError(err) - senderBalBefore := deps.App.BankKeeper.GetBalance( - deps.Ctx, deps.Sender.NibiruAddr, bankDenom, - ).Amount.Int64() - - s.T().Log("3) Call bankMsgSend(to, bankDenom, amount) from the EVM") - toAddr := testutil.AccAddress() - callArgs := []any{ - toAddr.String(), // 'to', can be hex or bech32 - bankDenom, // 'bankDenom' - big.NewInt(200), // amount + //----------------------------------------------------------------------- + // 5) Now send some tokens *back* to the bank via `sendToBank`. + //----------------------------------------------------------------------- + // We'll pick a brand new random account to receive them. + recipient := testutil.AccAddress() + s.T().Logf("5) Sending 400 tokens back from EVM to Cosmos bank => recipient: %s", recipient) + + sendBackArgs := []any{ + erc20Addr, // address erc20 + big.NewInt(400), // amount + recipient.String(), // to } - input, err := embeds.SmartContract_FunToken.ABI.Pack( - "bankMsgSend", - callArgs..., + + inputSendBack, err := embeds.SmartContract_FunToken.ABI.Pack( + string(precompile.FunTokenMethod_sendToBank), + sendBackArgs..., ) s.Require().NoError(err) deps.ResetGasMeter() - _, ethTxResp, err := evmtest.CallContractTx( + _, ethTxResp2, err := evmtest.CallContractTx( &deps, precompile.PrecompileAddr_FunToken, - input, + inputSendBack, deps.Sender, ) s.Require().NoError(err) - s.Require().Empty(ethTxResp.VmError) + s.Require().Empty(ethTxResp2.VmError, "sendToBank VMError") - s.T().Log("4) The return value for bankMsgSend is a single bool (true if success)") - var success bool + s.T().Log("Parse the returned amount from `sendToBank`") + var actualSentBack *big.Int err = embeds.SmartContract_FunToken.ABI.UnpackIntoInterface( - &success, - "bankMsgSend", - ethTxResp.Ret, + &actualSentBack, string(precompile.FunTokenMethod_sendToBank), + ethTxResp2.Ret, ) s.Require().NoError(err) - s.True(success, "bankMsgSend should return bool=true if no error") - - s.T().Log("Confirm the user lost 200 unibi") - wantSenderBal := senderBalBefore - 200 - gotSenderBal := deps.App.BankKeeper.GetBalance( - deps.Ctx, deps.Sender.NibiruAddr, bankDenom, - ).Amount.Int64() - s.EqualValues(wantSenderBal, gotSenderBal, "sender unibi after bankMsgSend") - - s.T().Log("Confirm the 'toAddr' gained 200 unibi") - gotRecipientBal := deps.App.BankKeeper.GetBalance( - deps.Ctx, toAddr, bankDenom, - ).Amount.Int64() - s.EqualValues(200, gotRecipientBal, "recipient unibi after bankMsgSend") + s.Require().EqualValues(400, actualSentBack.Int64(), "expect 400 minted back to bank") + + s.T().Log("Check sender's EVM balance has decreased by 400") + // The sender started with 1000 after the first sendToEvm + evmtest.AssertERC20BalanceEqual( + s.T(), + deps, + erc20Addr, + deps.Sender.EthAddr, + big.NewInt(600), // 1000 - 400 + ) + + s.T().Log("Check the bank side got 400 more") + recipientBal := deps.App.BankKeeper.GetBalance(deps.Ctx, recipient, bankDenom).Amount.BigInt() + s.Require().EqualValues(400, recipientBal.Int64(), "did the recipient get 400?") + + s.T().Log("Confirm module account doesn't keep them (burn or escrow) for bank-based tokens") + moduleBal := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankDenom).Amount.BigInt() + s.Require().EqualValues(600, moduleBal.Int64(), "module should now have 600 left escrowed") + + s.T().Log("Done! We sent tokens to EVM, then back to the bank, verifying the final balances.") } func bigTokens(n int64) *big.Int { @@ -569,6 +562,18 @@ func bigTokens(n int64) *big.Int { } func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { + // Create ERC20 token + + // EVM Transfer - Send 500 tokens to Bob (EVM) + + // sendToBank - Send 100 tokens from bob to alice's bank balance (EVM -> Cosmos) + // - mint cosmos token + // - escrow erc20 token + + // sendToEVM - Send 100 tokens from alice to bob's EVM address (Cosmos -> EVM) + // - burn cosmos token + // - unescrow erc20 token + deps := evmtest.NewTestDeps() bob := evmtest.NewEthPrivAcc() @@ -583,6 +588,7 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { // Deploy an ERC20 with 18 decimals erc20Resp, err := evmtest.DeployContract(&deps, embeds.SmartContract_TestERC20) + s.Require().NoError(err, "failed to deploy test ERC20") erc20Addr := erc20Resp.ContractAddr @@ -615,6 +621,7 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) // sendToBank: e.g. 100 tokens => 100 * 1e18 raw + // expects to escrow on EVM side and mint on cosmos side input, err := embeds.SmartContract_FunToken.ABI.Pack( string(precompile.FunTokenMethod_sendToBank), []any{ @@ -635,7 +642,10 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { // Expect user to have 400 tokens => 400 * 10^18 evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(400)) - // Finally sendToEvm(100) + // 100 tokens are escrowed + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, evm.EVM_MODULE_ADDRESS, bigTokens(100)) + + // Finally sendToEvm(100) -> (expects to burn on cosmos side and unescrow in the EVM side) input2, err := embeds.SmartContract_FunToken.ABI.Pack( "sendToEvm", []any{ @@ -649,16 +659,20 @@ func (s *FuntokenSuite) TestSendToEvm_NotMadeFromCoin() { s.Require().NoError(err) s.Require().Empty(resp2.VmError) - // no bank side left + // no bank side left for alice balAfter := deps.App.BankKeeper.GetBalance(deps.Ctx, alice.NibiruAddr, bankBal.Denom).Amount.BigInt() s.Require().EqualValues(bigTokens(0), balAfter) // check bob has 500 tokens again => 500 * 1e18 evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500)) - // check evm module account's balance - evmBal := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankBal.Denom).Amount.BigInt() - s.Require().EqualValues(bigTokens(0), evmBal) + // check evm module account's balance, it should have escrowed some tokens + // unescrow the tokens + evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, evm.EVM_MODULE_ADDRESS, bigTokens(0)) + + // burns the bank tokens + evmBal2 := deps.App.BankKeeper.GetBalance(deps.Ctx, evm.EVM_MODULE_ADDRESS[:], bankBal.Denom).Amount.BigInt() + s.Require().EqualValues(bigTokens(0), evmBal2) // user has 500 tokens again => 500 * 1e18 evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20Addr, bob.EthAddr, bigTokens(500))