From 93471653698e954de81c3c83b39e7bce6cb30bd6 Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 18 Oct 2024 11:54:42 +0100 Subject: [PATCH] feat: erc20 auth calls (#3012) * bump protocol contracts to use erc20 auth calls * bump protocol contracts and fix test dapp * rename current test to arbitrary call * rename existing tests * e2e test wip * new test fix * fix test * fix * PR comment * revert staking abi change * fmt * changelog * fix test * PR comment * PR comment * fix test --- changelog.md | 1 + cmd/zetae2e/local/v2.go | 1 + e2e/e2etests/e2etests.go | 11 +- ...st_v2_erc20_withdraw_and_arbitrary_call.go | 41 +++++++ .../test_v2_erc20_withdraw_and_call.go | 30 +++-- .../test_v2_erc20_withdraw_and_call_revert.go | 2 +- ...rc20_withdraw_and_call_revert_with_call.go | 2 +- ...test_v2_eth_withdraw_and_arbitrary_call.go | 2 +- e2e/e2etests/test_v2_eth_withdraw_and_call.go | 7 +- .../test_v2_eth_withdraw_and_call_revert.go | 13 ++- ..._eth_withdraw_and_call_revert_with_call.go | 2 +- ..._eth_withdraw_and_call_through_contract.go | 23 +--- .../test_v2_zevm_to_evm_arbitrary_call.go | 10 +- e2e/e2etests/test_v2_zevm_to_evm_call.go | 7 +- ...st_v2_zevm_to_evm_call_through_contract.go | 26 +---- e2e/runner/v2_zevm.go | 65 ++++++++--- go.mod | 2 +- go.sum | 4 +- pkg/contracts/testdappv2/TestDAppV2.abi | 90 ++++++--------- pkg/contracts/testdappv2/TestDAppV2.bin | 2 +- pkg/contracts/testdappv2/TestDAppV2.go | 104 +++++------------- pkg/contracts/testdappv2/TestDAppV2.json | 92 ++++++---------- pkg/contracts/testdappv2/TestDAppV2.sol | 10 +- zetaclient/chains/evm/signer/outbound_data.go | 28 ++++- zetaclient/chains/evm/signer/v2_sign.go | 36 +++--- zetaclient/chains/evm/signer/v2_signer.go | 2 +- 26 files changed, 290 insertions(+), 323 deletions(-) create mode 100644 e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go diff --git a/changelog.md b/changelog.md index 2dd8e75f9a..fb4435cade 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ * [2896](https://github.com/zeta-chain/node/pull/2896) - add TON inbound observation * [2987](https://github.com/zeta-chain/node/pull/2987) - add non-EVM standard inbound memo package * [2979](https://github.com/zeta-chain/node/pull/2979) - add fungible keeper ability to lock/unlock ZRC20 tokens +* [3012](https://github.com/zeta-chain/node/pull/3012) - integrate authenticated calls erc20 smart contract functionality into protocol ### Refactor diff --git a/cmd/zetae2e/local/v2.go b/cmd/zetae2e/local/v2.go index fa98ef6677..3ef5ff880a 100644 --- a/cmd/zetae2e/local/v2.go +++ b/cmd/zetae2e/local/v2.go @@ -34,6 +34,7 @@ func startV2Tests(eg *errgroup.Group, conf config.Config, deployerRunner *runner e2etests.TestV2ERC20DepositName, e2etests.TestV2ERC20DepositAndCallName, e2etests.TestV2ERC20WithdrawName, + e2etests.TestV2ERC20WithdrawAndArbitraryCallName, e2etests.TestV2ERC20WithdrawAndCallName, )) diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index fe6428385d..c94eb8f89d 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -143,6 +143,7 @@ const ( TestV2ERC20DepositAndCallRevertName = "v2_erc20_deposit_and_call_revert" TestV2ERC20DepositAndCallRevertWithCallName = "v2_erc20_deposit_and_call_revert_with_call" TestV2ERC20WithdrawName = "v2_erc20_withdraw" + TestV2ERC20WithdrawAndArbitraryCallName = "v2_erc20_withdraw_and_arbitrary_call" TestV2ERC20WithdrawAndCallName = "v2_erc20_withdraw_and_call" TestV2ERC20WithdrawAndCallRevertName = "v2_erc20_withdraw_and_call_revert" TestV2ERC20WithdrawAndCallRevertWithCallName = "v2_erc20_withdraw_and_call_revert_with_call" @@ -835,11 +836,17 @@ var AllE2ETests = []runner.E2ETest{ TestV2ERC20Withdraw, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndCallName, - "withdraw ERC20 from ZEVM and call a contract using V2 contract", + TestV2ERC20WithdrawAndArbitraryCallName, + "withdraw ERC20 from ZEVM and arbitrary call a contract using V2 contract", []runner.ArgDefinition{ {Description: "amount", DefaultValue: "1000"}, }, + TestV2ERC20WithdrawAndArbitraryCall, + ), + runner.NewE2ETest( + TestV2ERC20WithdrawAndCallName, + "withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract", + []runner.ArgDefinition{}, TestV2ERC20WithdrawAndCall, ), runner.NewE2ETest( diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go new file mode 100644 index 0000000000..ca48f4be8b --- /dev/null +++ b/e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go @@ -0,0 +1,41 @@ +package e2etests + +import ( + "math/big" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" + + "github.com/zeta-chain/node/e2e/runner" + "github.com/zeta-chain/node/e2e/utils" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" +) + +const payloadMessageWithdrawERC20 = "this is a test ERC20 withdraw and call payload" + +func TestV2ERC20WithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { + require.Len(r, args, 1) + + amount, ok := big.NewInt(0).SetString(args[0], 10) + require.True(r, ok, "Invalid amount specified for TestV2ERC20WithdrawAndCall") + + r.AssertTestDAppEVMCalled(false, payloadMessageWithdrawERC20, amount) + + r.ApproveERC20ZRC20(r.GatewayZEVMAddr) + r.ApproveETHZRC20(r.GatewayZEVMAddr) + + // perform the withdraw + tx := r.V2ERC20WithdrawAndArbitraryCall( + r.TestDAppV2EVMAddr, + amount, + r.EncodeERC20Call(r.ERC20Addr, amount, payloadMessageWithdrawERC20), + gatewayzevm.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, "withdraw") + require.Equal(r, crosschaintypes.CctxStatus_OutboundMined, cctx.CctxStatus.Status) + + r.AssertTestDAppEVMCalled(true, payloadMessageWithdrawERC20, amount) +} diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call.go b/e2e/e2etests/test_v2_erc20_withdraw_and_call.go index 6773e84f17..4596ba12da 100644 --- a/e2e/e2etests/test_v2_erc20_withdraw_and_call.go +++ b/e2e/e2etests/test_v2_erc20_withdraw_and_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" @@ -11,15 +12,20 @@ import ( crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -const payloadMessageWithdrawERC20 = "this is a test ERC20 withdraw and call payload" +const payloadMessageWithdrawAuthenticatedCallERC20 = "this is a test ERC20 withdraw and authenticated call payload" -func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, args []string) { - require.Len(r, args, 1) +func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, _ []string) { + previousGasLimit := r.ZEVMAuth.GasLimit + r.ZEVMAuth.GasLimit = 10000000 + defer func() { + r.ZEVMAuth.GasLimit = previousGasLimit + }() - amount, ok := big.NewInt(0).SetString(args[0], 10) - require.True(r, ok, "Invalid amount specified for TestV2ERC20WithdrawAndCall") + // called with fixed amount without arg since onCall implementation is for TestDappV2 is simple and generic + // without decoding the payload and amount handling for erc20, purpose of test is to verify correct sender and payload are used + amount := big.NewInt(10000) - r.AssertTestDAppEVMCalled(false, payloadMessageWithdrawERC20, amount) + r.AssertTestDAppEVMCalled(false, payloadMessageWithdrawAuthenticatedCallERC20, amount) r.ApproveERC20ZRC20(r.GatewayZEVMAddr) r.ApproveETHZRC20(r.GatewayZEVMAddr) @@ -28,7 +34,7 @@ func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, args []string) { tx := r.V2ERC20WithdrawAndCall( r.TestDAppV2EVMAddr, amount, - r.EncodeERC20Call(r.ERC20Addr, amount, payloadMessageWithdrawERC20), + []byte(payloadMessageWithdrawAuthenticatedCallERC20), gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, ) @@ -37,5 +43,13 @@ func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, args []string) { r.Logger.CCTX(*cctx, "withdraw") require.Equal(r, crosschaintypes.CctxStatus_OutboundMined, cctx.CctxStatus.Status) - r.AssertTestDAppEVMCalled(true, payloadMessageWithdrawERC20, amount) + r.AssertTestDAppEVMCalled(true, payloadMessageWithdrawAuthenticatedCallERC20, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payloadMessageWithdrawAuthenticatedCallERC20), + ) + require.NoError(r, err) + require.Equal(r, r.ZEVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go index 8454d09710..8ca60a238b 100644 --- a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go +++ b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go @@ -29,7 +29,7 @@ func TestV2ERC20WithdrawAndCallRevert(r *runner.E2ERunner, args []string) { require.EqualValues(r, int64(0), balance.Int64()) // perform the withdraw - tx := r.V2ERC20WithdrawAndCall( + tx := r.V2ERC20WithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, amount, r.EncodeERC20CallRevert(r.ERC20Addr, amount), diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go index 45bab52ae6..fb3b3201ff 100644 --- a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go @@ -26,7 +26,7 @@ func TestV2ERC20WithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string r.ApproveETHZRC20(r.GatewayZEVMAddr) // perform the withdraw - tx := r.V2ERC20WithdrawAndCall( + tx := r.V2ERC20WithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, amount, r.EncodeERC20CallRevert(r.ERC20Addr, amount), diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go index 932034d963..b290e33fcb 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go @@ -24,7 +24,7 @@ func TestV2ETHWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { r.ApproveETHZRC20(r.GatewayZEVMAddr) // perform the withdraw - tx := r.V2ETHWithdrawAndCall( + tx := r.V2ETHWithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, amount, r.EncodeGasCall(payloadMessageWithdrawETH), diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call.go b/e2e/e2etests/test_v2_eth_withdraw_and_call.go index de0cadabcf..bffd037e72 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_call.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_call.go @@ -30,13 +30,8 @@ func TestV2ETHWithdrawAndCall(r *runner.E2ERunner, args []string) { r.ApproveETHZRC20(r.GatewayZEVMAddr) - // set expected sender - tx, err := r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, r.ZEVMAuth.From) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - // perform the withdraw - tx = r.V2ETHWithdrawAndAuthenticatedCall( + tx := r.V2ETHWithdrawAndCall( r.TestDAppV2EVMAddr, amount, []byte(payloadMessageAuthenticatedWithdrawETH), diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go index 6df64c9a69..bfa0172e7b 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go @@ -28,10 +28,15 @@ func TestV2ETHWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { require.EqualValues(r, int64(0), balance.Int64()) // perform the withdraw - tx := r.V2ETHWithdrawAndCall(r.TestDAppV2EVMAddr, amount, r.EncodeGasCall("revert"), gatewayzevm.RevertOptions{ - RevertAddress: revertAddress, - OnRevertGasLimit: big.NewInt(0), - }) + tx := r.V2ETHWithdrawAndArbitraryCall( + r.TestDAppV2EVMAddr, + amount, + r.EncodeGasCall("revert"), + gatewayzevm.RevertOptions{ + RevertAddress: revertAddress, + 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) diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go index f4d31d5d14..f613ebffc2 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go @@ -25,7 +25,7 @@ func TestV2ETHWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) r.ApproveETHZRC20(r.GatewayZEVMAddr) // perform the withdraw - tx := r.V2ETHWithdrawAndCall( + tx := r.V2ETHWithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, amount, r.EncodeGasCall("revert"), diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go b/e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go index f2d4949032..28c36ee69d 100644 --- a/e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go +++ b/e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go @@ -40,13 +40,8 @@ func TestV2ETHWithdrawAndCallThroughContract(r *runner.E2ERunner, args []string) require.NoError(r, err) utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) - // set expected sender - tx, err = r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, gatewayCallerAddr) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - // perform the authenticated call - tx = r.V2ETHWithdrawAndAuthenticatedCallThroughContract(gatewayCaller, r.TestDAppV2EVMAddr, + tx = r.V2ETHWithdrawAndCallThroughContract(gatewayCaller, r.TestDAppV2EVMAddr, amount, []byte(payloadMessageAuthenticatedWithdrawETHThroughContract), gatewayzevmcaller.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) @@ -65,20 +60,4 @@ func TestV2ETHWithdrawAndCallThroughContract(r *runner.E2ERunner, args []string) ) require.NoError(r, err) require.Equal(r, gatewayCallerAddr, senderForMsg) - - // set expected sender to wrong one - tx, err = r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, r.ZEVMAuth.From) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - - // repeat authenticated call through contract, should revert because of wrong sender - tx = r.V2ETHWithdrawAndAuthenticatedCallThroughContract(gatewayCaller, r.TestDAppV2EVMAddr, - amount, - []byte(payloadMessageAuthenticatedWithdrawETHThroughContract), - gatewayzevmcaller.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) - - utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) - cctx = utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctx.CctxStatus.Status) } diff --git a/e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go b/e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go index 21104767f9..4b722fc4ae 100644 --- a/e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go +++ b/e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go @@ -22,9 +22,13 @@ func TestV2ZEVMToEVMArbitraryCall(r *runner.E2ERunner, args []string) { r.ApproveETHZRC20(r.GatewayZEVMAddr) // perform the call - tx := r.V2ZEVMToEMVCall(r.TestDAppV2EVMAddr, r.EncodeSimpleCall(payloadMessageEVMCall), gatewayzevm.RevertOptions{ - OnRevertGasLimit: big.NewInt(0), - }) + tx := r.V2ZEVMToEMVArbitraryCall( + r.TestDAppV2EVMAddr, + r.EncodeSimpleCall(payloadMessageEVMCall), + gatewayzevm.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) diff --git a/e2e/e2etests/test_v2_zevm_to_evm_call.go b/e2e/e2etests/test_v2_zevm_to_evm_call.go index ba9d5fba6f..9641778e3c 100644 --- a/e2e/e2etests/test_v2_zevm_to_evm_call.go +++ b/e2e/e2etests/test_v2_zevm_to_evm_call.go @@ -22,13 +22,8 @@ func TestV2ZEVMToEVMCall(r *runner.E2ERunner, args []string) { // necessary approval for fee payment r.ApproveETHZRC20(r.GatewayZEVMAddr) - // set expected sender - tx, err := r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, r.ZEVMAuth.From) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - // perform the authenticated call - tx = r.V2ZEVMToEMVAuthenticatedCall( + tx := r.V2ZEVMToEMVCall( r.TestDAppV2EVMAddr, []byte(payloadMessageEVMAuthenticatedCall), gatewayzevm.RevertOptions{ diff --git a/e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go b/e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go index a46b9f09f9..7ff9158365 100644 --- a/e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go +++ b/e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go @@ -33,13 +33,8 @@ func TestV2ZEVMToEVMCallThroughContract(r *runner.E2ERunner, args []string) { require.NoError(r, err) utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) - // set expected sender - tx, err = r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, gatewayCallerAddr) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - // perform the authenticated call - tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract( + tx = r.V2ZEVMToEMVCallThroughContract( gatewayCaller, r.TestDAppV2EVMAddr, []byte(payloadMessageEVMAuthenticatedCallThroughContract), @@ -61,23 +56,4 @@ func TestV2ZEVMToEVMCallThroughContract(r *runner.E2ERunner, args []string) { ) require.NoError(r, err) require.Equal(r, gatewayCallerAddr, senderForMsg) - - // set expected sender to wrong one - tx, err = r.TestDAppV2EVM.SetExpectedOnCallSender(r.EVMAuth, r.ZEVMAuth.From) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) - - // repeat authenticated call through contract, should revert because of wrong sender - tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract( - gatewayCaller, - r.TestDAppV2EVMAddr, - []byte(payloadMessageEVMAuthenticatedCallThroughContract), - gatewayzevmcaller.RevertOptions{ - OnRevertGasLimit: big.NewInt(0), - }, - ) - utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) - cctx = utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "call") - require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctx.CctxStatus.Status) } diff --git a/e2e/runner/v2_zevm.go b/e2e/runner/v2_zevm.go index 4824884bd0..5153f2c823 100644 --- a/e2e/runner/v2_zevm.go +++ b/e2e/runner/v2_zevm.go @@ -31,20 +31,20 @@ func (r *E2ERunner) V2ETHWithdraw( return tx } -// V2ETHWithdrawAndCall calls WithdrawAndCall of Gateway with gas token on ZEVM -func (r *E2ERunner) V2ETHWithdrawAndCall( +// V2ETHWithdrawAndCall calls WithdrawAndCall of Gateway with gas token on ZEVM using arbitrary call +func (r *E2ERunner) V2ETHWithdrawAndArbitraryCall( receiver ethcommon.Address, amount *big.Int, payload []byte, revertOptions gatewayzevm.RevertOptions, ) *ethtypes.Transaction { - tx, err := r.GatewayZEVM.WithdrawAndCall( + tx, err := r.GatewayZEVM.WithdrawAndCall0( r.ZEVMAuth, receiver.Bytes(), amount, r.ETHZRC20Addr, payload, - gasLimit, + gatewayzevm.CallOptions{GasLimit: gasLimit, IsArbitraryCall: true}, revertOptions, ) require.NoError(r, err) @@ -53,13 +53,13 @@ func (r *E2ERunner) V2ETHWithdrawAndCall( } // V2ETHWithdrawAndCall calls WithdrawAndCall of Gateway with gas token on ZEVM using authenticated call -func (r *E2ERunner) V2ETHWithdrawAndAuthenticatedCall( +func (r *E2ERunner) V2ETHWithdrawAndCall( receiver ethcommon.Address, amount *big.Int, payload []byte, revertOptions gatewayzevm.RevertOptions, ) *ethtypes.Transaction { - tx, err := r.GatewayZEVM.WithdrawAndCall2( + tx, err := r.GatewayZEVM.WithdrawAndCall0( r.ZEVMAuth, receiver.Bytes(), amount, @@ -78,7 +78,7 @@ func (r *E2ERunner) V2ETHWithdrawAndAuthenticatedCall( // V2ETHWithdrawAndCall calls WithdrawAndCall of Gateway with gas token on ZEVM using authenticated call // through contract -func (r *E2ERunner) V2ETHWithdrawAndAuthenticatedCallThroughContract( +func (r *E2ERunner) V2ETHWithdrawAndCallThroughContract( gatewayZEVMCaller *gatewayzevmcaller.GatewayZEVMCaller, receiver ethcommon.Address, amount *big.Int, @@ -120,7 +120,36 @@ func (r *E2ERunner) V2ERC20Withdraw( return tx } -// V2ERC20WithdrawAndCall calls WithdrawAndCall of Gateway with erc20 token on ZEVM +// V2ERC20WithdrawAndCall calls WithdrawAndCall of Gateway with erc20 token on ZEVM using arbitrary call +func (r *E2ERunner) V2ERC20WithdrawAndArbitraryCall( + receiver ethcommon.Address, + amount *big.Int, + payload []byte, + revertOptions gatewayzevm.RevertOptions, +) *ethtypes.Transaction { + // this function take more gas than default 500k + // so we need to increase the gas limit + previousGasLimit := r.ZEVMAuth.GasLimit + r.ZEVMAuth.GasLimit = 10000000 + defer func() { + r.ZEVMAuth.GasLimit = previousGasLimit + }() + + tx, err := r.GatewayZEVM.WithdrawAndCall0( + r.ZEVMAuth, + receiver.Bytes(), + amount, + r.ERC20ZRC20Addr, + payload, + gatewayzevm.CallOptions{GasLimit: gasLimit, IsArbitraryCall: true}, + revertOptions, + ) + require.NoError(r, err) + + return tx +} + +// V2ERC20WithdrawAndCall calls WithdrawAndCall of Gateway with erc20 token on ZEVM using authenticated call func (r *E2ERunner) V2ERC20WithdrawAndCall( receiver ethcommon.Address, amount *big.Int, @@ -135,13 +164,13 @@ func (r *E2ERunner) V2ERC20WithdrawAndCall( r.ZEVMAuth.GasLimit = previousGasLimit }() - tx, err := r.GatewayZEVM.WithdrawAndCall( + tx, err := r.GatewayZEVM.WithdrawAndCall0( r.ZEVMAuth, receiver.Bytes(), amount, r.ERC20ZRC20Addr, payload, - gasLimit, + gatewayzevm.CallOptions{GasLimit: gasLimit, IsArbitraryCall: false}, revertOptions, ) require.NoError(r, err) @@ -149,18 +178,18 @@ func (r *E2ERunner) V2ERC20WithdrawAndCall( return tx } -// V2ZEVMToEMVCall calls Call of Gateway on ZEVM -func (r *E2ERunner) V2ZEVMToEMVCall( +// V2ZEVMToEMVCall calls Call of Gateway on ZEVM using arbitrary call +func (r *E2ERunner) V2ZEVMToEMVArbitraryCall( receiver ethcommon.Address, payload []byte, revertOptions gatewayzevm.RevertOptions, ) *ethtypes.Transaction { - tx, err := r.GatewayZEVM.Call0( + tx, err := r.GatewayZEVM.Call( r.ZEVMAuth, receiver.Bytes(), r.ETHZRC20Addr, payload, - gasLimit, + gatewayzevm.CallOptions{GasLimit: gasLimit, IsArbitraryCall: true}, revertOptions, ) require.NoError(r, err) @@ -168,8 +197,8 @@ func (r *E2ERunner) V2ZEVMToEMVCall( return tx } -// V2ZEVMToEMVCall calls authenticated Call of Gateway on ZEVM -func (r *E2ERunner) V2ZEVMToEMVAuthenticatedCall( +// V2ZEVMToEMVCall calls authenticated Call of Gateway on ZEVM using authenticated call +func (r *E2ERunner) V2ZEVMToEMVCall( receiver ethcommon.Address, payload []byte, revertOptions gatewayzevm.RevertOptions, @@ -190,8 +219,8 @@ func (r *E2ERunner) V2ZEVMToEMVAuthenticatedCall( return tx } -// V2ZEVMToEMVCall calls authenticated Call of Gateway on ZEVM through contract -func (r *E2ERunner) V2ZEVMToEMVAuthenticatedCallThroughContract( +// V2ZEVMToEMVCall calls authenticated Call of Gateway on ZEVM through contract using authenticated call +func (r *E2ERunner) V2ZEVMToEMVCallThroughContract( gatewayZEVMCaller *gatewayzevmcaller.GatewayZEVMCaller, receiver ethcommon.Address, payload []byte, diff --git a/go.mod b/go.mod index cb746a49bf..faa6709809 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/zeta-chain/ethermint v0.0.0-20241010181243-044e22bdb7e7 github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 - github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241014093550-f7f6d9fd971a + github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241016134610-c70fec4d66a6 gitlab.com/thorchain/tss/go-tss v1.6.5 go.nhat.io/grpcmock v0.25.0 golang.org/x/crypto v0.23.0 diff --git a/go.sum b/go.sum index 8842365a96..8f884485e3 100644 --- a/go.sum +++ b/go.sum @@ -4208,8 +4208,8 @@ github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f h1:XqUvw9a3EnDa2 github.com/zeta-chain/go-tss v0.0.0-20240916173049-89fee4b0ae7f/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 h1:vck/FcIIpFOvpBUm0NO17jbEtmSz/W/a5Y4jRuSJl6I= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138/go.mod h1:U494OsZTWsU75hqoriZgMdSsgSGP1mUL1jX+wN/Aez8= -github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241014093550-f7f6d9fd971a h1:xsup+oupCrBtZT/jEaBGcL3k6KUlXWR7iXw/3RHBIpU= -github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241014093550-f7f6d9fd971a/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= +github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241016134610-c70fec4d66a6 h1:9xfE77UtF316hcsX7H2/OjROWtxBZyk8k1sQN3exIVM= +github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241016134610-c70fec4d66a6/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901 h1:9whtN5fjYHfk4yXIuAsYP2EHxImwDWDVUOnZJ2pfL3w= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901/go.mod h1:d2iTC62s9JwKiCMPhcDDXbIZmuzAyJ4lwso0H5QyRbk= github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= diff --git a/pkg/contracts/testdappv2/TestDAppV2.abi b/pkg/contracts/testdappv2/TestDAppV2.abi index 95618cf9db..c2846866a1 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.abi +++ b/pkg/contracts/testdappv2/TestDAppV2.abi @@ -60,19 +60,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "expectedOnCallSender", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -124,37 +111,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "internalType": "struct TestDAppV2.MessageContext", - "name": "messageContext", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "name": "onCall", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "payable", - "type": "function" - }, { "inputs": [ { @@ -195,11 +151,42 @@ "type": "bytes" } ], - "name": "onCrossChainCall", + "name": "onCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "internalType": "struct TestDAppV2.MessageContext", + "name": "messageContext", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "onCall", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [ { @@ -254,19 +241,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_expectedOnCallSender", - "type": "address" - } - ], - "name": "setExpectedOnCallSender", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { diff --git a/pkg/contracts/testdappv2/TestDAppV2.bin b/pkg/contracts/testdappv2/TestDAppV2.bin index 1c087ef1b5..d5b99ed321 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.bin +++ b/pkg/contracts/testdappv2/TestDAppV2.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063c234fecf1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063c234fecf146101ec578063c7a339a914610215578063c9028a361461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063676cc054146101635780639291fe2614610193578063a799911f146101d0576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b61017d60048036038101906101789190610e30565b6103ad565b60405161018a9190611131565b60405180910390f35b34801561019f57600080fd5b506101ba60048036038101906101b59190610de7565b610562565b6040516101c79190611173565b60405180910390f35b6101ea60048036038101906101e59190610de7565b6105a5565b005b3480156101f857600080fd5b50610213600480360381019061020e9190610ca8565b6105ce565b005b34801561022157600080fd5b5061023c60048036038101906102379190610d78565b610611565b005b34801561024a57600080fd5b5061026560048036038101906102609190610e90565b6106d4565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906103f99190610ca8565b73ffffffffffffffffffffffffffffffffffffffff161461044f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044690611153565b60405180910390fd5b61049c83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b6104ea83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906104fd9190610ca8565b6002848460405161050f92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016105799190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105ae816109c0565b156105b857600080fd5b6105c181610a16565b6105cb8134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61061a816109c0565b1561062457600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610661939291906110df565b602060405180830381600087803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190610cd5565b6106bc57600080fd5b6106c581610a16565b6106cf8183610a6a565b505050565b61072f8180606001906106e7919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61078c818060600190610742919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b80600001602081019061079f9190610ca8565b60028280606001906107b1919061118e565b6040516107bf92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220da9e50cb7b79ace99166ed06c9234f984bc9599fca79796389af6656411f73f964736f6c63430008070033 +608060405234801561001057600080fd5b5061130b806100206000396000f3fe6080604052600436106100a05760003560e01c8063a799911f11610064578063a799911f146101a8578063c7a339a9146101c4578063c9028a36146101ed578063e2842ed714610216578063f592cbfb14610253578063f936ae8514610290576100a7565b806336e980a0146100ac5780634297a263146100d55780635bcfd61614610112578063676cc0541461013b5780639291fe261461016b576100a7565b366100a757005b600080fd5b3480156100b857600080fd5b506100d360048036038101906100ce9190610c65565b6102cd565b005b3480156100e157600080fd5b506100fc60048036038101906100f79190610b80565b6102f7565b6040516101099190610fae565b60405180910390f35b34801561011e57600080fd5b5061013960048036038101906101349190610d57565b61030f565b005b61015560048036038101906101509190610cae565b610408565b6040516101629190610f8c565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190610c65565b61051d565b60405161019f9190610fae565b60405180910390f35b6101c260048036038101906101bd9190610c65565b610560565b005b3480156101d057600080fd5b506101eb60048036038101906101e69190610bf6565b610589565b005b3480156101f957600080fd5b50610214600480360381019061020f9190610d0e565b61064c565b005b34801561022257600080fd5b5061023d60048036038101906102389190610b80565b610786565b60405161024a9190610f71565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190610c65565b6107a6565b6040516102879190610f71565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b29190610bad565b6107f5565b6040516102c49190610f1f565b60405180910390f35b6102d68161083e565b156102e057600080fd5b6102e981610894565b6102f48160006108e8565b50565b60026020528060005260406000206000915090505481565b61035c82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061083e565b1561036657600080fd5b6103b382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b61040182828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846108e8565b5050505050565b606061045783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6104a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346108e8565b8360000160208101906104b89190610b26565b600184846040516104ca929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060026000836040516020016105349190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105698161083e565b1561057357600080fd5b61057c81610894565b61058681346108e8565b50565b6105928161083e565b1561059c57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016105d993929190610f3a565b602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062b9190610b53565b61063457600080fd5b61063d81610894565b61064781836108e8565b505050565b6106a781806060019061065f9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6107048180606001906106ba9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006108e8565b8060000160208101906107179190610b26565b60018280606001906107299190610fc9565b604051610737929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000836040516020016107bc9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6001818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161084f90610f0a565b60405160208183030381529060405280519060200120826040516020016108769190610ef3565b60405160208183030381529060405280519060200120149050919050565b6001600080836040516020016108aa9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060026000846040516020016108fe9190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b600061093d61093884611051565b61102c565b90508281526020810184848401111561095957610958611219565b5b610964848285611154565b509392505050565b600061097f61097a84611082565b61102c565b90508281526020810184848401111561099b5761099a611219565b5b6109a6848285611154565b509392505050565b6000813590506109bd81611262565b92915050565b6000815190506109d281611279565b92915050565b6000813590506109e781611290565b92915050565b60008083601f840112610a0357610a026111fb565b5b8235905067ffffffffffffffff811115610a2057610a1f6111f6565b5b602083019150836001820283011115610a3c57610a3b61120f565b5b9250929050565b600082601f830112610a5857610a576111fb565b5b8135610a6884826020860161092a565b91505092915050565b600081359050610a80816112a7565b92915050565b600082601f830112610a9b57610a9a6111fb565b5b8135610aab84826020860161096c565b91505092915050565b600060208284031215610aca57610ac9611205565b5b81905092915050565b600060808284031215610ae957610ae8611205565b5b81905092915050565b600060608284031215610b0857610b07611205565b5b81905092915050565b600081359050610b20816112be565b92915050565b600060208284031215610b3c57610b3b611223565b5b6000610b4a848285016109ae565b91505092915050565b600060208284031215610b6957610b68611223565b5b6000610b77848285016109c3565b91505092915050565b600060208284031215610b9657610b95611223565b5b6000610ba4848285016109d8565b91505092915050565b600060208284031215610bc357610bc2611223565b5b600082013567ffffffffffffffff811115610be157610be061121e565b5b610bed84828501610a43565b91505092915050565b600080600060608486031215610c0f57610c0e611223565b5b6000610c1d86828701610a71565b9350506020610c2e86828701610b11565b925050604084013567ffffffffffffffff811115610c4f57610c4e61121e565b5b610c5b86828701610a86565b9150509250925092565b600060208284031215610c7b57610c7a611223565b5b600082013567ffffffffffffffff811115610c9957610c9861121e565b5b610ca584828501610a86565b91505092915050565b600080600060408486031215610cc757610cc6611223565b5b6000610cd586828701610ab4565b935050602084013567ffffffffffffffff811115610cf657610cf561121e565b5b610d02868287016109ed565b92509250509250925092565b600060208284031215610d2457610d23611223565b5b600082013567ffffffffffffffff811115610d4257610d4161121e565b5b610d4e84828501610ad3565b91505092915050565b600080600080600060808688031215610d7357610d72611223565b5b600086013567ffffffffffffffff811115610d9157610d9061121e565b5b610d9d88828901610af2565b9550506020610dae888289016109ae565b9450506040610dbf88828901610b11565b935050606086013567ffffffffffffffff811115610de057610ddf61121e565b5b610dec888289016109ed565b92509250509295509295909350565b610e04816110f0565b82525050565b610e1381611102565b82525050565b6000610e2583856110da565b9350610e32838584611154565b82840190509392505050565b6000610e49826110b3565b610e5381856110c9565b9350610e63818560208601611163565b610e6c81611228565b840191505092915050565b6000610e82826110be565b610e8c81856110e5565b9350610e9c818560208601611163565b80840191505092915050565b6000610eb56006836110e5565b9150610ec082611239565b600682019050919050565b610ed48161114a565b82525050565b6000610ee7828486610e19565b91508190509392505050565b6000610eff8284610e77565b915081905092915050565b6000610f1582610ea8565b9150819050919050565b6000602082019050610f346000830184610dfb565b92915050565b6000606082019050610f4f6000830186610dfb565b610f5c6020830185610dfb565b610f696040830184610ecb565b949350505050565b6000602082019050610f866000830184610e0a565b92915050565b60006020820190508181036000830152610fa68184610e3e565b905092915050565b6000602082019050610fc36000830184610ecb565b92915050565b60008083356001602003843603038112610fe657610fe561120a565b5b80840192508235915067ffffffffffffffff82111561100857611007611200565b5b60208301925060018202360383131561102457611023611214565b5b509250929050565b6000611036611047565b90506110428282611196565b919050565b6000604051905090565b600067ffffffffffffffff82111561106c5761106b6111c7565b5b61107582611228565b9050602081019050919050565b600067ffffffffffffffff82111561109d5761109c6111c7565b5b6110a682611228565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600081905092915050565b60006110fb8261112a565b9050919050565b60008115159050919050565b6000819050919050565b6000611123826110f0565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015611181578082015181840152602081019050611166565b83811115611190576000848401525b50505050565b61119f82611228565b810181811067ffffffffffffffff821117156111be576111bd6111c7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61126b816110f0565b811461127657600080fd5b50565b61128281611102565b811461128d57600080fd5b50565b6112998161110e565b81146112a457600080fd5b50565b6112b081611118565b81146112bb57600080fd5b50565b6112c78161114a565b81146112d257600080fd5b5056fea26469706673582212201f295f137d0ea146883fdaa6858baa14e4c467a843ff4e7829fd9df0d4c2aede64736f6c63430008070033 diff --git a/pkg/contracts/testdappv2/TestDAppV2.go b/pkg/contracts/testdappv2/TestDAppV2.go index 5c32fe96f8..967c261e60 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.go +++ b/pkg/contracts/testdappv2/TestDAppV2.go @@ -51,8 +51,8 @@ type TestDAppV2zContext struct { // TestDAppV2MetaData contains all meta data concerning the TestDAppV2 contract. var TestDAppV2MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"amountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"calledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"erc20Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"expectedOnCallSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"gasCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getAmountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getCalledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"internalType\":\"structTestDAppV2.MessageContext\",\"name\":\"messageContext\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCall\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structTestDAppV2.zContext\",\"name\":\"_context\",\"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\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"revertMessage\",\"type\":\"bytes\"}],\"internalType\":\"structTestDAppV2.RevertContext\",\"name\":\"revertContext\",\"type\":\"tuple\"}],\"name\":\"onRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"senderWithMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_expectedOnCallSender\",\"type\":\"address\"}],\"name\":\"setExpectedOnCallSender\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"simpleCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063c234fecf1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063c234fecf146101ec578063c7a339a914610215578063c9028a361461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063676cc054146101635780639291fe2614610193578063a799911f146101d0576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b61017d60048036038101906101789190610e30565b6103ad565b60405161018a9190611131565b60405180910390f35b34801561019f57600080fd5b506101ba60048036038101906101b59190610de7565b610562565b6040516101c79190611173565b60405180910390f35b6101ea60048036038101906101e59190610de7565b6105a5565b005b3480156101f857600080fd5b50610213600480360381019061020e9190610ca8565b6105ce565b005b34801561022157600080fd5b5061023c60048036038101906102379190610d78565b610611565b005b34801561024a57600080fd5b5061026560048036038101906102609190610e90565b6106d4565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906103f99190610ca8565b73ffffffffffffffffffffffffffffffffffffffff161461044f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044690611153565b60405180910390fd5b61049c83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b6104ea83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906104fd9190610ca8565b6002848460405161050f92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016105799190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105ae816109c0565b156105b857600080fd5b6105c181610a16565b6105cb8134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61061a816109c0565b1561062457600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610661939291906110df565b602060405180830381600087803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190610cd5565b6106bc57600080fd5b6106c581610a16565b6106cf8183610a6a565b505050565b61072f8180606001906106e7919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61078c818060600190610742919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b80600001602081019061079f9190610ca8565b60028280606001906107b1919061118e565b6040516107bf92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220da9e50cb7b79ace99166ed06c9234f984bc9599fca79796389af6656411f73f964736f6c63430008070033", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"amountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"calledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"erc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"erc20Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"gasCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getAmountWithMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"getCalledWithMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structTestDAppV2.zContext\",\"name\":\"_context\",\"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\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"internalType\":\"structTestDAppV2.MessageContext\",\"name\":\"messageContext\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCall\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"revertMessage\",\"type\":\"bytes\"}],\"internalType\":\"structTestDAppV2.RevertContext\",\"name\":\"revertContext\",\"type\":\"tuple\"}],\"name\":\"onRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"senderWithMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"simpleCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x608060405234801561001057600080fd5b5061130b806100206000396000f3fe6080604052600436106100a05760003560e01c8063a799911f11610064578063a799911f146101a8578063c7a339a9146101c4578063c9028a36146101ed578063e2842ed714610216578063f592cbfb14610253578063f936ae8514610290576100a7565b806336e980a0146100ac5780634297a263146100d55780635bcfd61614610112578063676cc0541461013b5780639291fe261461016b576100a7565b366100a757005b600080fd5b3480156100b857600080fd5b506100d360048036038101906100ce9190610c65565b6102cd565b005b3480156100e157600080fd5b506100fc60048036038101906100f79190610b80565b6102f7565b6040516101099190610fae565b60405180910390f35b34801561011e57600080fd5b5061013960048036038101906101349190610d57565b61030f565b005b61015560048036038101906101509190610cae565b610408565b6040516101629190610f8c565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190610c65565b61051d565b60405161019f9190610fae565b60405180910390f35b6101c260048036038101906101bd9190610c65565b610560565b005b3480156101d057600080fd5b506101eb60048036038101906101e69190610bf6565b610589565b005b3480156101f957600080fd5b50610214600480360381019061020f9190610d0e565b61064c565b005b34801561022257600080fd5b5061023d60048036038101906102389190610b80565b610786565b60405161024a9190610f71565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190610c65565b6107a6565b6040516102879190610f71565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b29190610bad565b6107f5565b6040516102c49190610f1f565b60405180910390f35b6102d68161083e565b156102e057600080fd5b6102e981610894565b6102f48160006108e8565b50565b60026020528060005260406000206000915090505481565b61035c82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061083e565b1561036657600080fd5b6103b382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b61040182828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846108e8565b5050505050565b606061045783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6104a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346108e8565b8360000160208101906104b89190610b26565b600184846040516104ca929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060026000836040516020016105349190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105698161083e565b1561057357600080fd5b61057c81610894565b61058681346108e8565b50565b6105928161083e565b1561059c57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016105d993929190610f3a565b602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062b9190610b53565b61063457600080fd5b61063d81610894565b61064781836108e8565b505050565b6106a781806060019061065f9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6107048180606001906106ba9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006108e8565b8060000160208101906107179190610b26565b60018280606001906107299190610fc9565b604051610737929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000836040516020016107bc9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6001818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161084f90610f0a565b60405160208183030381529060405280519060200120826040516020016108769190610ef3565b60405160208183030381529060405280519060200120149050919050565b6001600080836040516020016108aa9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060026000846040516020016108fe9190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b600061093d61093884611051565b61102c565b90508281526020810184848401111561095957610958611219565b5b610964848285611154565b509392505050565b600061097f61097a84611082565b61102c565b90508281526020810184848401111561099b5761099a611219565b5b6109a6848285611154565b509392505050565b6000813590506109bd81611262565b92915050565b6000815190506109d281611279565b92915050565b6000813590506109e781611290565b92915050565b60008083601f840112610a0357610a026111fb565b5b8235905067ffffffffffffffff811115610a2057610a1f6111f6565b5b602083019150836001820283011115610a3c57610a3b61120f565b5b9250929050565b600082601f830112610a5857610a576111fb565b5b8135610a6884826020860161092a565b91505092915050565b600081359050610a80816112a7565b92915050565b600082601f830112610a9b57610a9a6111fb565b5b8135610aab84826020860161096c565b91505092915050565b600060208284031215610aca57610ac9611205565b5b81905092915050565b600060808284031215610ae957610ae8611205565b5b81905092915050565b600060608284031215610b0857610b07611205565b5b81905092915050565b600081359050610b20816112be565b92915050565b600060208284031215610b3c57610b3b611223565b5b6000610b4a848285016109ae565b91505092915050565b600060208284031215610b6957610b68611223565b5b6000610b77848285016109c3565b91505092915050565b600060208284031215610b9657610b95611223565b5b6000610ba4848285016109d8565b91505092915050565b600060208284031215610bc357610bc2611223565b5b600082013567ffffffffffffffff811115610be157610be061121e565b5b610bed84828501610a43565b91505092915050565b600080600060608486031215610c0f57610c0e611223565b5b6000610c1d86828701610a71565b9350506020610c2e86828701610b11565b925050604084013567ffffffffffffffff811115610c4f57610c4e61121e565b5b610c5b86828701610a86565b9150509250925092565b600060208284031215610c7b57610c7a611223565b5b600082013567ffffffffffffffff811115610c9957610c9861121e565b5b610ca584828501610a86565b91505092915050565b600080600060408486031215610cc757610cc6611223565b5b6000610cd586828701610ab4565b935050602084013567ffffffffffffffff811115610cf657610cf561121e565b5b610d02868287016109ed565b92509250509250925092565b600060208284031215610d2457610d23611223565b5b600082013567ffffffffffffffff811115610d4257610d4161121e565b5b610d4e84828501610ad3565b91505092915050565b600080600080600060808688031215610d7357610d72611223565b5b600086013567ffffffffffffffff811115610d9157610d9061121e565b5b610d9d88828901610af2565b9550506020610dae888289016109ae565b9450506040610dbf88828901610b11565b935050606086013567ffffffffffffffff811115610de057610ddf61121e565b5b610dec888289016109ed565b92509250509295509295909350565b610e04816110f0565b82525050565b610e1381611102565b82525050565b6000610e2583856110da565b9350610e32838584611154565b82840190509392505050565b6000610e49826110b3565b610e5381856110c9565b9350610e63818560208601611163565b610e6c81611228565b840191505092915050565b6000610e82826110be565b610e8c81856110e5565b9350610e9c818560208601611163565b80840191505092915050565b6000610eb56006836110e5565b9150610ec082611239565b600682019050919050565b610ed48161114a565b82525050565b6000610ee7828486610e19565b91508190509392505050565b6000610eff8284610e77565b915081905092915050565b6000610f1582610ea8565b9150819050919050565b6000602082019050610f346000830184610dfb565b92915050565b6000606082019050610f4f6000830186610dfb565b610f5c6020830185610dfb565b610f696040830184610ecb565b949350505050565b6000602082019050610f866000830184610e0a565b92915050565b60006020820190508181036000830152610fa68184610e3e565b905092915050565b6000602082019050610fc36000830184610ecb565b92915050565b60008083356001602003843603038112610fe657610fe561120a565b5b80840192508235915067ffffffffffffffff82111561100857611007611200565b5b60208301925060018202360383131561102457611023611214565b5b509250929050565b6000611036611047565b90506110428282611196565b919050565b6000604051905090565b600067ffffffffffffffff82111561106c5761106b6111c7565b5b61107582611228565b9050602081019050919050565b600067ffffffffffffffff82111561109d5761109c6111c7565b5b6110a682611228565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600081905092915050565b60006110fb8261112a565b9050919050565b60008115159050919050565b6000819050919050565b6000611123826110f0565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015611181578082015181840152602081019050611166565b83811115611190576000848401525b50505050565b61119f82611228565b810181811067ffffffffffffffff821117156111be576111bd6111c7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61126b816110f0565b811461127657600080fd5b50565b61128281611102565b811461128d57600080fd5b50565b6112998161110e565b81146112a457600080fd5b50565b6112b081611118565b81146112bb57600080fd5b50565b6112c78161114a565b81146112d257600080fd5b5056fea26469706673582212201f295f137d0ea146883fdaa6858baa14e4c467a843ff4e7829fd9df0d4c2aede64736f6c63430008070033", } // TestDAppV2ABI is the input ABI used to generate the binding from. @@ -284,37 +284,6 @@ func (_TestDAppV2 *TestDAppV2CallerSession) CalledWithMessage(arg0 [32]byte) (bo return _TestDAppV2.Contract.CalledWithMessage(&_TestDAppV2.CallOpts, arg0) } -// ExpectedOnCallSender is a free data retrieval call binding the contract method 0x59f4a777. -// -// Solidity: function expectedOnCallSender() view returns(address) -func (_TestDAppV2 *TestDAppV2Caller) ExpectedOnCallSender(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _TestDAppV2.contract.Call(opts, &out, "expectedOnCallSender") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// ExpectedOnCallSender is a free data retrieval call binding the contract method 0x59f4a777. -// -// Solidity: function expectedOnCallSender() view returns(address) -func (_TestDAppV2 *TestDAppV2Session) ExpectedOnCallSender() (common.Address, error) { - return _TestDAppV2.Contract.ExpectedOnCallSender(&_TestDAppV2.CallOpts) -} - -// ExpectedOnCallSender is a free data retrieval call binding the contract method 0x59f4a777. -// -// Solidity: function expectedOnCallSender() view returns(address) -func (_TestDAppV2 *TestDAppV2CallerSession) ExpectedOnCallSender() (common.Address, error) { - return _TestDAppV2.Contract.ExpectedOnCallSender(&_TestDAppV2.CallOpts) -} - // GetAmountWithMessage is a free data retrieval call binding the contract method 0x9291fe26. // // Solidity: function getAmountWithMessage(string message) view returns(uint256) @@ -450,46 +419,46 @@ func (_TestDAppV2 *TestDAppV2TransactorSession) GasCall(message string) (*types. return _TestDAppV2.Contract.GasCall(&_TestDAppV2.TransactOpts, message) } -// OnCall is a paid mutator transaction binding the contract method 0x676cc054. +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. // -// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) -func (_TestDAppV2 *TestDAppV2Transactor) OnCall(opts *bind.TransactOpts, messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { - return _TestDAppV2.contract.Transact(opts, "onCall", messageContext, message) +// Solidity: function onCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() +func (_TestDAppV2 *TestDAppV2Transactor) OnCall(opts *bind.TransactOpts, _context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _TestDAppV2.contract.Transact(opts, "onCall", _context, _zrc20, amount, message) } -// OnCall is a paid mutator transaction binding the contract method 0x676cc054. +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. // -// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) -func (_TestDAppV2 *TestDAppV2Session) OnCall(messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { - return _TestDAppV2.Contract.OnCall(&_TestDAppV2.TransactOpts, messageContext, message) +// Solidity: function onCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() +func (_TestDAppV2 *TestDAppV2Session) OnCall(_context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.OnCall(&_TestDAppV2.TransactOpts, _context, _zrc20, amount, message) } -// OnCall is a paid mutator transaction binding the contract method 0x676cc054. +// OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. // -// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) -func (_TestDAppV2 *TestDAppV2TransactorSession) OnCall(messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { - return _TestDAppV2.Contract.OnCall(&_TestDAppV2.TransactOpts, messageContext, message) +// Solidity: function onCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() +func (_TestDAppV2 *TestDAppV2TransactorSession) OnCall(_context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.OnCall(&_TestDAppV2.TransactOpts, _context, _zrc20, amount, message) } -// OnCrossChainCall is a paid mutator transaction binding the contract method 0xde43156e. +// OnCall0 is a paid mutator transaction binding the contract method 0x676cc054. // -// Solidity: function onCrossChainCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() -func (_TestDAppV2 *TestDAppV2Transactor) OnCrossChainCall(opts *bind.TransactOpts, _context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _TestDAppV2.contract.Transact(opts, "onCrossChainCall", _context, _zrc20, amount, message) +// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) +func (_TestDAppV2 *TestDAppV2Transactor) OnCall0(opts *bind.TransactOpts, messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { + return _TestDAppV2.contract.Transact(opts, "onCall0", messageContext, message) } -// OnCrossChainCall is a paid mutator transaction binding the contract method 0xde43156e. +// OnCall0 is a paid mutator transaction binding the contract method 0x676cc054. // -// Solidity: function onCrossChainCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() -func (_TestDAppV2 *TestDAppV2Session) OnCrossChainCall(_context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _TestDAppV2.Contract.OnCrossChainCall(&_TestDAppV2.TransactOpts, _context, _zrc20, amount, message) +// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) +func (_TestDAppV2 *TestDAppV2Session) OnCall0(messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.OnCall0(&_TestDAppV2.TransactOpts, messageContext, message) } -// OnCrossChainCall is a paid mutator transaction binding the contract method 0xde43156e. +// OnCall0 is a paid mutator transaction binding the contract method 0x676cc054. // -// Solidity: function onCrossChainCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() -func (_TestDAppV2 *TestDAppV2TransactorSession) OnCrossChainCall(_context TestDAppV2zContext, _zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _TestDAppV2.Contract.OnCrossChainCall(&_TestDAppV2.TransactOpts, _context, _zrc20, amount, message) +// Solidity: function onCall((address) messageContext, bytes message) payable returns(bytes) +func (_TestDAppV2 *TestDAppV2TransactorSession) OnCall0(messageContext TestDAppV2MessageContext, message []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.OnCall0(&_TestDAppV2.TransactOpts, messageContext, message) } // OnRevert is a paid mutator transaction binding the contract method 0xc9028a36. @@ -513,27 +482,6 @@ func (_TestDAppV2 *TestDAppV2TransactorSession) OnRevert(revertContext TestDAppV return _TestDAppV2.Contract.OnRevert(&_TestDAppV2.TransactOpts, revertContext) } -// SetExpectedOnCallSender is a paid mutator transaction binding the contract method 0xc234fecf. -// -// Solidity: function setExpectedOnCallSender(address _expectedOnCallSender) returns() -func (_TestDAppV2 *TestDAppV2Transactor) SetExpectedOnCallSender(opts *bind.TransactOpts, _expectedOnCallSender common.Address) (*types.Transaction, error) { - return _TestDAppV2.contract.Transact(opts, "setExpectedOnCallSender", _expectedOnCallSender) -} - -// SetExpectedOnCallSender is a paid mutator transaction binding the contract method 0xc234fecf. -// -// Solidity: function setExpectedOnCallSender(address _expectedOnCallSender) returns() -func (_TestDAppV2 *TestDAppV2Session) SetExpectedOnCallSender(_expectedOnCallSender common.Address) (*types.Transaction, error) { - return _TestDAppV2.Contract.SetExpectedOnCallSender(&_TestDAppV2.TransactOpts, _expectedOnCallSender) -} - -// SetExpectedOnCallSender is a paid mutator transaction binding the contract method 0xc234fecf. -// -// Solidity: function setExpectedOnCallSender(address _expectedOnCallSender) returns() -func (_TestDAppV2 *TestDAppV2TransactorSession) SetExpectedOnCallSender(_expectedOnCallSender common.Address) (*types.Transaction, error) { - return _TestDAppV2.Contract.SetExpectedOnCallSender(&_TestDAppV2.TransactOpts, _expectedOnCallSender) -} - // SimpleCall is a paid mutator transaction binding the contract method 0x36e980a0. // // Solidity: function simpleCall(string message) returns() diff --git a/pkg/contracts/testdappv2/TestDAppV2.json b/pkg/contracts/testdappv2/TestDAppV2.json index 632521fa63..2ea4bd665d 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.json +++ b/pkg/contracts/testdappv2/TestDAppV2.json @@ -61,19 +61,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "expectedOnCallSender", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -125,37 +112,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "internalType": "struct TestDAppV2.MessageContext", - "name": "messageContext", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "name": "onCall", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "payable", - "type": "function" - }, { "inputs": [ { @@ -196,11 +152,42 @@ "type": "bytes" } ], - "name": "onCrossChainCall", + "name": "onCall", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "internalType": "struct TestDAppV2.MessageContext", + "name": "messageContext", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "onCall", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [ { @@ -255,19 +242,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_expectedOnCallSender", - "type": "address" - } - ], - "name": "setExpectedOnCallSender", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -286,5 +260,5 @@ "type": "receive" } ], - "bin": "608060405234801561001057600080fd5b5061150a806100206000396000f3fe6080604052600436106100c65760003560e01c8063c234fecf1161007f578063de43156e11610059578063de43156e14610267578063e2842ed714610290578063f592cbfb146102cd578063f936ae851461030a576100cd565b8063c234fecf146101ec578063c7a339a914610215578063c9028a361461023e576100cd565b806336e980a0146100d25780634297a263146100fb57806359f4a77714610138578063676cc054146101635780639291fe2614610193578063a799911f146101d0576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100f960048036038101906100f49190610de7565b610347565b005b34801561010757600080fd5b50610122600480360381019061011d9190610d02565b610371565b60405161012f9190611173565b60405180910390f35b34801561014457600080fd5b5061014d610389565b60405161015a91906110c4565b60405180910390f35b61017d60048036038101906101789190610e30565b6103ad565b60405161018a9190611131565b60405180910390f35b34801561019f57600080fd5b506101ba60048036038101906101b59190610de7565b610562565b6040516101c79190611173565b60405180910390f35b6101ea60048036038101906101e59190610de7565b6105a5565b005b3480156101f857600080fd5b50610213600480360381019061020e9190610ca8565b6105ce565b005b34801561022157600080fd5b5061023c60048036038101906102379190610d78565b610611565b005b34801561024a57600080fd5b5061026560048036038101906102609190610e90565b6106d4565b005b34801561027357600080fd5b5061028e60048036038101906102899190610ed9565b61080e565b005b34801561029c57600080fd5b506102b760048036038101906102b29190610d02565b610907565b6040516102c49190611116565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190610de7565b610927565b6040516103019190611116565b60405180910390f35b34801561031657600080fd5b50610331600480360381019061032c9190610d2f565b610977565b60405161033e91906110c4565b60405180910390f35b610350816109c0565b1561035a57600080fd5b61036381610a16565b61036e816000610a6a565b50565b60036020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160208101906103f99190610ca8565b73ffffffffffffffffffffffffffffffffffffffff161461044f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044690611153565b60405180910390fd5b61049c83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b6104ea83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505034610a6a565b8360000160208101906104fd9190610ca8565b6002848460405161050f92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060036000836040516020016105799190611098565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105ae816109c0565b156105b857600080fd5b6105c181610a16565b6105cb8134610a6a565b50565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61061a816109c0565b1561062457600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610661939291906110df565b602060405180830381600087803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190610cd5565b6106bc57600080fd5b6106c581610a16565b6106cf8183610a6a565b505050565b61072f8180606001906106e7919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61078c818060600190610742919061118e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a6a565b80600001602081019061079f9190610ca8565b60028280606001906107b1919061118e565b6040516107bf92919061107f565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61085b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109c0565b1561086557600080fd5b6108b282828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a16565b61090082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a6a565b5050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b6000600160008360405160200161093e9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109d1906110af565b60405160208183030381529060405280519060200120826040516020016109f89190611098565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a2c9190611098565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a809190611098565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b6000610abf610aba84611216565b6111f1565b905082815260208101848484011115610adb57610ada6113ef565b5b610ae684828561132a565b509392505050565b6000610b01610afc84611247565b6111f1565b905082815260208101848484011115610b1d57610b1c6113ef565b5b610b2884828561132a565b509392505050565b600081359050610b3f81611461565b92915050565b600081519050610b5481611478565b92915050565b600081359050610b698161148f565b92915050565b60008083601f840112610b8557610b846113d1565b5b8235905067ffffffffffffffff811115610ba257610ba16113cc565b5b602083019150836001820283011115610bbe57610bbd6113e5565b5b9250929050565b600082601f830112610bda57610bd96113d1565b5b8135610bea848260208601610aac565b91505092915050565b600081359050610c02816114a6565b92915050565b600082601f830112610c1d57610c1c6113d1565b5b8135610c2d848260208601610aee565b91505092915050565b600060208284031215610c4c57610c4b6113db565b5b81905092915050565b600060808284031215610c6b57610c6a6113db565b5b81905092915050565b600060608284031215610c8a57610c896113db565b5b81905092915050565b600081359050610ca2816114bd565b92915050565b600060208284031215610cbe57610cbd6113f9565b5b6000610ccc84828501610b30565b91505092915050565b600060208284031215610ceb57610cea6113f9565b5b6000610cf984828501610b45565b91505092915050565b600060208284031215610d1857610d176113f9565b5b6000610d2684828501610b5a565b91505092915050565b600060208284031215610d4557610d446113f9565b5b600082013567ffffffffffffffff811115610d6357610d626113f4565b5b610d6f84828501610bc5565b91505092915050565b600080600060608486031215610d9157610d906113f9565b5b6000610d9f86828701610bf3565b9350506020610db086828701610c93565b925050604084013567ffffffffffffffff811115610dd157610dd06113f4565b5b610ddd86828701610c08565b9150509250925092565b600060208284031215610dfd57610dfc6113f9565b5b600082013567ffffffffffffffff811115610e1b57610e1a6113f4565b5b610e2784828501610c08565b91505092915050565b600080600060408486031215610e4957610e486113f9565b5b6000610e5786828701610c36565b935050602084013567ffffffffffffffff811115610e7857610e776113f4565b5b610e8486828701610b6f565b92509250509250925092565b600060208284031215610ea657610ea56113f9565b5b600082013567ffffffffffffffff811115610ec457610ec36113f4565b5b610ed084828501610c55565b91505092915050565b600080600080600060808688031215610ef557610ef46113f9565b5b600086013567ffffffffffffffff811115610f1357610f126113f4565b5b610f1f88828901610c74565b9550506020610f3088828901610b30565b9450506040610f4188828901610c93565b935050606086013567ffffffffffffffff811115610f6257610f616113f4565b5b610f6e88828901610b6f565b92509250509295509295909350565b610f86816112c6565b82525050565b610f95816112d8565b82525050565b6000610fa7838561129f565b9350610fb483858461132a565b82840190509392505050565b6000610fcb82611278565b610fd5818561128e565b9350610fe5818560208601611339565b610fee816113fe565b840191505092915050565b600061100482611283565b61100e81856112bb565b935061101e818560208601611339565b80840191505092915050565b60006110376016836112aa565b91506110428261140f565b602082019050919050565b600061105a6006836112bb565b915061106582611438565b600682019050919050565b61107981611320565b82525050565b600061108c828486610f9b565b91508190509392505050565b60006110a48284610ff9565b915081905092915050565b60006110ba8261104d565b9150819050919050565b60006020820190506110d96000830184610f7d565b92915050565b60006060820190506110f46000830186610f7d565b6111016020830185610f7d565b61110e6040830184611070565b949350505050565b600060208201905061112b6000830184610f8c565b92915050565b6000602082019050818103600083015261114b8184610fc0565b905092915050565b6000602082019050818103600083015261116c8161102a565b9050919050565b60006020820190506111886000830184611070565b92915050565b600080833560016020038436030381126111ab576111aa6113e0565b5b80840192508235915067ffffffffffffffff8211156111cd576111cc6113d6565b5b6020830192506001820236038313156111e9576111e86113ea565b5b509250929050565b60006111fb61120c565b9050611207828261136c565b919050565b6000604051905090565b600067ffffffffffffffff8211156112315761123061139d565b5b61123a826113fe565b9050602081019050919050565b600067ffffffffffffffff8211156112625761126161139d565b5b61126b826113fe565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006112d182611300565b9050919050565b60008115159050919050565b6000819050919050565b60006112f9826112c6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561135757808201518184015260208101905061133c565b83811115611366576000848401525b50505050565b611375826113fe565b810181811067ffffffffffffffff821117156113945761139361139d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f756e61757468656e746963617465642073656e64657200000000000000000000600082015250565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61146a816112c6565b811461147557600080fd5b50565b611481816112d8565b811461148c57600080fd5b50565b611498816112e4565b81146114a357600080fd5b50565b6114af816112ee565b81146114ba57600080fd5b50565b6114c681611320565b81146114d157600080fd5b5056fea2646970667358221220da9e50cb7b79ace99166ed06c9234f984bc9599fca79796389af6656411f73f964736f6c63430008070033" + "bin": "608060405234801561001057600080fd5b5061130b806100206000396000f3fe6080604052600436106100a05760003560e01c8063a799911f11610064578063a799911f146101a8578063c7a339a9146101c4578063c9028a36146101ed578063e2842ed714610216578063f592cbfb14610253578063f936ae8514610290576100a7565b806336e980a0146100ac5780634297a263146100d55780635bcfd61614610112578063676cc0541461013b5780639291fe261461016b576100a7565b366100a757005b600080fd5b3480156100b857600080fd5b506100d360048036038101906100ce9190610c65565b6102cd565b005b3480156100e157600080fd5b506100fc60048036038101906100f79190610b80565b6102f7565b6040516101099190610fae565b60405180910390f35b34801561011e57600080fd5b5061013960048036038101906101349190610d57565b61030f565b005b61015560048036038101906101509190610cae565b610408565b6040516101629190610f8c565b60405180910390f35b34801561017757600080fd5b50610192600480360381019061018d9190610c65565b61051d565b60405161019f9190610fae565b60405180910390f35b6101c260048036038101906101bd9190610c65565b610560565b005b3480156101d057600080fd5b506101eb60048036038101906101e69190610bf6565b610589565b005b3480156101f957600080fd5b50610214600480360381019061020f9190610d0e565b61064c565b005b34801561022257600080fd5b5061023d60048036038101906102389190610b80565b610786565b60405161024a9190610f71565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190610c65565b6107a6565b6040516102879190610f71565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b29190610bad565b6107f5565b6040516102c49190610f1f565b60405180910390f35b6102d68161083e565b156102e057600080fd5b6102e981610894565b6102f48160006108e8565b50565b60026020528060005260406000206000915090505481565b61035c82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061083e565b1561036657600080fd5b6103b382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b61040182828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050846108e8565b5050505050565b606061045783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6104a583838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050346108e8565b8360000160208101906104b89190610b26565b600184846040516104ca929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509392505050565b600060026000836040516020016105349190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b6105698161083e565b1561057357600080fd5b61057c81610894565b61058681346108e8565b50565b6105928161083e565b1561059c57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016105d993929190610f3a565b602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062b9190610b53565b61063457600080fd5b61063d81610894565b61064781836108e8565b505050565b6106a781806060019061065f9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610894565b6107048180606001906106ba9190610fc9565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505060006108e8565b8060000160208101906107179190610b26565b60018280606001906107299190610fc9565b604051610737929190610eda565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000836040516020016107bc9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6001818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405160200161084f90610f0a565b60405160208183030381529060405280519060200120826040516020016108769190610ef3565b60405160208183030381529060405280519060200120149050919050565b6001600080836040516020016108aa9190610ef3565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060026000846040516020016108fe9190610ef3565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b600061093d61093884611051565b61102c565b90508281526020810184848401111561095957610958611219565b5b610964848285611154565b509392505050565b600061097f61097a84611082565b61102c565b90508281526020810184848401111561099b5761099a611219565b5b6109a6848285611154565b509392505050565b6000813590506109bd81611262565b92915050565b6000815190506109d281611279565b92915050565b6000813590506109e781611290565b92915050565b60008083601f840112610a0357610a026111fb565b5b8235905067ffffffffffffffff811115610a2057610a1f6111f6565b5b602083019150836001820283011115610a3c57610a3b61120f565b5b9250929050565b600082601f830112610a5857610a576111fb565b5b8135610a6884826020860161092a565b91505092915050565b600081359050610a80816112a7565b92915050565b600082601f830112610a9b57610a9a6111fb565b5b8135610aab84826020860161096c565b91505092915050565b600060208284031215610aca57610ac9611205565b5b81905092915050565b600060808284031215610ae957610ae8611205565b5b81905092915050565b600060608284031215610b0857610b07611205565b5b81905092915050565b600081359050610b20816112be565b92915050565b600060208284031215610b3c57610b3b611223565b5b6000610b4a848285016109ae565b91505092915050565b600060208284031215610b6957610b68611223565b5b6000610b77848285016109c3565b91505092915050565b600060208284031215610b9657610b95611223565b5b6000610ba4848285016109d8565b91505092915050565b600060208284031215610bc357610bc2611223565b5b600082013567ffffffffffffffff811115610be157610be061121e565b5b610bed84828501610a43565b91505092915050565b600080600060608486031215610c0f57610c0e611223565b5b6000610c1d86828701610a71565b9350506020610c2e86828701610b11565b925050604084013567ffffffffffffffff811115610c4f57610c4e61121e565b5b610c5b86828701610a86565b9150509250925092565b600060208284031215610c7b57610c7a611223565b5b600082013567ffffffffffffffff811115610c9957610c9861121e565b5b610ca584828501610a86565b91505092915050565b600080600060408486031215610cc757610cc6611223565b5b6000610cd586828701610ab4565b935050602084013567ffffffffffffffff811115610cf657610cf561121e565b5b610d02868287016109ed565b92509250509250925092565b600060208284031215610d2457610d23611223565b5b600082013567ffffffffffffffff811115610d4257610d4161121e565b5b610d4e84828501610ad3565b91505092915050565b600080600080600060808688031215610d7357610d72611223565b5b600086013567ffffffffffffffff811115610d9157610d9061121e565b5b610d9d88828901610af2565b9550506020610dae888289016109ae565b9450506040610dbf88828901610b11565b935050606086013567ffffffffffffffff811115610de057610ddf61121e565b5b610dec888289016109ed565b92509250509295509295909350565b610e04816110f0565b82525050565b610e1381611102565b82525050565b6000610e2583856110da565b9350610e32838584611154565b82840190509392505050565b6000610e49826110b3565b610e5381856110c9565b9350610e63818560208601611163565b610e6c81611228565b840191505092915050565b6000610e82826110be565b610e8c81856110e5565b9350610e9c818560208601611163565b80840191505092915050565b6000610eb56006836110e5565b9150610ec082611239565b600682019050919050565b610ed48161114a565b82525050565b6000610ee7828486610e19565b91508190509392505050565b6000610eff8284610e77565b915081905092915050565b6000610f1582610ea8565b9150819050919050565b6000602082019050610f346000830184610dfb565b92915050565b6000606082019050610f4f6000830186610dfb565b610f5c6020830185610dfb565b610f696040830184610ecb565b949350505050565b6000602082019050610f866000830184610e0a565b92915050565b60006020820190508181036000830152610fa68184610e3e565b905092915050565b6000602082019050610fc36000830184610ecb565b92915050565b60008083356001602003843603038112610fe657610fe561120a565b5b80840192508235915067ffffffffffffffff82111561100857611007611200565b5b60208301925060018202360383131561102457611023611214565b5b509250929050565b6000611036611047565b90506110428282611196565b919050565b6000604051905090565b600067ffffffffffffffff82111561106c5761106b6111c7565b5b61107582611228565b9050602081019050919050565b600067ffffffffffffffff82111561109d5761109c6111c7565b5b6110a682611228565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600081905092915050565b60006110fb8261112a565b9050919050565b60008115159050919050565b6000819050919050565b6000611123826110f0565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015611181578082015181840152602081019050611166565b83811115611190576000848401525b50505050565b61119f82611228565b810181811067ffffffffffffffff821117156111be576111bd6111c7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b61126b816110f0565b811461127657600080fd5b50565b61128281611102565b811461128d57600080fd5b50565b6112998161110e565b81146112a457600080fd5b50565b6112b081611118565b81146112bb57600080fd5b50565b6112c78161114a565b81146112d257600080fd5b5056fea26469706673582212201f295f137d0ea146883fdaa6858baa14e4c467a843ff4e7829fd9df0d4c2aede64736f6c63430008070033" } diff --git a/pkg/contracts/testdappv2/TestDAppV2.sol b/pkg/contracts/testdappv2/TestDAppV2.sol index 7919d13b5d..c460c87025 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.sol +++ b/pkg/contracts/testdappv2/TestDAppV2.sol @@ -30,8 +30,6 @@ contract TestDAppV2 { address sender; } - address public expectedOnCallSender; - // these structures allow to assess contract calls mapping(bytes32 => bool) public calledWithMessage; mapping(bytes => address) public senderWithMessage; @@ -53,7 +51,7 @@ contract TestDAppV2 { } // Universal contract interface - function onCrossChainCall( + function onCall( zContext calldata _context, address _zrc20, uint256 amount, @@ -105,12 +103,8 @@ contract TestDAppV2 { senderWithMessage[revertContext.revertMessage] = revertContext.sender; } - function setExpectedOnCallSender(address _expectedOnCallSender) external { - expectedOnCallSender = _expectedOnCallSender; - } - + // Callable interface function onCall(MessageContext calldata messageContext, bytes calldata message) external payable returns (bytes memory) { - require(messageContext.sender == expectedOnCallSender, "unauthenticated sender"); setCalledWithMessage(string(message)); setAmountWithMessage(string(message), msg.value); senderWithMessage[message] = messageContext.sender; diff --git a/zetaclient/chains/evm/signer/outbound_data.go b/zetaclient/chains/evm/signer/outbound_data.go index 0cc65c19e2..200ae1f70b 100644 --- a/zetaclient/chains/evm/signer/outbound_data.go +++ b/zetaclient/chains/evm/signer/outbound_data.go @@ -10,6 +10,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" "github.com/rs/zerolog" + "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayevm.sol" "github.com/zeta-chain/node/pkg/coin" "github.com/zeta-chain/node/x/crosschain/types" @@ -42,6 +43,9 @@ type OutboundData struct { // revertOptions field contains data detailing the revert options revertOptions types.RevertOptions + + // callOptions field determinenes if call is arbitrary or authenticated and contains gasLimit + callOptions types.CallOptions } // NewOutboundData creates OutboundData from the given CCTX. @@ -67,14 +71,16 @@ func NewOutboundData( } var ( - to ethcommon.Address - toChainID *big.Int + to ethcommon.Address + toChainID *big.Int + callOptions types.CallOptions ) // in protocol contract v2, receiver is always set in the outbound if cctx.ProtocolContractVersion == types.ProtocolContractVersion_V2 { to = ethcommon.HexToAddress(cctx.GetCurrentOutboundParam().Receiver) toChainID = big.NewInt(cctx.GetCurrentOutboundParam().ReceiverChainId) + callOptions = *cctx.GetCurrentOutboundParam().CallOptions } else { // recipient + destination chain var skip bool @@ -140,9 +146,27 @@ func NewOutboundData( outboundParams: outboundParams, revertOptions: cctx.RevertOptions, + + callOptions: callOptions, }, false, nil } +func (o OutboundData) MessageContext() (gatewayevm.MessageContext, error) { + if o.callOptions == (types.CallOptions{}) { + return gatewayevm.MessageContext{}, errors.New("call options not found") + } + // if sender is provided in messageContext call is authenticated and target is Callable.onCall + // otherwise, call is arbitrary + messageContext := gatewayevm.MessageContext{ + Sender: o.sender, + } + if o.callOptions.IsArbitraryCall { + messageContext.Sender = ethcommon.Address{} + } + + return messageContext, nil +} + func getCCTXIndex(cctx *types.CrossChainTx) ([32]byte, error) { // `0x` + `64 chars`. Two chars ranging `00...FF` represent one byte (64 chars = 32 bytes) if len(cctx.Index) != (2 + 64) { diff --git a/zetaclient/chains/evm/signer/v2_sign.go b/zetaclient/chains/evm/signer/v2_sign.go index 3a00a86c48..443f304785 100644 --- a/zetaclient/chains/evm/signer/v2_sign.go +++ b/zetaclient/chains/evm/signer/v2_sign.go @@ -19,7 +19,6 @@ import ( // bytes calldata data func (signer *Signer) signGatewayExecute( ctx context.Context, - sender string, txData *OutboundData, ) (*ethtypes.Transaction, error) { gatewayABI, err := gatewayevm.GatewayEVMMetaData.GetAbi() @@ -27,21 +26,16 @@ func (signer *Signer) signGatewayExecute( return nil, errors.Wrap(err, "unable to get GatewayEVMMetaData ABI") } + messageContext, err := txData.MessageContext() + if err != nil { + return nil, err + } + var data []byte - if txData.outboundParams.CallOptions.IsArbitraryCall { - data, err = gatewayABI.Pack("execute", txData.to, txData.message) - if err != nil { - return nil, fmt.Errorf("execute pack error: %w", err) - } - } else { - messageContext := gatewayevm.MessageContext{ - Sender: common.HexToAddress(sender), - } - data, err = gatewayABI.Pack("execute0", messageContext, txData.to, txData.message) - if err != nil { - return nil, fmt.Errorf("execute0 pack error: %w", err) - } + data, err = gatewayABI.Pack("execute", messageContext, txData.to, txData.message) + if err != nil { + return nil, fmt.Errorf("execute pack error: %w", err) } tx, _, _, err := signer.Sign( @@ -155,7 +149,19 @@ func (signer *Signer) signERC20CustodyWithdrawAndCall( return nil, errors.Wrap(err, "unable to get ERC20CustodyMetaData ABI") } - data, err := erc20CustodyV2ABI.Pack("withdrawAndCall", txData.to, txData.asset, txData.amount, txData.message) + messageContext, err := txData.MessageContext() + if err != nil { + return nil, err + } + + data, err := erc20CustodyV2ABI.Pack( + "withdrawAndCall", + messageContext, + txData.to, + txData.asset, + txData.amount, + txData.message, + ) if err != nil { return nil, fmt.Errorf("withdraw pack error: %w", err) } diff --git a/zetaclient/chains/evm/signer/v2_signer.go b/zetaclient/chains/evm/signer/v2_signer.go index e687454b3b..664663cf0f 100644 --- a/zetaclient/chains/evm/signer/v2_signer.go +++ b/zetaclient/chains/evm/signer/v2_signer.go @@ -27,7 +27,7 @@ func (signer *Signer) SignOutboundFromCCTXV2( case evm.OutboundTypeGasWithdrawAndCall, evm.OutboundTypeCall: // both gas withdraw and call and no-asset call uses gateway execute // no-asset call simply hash msg.value == 0 - return signer.signGatewayExecute(ctx, cctx.InboundParams.Sender, outboundData) + return signer.signGatewayExecute(ctx, outboundData) case evm.OutboundTypeGasWithdrawRevertAndCallOnRevert: return signer.signGatewayExecuteRevert(ctx, cctx.InboundParams.Sender, outboundData) case evm.OutboundTypeERC20WithdrawRevertAndCallOnRevert: