diff --git a/libevm/precompilegen/Test.sol b/libevm/precompilegen/Test.sol index e6490dc37748..5f9a33ca6c91 100644 --- a/libevm/precompilegen/Test.sol +++ b/libevm/precompilegen/Test.sol @@ -24,13 +24,17 @@ interface IPrecompile { function Pure() external pure returns (bool canReadState, bool canWriteState); function NeitherViewNorPure() external returns (bool canReadState, bool canWriteState); + + function Payable() external payable returns (uint256 value); + + function NonPayable() external; } /// @dev Testing contract to exercise the implementaiton of `IPrecompile`. contract PrecompileTest { IPrecompile immutable precompile; - constructor(IPrecompile _precompile) { + constructor(IPrecompile _precompile) payable { precompile = _precompile; } @@ -107,4 +111,15 @@ contract PrecompileTest { assertReadOnly(IPrecompile.NeitherViewNorPure.selector, true, true); emit Called("NeitherViewNorPure()"); } + + function Transfer() external { + uint256 value = precompile.Payable{value: 42}(); + assert(value == 42); + + (bool ok,) = address(precompile).call{value: 42}(abi.encodeWithSelector(IPrecompile.NonPayable.selector)); + assert(!ok); + // TODO: DO NOT MERGE without checking the return data + + emit Called("Transfer()"); + } } diff --git a/libevm/precompilegen/abigen.gen_test.go b/libevm/precompilegen/abigen.gen_test.go index 4f44c1021092..8dbaa18c3ad6 100644 --- a/libevm/precompilegen/abigen.gen_test.go +++ b/libevm/precompilegen/abigen.gen_test.go @@ -36,8 +36,8 @@ type IPrecompileWrapper struct { // PrecompileTestMetaData contains all meta data concerning the PrecompileTest contract. var PrecompileTestMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"contractIPrecompile\",\"name\":\"_precompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"func\",\"type\":\"string\"}],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"Echo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"x\",\"type\":\"string\"}],\"name\":\"Echo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"EchoingFallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"int256\",\"name\":\"val\",\"type\":\"int256\"}],\"internalType\":\"structIPrecompile.Wrapper\",\"name\":\"x\",\"type\":\"tuple\"}],\"name\":\"Extract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"bytes2\",\"name\":\"y\",\"type\":\"bytes2\"},{\"internalType\":\"address\",\"name\":\"z\",\"type\":\"address\"}],\"name\":\"HashPacked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NeitherViewNorPure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"Pure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"err\",\"type\":\"bytes\"}],\"name\":\"RevertWith\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"Self\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"View\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60a060405234801561000f575f5ffd5b50604051611ae8380380611ae8833981810160405281019061003191906100da565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050610105565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100988261006f565b9050919050565b5f6100a98261008e565b9050919050565b6100b98161009f565b81146100c3575f5ffd5b50565b5f815190506100d4816100b0565b92915050565b5f602082840312156100ef576100ee61006b565b5b5f6100fc848285016100c6565b91505092915050565b6080516119936101555f395f81816101bd015281816102e70152818161044b0152818161058501528181610673015281816106aa015281816107bd015281816108c80152610a1a01526119935ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c8063b4a8180811610064578063b4a8180814610108578063c62c692f14610124578063d7cc1f371461012e578063db84d7c01461014a578063f5ad2fb8146101665761009c565b80631686f265146100a057806334d6d9be146100aa578063a7263000146100c6578063a93cbd97146100d0578063ad8108a4146100ec575b5f5ffd5b6100a8610170565b005b6100c460048036038101906100bf9190610ba0565b6101ba565b005b6100ce610299565b005b6100ea60048036038101906100e59190610d07565b6102e3565b005b61010660048036038101906101019190610dbe565b610449565b005b610122600480360381019061011d9190610d07565b61052b565b005b61012c610671565b005b61014860048036038101906101439190610e98565b610790565b005b610164600480360381019061015f9190610f86565b61089f565b005b61016e6109cd565b005b610183631686f26560e01b60015f610a16565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516101b090611027565b60405180910390a1565b807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166334d6d9be836040518263ffffffff1660e01b81526004016102149190611054565b602060405180830381865afa15801561022f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102539190611081565b14610261576102606110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161028e90611123565b60405180910390a150565b6102ac63a726300060e01b600180610a16565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516102d99061118b565b60405180910390a1565b5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a93cbd9760e01b846040516024016103359190611209565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161039f9190611263565b5f604051808303815f865af19150503d805f81146103d8576040519150601f19603f3d011682016040523d82523d5f602084013e6103dd565b606091505b509150915081156103f1576103f06110ac565b5b828051906020012081805190602001201461040f5761040e6110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161043c906112c3565b60405180910390a1505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ad8108a4826040518263ffffffff1660e01b81526004016104a2919061130a565b602060405180830381865afa1580156104bd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104e19190611337565b815f0151146104f3576104f26110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610520906113ac565b60405180910390a150565b5f5f8260405160240161053e9190611209565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16836040516105c89190611263565b5f60405180830381855afa9150503d805f8114610600576040519150601f19603f3d011682016040523d82523d5f602084013e610605565b606091505b509150915081610618576106176110ac565b5b8280519060200120818051906020012014610636576106356110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161066390611414565b60405180910390a150505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c62c692f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610711573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107359190611446565b73ffffffffffffffffffffffffffffffffffffffff1614610759576107586110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610786906114bb565b60405180910390a1565b8282826040516020016107a59392919061155e565b604051602081830303815290604052805190602001207f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d7cc1f378585856040518463ffffffff1660e01b8152600401610818939291906115b8565b602060405180830381865afa158015610833573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108579190611620565b14610865576108646110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161089290611695565b60405180910390a1505050565b806040516020016108b091906116f7565b604051602081830303815290604052805190602001207f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663db84d7c0836040518263ffffffff1660e01b815260040161091f9190611745565b5f60405180830381865afa158015610939573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061096191906117d3565b60405160200161097191906116f7565b6040516020818303038152906040528051906020012014610995576109946110ac565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516109c290611864565b60405180910390a150565b6109df63f5ad2fb860e01b5f5f610a16565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610a0c906118cc565b60405180910390a1565b5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1685604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ac09190611263565b5f604051808303815f865af19150503d805f8114610af9576040519150601f19603f3d011682016040523d82523d5f602084013e610afe565b606091505b509150915081610b1157610b106110ac565b5b5f5f82806020019051810190610b27919061191f565b9150915085151582151514610b3f57610b3e6110ac565b5b84151581151514610b5357610b526110ac565b5b50505050505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b610b7f81610b6d565b8114610b89575f5ffd5b50565b5f81359050610b9a81610b76565b92915050565b5f60208284031215610bb557610bb4610b65565b5b5f610bc284828501610b8c565b91505092915050565b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610c1982610bd3565b810181811067ffffffffffffffff82111715610c3857610c37610be3565b5b80604052505050565b5f610c4a610b5c565b9050610c568282610c10565b919050565b5f67ffffffffffffffff821115610c7557610c74610be3565b5b610c7e82610bd3565b9050602081019050919050565b828183375f83830152505050565b5f610cab610ca684610c5b565b610c41565b905082815260208101848484011115610cc757610cc6610bcf565b5b610cd2848285610c8b565b509392505050565b5f82601f830112610cee57610ced610bcb565b5b8135610cfe848260208601610c99565b91505092915050565b5f60208284031215610d1c57610d1b610b65565b5b5f82013567ffffffffffffffff811115610d3957610d38610b69565b5b610d4584828501610cda565b91505092915050565b5f5ffd5b5f819050919050565b610d6481610d52565b8114610d6e575f5ffd5b50565b5f81359050610d7f81610d5b565b92915050565b5f60208284031215610d9a57610d99610d4e565b5b610da46020610c41565b90505f610db384828501610d71565b5f8301525092915050565b5f60208284031215610dd357610dd2610b65565b5b5f610de084828501610d85565b91505092915050565b5f7fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b610e1d81610de9565b8114610e27575f5ffd5b50565b5f81359050610e3881610e14565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610e6782610e3e565b9050919050565b610e7781610e5d565b8114610e81575f5ffd5b50565b5f81359050610e9281610e6e565b92915050565b5f5f5f60608486031215610eaf57610eae610b65565b5b5f610ebc86828701610b8c565b9350506020610ecd86828701610e2a565b9250506040610ede86828701610e84565b9150509250925092565b5f67ffffffffffffffff821115610f0257610f01610be3565b5b610f0b82610bd3565b9050602081019050919050565b5f610f2a610f2584610ee8565b610c41565b905082815260208101848484011115610f4657610f45610bcf565b5b610f51848285610c8b565b509392505050565b5f82601f830112610f6d57610f6c610bcb565b5b8135610f7d848260208601610f18565b91505092915050565b5f60208284031215610f9b57610f9a610b65565b5b5f82013567ffffffffffffffff811115610fb857610fb7610b69565b5b610fc484828501610f59565b91505092915050565b5f82825260208201905092915050565b7f56696577282900000000000000000000000000000000000000000000000000005f82015250565b5f611011600683610fcd565b915061101c82610fdd565b602082019050919050565b5f6020820190508181035f83015261103e81611005565b9050919050565b61104e81610b6d565b82525050565b5f6020820190506110675f830184611045565b92915050565b5f8151905061107b81610b76565b92915050565b5f6020828403121561109657611095610b65565b5b5f6110a38482850161106d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b7f4563686f2875696e7432353629000000000000000000000000000000000000005f82015250565b5f61110d600d83610fcd565b9150611118826110d9565b602082019050919050565b5f6020820190508181035f83015261113a81611101565b9050919050565b7f4e656974686572566965774e6f725075726528290000000000000000000000005f82015250565b5f611175601483610fcd565b915061118082611141565b602082019050919050565b5f6020820190508181035f8301526111a281611169565b9050919050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f6111db826111a9565b6111e581856111b3565b93506111f58185602086016111c3565b6111fe81610bd3565b840191505092915050565b5f6020820190508181035f83015261122181846111d1565b905092915050565b5f81905092915050565b5f61123d826111a9565b6112478185611229565b93506112578185602086016111c3565b80840191505092915050565b5f61126e8284611233565b915081905092915050565b7f52657665727457697468282e2e2e2900000000000000000000000000000000005f82015250565b5f6112ad600f83610fcd565b91506112b882611279565b602082019050919050565b5f6020820190508181035f8301526112da816112a1565b9050919050565b6112ea81610d52565b82525050565b602082015f8201516113045f8501826112e1565b50505050565b5f60208201905061131d5f8301846112f0565b92915050565b5f8151905061133181610d5b565b92915050565b5f6020828403121561134c5761134b610b65565b5b5f61135984828501611323565b91505092915050565b7f45787472616374282e2e2e2900000000000000000000000000000000000000005f82015250565b5f611396600c83610fcd565b91506113a182611362565b602082019050919050565b5f6020820190508181035f8301526113c38161138a565b9050919050565b7f4563686f696e6746616c6c6261636b282e2e2e290000000000000000000000005f82015250565b5f6113fe601483610fcd565b9150611409826113ca565b602082019050919050565b5f6020820190508181035f83015261142b816113f2565b9050919050565b5f8151905061144081610e6e565b92915050565b5f6020828403121561145b5761145a610b65565b5b5f61146884828501611432565b91505092915050565b7f53656c66282900000000000000000000000000000000000000000000000000005f82015250565b5f6114a5600683610fcd565b91506114b082611471565b602082019050919050565b5f6020820190508181035f8301526114d281611499565b9050919050565b5f819050919050565b6114f36114ee82610b6d565b6114d9565b82525050565b5f819050919050565b61151361150e82610de9565b6114f9565b82525050565b5f8160601b9050919050565b5f61152f82611519565b9050919050565b5f61154082611525565b9050919050565b61155861155382610e5d565b611536565b82525050565b5f61156982866114e2565b6020820191506115798285611502565b6002820191506115898284611547565b601482019150819050949350505050565b6115a381610de9565b82525050565b6115b281610e5d565b82525050565b5f6060820190506115cb5f830186611045565b6115d8602083018561159a565b6115e560408301846115a9565b949350505050565b5f819050919050565b6115ff816115ed565b8114611609575f5ffd5b50565b5f8151905061161a816115f6565b92915050565b5f6020828403121561163557611634610b65565b5b5f6116428482850161160c565b91505092915050565b7f486173685061636b6564282e2e2e2900000000000000000000000000000000005f82015250565b5f61167f600f83610fcd565b915061168a8261164b565b602082019050919050565b5f6020820190508181035f8301526116ac81611673565b9050919050565b5f81519050919050565b5f81905092915050565b5f6116d1826116b3565b6116db81856116bd565b93506116eb8185602086016111c3565b80840191505092915050565b5f61170282846116c7565b915081905092915050565b5f611717826116b3565b6117218185610fcd565b93506117318185602086016111c3565b61173a81610bd3565b840191505092915050565b5f6020820190508181035f83015261175d818461170d565b905092915050565b5f61177761177284610ee8565b610c41565b90508281526020810184848401111561179357611792610bcf565b5b61179e8482856111c3565b509392505050565b5f82601f8301126117ba576117b9610bcb565b5b81516117ca848260208601611765565b91505092915050565b5f602082840312156117e8576117e7610b65565b5b5f82015167ffffffffffffffff81111561180557611804610b69565b5b611811848285016117a6565b91505092915050565b7f4563686f28737472696e672900000000000000000000000000000000000000005f82015250565b5f61184e600c83610fcd565b91506118598261181a565b602082019050919050565b5f6020820190508181035f83015261187b81611842565b9050919050565b7f50757265282900000000000000000000000000000000000000000000000000005f82015250565b5f6118b6600683610fcd565b91506118c182611882565b602082019050919050565b5f6020820190508181035f8301526118e3816118aa565b9050919050565b5f8115159050919050565b6118fe816118ea565b8114611908575f5ffd5b50565b5f81519050611919816118f5565b92915050565b5f5f6040838503121561193557611934610b65565b5b5f6119428582860161190b565b92505060206119538582860161190b565b915050925092905056fea26469706673582212206fbd1578963795306db34fa421e0e514e3e99979c9760a9b6f393505a99b5b3864736f6c634300081c0033", + ABI: "[{\"inputs\":[{\"internalType\":\"contractIPrecompile\",\"name\":\"_precompile\",\"type\":\"address\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"func\",\"type\":\"string\"}],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"Echo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"x\",\"type\":\"string\"}],\"name\":\"Echo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"EchoingFallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"int256\",\"name\":\"val\",\"type\":\"int256\"}],\"internalType\":\"structIPrecompile.Wrapper\",\"name\":\"x\",\"type\":\"tuple\"}],\"name\":\"Extract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"bytes2\",\"name\":\"y\",\"type\":\"bytes2\"},{\"internalType\":\"address\",\"name\":\"z\",\"type\":\"address\"}],\"name\":\"HashPacked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NeitherViewNorPure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"Pure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"err\",\"type\":\"bytes\"}],\"name\":\"RevertWith\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"Self\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"Transfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"View\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60a0604052604051611d49380380611d49833981810160405281019061002591906100ce565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1681525050506100f9565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61008c82610063565b9050919050565b5f61009d82610082565b9050919050565b6100ad81610093565b81146100b7575f5ffd5b50565b5f815190506100c8816100a4565b92915050565b5f602082840312156100e3576100e261005f565b5b5f6100f0848285016100ba565b91505092915050565b608051611bf26101575f395f81816101d2015281816102b101528181610356015281816104de015281816106420152818161077c0152818161086a015281816108a1015281816109b401528181610abf0152610c110152611bf25ff3fe608060405234801561000f575f5ffd5b50600436106100a7575f3560e01c8063ad8108a41161006f578063ad8108a414610101578063b4a818081461011d578063c62c692f14610139578063d7cc1f3714610143578063db84d7c01461015f578063f5ad2fb81461017b576100a7565b80631686f265146100ab57806334d6d9be146100b5578063406dade3146100d1578063a7263000146100db578063a93cbd97146100e5575b5f5ffd5b6100b3610185565b005b6100cf60048036038101906100ca9190610d97565b6101cf565b005b6100d96102ae565b005b6100e3610490565b005b6100ff60048036038101906100fa9190610efe565b6104da565b005b61011b60048036038101906101169190610fb5565b610640565b005b61013760048036038101906101329190610efe565b610722565b005b610141610868565b005b61015d6004803603810190610158919061108f565b610987565b005b6101796004803603810190610174919061117d565b610a96565b005b610183610bc4565b005b610198631686f26560e01b60015f610c0d565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516101c59061121e565b60405180910390a1565b807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166334d6d9be836040518263ffffffff1660e01b8152600401610229919061124b565b602060405180830381865afa158015610244573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102689190611278565b14610276576102756112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516102a39061131a565b60405180910390a150565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631b7fb4b0602a6040518263ffffffff1660e01b815260040160206040518083038185885af115801561031b573d5f5f3e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906103409190611278565b9050602a8114610353576103526112a3565b5b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16602a636fb1b0e960e01b604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610405919061138a565b5f6040518083038185875af1925050503d805f811461043f576040519150601f19603f3d011682016040523d82523d5f602084013e610444565b606091505b505090508015610457576104566112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610484906113ea565b60405180910390a15050565b6104a363a726300060e01b600180610c0d565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516104d090611452565b60405180910390a1565b5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a93cbd9760e01b8460405160240161052c91906114b8565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610596919061138a565b5f604051808303815f865af19150503d805f81146105cf576040519150601f19603f3d011682016040523d82523d5f602084013e6105d4565b606091505b509150915081156105e8576105e76112a3565b5b8280519060200120818051906020012014610606576106056112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161063390611522565b60405180910390a1505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ad8108a4826040518263ffffffff1660e01b81526004016106999190611569565b602060405180830381865afa1580156106b4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d89190611596565b815f0151146106ea576106e96112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a6040516107179061160b565b60405180910390a150565b5f5f8260405160240161073591906114b8565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16836040516107bf919061138a565b5f60405180830381855afa9150503d805f81146107f7576040519150601f19603f3d011682016040523d82523d5f602084013e6107fc565b606091505b50915091508161080f5761080e6112a3565b5b828051906020012081805190602001201461082d5761082c6112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161085a90611673565b60405180910390a150505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c62c692f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610908573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092c91906116a5565b73ffffffffffffffffffffffffffffffffffffffff16146109505761094f6112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a60405161097d9061171a565b60405180910390a1565b82828260405160200161099c939291906117bd565b604051602081830303815290604052805190602001207f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d7cc1f378585856040518463ffffffff1660e01b8152600401610a0f93929190611817565b602060405180830381865afa158015610a2a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a4e919061187f565b14610a5c57610a5b6112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610a89906118f4565b60405180910390a1505050565b80604051602001610aa79190611956565b604051602081830303815290604052805190602001207f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663db84d7c0836040518263ffffffff1660e01b8152600401610b1691906119a4565b5f60405180830381865afa158015610b30573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f82011682018060405250810190610b589190611a32565b604051602001610b689190611956565b6040516020818303038152906040528051906020012014610b8c57610b8b6112a3565b5b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610bb990611ac3565b60405180910390a150565b610bd663f5ad2fb860e01b5f5f610c0d565b7f3fd5724095fcb65d3b7e6d79ac130db7e9dbf891d59bb0da292d471bc40d564a604051610c0390611b2b565b60405180910390a1565b5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1685604051602401604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610cb7919061138a565b5f604051808303815f865af19150503d805f8114610cf0576040519150601f19603f3d011682016040523d82523d5f602084013e610cf5565b606091505b509150915081610d0857610d076112a3565b5b5f5f82806020019051810190610d1e9190611b7e565b9150915085151582151514610d3657610d356112a3565b5b84151581151514610d4a57610d496112a3565b5b50505050505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b610d7681610d64565b8114610d80575f5ffd5b50565b5f81359050610d9181610d6d565b92915050565b5f60208284031215610dac57610dab610d5c565b5b5f610db984828501610d83565b91505092915050565b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610e1082610dca565b810181811067ffffffffffffffff82111715610e2f57610e2e610dda565b5b80604052505050565b5f610e41610d53565b9050610e4d8282610e07565b919050565b5f67ffffffffffffffff821115610e6c57610e6b610dda565b5b610e7582610dca565b9050602081019050919050565b828183375f83830152505050565b5f610ea2610e9d84610e52565b610e38565b905082815260208101848484011115610ebe57610ebd610dc6565b5b610ec9848285610e82565b509392505050565b5f82601f830112610ee557610ee4610dc2565b5b8135610ef5848260208601610e90565b91505092915050565b5f60208284031215610f1357610f12610d5c565b5b5f82013567ffffffffffffffff811115610f3057610f2f610d60565b5b610f3c84828501610ed1565b91505092915050565b5f5ffd5b5f819050919050565b610f5b81610f49565b8114610f65575f5ffd5b50565b5f81359050610f7681610f52565b92915050565b5f60208284031215610f9157610f90610f45565b5b610f9b6020610e38565b90505f610faa84828501610f68565b5f8301525092915050565b5f60208284031215610fca57610fc9610d5c565b5b5f610fd784828501610f7c565b91505092915050565b5f7fffff00000000000000000000000000000000000000000000000000000000000082169050919050565b61101481610fe0565b811461101e575f5ffd5b50565b5f8135905061102f8161100b565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61105e82611035565b9050919050565b61106e81611054565b8114611078575f5ffd5b50565b5f8135905061108981611065565b92915050565b5f5f5f606084860312156110a6576110a5610d5c565b5b5f6110b386828701610d83565b93505060206110c486828701611021565b92505060406110d58682870161107b565b9150509250925092565b5f67ffffffffffffffff8211156110f9576110f8610dda565b5b61110282610dca565b9050602081019050919050565b5f61112161111c846110df565b610e38565b90508281526020810184848401111561113d5761113c610dc6565b5b611148848285610e82565b509392505050565b5f82601f83011261116457611163610dc2565b5b813561117484826020860161110f565b91505092915050565b5f6020828403121561119257611191610d5c565b5b5f82013567ffffffffffffffff8111156111af576111ae610d60565b5b6111bb84828501611150565b91505092915050565b5f82825260208201905092915050565b7f56696577282900000000000000000000000000000000000000000000000000005f82015250565b5f6112086006836111c4565b9150611213826111d4565b602082019050919050565b5f6020820190508181035f830152611235816111fc565b9050919050565b61124581610d64565b82525050565b5f60208201905061125e5f83018461123c565b92915050565b5f8151905061127281610d6d565b92915050565b5f6020828403121561128d5761128c610d5c565b5b5f61129a84828501611264565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b7f4563686f2875696e7432353629000000000000000000000000000000000000005f82015250565b5f611304600d836111c4565b915061130f826112d0565b602082019050919050565b5f6020820190508181035f830152611331816112f8565b9050919050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f61136482611338565b61136e8185611342565b935061137e81856020860161134c565b80840191505092915050565b5f611395828461135a565b915081905092915050565b7f5472616e736665722829000000000000000000000000000000000000000000005f82015250565b5f6113d4600a836111c4565b91506113df826113a0565b602082019050919050565b5f6020820190508181035f830152611401816113c8565b9050919050565b7f4e656974686572566965774e6f725075726528290000000000000000000000005f82015250565b5f61143c6014836111c4565b915061144782611408565b602082019050919050565b5f6020820190508181035f83015261146981611430565b9050919050565b5f82825260208201905092915050565b5f61148a82611338565b6114948185611470565b93506114a481856020860161134c565b6114ad81610dca565b840191505092915050565b5f6020820190508181035f8301526114d08184611480565b905092915050565b7f52657665727457697468282e2e2e2900000000000000000000000000000000005f82015250565b5f61150c600f836111c4565b9150611517826114d8565b602082019050919050565b5f6020820190508181035f83015261153981611500565b9050919050565b61154981610f49565b82525050565b602082015f8201516115635f850182611540565b50505050565b5f60208201905061157c5f83018461154f565b92915050565b5f8151905061159081610f52565b92915050565b5f602082840312156115ab576115aa610d5c565b5b5f6115b884828501611582565b91505092915050565b7f45787472616374282e2e2e2900000000000000000000000000000000000000005f82015250565b5f6115f5600c836111c4565b9150611600826115c1565b602082019050919050565b5f6020820190508181035f830152611622816115e9565b9050919050565b7f4563686f696e6746616c6c6261636b282e2e2e290000000000000000000000005f82015250565b5f61165d6014836111c4565b915061166882611629565b602082019050919050565b5f6020820190508181035f83015261168a81611651565b9050919050565b5f8151905061169f81611065565b92915050565b5f602082840312156116ba576116b9610d5c565b5b5f6116c784828501611691565b91505092915050565b7f53656c66282900000000000000000000000000000000000000000000000000005f82015250565b5f6117046006836111c4565b915061170f826116d0565b602082019050919050565b5f6020820190508181035f830152611731816116f8565b9050919050565b5f819050919050565b61175261174d82610d64565b611738565b82525050565b5f819050919050565b61177261176d82610fe0565b611758565b82525050565b5f8160601b9050919050565b5f61178e82611778565b9050919050565b5f61179f82611784565b9050919050565b6117b76117b282611054565b611795565b82525050565b5f6117c88286611741565b6020820191506117d88285611761565b6002820191506117e882846117a6565b601482019150819050949350505050565b61180281610fe0565b82525050565b61181181611054565b82525050565b5f60608201905061182a5f83018661123c565b61183760208301856117f9565b6118446040830184611808565b949350505050565b5f819050919050565b61185e8161184c565b8114611868575f5ffd5b50565b5f8151905061187981611855565b92915050565b5f6020828403121561189457611893610d5c565b5b5f6118a18482850161186b565b91505092915050565b7f486173685061636b6564282e2e2e2900000000000000000000000000000000005f82015250565b5f6118de600f836111c4565b91506118e9826118aa565b602082019050919050565b5f6020820190508181035f83015261190b816118d2565b9050919050565b5f81519050919050565b5f81905092915050565b5f61193082611912565b61193a818561191c565b935061194a81856020860161134c565b80840191505092915050565b5f6119618284611926565b915081905092915050565b5f61197682611912565b61198081856111c4565b935061199081856020860161134c565b61199981610dca565b840191505092915050565b5f6020820190508181035f8301526119bc818461196c565b905092915050565b5f6119d66119d1846110df565b610e38565b9050828152602081018484840111156119f2576119f1610dc6565b5b6119fd84828561134c565b509392505050565b5f82601f830112611a1957611a18610dc2565b5b8151611a298482602086016119c4565b91505092915050565b5f60208284031215611a4757611a46610d5c565b5b5f82015167ffffffffffffffff811115611a6457611a63610d60565b5b611a7084828501611a05565b91505092915050565b7f4563686f28737472696e672900000000000000000000000000000000000000005f82015250565b5f611aad600c836111c4565b9150611ab882611a79565b602082019050919050565b5f6020820190508181035f830152611ada81611aa1565b9050919050565b7f50757265282900000000000000000000000000000000000000000000000000005f82015250565b5f611b156006836111c4565b9150611b2082611ae1565b602082019050919050565b5f6020820190508181035f830152611b4281611b09565b9050919050565b5f8115159050919050565b611b5d81611b49565b8114611b67575f5ffd5b50565b5f81519050611b7881611b54565b92915050565b5f5f60408385031215611b9457611b93610d5c565b5b5f611ba185828601611b6a565b9250506020611bb285828601611b6a565b915050925092905056fea264697066735822122015cec228d3431d1c7e411919e8c1d0eedf25bb9b34ed83e88e4dbcb442ad811764736f6c634300081c0033", } // PrecompileTestABI is the input ABI used to generate the binding from. @@ -396,6 +396,27 @@ func (_PrecompileTest *PrecompileTestTransactorSession) Self() (*types.Transacti return _PrecompileTest.Contract.Self(&_PrecompileTest.TransactOpts) } +// Transfer is a paid mutator transaction binding the contract method 0x406dade3. +// +// Solidity: function Transfer() returns() +func (_PrecompileTest *PrecompileTestTransactor) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PrecompileTest.contract.Transact(opts, "Transfer") +} + +// Transfer is a paid mutator transaction binding the contract method 0x406dade3. +// +// Solidity: function Transfer() returns() +func (_PrecompileTest *PrecompileTestSession) Transfer() (*types.Transaction, error) { + return _PrecompileTest.Contract.Transfer(&_PrecompileTest.TransactOpts) +} + +// Transfer is a paid mutator transaction binding the contract method 0x406dade3. +// +// Solidity: function Transfer() returns() +func (_PrecompileTest *PrecompileTestTransactorSession) Transfer() (*types.Transaction, error) { + return _PrecompileTest.Contract.Transfer(&_PrecompileTest.TransactOpts) +} + // View is a paid mutator transaction binding the contract method 0x1686f265. // // Solidity: function View() returns() diff --git a/libevm/precompilegen/main_test.go b/libevm/precompilegen/main_test.go index 0b2ef5155602..50388e410b4d 100644 --- a/libevm/precompilegen/main_test.go +++ b/libevm/precompilegen/main_test.go @@ -89,12 +89,15 @@ func TestGeneratedPrecompile(t *testing.T) { txOpts, err := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) require.NoError(t, err, "bind.NewKeyedTransactorWithChainID(..., 1337)") txOpts.GasLimit = 30e6 + txOpts.Value = big.NewInt(1e9) client := sim.Client() _, tx, test, err := DeployPrecompileTest(txOpts, client, precompile) require.NoError(t, err, "DeployPrecompileTest(...)") sim.Commit() successfulTxReceipt(ctx, t, client, tx) + + txOpts.Value = nil suite := &PrecompileTestSession{ Contract: test, TransactOpts: *txOpts, @@ -166,6 +169,12 @@ func TestGeneratedPrecompile(t *testing.T) { }, wantCalledEvent: "NeitherViewNorPure()", }, + { + transact: func() (*types.Transaction, error) { + return suite.Transfer() + }, + wantCalledEvent: "Transfer()", + }, } for _, tt := range tests { @@ -248,3 +257,11 @@ func (contract) Pure(env vm.PrecompileEnvironment) (bool, bool, error) { func (contract) NeitherViewNorPure(env vm.PrecompileEnvironment) (bool, bool, error) { return canReadState(env), canWriteState(env), nil } + +func (contract) Payable(env vm.PrecompileEnvironment) (*big.Int, error) { + return env.Value().ToBig(), nil +} + +func (contract) NonPayable(env vm.PrecompileEnvironment) error { + return nil +} diff --git a/libevm/precompilegen/precompile.go.tmpl b/libevm/precompilegen/precompile.go.tmpl index 309ddb7ad34d..c2963ba6f2b3 100644 --- a/libevm/precompilegen/precompile.go.tmpl +++ b/libevm/precompilegen/precompile.go.tmpl @@ -102,9 +102,11 @@ type dispatch struct{} {{range methods .ABI}} func (dispatch) {{.Name}}(impl Contract, env vm.PrecompileEnvironment, input []byte) ([]byte, error) { + {{if or (gt (len .Inputs) 0) (gt (len .Outputs) 0) -}} method := methods[{{hex .ID}}] + {{- end}} - {{if gt (len .Inputs) 0}} + {{if gt (len .Inputs) 0 -}} inputs, err := method.Inputs.Unpack(input[abi.SelectorByteLen:]) if err != nil { return nil, err @@ -112,7 +114,7 @@ func (dispatch) {{.Name}}(impl Contract, env vm.PrecompileEnvironment, input []b {{- range $i, $in := .Inputs}} i{{$i}} := inputs[{{$i}}].({{type $in}}) {{- end}} - {{end}} + {{- end}} { {{args "o" (len .Outputs) false true}} := impl.{{.Name}}({{args "i" (len .Inputs) true false}}) @@ -123,7 +125,7 @@ func (dispatch) {{.Name}}(impl Contract, env vm.PrecompileEnvironment, input []b return method.Outputs.Pack({{args "o" (len .Outputs) false false}}) {{- else -}} return nil, nil - {{end}} + {{- end}} } } {{end}} \ No newline at end of file diff --git a/libevm/precompilegen/testprecompile/generated.go b/libevm/precompilegen/testprecompile/generated.go index 95f65a2b3a98..66d7460cd72a 100644 --- a/libevm/precompilegen/testprecompile/generated.go +++ b/libevm/precompilegen/testprecompile/generated.go @@ -1,5 +1,5 @@ // Package testprecompile is a generated package for creating EVM precompiles -// conforming to the EIP-165 interface ID 0xbe022088. +// conforming to the EIP-165 interface ID 0xcacc24d1. package testprecompile // Code generated by precompilegen. DO NOT EDIT. @@ -15,7 +15,7 @@ import ( ) // A Contract is an implementation of a precompiled contract conforming to the -// EIP-165 interface ID 0xbe022088. +// EIP-165 interface ID 0xcacc24d1. type Contract interface { // Fallback implements a fallback function, called if the method selector // fails to match any other method. @@ -43,6 +43,14 @@ type Contract interface { // function NeitherViewNorPure() returns(bool canReadState, bool canWriteState) NeitherViewNorPure(vm.PrecompileEnvironment) (bool, bool, error) + // NonPayable implements the function with selector 0x6fb1b0e9: + // function NonPayable() returns() + NonPayable(vm.PrecompileEnvironment) error + + // Payable implements the function with selector 0x1b7fb4b0: + // function Payable() payable returns(uint256 value) + Payable(vm.PrecompileEnvironment) (*big.Int, error) + // Pure implements the function with selector 0xf5ad2fb8: // function Pure() pure returns(bool canReadState, bool canWriteState) Pure(vm.PrecompileEnvironment) (bool, bool, error) @@ -71,7 +79,7 @@ var ( dispatchers map[abi.Selector]methodDispatcher ) -const abiJSON = `[{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"Echo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"Echo","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"int256","name":"val","type":"int256"}],"internalType":"struct IPrecompile.Wrapper","name":"","type":"tuple"}],"name":"Extract","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes2","name":"","type":"bytes2"},{"internalType":"address","name":"","type":"address"}],"name":"HashPacked","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NeitherViewNorPure","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"Pure","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"RevertWith","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"Self","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"View","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"view","type":"function"}]` +const abiJSON = `[{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"Echo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"Echo","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"int256","name":"val","type":"int256"}],"internalType":"struct IPrecompile.Wrapper","name":"","type":"tuple"}],"name":"Extract","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes2","name":"","type":"bytes2"},{"internalType":"address","name":"","type":"address"}],"name":"HashPacked","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NeitherViewNorPure","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"NonPayable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"Payable","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"Pure","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"RevertWith","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"Self","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"View","outputs":[{"internalType":"bool","name":"canReadState","type":"bool"},{"internalType":"bool","name":"canWriteState","type":"bool"}],"stateMutability":"view","type":"function"}]` func init() { parsed, err := abi.JSON(strings.NewReader(abiJSON)) @@ -87,6 +95,8 @@ func init() { 0xad8108a4: d.Extract, 0xd7cc1f37: d.HashPacked, 0xa7263000: d.NeitherViewNorPure, + 0x6fb1b0e9: d.NonPayable, + 0x1b7fb4b0: d.Payable, 0xf5ad2fb8: d.Pure, 0xa93cbd97: d.RevertWith, 0xc62c692f: d.Self, @@ -233,6 +243,30 @@ func (dispatch) NeitherViewNorPure(impl Contract, env vm.PrecompileEnvironment, } } +func (dispatch) NonPayable(impl Contract, env vm.PrecompileEnvironment, input []byte) ([]byte, error) { + + { + err := impl.NonPayable(env) + if err != nil { + return nil, err + } + return nil, nil + } +} + +func (dispatch) Payable(impl Contract, env vm.PrecompileEnvironment, input []byte) ([]byte, error) { + method := methods[0x1b7fb4b0] + + { + o0, err := impl.Payable(env) + if err != nil { + return nil, err + } + + return method.Outputs.Pack(o0) + } +} + func (dispatch) Pure(impl Contract, env vm.PrecompileEnvironment, input []byte) ([]byte, error) { method := methods[0xf5ad2fb8] @@ -261,7 +295,6 @@ func (dispatch) RevertWith(impl Contract, env vm.PrecompileEnvironment, input [] return nil, err } return nil, nil - } }