diff --git a/cmd/zetae2e/local/v2.go b/cmd/zetae2e/local/v2.go index 770d7201ef..88423b9742 100644 --- a/cmd/zetae2e/local/v2.go +++ b/cmd/zetae2e/local/v2.go @@ -40,6 +40,7 @@ func startV2Tests(eg *errgroup.Group, conf config.Config, deployerRunner *runner e2etests.TestV2ERC20WithdrawAndCallName, e2etests.TestV2ERC20DepositAndCallNoMessageName, e2etests.TestV2ERC20WithdrawAndCallNoMessageName, + e2etests.TestV2DepositAndCallSwapName, )) // Test revert cases for gas token workflow diff --git a/e2e/contracts/zevmswap/ZEVMSwapApp.abi b/e2e/contracts/zevmswap/ZEVMSwapApp.abi index 50bf177b93..39b360e605 100644 --- a/e2e/contracts/zevmswap/ZEVMSwapApp.abi +++ b/e2e/contracts/zevmswap/ZEVMSwapApp.abi @@ -73,6 +73,51 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "origin", + "type": "bytes" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "internalType": "struct Context", + "name": "", + "type": "tuple" + }, + { + "internalType": "address", + "name": "zrc20", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "onCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/e2e/contracts/zevmswap/ZEVMSwapApp.bin b/e2e/contracts/zevmswap/ZEVMSwapApp.bin index f512145bdd..8b208b65b3 100644 --- a/e2e/contracts/zevmswap/ZEVMSwapApp.bin +++ b/e2e/contracts/zevmswap/ZEVMSwapApp.bin @@ -1 +1 @@ -60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033 +60c060405234801561001057600080fd5b506040516117a63803806117a683398181016040528101906100329190610104565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610144565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100d1826100a6565b9050919050565b6100e1816100c6565b81146100ec57600080fd5b50565b6000815190506100fe816100d8565b92915050565b6000806040838503121561011b5761011a6100a1565b5b6000610129858286016100ef565b925050602061013a858286016100ef565b9150509250929050565b60805160a05161161a61018c6000396000818161067001526106b801526000818161025b015281816102e0015281816106940152818161085a01526108df015261161a6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80635bcfd61614610067578063a06ea8bc14610083578063bb88b769146100b4578063bd00c9c4146100d2578063de43156e146100f0578063df73044e1461010c575b600080fd5b610081600480360381019061007c9190610d33565b61013c565b005b61009d60048036038101906100989190610dd7565b6105d4565b6040516100ab929190610ec3565b60405180910390f35b6100bc61066e565b6040516100c99190610ef3565b60405180910390f35b6100da610692565b6040516100e79190610ef3565b60405180910390f35b61010a60048036038101906101059190610d33565b6106b6565b005b61012660048036038101906101219190610f0e565b610bd3565b6040516101339190610f6e565b60405180910390f35b600060608061014b85856105d4565b8093508194505050600267ffffffffffffffff81111561016e5761016d610f90565b5b60405190808252806020026020018201604052801561019c5781602001602082028036833780820191505090505b50905086816000815181106101b4576101b3610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061020357610202610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610298929190610ffd565b6020604051808303816000875af11580156102b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102db919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161034995949392919061118e565b6000604051808303816000875af1158015610368573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610391919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156103e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610404919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610443929190610ffd565b6020604051808303816000875af1158015610462573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610486919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106104ba576104b9610fbf565b5b60200260200101516104cc91906113d9565b6040518363ffffffff1660e01b81526004016104e9929190610ffd565b6020604051808303816000875af1158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061055e5761055d610fbf565b5b60200260200101516040518363ffffffff1660e01b815260040161058392919061141b565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c6919061105e565b505050505050505050505050565b600060608060008086869050915086866000906014926105f693929190611455565b9061060191906114d4565b60601c90508686601490809261061993929190611455565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073b576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061074a85856105d4565b8093508194505050600267ffffffffffffffff81111561076d5761076c610f90565b5b60405190808252806020026020018201604052801561079b5781602001602082028036833780820191505090505b50905086816000815181106107b3576107b2610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061080257610801610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610897929190610ffd565b6020604051808303816000875af11580156108b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108da919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161094895949392919061118e565b6000604051808303816000875af1158015610967573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610990919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156109df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a03919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610a42929190610ffd565b6020604051808303816000875af1158015610a61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a85919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a86600181518110610ab957610ab8610fbf565b5b6020026020010151610acb91906113d9565b6040518363ffffffff1660e01b8152600401610ae8929190610ffd565b6020604051808303816000875af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2b919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268685600181518110610b5d57610b5c610fbf565b5b60200260200101516040518363ffffffff1660e01b8152600401610b8292919061141b565b6020604051808303816000875af1158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc5919061105e565b505050505050505050505050565b6060838383604051602001610bea939291906115ba565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600060608284031215610c3157610c30610c16565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c6582610c3a565b9050919050565b610c7581610c5a565b8114610c8057600080fd5b50565b600081359050610c9281610c6c565b92915050565b6000819050919050565b610cab81610c98565b8114610cb657600080fd5b50565b600081359050610cc881610ca2565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610cf357610cf2610cce565b5b8235905067ffffffffffffffff811115610d1057610d0f610cd3565b5b602083019150836001820283011115610d2c57610d2b610cd8565b5b9250929050565b600080600080600060808688031215610d4f57610d4e610c0c565b5b600086013567ffffffffffffffff811115610d6d57610d6c610c11565b5b610d7988828901610c1b565b9550506020610d8a88828901610c83565b9450506040610d9b88828901610cb9565b935050606086013567ffffffffffffffff811115610dbc57610dbb610c11565b5b610dc888828901610cdd565b92509250509295509295909350565b60008060208385031215610dee57610ded610c0c565b5b600083013567ffffffffffffffff811115610e0c57610e0b610c11565b5b610e1885828601610cdd565b92509250509250929050565b610e2d81610c5a565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e6d578082015181840152602081019050610e52565b60008484015250505050565b6000601f19601f8301169050919050565b6000610e9582610e33565b610e9f8185610e3e565b9350610eaf818560208601610e4f565b610eb881610e79565b840191505092915050565b6000604082019050610ed86000830185610e24565b8181036020830152610eea8184610e8a565b90509392505050565b6000602082019050610f086000830184610e24565b92915050565b600080600060408486031215610f2757610f26610c0c565b5b6000610f3586828701610c83565b935050602084013567ffffffffffffffff811115610f5657610f55610c11565b5b610f6286828701610cdd565b92509250509250925092565b60006020820190508181036000830152610f888184610e8a565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610ff781610c98565b82525050565b60006040820190506110126000830185610e24565b61101f6020830184610fee565b9392505050565b60008115159050919050565b61103b81611026565b811461104657600080fd5b50565b60008151905061105881611032565b92915050565b60006020828403121561107457611073610c0c565b5b600061108284828501611049565b91505092915050565b6000819050919050565b6000819050919050565b60006110ba6110b56110b08461108b565b611095565b610c98565b9050919050565b6110ca8161109f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61110581610c5a565b82525050565b600061111783836110fc565b60208301905092915050565b6000602082019050919050565b600061113b826110d0565b61114581856110db565b9350611150836110ec565b8060005b83811015611181578151611168888261110b565b975061117383611123565b925050600181019050611154565b5085935050505092915050565b600060a0820190506111a36000830188610fee565b6111b060208301876110c1565b81810360408301526111c28186611130565b90506111d16060830185610e24565b6111de6080830184610fee565b9695505050505050565b6111f182610e79565b810181811067ffffffffffffffff821117156112105761120f610f90565b5b80604052505050565b6000611223610c02565b905061122f82826111e8565b919050565b600067ffffffffffffffff82111561124f5761124e610f90565b5b602082029050602081019050919050565b60008151905061126f81610ca2565b92915050565b600061128861128384611234565b611219565b905080838252602082019050602084028301858111156112ab576112aa610cd8565b5b835b818110156112d457806112c08882611260565b8452602084019350506020810190506112ad565b5050509392505050565b600082601f8301126112f3576112f2610cce565b5b8151611303848260208601611275565b91505092915050565b60006020828403121561132257611321610c0c565b5b600082015167ffffffffffffffff8111156113405761133f610c11565b5b61134c848285016112de565b91505092915050565b60008151905061136481610c6c565b92915050565b6000806040838503121561138157611380610c0c565b5b600061138f85828601611355565b92505060206113a085828601611260565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006113e482610c98565b91506113ef83610c98565b92508282026113fd81610c98565b91508282048414831517611414576114136113aa565b5b5092915050565b600060408201905081810360008301526114358185610e8a565b90506114446020830184610fee565b9392505050565b600080fd5b600080fd5b600080858511156114695761146861144b565b5b8386111561147a57611479611450565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b60006114e08383611490565b826114eb813561149b565b9250601482101561152b576115267fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026114c7565b831692505b505092915050565b60008160601b9050919050565b600061154b82611533565b9050919050565b600061155d82611540565b9050919050565b61157561157082610c5a565b611552565b82525050565b600081905092915050565b82818337600083830152505050565b60006115a1838561157b565b93506115ae838584611586565b82840190509392505050565b60006115c68286611564565b6014820191506115d7828486611595565b915081905094935050505056fea2646970667358221220154bbadb87b49f8568829220c413c264d9405e5acb49ef710acf293adbd4f01564736f6c634300081a0033 diff --git a/e2e/contracts/zevmswap/ZEVMSwapApp.go b/e2e/contracts/zevmswap/ZEVMSwapApp.go index b02a69f878..ecf0ef8dc2 100644 --- a/e2e/contracts/zevmswap/ZEVMSwapApp.go +++ b/e2e/contracts/zevmswap/ZEVMSwapApp.go @@ -38,8 +38,8 @@ type Context struct { // ZEVMSwapAppMetaData contains all meta data concerning the ZEVMSwapApp contract. var ZEVMSwapAppMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router02_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"systemContract_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"decodeMemo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"targetZRC20\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"}],\"name\":\"encodeMemo\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structContext\",\"name\":\"\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"router02\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"systemContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router02_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"systemContract_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"decodeMemo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"targetZRC20\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"}],\"name\":\"encodeMemo\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structContext\",\"name\":\"\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structContext\",\"name\":\"\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"router02\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"systemContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60c060405234801561001057600080fd5b506040516117a63803806117a683398181016040528101906100329190610104565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610144565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100d1826100a6565b9050919050565b6100e1816100c6565b81146100ec57600080fd5b50565b6000815190506100fe816100d8565b92915050565b6000806040838503121561011b5761011a6100a1565b5b6000610129858286016100ef565b925050602061013a858286016100ef565b9150509250929050565b60805160a05161161a61018c6000396000818161067001526106b801526000818161025b015281816102e0015281816106940152818161085a01526108df015261161a6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80635bcfd61614610067578063a06ea8bc14610083578063bb88b769146100b4578063bd00c9c4146100d2578063de43156e146100f0578063df73044e1461010c575b600080fd5b610081600480360381019061007c9190610d33565b61013c565b005b61009d60048036038101906100989190610dd7565b6105d4565b6040516100ab929190610ec3565b60405180910390f35b6100bc61066e565b6040516100c99190610ef3565b60405180910390f35b6100da610692565b6040516100e79190610ef3565b60405180910390f35b61010a60048036038101906101059190610d33565b6106b6565b005b61012660048036038101906101219190610f0e565b610bd3565b6040516101339190610f6e565b60405180910390f35b600060608061014b85856105d4565b8093508194505050600267ffffffffffffffff81111561016e5761016d610f90565b5b60405190808252806020026020018201604052801561019c5781602001602082028036833780820191505090505b50905086816000815181106101b4576101b3610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061020357610202610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610298929190610ffd565b6020604051808303816000875af11580156102b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102db919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161034995949392919061118e565b6000604051808303816000875af1158015610368573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610391919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156103e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610404919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610443929190610ffd565b6020604051808303816000875af1158015610462573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610486919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106104ba576104b9610fbf565b5b60200260200101516104cc91906113d9565b6040518363ffffffff1660e01b81526004016104e9929190610ffd565b6020604051808303816000875af1158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061055e5761055d610fbf565b5b60200260200101516040518363ffffffff1660e01b815260040161058392919061141b565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c6919061105e565b505050505050505050505050565b600060608060008086869050915086866000906014926105f693929190611455565b9061060191906114d4565b60601c90508686601490809261061993929190611455565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073b576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061074a85856105d4565b8093508194505050600267ffffffffffffffff81111561076d5761076c610f90565b5b60405190808252806020026020018201604052801561079b5781602001602082028036833780820191505090505b50905086816000815181106107b3576107b2610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061080257610801610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610897929190610ffd565b6020604051808303816000875af11580156108b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108da919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161094895949392919061118e565b6000604051808303816000875af1158015610967573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610990919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156109df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a03919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610a42929190610ffd565b6020604051808303816000875af1158015610a61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a85919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a86600181518110610ab957610ab8610fbf565b5b6020026020010151610acb91906113d9565b6040518363ffffffff1660e01b8152600401610ae8929190610ffd565b6020604051808303816000875af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2b919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268685600181518110610b5d57610b5c610fbf565b5b60200260200101516040518363ffffffff1660e01b8152600401610b8292919061141b565b6020604051808303816000875af1158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc5919061105e565b505050505050505050505050565b6060838383604051602001610bea939291906115ba565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600060608284031215610c3157610c30610c16565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c6582610c3a565b9050919050565b610c7581610c5a565b8114610c8057600080fd5b50565b600081359050610c9281610c6c565b92915050565b6000819050919050565b610cab81610c98565b8114610cb657600080fd5b50565b600081359050610cc881610ca2565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610cf357610cf2610cce565b5b8235905067ffffffffffffffff811115610d1057610d0f610cd3565b5b602083019150836001820283011115610d2c57610d2b610cd8565b5b9250929050565b600080600080600060808688031215610d4f57610d4e610c0c565b5b600086013567ffffffffffffffff811115610d6d57610d6c610c11565b5b610d7988828901610c1b565b9550506020610d8a88828901610c83565b9450506040610d9b88828901610cb9565b935050606086013567ffffffffffffffff811115610dbc57610dbb610c11565b5b610dc888828901610cdd565b92509250509295509295909350565b60008060208385031215610dee57610ded610c0c565b5b600083013567ffffffffffffffff811115610e0c57610e0b610c11565b5b610e1885828601610cdd565b92509250509250929050565b610e2d81610c5a565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e6d578082015181840152602081019050610e52565b60008484015250505050565b6000601f19601f8301169050919050565b6000610e9582610e33565b610e9f8185610e3e565b9350610eaf818560208601610e4f565b610eb881610e79565b840191505092915050565b6000604082019050610ed86000830185610e24565b8181036020830152610eea8184610e8a565b90509392505050565b6000602082019050610f086000830184610e24565b92915050565b600080600060408486031215610f2757610f26610c0c565b5b6000610f3586828701610c83565b935050602084013567ffffffffffffffff811115610f5657610f55610c11565b5b610f6286828701610cdd565b92509250509250925092565b60006020820190508181036000830152610f888184610e8a565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610ff781610c98565b82525050565b60006040820190506110126000830185610e24565b61101f6020830184610fee565b9392505050565b60008115159050919050565b61103b81611026565b811461104657600080fd5b50565b60008151905061105881611032565b92915050565b60006020828403121561107457611073610c0c565b5b600061108284828501611049565b91505092915050565b6000819050919050565b6000819050919050565b60006110ba6110b56110b08461108b565b611095565b610c98565b9050919050565b6110ca8161109f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61110581610c5a565b82525050565b600061111783836110fc565b60208301905092915050565b6000602082019050919050565b600061113b826110d0565b61114581856110db565b9350611150836110ec565b8060005b83811015611181578151611168888261110b565b975061117383611123565b925050600181019050611154565b5085935050505092915050565b600060a0820190506111a36000830188610fee565b6111b060208301876110c1565b81810360408301526111c28186611130565b90506111d16060830185610e24565b6111de6080830184610fee565b9695505050505050565b6111f182610e79565b810181811067ffffffffffffffff821117156112105761120f610f90565b5b80604052505050565b6000611223610c02565b905061122f82826111e8565b919050565b600067ffffffffffffffff82111561124f5761124e610f90565b5b602082029050602081019050919050565b60008151905061126f81610ca2565b92915050565b600061128861128384611234565b611219565b905080838252602082019050602084028301858111156112ab576112aa610cd8565b5b835b818110156112d457806112c08882611260565b8452602084019350506020810190506112ad565b5050509392505050565b600082601f8301126112f3576112f2610cce565b5b8151611303848260208601611275565b91505092915050565b60006020828403121561132257611321610c0c565b5b600082015167ffffffffffffffff8111156113405761133f610c11565b5b61134c848285016112de565b91505092915050565b60008151905061136481610c6c565b92915050565b6000806040838503121561138157611380610c0c565b5b600061138f85828601611355565b92505060206113a085828601611260565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006113e482610c98565b91506113ef83610c98565b92508282026113fd81610c98565b91508282048414831517611414576114136113aa565b5b5092915050565b600060408201905081810360008301526114358185610e8a565b90506114446020830184610fee565b9392505050565b600080fd5b600080fd5b600080858511156114695761146861144b565b5b8386111561147a57611479611450565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b60006114e08383611490565b826114eb813561149b565b9250601482101561152b576115267fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026114c7565b831692505b505092915050565b60008160601b9050919050565b600061154b82611533565b9050919050565b600061155d82611540565b9050919050565b61157561157082610c5a565b611552565b82525050565b600081905092915050565b82818337600083830152505050565b60006115a1838561157b565b93506115ae838584611586565b82840190509392505050565b60006115c68286611564565b6014820191506115d7828486611595565b915081905094935050505056fea2646970667358221220154bbadb87b49f8568829220c413c264d9405e5acb49ef710acf293adbd4f01564736f6c634300081a0033", } // ZEVMSwapAppABI is the input ABI used to generate the binding from. @@ -334,6 +334,27 @@ func (_ZEVMSwapApp *ZEVMSwapAppCallerSession) SystemContract() (common.Address, return _ZEVMSwapApp.Contract.SystemContract(&_ZEVMSwapApp.CallOpts) } +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. +// +// Solidity: function onCall((bytes,address,uint256) , address zrc20, uint256 amount, bytes message) returns() +func (_ZEVMSwapApp *ZEVMSwapAppTransactor) OnCall(opts *bind.TransactOpts, arg0 Context, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _ZEVMSwapApp.contract.Transact(opts, "onCall", arg0, zrc20, amount, message) +} + +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. +// +// Solidity: function onCall((bytes,address,uint256) , address zrc20, uint256 amount, bytes message) returns() +func (_ZEVMSwapApp *ZEVMSwapAppSession) OnCall(arg0 Context, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _ZEVMSwapApp.Contract.OnCall(&_ZEVMSwapApp.TransactOpts, arg0, zrc20, amount, message) +} + +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. +// +// Solidity: function onCall((bytes,address,uint256) , address zrc20, uint256 amount, bytes message) returns() +func (_ZEVMSwapApp *ZEVMSwapAppTransactorSession) OnCall(arg0 Context, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _ZEVMSwapApp.Contract.OnCall(&_ZEVMSwapApp.TransactOpts, arg0, zrc20, amount, message) +} + // OnCrossChainCall is a paid mutator transaction binding the contract method 0xde43156e. // // Solidity: function onCrossChainCall((bytes,address,uint256) , address zrc20, uint256 amount, bytes message) returns() diff --git a/e2e/contracts/zevmswap/ZEVMSwapApp.json b/e2e/contracts/zevmswap/ZEVMSwapApp.json index 5c803781fa..b8898c7994 100644 --- a/e2e/contracts/zevmswap/ZEVMSwapApp.json +++ b/e2e/contracts/zevmswap/ZEVMSwapApp.json @@ -74,6 +74,51 @@ "stateMutability": "pure", "type": "function" }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "origin", + "type": "bytes" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "internalType": "struct Context", + "name": "", + "type": "tuple" + }, + { + "internalType": "address", + "name": "zrc20", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "onCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -146,5 +191,5 @@ "type": "function" } ], - "bin": "60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033" + "bin": "60c060405234801561001057600080fd5b506040516117a63803806117a683398181016040528101906100329190610104565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610144565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100d1826100a6565b9050919050565b6100e1816100c6565b81146100ec57600080fd5b50565b6000815190506100fe816100d8565b92915050565b6000806040838503121561011b5761011a6100a1565b5b6000610129858286016100ef565b925050602061013a858286016100ef565b9150509250929050565b60805160a05161161a61018c6000396000818161067001526106b801526000818161025b015281816102e0015281816106940152818161085a01526108df015261161a6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80635bcfd61614610067578063a06ea8bc14610083578063bb88b769146100b4578063bd00c9c4146100d2578063de43156e146100f0578063df73044e1461010c575b600080fd5b610081600480360381019061007c9190610d33565b61013c565b005b61009d60048036038101906100989190610dd7565b6105d4565b6040516100ab929190610ec3565b60405180910390f35b6100bc61066e565b6040516100c99190610ef3565b60405180910390f35b6100da610692565b6040516100e79190610ef3565b60405180910390f35b61010a60048036038101906101059190610d33565b6106b6565b005b61012660048036038101906101219190610f0e565b610bd3565b6040516101339190610f6e565b60405180910390f35b600060608061014b85856105d4565b8093508194505050600267ffffffffffffffff81111561016e5761016d610f90565b5b60405190808252806020026020018201604052801561019c5781602001602082028036833780820191505090505b50905086816000815181106101b4576101b3610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061020357610202610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610298929190610ffd565b6020604051808303816000875af11580156102b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102db919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161034995949392919061118e565b6000604051808303816000875af1158015610368573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610391919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156103e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610404919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610443929190610ffd565b6020604051808303816000875af1158015610462573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610486919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106104ba576104b9610fbf565b5b60200260200101516104cc91906113d9565b6040518363ffffffff1660e01b81526004016104e9929190610ffd565b6020604051808303816000875af1158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061055e5761055d610fbf565b5b60200260200101516040518363ffffffff1660e01b815260040161058392919061141b565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c6919061105e565b505050505050505050505050565b600060608060008086869050915086866000906014926105f693929190611455565b9061060191906114d4565b60601c90508686601490809261061993929190611455565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073b576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061074a85856105d4565b8093508194505050600267ffffffffffffffff81111561076d5761076c610f90565b5b60405190808252806020026020018201604052801561079b5781602001602082028036833780820191505090505b50905086816000815181106107b3576107b2610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061080257610801610fbf565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b8152600401610897929190610ffd565b6020604051808303816000875af11580156108b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108da919061105e565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161094895949392919061118e565b6000604051808303816000875af1158015610967573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610990919061130c565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa1580156109df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a03919061136a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610a42929190610ffd565b6020604051808303816000875af1158015610a61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a85919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a86600181518110610ab957610ab8610fbf565b5b6020026020010151610acb91906113d9565b6040518363ffffffff1660e01b8152600401610ae8929190610ffd565b6020604051808303816000875af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2b919061105e565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268685600181518110610b5d57610b5c610fbf565b5b60200260200101516040518363ffffffff1660e01b8152600401610b8292919061141b565b6020604051808303816000875af1158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc5919061105e565b505050505050505050505050565b6060838383604051602001610bea939291906115ba565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600060608284031215610c3157610c30610c16565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c6582610c3a565b9050919050565b610c7581610c5a565b8114610c8057600080fd5b50565b600081359050610c9281610c6c565b92915050565b6000819050919050565b610cab81610c98565b8114610cb657600080fd5b50565b600081359050610cc881610ca2565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610cf357610cf2610cce565b5b8235905067ffffffffffffffff811115610d1057610d0f610cd3565b5b602083019150836001820283011115610d2c57610d2b610cd8565b5b9250929050565b600080600080600060808688031215610d4f57610d4e610c0c565b5b600086013567ffffffffffffffff811115610d6d57610d6c610c11565b5b610d7988828901610c1b565b9550506020610d8a88828901610c83565b9450506040610d9b88828901610cb9565b935050606086013567ffffffffffffffff811115610dbc57610dbb610c11565b5b610dc888828901610cdd565b92509250509295509295909350565b60008060208385031215610dee57610ded610c0c565b5b600083013567ffffffffffffffff811115610e0c57610e0b610c11565b5b610e1885828601610cdd565b92509250509250929050565b610e2d81610c5a565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610e6d578082015181840152602081019050610e52565b60008484015250505050565b6000601f19601f8301169050919050565b6000610e9582610e33565b610e9f8185610e3e565b9350610eaf818560208601610e4f565b610eb881610e79565b840191505092915050565b6000604082019050610ed86000830185610e24565b8181036020830152610eea8184610e8a565b90509392505050565b6000602082019050610f086000830184610e24565b92915050565b600080600060408486031215610f2757610f26610c0c565b5b6000610f3586828701610c83565b935050602084013567ffffffffffffffff811115610f5657610f55610c11565b5b610f6286828701610cdd565b92509250509250925092565b60006020820190508181036000830152610f888184610e8a565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610ff781610c98565b82525050565b60006040820190506110126000830185610e24565b61101f6020830184610fee565b9392505050565b60008115159050919050565b61103b81611026565b811461104657600080fd5b50565b60008151905061105881611032565b92915050565b60006020828403121561107457611073610c0c565b5b600061108284828501611049565b91505092915050565b6000819050919050565b6000819050919050565b60006110ba6110b56110b08461108b565b611095565b610c98565b9050919050565b6110ca8161109f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61110581610c5a565b82525050565b600061111783836110fc565b60208301905092915050565b6000602082019050919050565b600061113b826110d0565b61114581856110db565b9350611150836110ec565b8060005b83811015611181578151611168888261110b565b975061117383611123565b925050600181019050611154565b5085935050505092915050565b600060a0820190506111a36000830188610fee565b6111b060208301876110c1565b81810360408301526111c28186611130565b90506111d16060830185610e24565b6111de6080830184610fee565b9695505050505050565b6111f182610e79565b810181811067ffffffffffffffff821117156112105761120f610f90565b5b80604052505050565b6000611223610c02565b905061122f82826111e8565b919050565b600067ffffffffffffffff82111561124f5761124e610f90565b5b602082029050602081019050919050565b60008151905061126f81610ca2565b92915050565b600061128861128384611234565b611219565b905080838252602082019050602084028301858111156112ab576112aa610cd8565b5b835b818110156112d457806112c08882611260565b8452602084019350506020810190506112ad565b5050509392505050565b600082601f8301126112f3576112f2610cce565b5b8151611303848260208601611275565b91505092915050565b60006020828403121561132257611321610c0c565b5b600082015167ffffffffffffffff8111156113405761133f610c11565b5b61134c848285016112de565b91505092915050565b60008151905061136481610c6c565b92915050565b6000806040838503121561138157611380610c0c565b5b600061138f85828601611355565b92505060206113a085828601611260565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006113e482610c98565b91506113ef83610c98565b92508282026113fd81610c98565b91508282048414831517611414576114136113aa565b5b5092915050565b600060408201905081810360008301526114358185610e8a565b90506114446020830184610fee565b9392505050565b600080fd5b600080fd5b600080858511156114695761146861144b565b5b8386111561147a57611479611450565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b60006114e08383611490565b826114eb813561149b565b9250601482101561152b576115267fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026114c7565b831692505b505092915050565b60008160601b9050919050565b600061154b82611533565b9050919050565b600061155d82611540565b9050919050565b61157561157082610c5a565b611552565b82525050565b600081905092915050565b82818337600083830152505050565b60006115a1838561157b565b93506115ae838584611586565b82840190509392505050565b60006115c68286611564565b6014820191506115d7828486611595565b915081905094935050505056fea2646970667358221220154bbadb87b49f8568829220c413c264d9405e5acb49ef710acf293adbd4f01564736f6c634300081a0033" } diff --git a/e2e/contracts/zevmswap/ZEVMSwapApp.sol b/e2e/contracts/zevmswap/ZEVMSwapApp.sol index e9f098699d..a25e6a3bd1 100644 --- a/e2e/contracts/zevmswap/ZEVMSwapApp.sol +++ b/e2e/contracts/zevmswap/ZEVMSwapApp.sol @@ -96,4 +96,28 @@ contract ZEVMSwapApp is zContract { IZRC20(targetZRC20).approve(address(targetZRC20), amounts[1]*10); IZRC20(targetZRC20).withdraw(recipient, amounts[1]); } + + // used with v2 contracts + function onCall(Context calldata, address zrc20, uint256 amount, bytes calldata message) external { + address targetZRC20; + bytes memory recipient; + address[] memory path; + + (targetZRC20, recipient) = decodeMemo(message); + path = new address[](2); + path[0] = zrc20; + path[1] = targetZRC20; + + // approve the usage of this token by router02 + IZRC20(zrc20).approve(address(router02), amount); + + // swap for target token + uint256[] memory amounts = IUniswapV2Router02(router02).swapExactTokensForTokens(amount, 0, path, address(this), _DEADLINE); + + // perform withdrawal with the target token + (address gasZRC20Addr,uint256 gasFee) = IZRC20(targetZRC20).withdrawGasFee(); + IZRC20(gasZRC20Addr).approve(address(targetZRC20), gasFee); + IZRC20(targetZRC20).approve(address(targetZRC20), amounts[1]*10); + IZRC20(targetZRC20).withdraw(recipient, amounts[1]); + } } \ No newline at end of file diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index 52c7022be5..b7d39e906f 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -171,6 +171,7 @@ const ( TestV2ZEVMToEVMCallName = "v2_zevm_to_evm_call" TestV2ZEVMToEVMCallThroughContractName = "v2_zevm_to_evm_call_through_contract" TestV2EVMToZEVMCallName = "v2_evm_to_zevm_call" + TestV2DepositAndCallSwapName = "v2_deposit_and_call_swap_name" /* Operational tests @@ -1066,6 +1067,12 @@ var AllE2ETests = []runner.E2ETest{ []runner.ArgDefinition{}, TestV2EVMToZEVMCall, ), + runner.NewE2ETest( + TestV2DepositAndCallSwapName, + "evm -> zevm deposit and call with swap and withdraw", + []runner.ArgDefinition{}, + TestV2DepositAndCallSwap, + ), /* Special tests */ diff --git a/e2e/e2etests/test_v2_deposit_and_call_swap.go b/e2e/e2etests/test_v2_deposit_and_call_swap.go new file mode 100644 index 0000000000..ed71ed3c53 --- /dev/null +++ b/e2e/e2etests/test_v2_deposit_and_call_swap.go @@ -0,0 +1,88 @@ +package e2etests + +import ( + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayevm.sol" + + "github.com/zeta-chain/node/e2e/runner" + "github.com/zeta-chain/node/e2e/utils" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" +) + +// TODO: This test is similar to TestCrosschainSwap +// purpose is to test similar scenario with v2 contracts where there is swap + withdraw in onCall +// to showcase that it's not reverting with gas limit issues +// this test should be removed when this issue is completed: https://github.com/zeta-chain/node/issues/2711 +func TestV2DepositAndCallSwap(r *runner.E2ERunner, _ []string) { + // create tokens pair (erc20 and eth) + tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + // approve router to spend tokens being swapped + tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + tx, err = r.ETHZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + // fund ZEVMSwapApp with gas ZRC20s for withdraw + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e10)) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + tx, err = r.ERC20ZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e6)) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + // temporarily increase gas limit to 400000 + previousGasLimit := r.ZEVMAuth.GasLimit + defer func() { + r.ZEVMAuth.GasLimit = previousGasLimit + }() + + // add liquidity for swap + r.ZEVMAuth.GasLimit = 400000 + tx, err = r.UniswapV2Router.AddLiquidity( + r.ZEVMAuth, + r.ERC20ZRC20Addr, + r.ETHZRC20Addr, + big.NewInt(1e8), + big.NewInt(1e8), + big.NewInt(1e8), + big.NewInt(1e5), + r.EVMAddress(), + big.NewInt(time.Now().Add(10*time.Minute).Unix()), + ) + require.NoError(r, err) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + + // memobytes is dApp specific; see the contracts/ZEVMSwapApp.sol for details + // it is [targetZRC20, receiver] + memobytes, err := r.ZEVMSwapApp.EncodeMemo( + &bind.CallOpts{}, + r.ETHZRC20Addr, + r.EVMAddress().Bytes(), + ) + require.NoError(r, err) + + // perform the deposit and call + r.ApproveERC20OnEVM(r.GatewayEVMAddr) + tx = r.V2ERC20DepositAndCall( + r.ZEVMSwapAppAddr, + big.NewInt(8e7), + memobytes, + gatewayevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, + ) + + // wait for the cctx to be mined + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "deposit_and_call") + require.Equal(r, crosschaintypes.CctxStatus_OutboundMined, cctx.CctxStatus.Status) +}