diff --git a/e2e/e2etests/test_deploy_contract.go b/e2e/e2etests/test_deploy_contract.go index 92b1ae9257..4a0c8474da 100644 --- a/e2e/e2etests/test_deploy_contract.go +++ b/e2e/e2etests/test_deploy_contract.go @@ -46,6 +46,7 @@ func deployZEVMTestDApp(r *runner.E2ERunner) (ethcommon.Address, error) { r.ZEVMAuth, r.ZEVMClient, true, + r.GatewayEVMAddr, ) if err != nil { return addr, err @@ -66,6 +67,7 @@ func deployEVMTestDApp(r *runner.E2ERunner) (ethcommon.Address, error) { r.EVMAuth, r.EVMClient, false, + r.GatewayEVMAddr, ) if err != nil { return addr, err diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 9484888cf3..9fbc905aa9 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -87,11 +87,5 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call to reverter reverted") - // Check the error carries the revert executed. - // tolerate the error in both the ErrorMessage field and the StatusMessage field - if cctx.CctxStatus.ErrorMessage != "" { - require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") - } else { - require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo) - } + require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo) } diff --git a/e2e/e2etests/test_inbound_trackers.go b/e2e/e2etests/test_inbound_trackers.go index b26b505cf1..7aeb38b8ea 100644 --- a/e2e/e2etests/test_inbound_trackers.go +++ b/e2e/e2etests/test_inbound_trackers.go @@ -84,4 +84,32 @@ func TestInboundTrackers(r *runner.E2ERunner, args []string) { ) addTrackerAndWaitForCCTX(coin.CoinType_NoAssetCall, tx.Hash().Hex()) r.Logger.Print("🍾v2 call observed") + + // set value of the payable transactions + previousValue := r.EVMAuth.Value + r.EVMAuth.Value = amount + + // send v2 deposit through contract + r.Logger.Print("🏃test v2 deposit through contract") + tx, err := r.TestDAppV2EVM.GatewayDeposit(r.EVMAuth, r.EVMAddress()) + require.NoError(r, err) + addTrackerAndWaitForCCTX(coin.CoinType_Gas, tx.Hash().Hex()) + r.Logger.Print("🍾v2 deposit through contract observed") + + // send v2 deposit and call through contract + r.Logger.Print("🏃test v2 deposit and call through contract") + tx, err = r.TestDAppV2EVM.GatewayDepositAndCall(r.EVMAuth, r.TestDAppV2ZEVMAddr, []byte(randomPayload(r))) + require.NoError(r, err) + addTrackerAndWaitForCCTX(coin.CoinType_Gas, tx.Hash().Hex()) + r.Logger.Print("🍾v2 deposit and call through contract observed") + + // reset the value of the payable transactions + r.EVMAuth.Value = previousValue + + // send v2 call through contract + r.Logger.Print("🏃test v2 call through contract") + tx, err = r.TestDAppV2EVM.GatewayCall(r.EVMAuth, r.TestDAppV2ZEVMAddr, []byte(randomPayload(r))) + require.NoError(r, err) + addTrackerAndWaitForCCTX(coin.CoinType_NoAssetCall, tx.Hash().Hex()) + r.Logger.Print("🍾v2 call through contract observed") } diff --git a/e2e/e2etests/test_solana_deposit_refund.go b/e2e/e2etests/test_solana_deposit_refund.go index c8724e72f8..094e87a3e3 100644 --- a/e2e/e2etests/test_solana_deposit_refund.go +++ b/e2e/e2etests/test_solana_deposit_refund.go @@ -31,11 +31,5 @@ func TestSolanaDepositAndCallRevert(r *runner.E2ERunner, args []string) { r.Logger.CCTX(*cctx, "solana_deposit_and_refund") utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - // Check the error carries the revert executed. - // tolerate the error in both the ErrorMessage field and the StatusMessage field - if cctx.CctxStatus.ErrorMessage != "" { - require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") - } else { - require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo) - } + require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo) } diff --git a/e2e/e2etests/test_ton_deposit_refund.go b/e2e/e2etests/test_ton_deposit_refund.go index 3259e1d1d6..5c65cca4a9 100644 --- a/e2e/e2etests/test_ton_deposit_refund.go +++ b/e2e/e2etests/test_ton_deposit_refund.go @@ -39,12 +39,5 @@ func TestTONDepositAndCallRefund(r *runner.E2ERunner, args []string) { require.NoError(r, err) r.Logger.CCTX(*cctx, "ton_deposit_and_refund") - // Check the error carries the revert executed. - // tolerate the error in both the ErrorMessage field and the StatusMessage field - if cctx.CctxStatus.ErrorMessage != "" { - require.Contains(r, cctx.CctxStatus.ErrorMessage, "revert executed") - return - } - - require.Contains(r, cctx.CctxStatus.StatusMessage, utils.ErrHashRevertFoo) + require.Contains(r, cctx.CctxStatus.ErrorMessage, utils.ErrHashRevertFoo) } diff --git a/e2e/runner/balances.go b/e2e/runner/balances.go index 8d1fb82597..5de1e9b9ff 100644 --- a/e2e/runner/balances.go +++ b/e2e/runner/balances.go @@ -98,7 +98,7 @@ func (r *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, error) { // solana var solSOL *big.Int var solSPL *big.Int - if r.Account.SolanaAddress != "" && r.Account.SolanaPrivateKey != "" { + if r.Account.SolanaAddress != "" && r.Account.SolanaPrivateKey != "" && r.SolanaClient != nil { solanaAddr := solana.MustPublicKeyFromBase58(r.Account.SolanaAddress.String()) privateKey := solana.MustPrivateKeyFromBase58(r.Account.SolanaPrivateKey.String()) solSOLBalance, err := r.SolanaClient.GetBalance( diff --git a/e2e/runner/v2_setup_evm.go b/e2e/runner/v2_setup_evm.go index 8545302fd3..97c3280395 100644 --- a/e2e/runner/v2_setup_evm.go +++ b/e2e/runner/v2_setup_evm.go @@ -102,7 +102,7 @@ func (r *E2ERunner) SetupEVMV2() { require.NoError(r, err) // deploy test dapp v2 - testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.EVMAuth, r.EVMClient, false) + testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.EVMAuth, r.EVMClient, false, r.GatewayEVMAddr) require.NoError(r, err) r.TestDAppV2EVMAddr = testDAppV2Addr diff --git a/e2e/runner/v2_setup_zeta.go b/e2e/runner/v2_setup_zeta.go index 69f16e2658..b11aaf8236 100644 --- a/e2e/runner/v2_setup_zeta.go +++ b/e2e/runner/v2_setup_zeta.go @@ -65,7 +65,12 @@ func (r *E2ERunner) SetZEVMContractsV2() { require.NoError(r, err) // deploy test dapp v2 - testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2(r.ZEVMAuth, r.ZEVMClient, true) + testDAppV2Addr, txTestDAppV2, _, err := testdappv2.DeployTestDAppV2( + r.ZEVMAuth, + r.ZEVMClient, + true, + r.GatewayEVMAddr, + ) require.NoError(r, err) r.TestDAppV2ZEVMAddr = testDAppV2Addr diff --git a/pkg/contracts/testdappv2/TestDAppV2.abi b/pkg/contracts/testdappv2/TestDAppV2.abi index d87050a8a0..3f53ac838d 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.abi +++ b/pkg/contracts/testdappv2/TestDAppV2.abi @@ -5,6 +5,11 @@ "internalType": "bool", "name": "isZetaChain_", "type": "bool" + }, + { + "internalType": "address", + "name": "gateway_", + "type": "address" } ], "stateMutability": "nonpayable", @@ -97,6 +102,68 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [], + "name": "gateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "gatewayCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + } + ], + "name": "gatewayDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "gatewayDepositAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [ { diff --git a/pkg/contracts/testdappv2/TestDAppV2.bin b/pkg/contracts/testdappv2/TestDAppV2.bin index b46669b67e..5455aed4f7 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.bin +++ b/pkg/contracts/testdappv2/TestDAppV2.bin @@ -1 +1 @@ -60a0604052348015600f57600080fd5b506040516117953803806117958339818101604052810190602f91906078565b8015156080811515815250505060a0565b600080fd5b60008115159050919050565b6058816045565b8114606257600080fd5b50565b6000815190506072816051565b92915050565b600060208284031215608b57608a6040565b5b60006097848285016065565b91505092915050565b6080516116d36100c26000396000818161079601526108ff01526116d36000f3fe6080604052600436106100e15760003560e01c8063c7a339a91161007f578063c91f356711610059578063c91f3567146102bf578063e2842ed7146102ea578063f592cbfb14610327578063f936ae8514610364576100e8565b8063c7a339a914610242578063c85f84341461026b578063c9028a3614610296576100e8565b8063676cc054116100bb578063676cc0541461017c5780639291fe26146101ac578063a799911f146101e9578063ad23b28b14610205576100e8565b806336e980a0146100ed5780634297a263146101165780635bcfd61614610153576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610114600480360381019061010f9190610cd1565b6103a1565b005b34801561012257600080fd5b5061013d60048036038101906101389190610d50565b6103cb565b60405161014a9190610d96565b60405180910390f35b34801561015f57600080fd5b5061017a60048036038101906101759190610ebf565b6103e3565b005b61019660048036038101906101919190610f82565b6104c9565b6040516101a39190611061565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190610cd1565b6105db565b6040516101e09190610d96565b60405180910390f35b61020360048036038101906101fe9190610cd1565b61061e565b005b34801561021157600080fd5b5061022c60048036038101906102279190611083565b610647565b6040516102399190611105565b60405180910390f35b34801561024e57600080fd5b5061026960048036038101906102649190611165565b6106a7565b005b34801561027757600080fd5b5061028061075b565b60405161028d9190611105565b60405180910390f35b3480156102a257600080fd5b506102bd60048036038101906102b891906111f3565b610794565b005b3480156102cb57600080fd5b506102d46108fd565b6040516102e19190611257565b60405180910390f35b3480156102f657600080fd5b50610311600480360381019061030c9190610d50565b610921565b60405161031e9190611257565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190610cd1565b610941565b60405161035b9190611257565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190611313565b610991565b604051610398919061136b565b60405180910390f35b6103aa816109da565b156103b457600080fd5b6103bd81610a30565b6103c8816000610a84565b50565b60036020528060005260406000206000915090505481565b61043082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109da565b1561043a57600080fd5b60008083839050146104905782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104ac565b6104ab8660200160208101906104a69190611083565b610647565b5b90506104b781610a30565b6104c18185610a84565b505050505050565b606060008084849050146105215783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061053d565b61053c8560000160208101906105379190611083565b610647565b5b905061054881610a30565b6105528134610a84565b8460000160208101906105659190611083565b60028260405161057591906113c2565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016105f29190611415565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b610627816109da565b1561063157600080fd5b61063a81610a30565b6106448134610a84565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525082604051602001610691929190611474565b6040516020818303038152906040529050919050565b6106b0816109da565b156106ba57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016106f79392919061149c565b6020604051808303816000875af1158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a91906114ff565b61074357600080fd5b61074c81610a30565b6107568183610a84565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f0000000000000000000000000000000000000000000000000000000000000000156107c3576107c2610ac6565b5b61081e8180606001906107d6919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a30565b61087b818060600190610831919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a84565b80600001602081019061088e9190611083565b60028280606001906108a0919061153b565b6040516108ae9291906115c3565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016109589190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109eb90611628565b6040516020818303038152906040528051906020012082604051602001610a129190611415565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a469190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a9a9190611415565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610ae3919061166c565b905060005b81811015610b265760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610ae8565b50600080610b349190610b39565b505050565b5080546000825590600052602060002090810190610b579190610b5a565b50565b5b80821115610b73576000816000905550600101610b5b565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610bde82610b95565b810181811067ffffffffffffffff82111715610bfd57610bfc610ba6565b5b80604052505050565b6000610c10610b77565b9050610c1c8282610bd5565b919050565b600067ffffffffffffffff821115610c3c57610c3b610ba6565b5b610c4582610b95565b9050602081019050919050565b82818337600083830152505050565b6000610c74610c6f84610c21565b610c06565b905082815260208101848484011115610c9057610c8f610b90565b5b610c9b848285610c52565b509392505050565b600082601f830112610cb857610cb7610b8b565b5b8135610cc8848260208601610c61565b91505092915050565b600060208284031215610ce757610ce6610b81565b5b600082013567ffffffffffffffff811115610d0557610d04610b86565b5b610d1184828501610ca3565b91505092915050565b6000819050919050565b610d2d81610d1a565b8114610d3857600080fd5b50565b600081359050610d4a81610d24565b92915050565b600060208284031215610d6657610d65610b81565b5b6000610d7484828501610d3b565b91505092915050565b6000819050919050565b610d9081610d7d565b82525050565b6000602082019050610dab6000830184610d87565b92915050565b600080fd5b600060608284031215610dcc57610dcb610db1565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e0082610dd5565b9050919050565b610e1081610df5565b8114610e1b57600080fd5b50565b600081359050610e2d81610e07565b92915050565b610e3c81610d7d565b8114610e4757600080fd5b50565b600081359050610e5981610e33565b92915050565b600080fd5b600080fd5b60008083601f840112610e7f57610e7e610b8b565b5b8235905067ffffffffffffffff811115610e9c57610e9b610e5f565b5b602083019150836001820283011115610eb857610eb7610e64565b5b9250929050565b600080600080600060808688031215610edb57610eda610b81565b5b600086013567ffffffffffffffff811115610ef957610ef8610b86565b5b610f0588828901610db6565b9550506020610f1688828901610e1e565b9450506040610f2788828901610e4a565b935050606086013567ffffffffffffffff811115610f4857610f47610b86565b5b610f5488828901610e69565b92509250509295509295909350565b600060208284031215610f7957610f78610db1565b5b81905092915050565b600080600060408486031215610f9b57610f9a610b81565b5b6000610fa986828701610f63565b935050602084013567ffffffffffffffff811115610fca57610fc9610b86565b5b610fd686828701610e69565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b8381101561101c578082015181840152602081019050611001565b60008484015250505050565b600061103382610fe2565b61103d8185610fed565b935061104d818560208601610ffe565b61105681610b95565b840191505092915050565b6000602082019050818103600083015261107b8184611028565b905092915050565b60006020828403121561109957611098610b81565b5b60006110a784828501610e1e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006110d7826110b0565b6110e181856110bb565b93506110f1818560208601610ffe565b6110fa81610b95565b840191505092915050565b6000602082019050818103600083015261111f81846110cc565b905092915050565b600061113282610df5565b9050919050565b61114281611127565b811461114d57600080fd5b50565b60008135905061115f81611139565b92915050565b60008060006060848603121561117e5761117d610b81565b5b600061118c86828701611150565b935050602061119d86828701610e4a565b925050604084013567ffffffffffffffff8111156111be576111bd610b86565b5b6111ca86828701610ca3565b9150509250925092565b6000608082840312156111ea576111e9610db1565b5b81905092915050565b60006020828403121561120957611208610b81565b5b600082013567ffffffffffffffff81111561122757611226610b86565b5b611233848285016111d4565b91505092915050565b60008115159050919050565b6112518161123c565b82525050565b600060208201905061126c6000830184611248565b92915050565b600067ffffffffffffffff82111561128d5761128c610ba6565b5b61129682610b95565b9050602081019050919050565b60006112b66112b184611272565b610c06565b9050828152602081018484840111156112d2576112d1610b90565b5b6112dd848285610c52565b509392505050565b600082601f8301126112fa576112f9610b8b565b5b813561130a8482602086016112a3565b91505092915050565b60006020828403121561132957611328610b81565b5b600082013567ffffffffffffffff81111561134757611346610b86565b5b611353848285016112e5565b91505092915050565b61136581610df5565b82525050565b6000602082019050611380600083018461135c565b92915050565b600081905092915050565b600061139c82610fe2565b6113a68185611386565b93506113b6818560208601610ffe565b80840191505092915050565b60006113ce8284611391565b915081905092915050565b600081905092915050565b60006113ef826110b0565b6113f981856113d9565b9350611409818560208601610ffe565b80840191505092915050565b600061142182846113e4565b915081905092915050565b60008160601b9050919050565b60006114448261142c565b9050919050565b600061145682611439565b9050919050565b61146e61146982610df5565b61144b565b82525050565b600061148082856113e4565b915061148c828461145d565b6014820191508190509392505050565b60006060820190506114b1600083018661135c565b6114be602083018561135c565b6114cb6040830184610d87565b949350505050565b6114dc8161123c565b81146114e757600080fd5b50565b6000815190506114f9816114d3565b92915050565b60006020828403121561151557611514610b81565b5b6000611523848285016114ea565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115585761155761152c565b5b80840192508235915067ffffffffffffffff82111561157a57611579611531565b5b60208301925060018202360383131561159657611595611536565b5b509250929050565b60006115aa8385611386565b93506115b7838584610c52565b82840190509392505050565b60006115d082848661159e565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b60006116126006836113d9565b915061161d826115dc565b600682019050919050565b600061163382611605565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061167782610d7d565b915061168283610d7d565b9250826116925761169161163d565b5b82820490509291505056fea2646970667358221220eabca6f5232e330b7bfacfcaa51280bd616323d8694afc461b86845313fcbed364736f6c634300081a0033 +60c060405234801561001057600080fd5b50604051611ebb380380611ebb83398181016040528101906100329190610114565b8115156080811515815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610154565b600080fd5b60008115159050919050565b6100938161007e565b811461009e57600080fd5b50565b6000815190506100b08161008a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e1826100b6565b9050919050565b6100f1816100d6565b81146100fc57600080fd5b50565b60008151905061010e816100e8565b92915050565b6000806040838503121561012b5761012a610079565b5b6000610139858286016100a1565b925050602061014a858286016100ff565b9150509250929050565b60805160a051611d116101aa6000396000818161045b015281816104d40152818161084e0152610c730152600081816104a90152818161082301528181610abb01528181610c240152610c480152611d116000f3fe60806040526004361061010d5760003560e01c8063ad23b28b11610095578063c91f356711610064578063c91f35671461035b578063deb3b1e414610386578063e2842ed7146103a2578063f592cbfb146103df578063f936ae851461041c57610114565b8063ad23b28b146102a1578063c7a339a9146102de578063c85f843414610307578063c9028a361461033257610114565b80635bcfd616116100dc5780635bcfd616146101d3578063676cc054146101fc5780639291fe261461022c5780639ca016ed14610269578063a799911f1461028557610114565b8063116191b61461011957806336e980a01461014457806341a3cd4a1461016d5780634297a2631461019657610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610459565b60405161013b9190611005565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061117a565b61047d565b005b34801561017957600080fd5b50610194600480360381019061018f919061124f565b6104a7565b005b3480156101a257600080fd5b506101bd60048036038101906101b891906112e5565b6105ce565b6040516101ca919061132b565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f59190611396565b6105e6565b005b61021660048036038101906102119190611459565b6106cc565b6040516102239190611538565b60405180910390f35b34801561023857600080fd5b50610253600480360381019061024e919061117a565b6107de565b604051610260919061132b565b60405180910390f35b610283600480360381019061027e919061155a565b610821565b005b61029f600480360381019061029a919061117a565b610943565b005b3480156102ad57600080fd5b506102c860048036038101906102c3919061155a565b61096c565b6040516102d591906115dc565b60405180910390f35b3480156102ea57600080fd5b506103056004803603810190610300919061163c565b6109cc565b005b34801561031357600080fd5b5061031c610a80565b60405161032991906115dc565b60405180910390f35b34801561033e57600080fd5b50610359600480360381019061035491906116ca565b610ab9565b005b34801561036757600080fd5b50610370610c22565b60405161037d919061172e565b60405180910390f35b6103a0600480360381019061039b919061124f565b610c46565b005b3480156103ae57600080fd5b506103c960048036038101906103c491906112e5565b610d6e565b6040516103d6919061172e565b60405180910390f35b3480156103eb57600080fd5b506104066004803603810190610401919061117a565b610d8e565b604051610413919061172e565b60405180910390f35b34801561042857600080fd5b50610443600480360381019061043e91906117ea565b610dde565b6040516104509190611005565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b61048681610e27565b1561049057600080fd5b61049981610e7d565b6104a4816000610ed1565b50565b7f0000000000000000000000000000000000000000000000000000000000000000156104d257600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631becceb48484846040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518563ffffffff1660e01b8152600401610597949392919061194d565b600060405180830381600087803b1580156105b157600080fd5b505af11580156105c5573d6000803e3d6000fd5b50505050505050565b60036020528060005260406000206000915090505481565b61063382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e27565b1561063d57600080fd5b60008083839050146106935782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506106af565b6106ae8660200160208101906106a9919061155a565b61096c565b5b90506106ba81610e7d565b6106c48185610ed1565b505050505050565b606060008084849050146107245783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610740565b61073f85600001602081019061073a919061155a565b61096c565b5b905061074b81610e7d565b6107558134610ed1565b846000016020810190610768919061155a565b60028260405161077891906119d0565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016107f59190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b7f00000000000000000000000000000000000000000000000000000000000000001561084c57600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663726ac97c34836040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518463ffffffff1660e01b815260040161090e929190611a3a565b6000604051808303818588803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050505050565b61094c81610e27565b1561095657600080fd5b61095f81610e7d565b6109698134610ed1565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d65737361676500000000000000000000815250826040516020016109b6929190611ab2565b6040516020818303038152906040529050919050565b6109d581610e27565b156109df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610a1c93929190611ada565b6020604051808303816000875af1158015610a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5f9190611b3d565b610a6857600080fd5b610a7181610e7d565b610a7b8183610ed1565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f000000000000000000000000000000000000000000000000000000000000000015610ae857610ae7610f13565b5b610b43818060600190610afb9190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e7d565b610ba0818060600190610b569190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610ed1565b806000016020810190610bb3919061155a565b6002828060600190610bc59190611b79565b604051610bd3929190611c01565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000015610c7157600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663744b9b8b348585856040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518663ffffffff1660e01b8152600401610d37949392919061194d565b6000604051808303818588803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b5050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b60006001600083604051602001610da59190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000604051602001610e3890611c66565b6040516020818303038152906040528051906020012082604051602001610e5f9190611a23565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610e939190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610ee79190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610f309190611caa565b905060005b81811015610f735760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610f35565b50600080610f819190610f86565b505050565b5080546000825590600052602060002090810190610fa49190610fa7565b50565b5b80821115610fc0576000816000905550600101610fa8565b5090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610fef82610fc4565b9050919050565b610fff81610fe4565b82525050565b600060208201905061101a6000830184610ff6565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6110878261103e565b810181811067ffffffffffffffff821117156110a6576110a561104f565b5b80604052505050565b60006110b9611020565b90506110c5828261107e565b919050565b600067ffffffffffffffff8211156110e5576110e461104f565b5b6110ee8261103e565b9050602081019050919050565b82818337600083830152505050565b600061111d611118846110ca565b6110af565b90508281526020810184848401111561113957611138611039565b5b6111448482856110fb565b509392505050565b600082601f83011261116157611160611034565b5b813561117184826020860161110a565b91505092915050565b6000602082840312156111905761118f61102a565b5b600082013567ffffffffffffffff8111156111ae576111ad61102f565b5b6111ba8482850161114c565b91505092915050565b6111cc81610fe4565b81146111d757600080fd5b50565b6000813590506111e9816111c3565b92915050565b600080fd5b600080fd5b60008083601f84011261120f5761120e611034565b5b8235905067ffffffffffffffff81111561122c5761122b6111ef565b5b602083019150836001820283011115611248576112476111f4565b5b9250929050565b6000806000604084860312156112685761126761102a565b5b6000611276868287016111da565b935050602084013567ffffffffffffffff8111156112975761129661102f565b5b6112a3868287016111f9565b92509250509250925092565b6000819050919050565b6112c2816112af565b81146112cd57600080fd5b50565b6000813590506112df816112b9565b92915050565b6000602082840312156112fb576112fa61102a565b5b6000611309848285016112d0565b91505092915050565b6000819050919050565b61132581611312565b82525050565b6000602082019050611340600083018461131c565b92915050565b600080fd5b60006060828403121561136157611360611346565b5b81905092915050565b61137381611312565b811461137e57600080fd5b50565b6000813590506113908161136a565b92915050565b6000806000806000608086880312156113b2576113b161102a565b5b600086013567ffffffffffffffff8111156113d0576113cf61102f565b5b6113dc8882890161134b565b95505060206113ed888289016111da565b94505060406113fe88828901611381565b935050606086013567ffffffffffffffff81111561141f5761141e61102f565b5b61142b888289016111f9565b92509250509295509295909350565b6000602082840312156114505761144f611346565b5b81905092915050565b6000806000604084860312156114725761147161102a565b5b60006114808682870161143a565b935050602084013567ffffffffffffffff8111156114a1576114a061102f565b5b6114ad868287016111f9565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b838110156114f35780820151818401526020810190506114d8565b60008484015250505050565b600061150a826114b9565b61151481856114c4565b93506115248185602086016114d5565b61152d8161103e565b840191505092915050565b6000602082019050818103600083015261155281846114ff565b905092915050565b6000602082840312156115705761156f61102a565b5b600061157e848285016111da565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006115ae82611587565b6115b88185611592565b93506115c88185602086016114d5565b6115d18161103e565b840191505092915050565b600060208201905081810360008301526115f681846115a3565b905092915050565b600061160982610fe4565b9050919050565b611619816115fe565b811461162457600080fd5b50565b60008135905061163681611610565b92915050565b6000806000606084860312156116555761165461102a565b5b600061166386828701611627565b935050602061167486828701611381565b925050604084013567ffffffffffffffff8111156116955761169461102f565b5b6116a18682870161114c565b9150509250925092565b6000608082840312156116c1576116c0611346565b5b81905092915050565b6000602082840312156116e0576116df61102a565b5b600082013567ffffffffffffffff8111156116fe576116fd61102f565b5b61170a848285016116ab565b91505092915050565b60008115159050919050565b61172881611713565b82525050565b6000602082019050611743600083018461171f565b92915050565b600067ffffffffffffffff8211156117645761176361104f565b5b61176d8261103e565b9050602081019050919050565b600061178d61178884611749565b6110af565b9050828152602081018484840111156117a9576117a8611039565b5b6117b48482856110fb565b509392505050565b600082601f8301126117d1576117d0611034565b5b81356117e184826020860161177a565b91505092915050565b600060208284031215611800576117ff61102a565b5b600082013567ffffffffffffffff81111561181e5761181d61102f565b5b61182a848285016117bc565b91505092915050565b600061183f83856114c4565b935061184c8385846110fb565b6118558361103e565b840190509392505050565b61186981610fe4565b82525050565b61187881611713565b82525050565b600082825260208201905092915050565b600061189a826114b9565b6118a4818561187e565b93506118b48185602086016114d5565b6118bd8161103e565b840191505092915050565b6118d181611312565b82525050565b600060a0830160008301516118ef6000860182611860565b506020830151611902602086018261186f565b5060408301516119156040860182611860565b506060830151848203606086015261192d828261188f565b915050608083015161194260808601826118c8565b508091505092915050565b60006060820190506119626000830187610ff6565b8181036020830152611975818587611833565b9050818103604083015261198981846118d7565b905095945050505050565b600081905092915050565b60006119aa826114b9565b6119b48185611994565b93506119c48185602086016114d5565b80840191505092915050565b60006119dc828461199f565b915081905092915050565b600081905092915050565b60006119fd82611587565b611a0781856119e7565b9350611a178185602086016114d5565b80840191505092915050565b6000611a2f82846119f2565b915081905092915050565b6000604082019050611a4f6000830185610ff6565b8181036020830152611a6181846118d7565b90509392505050565b60008160601b9050919050565b6000611a8282611a6a565b9050919050565b6000611a9482611a77565b9050919050565b611aac611aa782610fe4565b611a89565b82525050565b6000611abe82856119f2565b9150611aca8284611a9b565b6014820191508190509392505050565b6000606082019050611aef6000830186610ff6565b611afc6020830185610ff6565b611b09604083018461131c565b949350505050565b611b1a81611713565b8114611b2557600080fd5b50565b600081519050611b3781611b11565b92915050565b600060208284031215611b5357611b5261102a565b5b6000611b6184828501611b28565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112611b9657611b95611b6a565b5b80840192508235915067ffffffffffffffff821115611bb857611bb7611b6f565b5b602083019250600182023603831315611bd457611bd3611b74565b5b509250929050565b6000611be88385611994565b9350611bf58385846110fb565b82840190509392505050565b6000611c0e828486611bdc565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b6000611c506006836119e7565b9150611c5b82611c1a565b600682019050919050565b6000611c7182611c43565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611cb582611312565b9150611cc083611312565b925082611cd057611ccf611c7b565b5b82820490509291505056fea2646970667358221220c65e0c220554f807998419d73152c256b7cda9add6caf7336e420daca02bf0cf64736f6c634300081a0033 diff --git a/pkg/contracts/testdappv2/TestDAppV2.go b/pkg/contracts/testdappv2/TestDAppV2.go index aa825ebcce..55b397cbd3 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\":\"bool\",\"name\":\"isZetaChain_\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"NO_MESSAGE_CALL\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"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\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"getNoMessageIndex\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isZetaChain\",\"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: "0x60a0604052348015600f57600080fd5b506040516117953803806117958339818101604052810190602f91906078565b8015156080811515815250505060a0565b600080fd5b60008115159050919050565b6058816045565b8114606257600080fd5b50565b6000815190506072816051565b92915050565b600060208284031215608b57608a6040565b5b60006097848285016065565b91505092915050565b6080516116d36100c26000396000818161079601526108ff01526116d36000f3fe6080604052600436106100e15760003560e01c8063c7a339a91161007f578063c91f356711610059578063c91f3567146102bf578063e2842ed7146102ea578063f592cbfb14610327578063f936ae8514610364576100e8565b8063c7a339a914610242578063c85f84341461026b578063c9028a3614610296576100e8565b8063676cc054116100bb578063676cc0541461017c5780639291fe26146101ac578063a799911f146101e9578063ad23b28b14610205576100e8565b806336e980a0146100ed5780634297a263146101165780635bcfd61614610153576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610114600480360381019061010f9190610cd1565b6103a1565b005b34801561012257600080fd5b5061013d60048036038101906101389190610d50565b6103cb565b60405161014a9190610d96565b60405180910390f35b34801561015f57600080fd5b5061017a60048036038101906101759190610ebf565b6103e3565b005b61019660048036038101906101919190610f82565b6104c9565b6040516101a39190611061565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190610cd1565b6105db565b6040516101e09190610d96565b60405180910390f35b61020360048036038101906101fe9190610cd1565b61061e565b005b34801561021157600080fd5b5061022c60048036038101906102279190611083565b610647565b6040516102399190611105565b60405180910390f35b34801561024e57600080fd5b5061026960048036038101906102649190611165565b6106a7565b005b34801561027757600080fd5b5061028061075b565b60405161028d9190611105565b60405180910390f35b3480156102a257600080fd5b506102bd60048036038101906102b891906111f3565b610794565b005b3480156102cb57600080fd5b506102d46108fd565b6040516102e19190611257565b60405180910390f35b3480156102f657600080fd5b50610311600480360381019061030c9190610d50565b610921565b60405161031e9190611257565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190610cd1565b610941565b60405161035b9190611257565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190611313565b610991565b604051610398919061136b565b60405180910390f35b6103aa816109da565b156103b457600080fd5b6103bd81610a30565b6103c8816000610a84565b50565b60036020528060005260406000206000915090505481565b61043082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109da565b1561043a57600080fd5b60008083839050146104905782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104ac565b6104ab8660200160208101906104a69190611083565b610647565b5b90506104b781610a30565b6104c18185610a84565b505050505050565b606060008084849050146105215783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061053d565b61053c8560000160208101906105379190611083565b610647565b5b905061054881610a30565b6105528134610a84565b8460000160208101906105659190611083565b60028260405161057591906113c2565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016105f29190611415565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b610627816109da565b1561063157600080fd5b61063a81610a30565b6106448134610a84565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525082604051602001610691929190611474565b6040516020818303038152906040529050919050565b6106b0816109da565b156106ba57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016106f79392919061149c565b6020604051808303816000875af1158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a91906114ff565b61074357600080fd5b61074c81610a30565b6107568183610a84565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f0000000000000000000000000000000000000000000000000000000000000000156107c3576107c2610ac6565b5b61081e8180606001906107d6919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a30565b61087b818060600190610831919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a84565b80600001602081019061088e9190611083565b60028280606001906108a0919061153b565b6040516108ae9291906115c3565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016109589190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109eb90611628565b6040516020818303038152906040528051906020012082604051602001610a129190611415565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a469190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a9a9190611415565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610ae3919061166c565b905060005b81811015610b265760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610ae8565b50600080610b349190610b39565b505050565b5080546000825590600052602060002090810190610b579190610b5a565b50565b5b80821115610b73576000816000905550600101610b5b565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610bde82610b95565b810181811067ffffffffffffffff82111715610bfd57610bfc610ba6565b5b80604052505050565b6000610c10610b77565b9050610c1c8282610bd5565b919050565b600067ffffffffffffffff821115610c3c57610c3b610ba6565b5b610c4582610b95565b9050602081019050919050565b82818337600083830152505050565b6000610c74610c6f84610c21565b610c06565b905082815260208101848484011115610c9057610c8f610b90565b5b610c9b848285610c52565b509392505050565b600082601f830112610cb857610cb7610b8b565b5b8135610cc8848260208601610c61565b91505092915050565b600060208284031215610ce757610ce6610b81565b5b600082013567ffffffffffffffff811115610d0557610d04610b86565b5b610d1184828501610ca3565b91505092915050565b6000819050919050565b610d2d81610d1a565b8114610d3857600080fd5b50565b600081359050610d4a81610d24565b92915050565b600060208284031215610d6657610d65610b81565b5b6000610d7484828501610d3b565b91505092915050565b6000819050919050565b610d9081610d7d565b82525050565b6000602082019050610dab6000830184610d87565b92915050565b600080fd5b600060608284031215610dcc57610dcb610db1565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e0082610dd5565b9050919050565b610e1081610df5565b8114610e1b57600080fd5b50565b600081359050610e2d81610e07565b92915050565b610e3c81610d7d565b8114610e4757600080fd5b50565b600081359050610e5981610e33565b92915050565b600080fd5b600080fd5b60008083601f840112610e7f57610e7e610b8b565b5b8235905067ffffffffffffffff811115610e9c57610e9b610e5f565b5b602083019150836001820283011115610eb857610eb7610e64565b5b9250929050565b600080600080600060808688031215610edb57610eda610b81565b5b600086013567ffffffffffffffff811115610ef957610ef8610b86565b5b610f0588828901610db6565b9550506020610f1688828901610e1e565b9450506040610f2788828901610e4a565b935050606086013567ffffffffffffffff811115610f4857610f47610b86565b5b610f5488828901610e69565b92509250509295509295909350565b600060208284031215610f7957610f78610db1565b5b81905092915050565b600080600060408486031215610f9b57610f9a610b81565b5b6000610fa986828701610f63565b935050602084013567ffffffffffffffff811115610fca57610fc9610b86565b5b610fd686828701610e69565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b8381101561101c578082015181840152602081019050611001565b60008484015250505050565b600061103382610fe2565b61103d8185610fed565b935061104d818560208601610ffe565b61105681610b95565b840191505092915050565b6000602082019050818103600083015261107b8184611028565b905092915050565b60006020828403121561109957611098610b81565b5b60006110a784828501610e1e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006110d7826110b0565b6110e181856110bb565b93506110f1818560208601610ffe565b6110fa81610b95565b840191505092915050565b6000602082019050818103600083015261111f81846110cc565b905092915050565b600061113282610df5565b9050919050565b61114281611127565b811461114d57600080fd5b50565b60008135905061115f81611139565b92915050565b60008060006060848603121561117e5761117d610b81565b5b600061118c86828701611150565b935050602061119d86828701610e4a565b925050604084013567ffffffffffffffff8111156111be576111bd610b86565b5b6111ca86828701610ca3565b9150509250925092565b6000608082840312156111ea576111e9610db1565b5b81905092915050565b60006020828403121561120957611208610b81565b5b600082013567ffffffffffffffff81111561122757611226610b86565b5b611233848285016111d4565b91505092915050565b60008115159050919050565b6112518161123c565b82525050565b600060208201905061126c6000830184611248565b92915050565b600067ffffffffffffffff82111561128d5761128c610ba6565b5b61129682610b95565b9050602081019050919050565b60006112b66112b184611272565b610c06565b9050828152602081018484840111156112d2576112d1610b90565b5b6112dd848285610c52565b509392505050565b600082601f8301126112fa576112f9610b8b565b5b813561130a8482602086016112a3565b91505092915050565b60006020828403121561132957611328610b81565b5b600082013567ffffffffffffffff81111561134757611346610b86565b5b611353848285016112e5565b91505092915050565b61136581610df5565b82525050565b6000602082019050611380600083018461135c565b92915050565b600081905092915050565b600061139c82610fe2565b6113a68185611386565b93506113b6818560208601610ffe565b80840191505092915050565b60006113ce8284611391565b915081905092915050565b600081905092915050565b60006113ef826110b0565b6113f981856113d9565b9350611409818560208601610ffe565b80840191505092915050565b600061142182846113e4565b915081905092915050565b60008160601b9050919050565b60006114448261142c565b9050919050565b600061145682611439565b9050919050565b61146e61146982610df5565b61144b565b82525050565b600061148082856113e4565b915061148c828461145d565b6014820191508190509392505050565b60006060820190506114b1600083018661135c565b6114be602083018561135c565b6114cb6040830184610d87565b949350505050565b6114dc8161123c565b81146114e757600080fd5b50565b6000815190506114f9816114d3565b92915050565b60006020828403121561151557611514610b81565b5b6000611523848285016114ea565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115585761155761152c565b5b80840192508235915067ffffffffffffffff82111561157a57611579611531565b5b60208301925060018202360383131561159657611595611536565b5b509250929050565b60006115aa8385611386565b93506115b7838584610c52565b82840190509392505050565b60006115d082848661159e565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b60006116126006836113d9565b915061161d826115dc565b600682019050919050565b600061163382611605565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061167782610d7d565b915061168283610d7d565b9250826116925761169161163d565b5b82820490509291505056fea2646970667358221220eabca6f5232e330b7bfacfcaa51280bd616323d8694afc461b86845313fcbed364736f6c634300081a0033", + ABI: "[{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"isZetaChain_\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"gateway_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"NO_MESSAGE_CALL\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"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\":[],\"name\":\"gateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"gatewayCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"}],\"name\":\"gatewayDeposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"dst\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"gatewayDepositAndCall\",\"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\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"getNoMessageIndex\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isZetaChain\",\"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: "0x60c060405234801561001057600080fd5b50604051611ebb380380611ebb83398181016040528101906100329190610114565b8115156080811515815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610154565b600080fd5b60008115159050919050565b6100938161007e565b811461009e57600080fd5b50565b6000815190506100b08161008a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e1826100b6565b9050919050565b6100f1816100d6565b81146100fc57600080fd5b50565b60008151905061010e816100e8565b92915050565b6000806040838503121561012b5761012a610079565b5b6000610139858286016100a1565b925050602061014a858286016100ff565b9150509250929050565b60805160a051611d116101aa6000396000818161045b015281816104d40152818161084e0152610c730152600081816104a90152818161082301528181610abb01528181610c240152610c480152611d116000f3fe60806040526004361061010d5760003560e01c8063ad23b28b11610095578063c91f356711610064578063c91f35671461035b578063deb3b1e414610386578063e2842ed7146103a2578063f592cbfb146103df578063f936ae851461041c57610114565b8063ad23b28b146102a1578063c7a339a9146102de578063c85f843414610307578063c9028a361461033257610114565b80635bcfd616116100dc5780635bcfd616146101d3578063676cc054146101fc5780639291fe261461022c5780639ca016ed14610269578063a799911f1461028557610114565b8063116191b61461011957806336e980a01461014457806341a3cd4a1461016d5780634297a2631461019657610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610459565b60405161013b9190611005565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061117a565b61047d565b005b34801561017957600080fd5b50610194600480360381019061018f919061124f565b6104a7565b005b3480156101a257600080fd5b506101bd60048036038101906101b891906112e5565b6105ce565b6040516101ca919061132b565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f59190611396565b6105e6565b005b61021660048036038101906102119190611459565b6106cc565b6040516102239190611538565b60405180910390f35b34801561023857600080fd5b50610253600480360381019061024e919061117a565b6107de565b604051610260919061132b565b60405180910390f35b610283600480360381019061027e919061155a565b610821565b005b61029f600480360381019061029a919061117a565b610943565b005b3480156102ad57600080fd5b506102c860048036038101906102c3919061155a565b61096c565b6040516102d591906115dc565b60405180910390f35b3480156102ea57600080fd5b506103056004803603810190610300919061163c565b6109cc565b005b34801561031357600080fd5b5061031c610a80565b60405161032991906115dc565b60405180910390f35b34801561033e57600080fd5b50610359600480360381019061035491906116ca565b610ab9565b005b34801561036757600080fd5b50610370610c22565b60405161037d919061172e565b60405180910390f35b6103a0600480360381019061039b919061124f565b610c46565b005b3480156103ae57600080fd5b506103c960048036038101906103c491906112e5565b610d6e565b6040516103d6919061172e565b60405180910390f35b3480156103eb57600080fd5b506104066004803603810190610401919061117a565b610d8e565b604051610413919061172e565b60405180910390f35b34801561042857600080fd5b50610443600480360381019061043e91906117ea565b610dde565b6040516104509190611005565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b61048681610e27565b1561049057600080fd5b61049981610e7d565b6104a4816000610ed1565b50565b7f0000000000000000000000000000000000000000000000000000000000000000156104d257600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631becceb48484846040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518563ffffffff1660e01b8152600401610597949392919061194d565b600060405180830381600087803b1580156105b157600080fd5b505af11580156105c5573d6000803e3d6000fd5b50505050505050565b60036020528060005260406000206000915090505481565b61063382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e27565b1561063d57600080fd5b60008083839050146106935782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506106af565b6106ae8660200160208101906106a9919061155a565b61096c565b5b90506106ba81610e7d565b6106c48185610ed1565b505050505050565b606060008084849050146107245783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610740565b61073f85600001602081019061073a919061155a565b61096c565b5b905061074b81610e7d565b6107558134610ed1565b846000016020810190610768919061155a565b60028260405161077891906119d0565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016107f59190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b7f00000000000000000000000000000000000000000000000000000000000000001561084c57600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663726ac97c34836040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518463ffffffff1660e01b815260040161090e929190611a3a565b6000604051808303818588803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050505050565b61094c81610e27565b1561095657600080fd5b61095f81610e7d565b6109698134610ed1565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d65737361676500000000000000000000815250826040516020016109b6929190611ab2565b6040516020818303038152906040529050919050565b6109d581610e27565b156109df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610a1c93929190611ada565b6020604051808303816000875af1158015610a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5f9190611b3d565b610a6857600080fd5b610a7181610e7d565b610a7b8183610ed1565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f000000000000000000000000000000000000000000000000000000000000000015610ae857610ae7610f13565b5b610b43818060600190610afb9190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e7d565b610ba0818060600190610b569190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610ed1565b806000016020810190610bb3919061155a565b6002828060600190610bc59190611b79565b604051610bd3929190611c01565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000015610c7157600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663744b9b8b348585856040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518663ffffffff1660e01b8152600401610d37949392919061194d565b6000604051808303818588803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b5050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b60006001600083604051602001610da59190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000604051602001610e3890611c66565b6040516020818303038152906040528051906020012082604051602001610e5f9190611a23565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610e939190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610ee79190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610f309190611caa565b905060005b81811015610f735760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610f35565b50600080610f819190610f86565b505050565b5080546000825590600052602060002090810190610fa49190610fa7565b50565b5b80821115610fc0576000816000905550600101610fa8565b5090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610fef82610fc4565b9050919050565b610fff81610fe4565b82525050565b600060208201905061101a6000830184610ff6565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6110878261103e565b810181811067ffffffffffffffff821117156110a6576110a561104f565b5b80604052505050565b60006110b9611020565b90506110c5828261107e565b919050565b600067ffffffffffffffff8211156110e5576110e461104f565b5b6110ee8261103e565b9050602081019050919050565b82818337600083830152505050565b600061111d611118846110ca565b6110af565b90508281526020810184848401111561113957611138611039565b5b6111448482856110fb565b509392505050565b600082601f83011261116157611160611034565b5b813561117184826020860161110a565b91505092915050565b6000602082840312156111905761118f61102a565b5b600082013567ffffffffffffffff8111156111ae576111ad61102f565b5b6111ba8482850161114c565b91505092915050565b6111cc81610fe4565b81146111d757600080fd5b50565b6000813590506111e9816111c3565b92915050565b600080fd5b600080fd5b60008083601f84011261120f5761120e611034565b5b8235905067ffffffffffffffff81111561122c5761122b6111ef565b5b602083019150836001820283011115611248576112476111f4565b5b9250929050565b6000806000604084860312156112685761126761102a565b5b6000611276868287016111da565b935050602084013567ffffffffffffffff8111156112975761129661102f565b5b6112a3868287016111f9565b92509250509250925092565b6000819050919050565b6112c2816112af565b81146112cd57600080fd5b50565b6000813590506112df816112b9565b92915050565b6000602082840312156112fb576112fa61102a565b5b6000611309848285016112d0565b91505092915050565b6000819050919050565b61132581611312565b82525050565b6000602082019050611340600083018461131c565b92915050565b600080fd5b60006060828403121561136157611360611346565b5b81905092915050565b61137381611312565b811461137e57600080fd5b50565b6000813590506113908161136a565b92915050565b6000806000806000608086880312156113b2576113b161102a565b5b600086013567ffffffffffffffff8111156113d0576113cf61102f565b5b6113dc8882890161134b565b95505060206113ed888289016111da565b94505060406113fe88828901611381565b935050606086013567ffffffffffffffff81111561141f5761141e61102f565b5b61142b888289016111f9565b92509250509295509295909350565b6000602082840312156114505761144f611346565b5b81905092915050565b6000806000604084860312156114725761147161102a565b5b60006114808682870161143a565b935050602084013567ffffffffffffffff8111156114a1576114a061102f565b5b6114ad868287016111f9565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b838110156114f35780820151818401526020810190506114d8565b60008484015250505050565b600061150a826114b9565b61151481856114c4565b93506115248185602086016114d5565b61152d8161103e565b840191505092915050565b6000602082019050818103600083015261155281846114ff565b905092915050565b6000602082840312156115705761156f61102a565b5b600061157e848285016111da565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006115ae82611587565b6115b88185611592565b93506115c88185602086016114d5565b6115d18161103e565b840191505092915050565b600060208201905081810360008301526115f681846115a3565b905092915050565b600061160982610fe4565b9050919050565b611619816115fe565b811461162457600080fd5b50565b60008135905061163681611610565b92915050565b6000806000606084860312156116555761165461102a565b5b600061166386828701611627565b935050602061167486828701611381565b925050604084013567ffffffffffffffff8111156116955761169461102f565b5b6116a18682870161114c565b9150509250925092565b6000608082840312156116c1576116c0611346565b5b81905092915050565b6000602082840312156116e0576116df61102a565b5b600082013567ffffffffffffffff8111156116fe576116fd61102f565b5b61170a848285016116ab565b91505092915050565b60008115159050919050565b61172881611713565b82525050565b6000602082019050611743600083018461171f565b92915050565b600067ffffffffffffffff8211156117645761176361104f565b5b61176d8261103e565b9050602081019050919050565b600061178d61178884611749565b6110af565b9050828152602081018484840111156117a9576117a8611039565b5b6117b48482856110fb565b509392505050565b600082601f8301126117d1576117d0611034565b5b81356117e184826020860161177a565b91505092915050565b600060208284031215611800576117ff61102a565b5b600082013567ffffffffffffffff81111561181e5761181d61102f565b5b61182a848285016117bc565b91505092915050565b600061183f83856114c4565b935061184c8385846110fb565b6118558361103e565b840190509392505050565b61186981610fe4565b82525050565b61187881611713565b82525050565b600082825260208201905092915050565b600061189a826114b9565b6118a4818561187e565b93506118b48185602086016114d5565b6118bd8161103e565b840191505092915050565b6118d181611312565b82525050565b600060a0830160008301516118ef6000860182611860565b506020830151611902602086018261186f565b5060408301516119156040860182611860565b506060830151848203606086015261192d828261188f565b915050608083015161194260808601826118c8565b508091505092915050565b60006060820190506119626000830187610ff6565b8181036020830152611975818587611833565b9050818103604083015261198981846118d7565b905095945050505050565b600081905092915050565b60006119aa826114b9565b6119b48185611994565b93506119c48185602086016114d5565b80840191505092915050565b60006119dc828461199f565b915081905092915050565b600081905092915050565b60006119fd82611587565b611a0781856119e7565b9350611a178185602086016114d5565b80840191505092915050565b6000611a2f82846119f2565b915081905092915050565b6000604082019050611a4f6000830185610ff6565b8181036020830152611a6181846118d7565b90509392505050565b60008160601b9050919050565b6000611a8282611a6a565b9050919050565b6000611a9482611a77565b9050919050565b611aac611aa782610fe4565b611a89565b82525050565b6000611abe82856119f2565b9150611aca8284611a9b565b6014820191508190509392505050565b6000606082019050611aef6000830186610ff6565b611afc6020830185610ff6565b611b09604083018461131c565b949350505050565b611b1a81611713565b8114611b2557600080fd5b50565b600081519050611b3781611b11565b92915050565b600060208284031215611b5357611b5261102a565b5b6000611b6184828501611b28565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112611b9657611b95611b6a565b5b80840192508235915067ffffffffffffffff821115611bb857611bb7611b6f565b5b602083019250600182023603831315611bd457611bd3611b74565b5b509250929050565b6000611be88385611994565b9350611bf58385846110fb565b82840190509392505050565b6000611c0e828486611bdc565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b6000611c506006836119e7565b9150611c5b82611c1a565b600682019050919050565b6000611c7182611c43565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611cb582611312565b9150611cc083611312565b925082611cd057611ccf611c7b565b5b82820490509291505056fea2646970667358221220c65e0c220554f807998419d73152c256b7cda9add6caf7336e420daca02bf0cf64736f6c634300081a0033", } // TestDAppV2ABI is the input ABI used to generate the binding from. @@ -64,7 +64,7 @@ var TestDAppV2ABI = TestDAppV2MetaData.ABI var TestDAppV2Bin = TestDAppV2MetaData.Bin // DeployTestDAppV2 deploys a new Ethereum contract, binding an instance of TestDAppV2 to it. -func DeployTestDAppV2(auth *bind.TransactOpts, backend bind.ContractBackend, isZetaChain_ bool) (common.Address, *types.Transaction, *TestDAppV2, error) { +func DeployTestDAppV2(auth *bind.TransactOpts, backend bind.ContractBackend, isZetaChain_ bool, gateway_ common.Address) (common.Address, *types.Transaction, *TestDAppV2, error) { parsed, err := TestDAppV2MetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err @@ -73,7 +73,7 @@ func DeployTestDAppV2(auth *bind.TransactOpts, backend bind.ContractBackend, isZ return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(TestDAppV2Bin), backend, isZetaChain_) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(TestDAppV2Bin), backend, isZetaChain_, gateway_) if err != nil { return common.Address{}, nil, nil, err } @@ -315,6 +315,37 @@ func (_TestDAppV2 *TestDAppV2CallerSession) CalledWithMessage(arg0 [32]byte) (bo return _TestDAppV2.Contract.CalledWithMessage(&_TestDAppV2.CallOpts, arg0) } +// Gateway is a free data retrieval call binding the contract method 0x116191b6. +// +// Solidity: function gateway() view returns(address) +func (_TestDAppV2 *TestDAppV2Caller) Gateway(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TestDAppV2.contract.Call(opts, &out, "gateway") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Gateway is a free data retrieval call binding the contract method 0x116191b6. +// +// Solidity: function gateway() view returns(address) +func (_TestDAppV2 *TestDAppV2Session) Gateway() (common.Address, error) { + return _TestDAppV2.Contract.Gateway(&_TestDAppV2.CallOpts) +} + +// Gateway is a free data retrieval call binding the contract method 0x116191b6. +// +// Solidity: function gateway() view returns(address) +func (_TestDAppV2 *TestDAppV2CallerSession) Gateway() (common.Address, error) { + return _TestDAppV2.Contract.Gateway(&_TestDAppV2.CallOpts) +} + // GetAmountWithMessage is a free data retrieval call binding the contract method 0x9291fe26. // // Solidity: function getAmountWithMessage(string message) view returns(uint256) @@ -512,6 +543,69 @@ func (_TestDAppV2 *TestDAppV2TransactorSession) GasCall(message string) (*types. return _TestDAppV2.Contract.GasCall(&_TestDAppV2.TransactOpts, message) } +// GatewayCall is a paid mutator transaction binding the contract method 0x41a3cd4a. +// +// Solidity: function gatewayCall(address dst, bytes payload) returns() +func (_TestDAppV2 *TestDAppV2Transactor) GatewayCall(opts *bind.TransactOpts, dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.contract.Transact(opts, "gatewayCall", dst, payload) +} + +// GatewayCall is a paid mutator transaction binding the contract method 0x41a3cd4a. +// +// Solidity: function gatewayCall(address dst, bytes payload) returns() +func (_TestDAppV2 *TestDAppV2Session) GatewayCall(dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayCall(&_TestDAppV2.TransactOpts, dst, payload) +} + +// GatewayCall is a paid mutator transaction binding the contract method 0x41a3cd4a. +// +// Solidity: function gatewayCall(address dst, bytes payload) returns() +func (_TestDAppV2 *TestDAppV2TransactorSession) GatewayCall(dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayCall(&_TestDAppV2.TransactOpts, dst, payload) +} + +// GatewayDeposit is a paid mutator transaction binding the contract method 0x9ca016ed. +// +// Solidity: function gatewayDeposit(address dst) payable returns() +func (_TestDAppV2 *TestDAppV2Transactor) GatewayDeposit(opts *bind.TransactOpts, dst common.Address) (*types.Transaction, error) { + return _TestDAppV2.contract.Transact(opts, "gatewayDeposit", dst) +} + +// GatewayDeposit is a paid mutator transaction binding the contract method 0x9ca016ed. +// +// Solidity: function gatewayDeposit(address dst) payable returns() +func (_TestDAppV2 *TestDAppV2Session) GatewayDeposit(dst common.Address) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayDeposit(&_TestDAppV2.TransactOpts, dst) +} + +// GatewayDeposit is a paid mutator transaction binding the contract method 0x9ca016ed. +// +// Solidity: function gatewayDeposit(address dst) payable returns() +func (_TestDAppV2 *TestDAppV2TransactorSession) GatewayDeposit(dst common.Address) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayDeposit(&_TestDAppV2.TransactOpts, dst) +} + +// GatewayDepositAndCall is a paid mutator transaction binding the contract method 0xdeb3b1e4. +// +// Solidity: function gatewayDepositAndCall(address dst, bytes payload) payable returns() +func (_TestDAppV2 *TestDAppV2Transactor) GatewayDepositAndCall(opts *bind.TransactOpts, dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.contract.Transact(opts, "gatewayDepositAndCall", dst, payload) +} + +// GatewayDepositAndCall is a paid mutator transaction binding the contract method 0xdeb3b1e4. +// +// Solidity: function gatewayDepositAndCall(address dst, bytes payload) payable returns() +func (_TestDAppV2 *TestDAppV2Session) GatewayDepositAndCall(dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayDepositAndCall(&_TestDAppV2.TransactOpts, dst, payload) +} + +// GatewayDepositAndCall is a paid mutator transaction binding the contract method 0xdeb3b1e4. +// +// Solidity: function gatewayDepositAndCall(address dst, bytes payload) payable returns() +func (_TestDAppV2 *TestDAppV2TransactorSession) GatewayDepositAndCall(dst common.Address, payload []byte) (*types.Transaction, error) { + return _TestDAppV2.Contract.GatewayDepositAndCall(&_TestDAppV2.TransactOpts, dst, payload) +} + // OnCall is a paid mutator transaction binding the contract method 0x5bcfd616. // // Solidity: function onCall((bytes,address,uint256) _context, address _zrc20, uint256 amount, bytes message) returns() diff --git a/pkg/contracts/testdappv2/TestDAppV2.json b/pkg/contracts/testdappv2/TestDAppV2.json index 9e3e79499c..41a2d6017d 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.json +++ b/pkg/contracts/testdappv2/TestDAppV2.json @@ -6,6 +6,11 @@ "internalType": "bool", "name": "isZetaChain_", "type": "bool" + }, + { + "internalType": "address", + "name": "gateway_", + "type": "address" } ], "stateMutability": "nonpayable", @@ -98,6 +103,68 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [], + "name": "gateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "gatewayCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + } + ], + "name": "gatewayDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "name": "gatewayDepositAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, { "inputs": [ { @@ -316,5 +383,5 @@ "type": "receive" } ], - "bin": "60a0604052348015600f57600080fd5b506040516117953803806117958339818101604052810190602f91906078565b8015156080811515815250505060a0565b600080fd5b60008115159050919050565b6058816045565b8114606257600080fd5b50565b6000815190506072816051565b92915050565b600060208284031215608b57608a6040565b5b60006097848285016065565b91505092915050565b6080516116d36100c26000396000818161079601526108ff01526116d36000f3fe6080604052600436106100e15760003560e01c8063c7a339a91161007f578063c91f356711610059578063c91f3567146102bf578063e2842ed7146102ea578063f592cbfb14610327578063f936ae8514610364576100e8565b8063c7a339a914610242578063c85f84341461026b578063c9028a3614610296576100e8565b8063676cc054116100bb578063676cc0541461017c5780639291fe26146101ac578063a799911f146101e9578063ad23b28b14610205576100e8565b806336e980a0146100ed5780634297a263146101165780635bcfd61614610153576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610114600480360381019061010f9190610cd1565b6103a1565b005b34801561012257600080fd5b5061013d60048036038101906101389190610d50565b6103cb565b60405161014a9190610d96565b60405180910390f35b34801561015f57600080fd5b5061017a60048036038101906101759190610ebf565b6103e3565b005b61019660048036038101906101919190610f82565b6104c9565b6040516101a39190611061565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190610cd1565b6105db565b6040516101e09190610d96565b60405180910390f35b61020360048036038101906101fe9190610cd1565b61061e565b005b34801561021157600080fd5b5061022c60048036038101906102279190611083565b610647565b6040516102399190611105565b60405180910390f35b34801561024e57600080fd5b5061026960048036038101906102649190611165565b6106a7565b005b34801561027757600080fd5b5061028061075b565b60405161028d9190611105565b60405180910390f35b3480156102a257600080fd5b506102bd60048036038101906102b891906111f3565b610794565b005b3480156102cb57600080fd5b506102d46108fd565b6040516102e19190611257565b60405180910390f35b3480156102f657600080fd5b50610311600480360381019061030c9190610d50565b610921565b60405161031e9190611257565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190610cd1565b610941565b60405161035b9190611257565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190611313565b610991565b604051610398919061136b565b60405180910390f35b6103aa816109da565b156103b457600080fd5b6103bd81610a30565b6103c8816000610a84565b50565b60036020528060005260406000206000915090505481565b61043082828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109da565b1561043a57600080fd5b60008083839050146104905782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104ac565b6104ab8660200160208101906104a69190611083565b610647565b5b90506104b781610a30565b6104c18185610a84565b505050505050565b606060008084849050146105215783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061053d565b61053c8560000160208101906105379190611083565b610647565b5b905061054881610a30565b6105528134610a84565b8460000160208101906105659190611083565b60028260405161057591906113c2565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016105f29190611415565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b610627816109da565b1561063157600080fd5b61063a81610a30565b6106448134610a84565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525082604051602001610691929190611474565b6040516020818303038152906040529050919050565b6106b0816109da565b156106ba57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016106f79392919061149c565b6020604051808303816000875af1158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a91906114ff565b61074357600080fd5b61074c81610a30565b6107568183610a84565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f0000000000000000000000000000000000000000000000000000000000000000156107c3576107c2610ac6565b5b61081e8180606001906107d6919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a30565b61087b818060600190610831919061153b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610a84565b80600001602081019061088e9190611083565b60028280606001906108a0919061153b565b6040516108ae9291906115c3565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60016020528060005260406000206000915054906101000a900460ff1681565b600060016000836040516020016109589190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006040516020016109eb90611628565b6040516020818303038152906040528051906020012082604051602001610a129190611415565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610a469190611415565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610a9a9190611415565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610ae3919061166c565b905060005b81811015610b265760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610ae8565b50600080610b349190610b39565b505050565b5080546000825590600052602060002090810190610b579190610b5a565b50565b5b80821115610b73576000816000905550600101610b5b565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610bde82610b95565b810181811067ffffffffffffffff82111715610bfd57610bfc610ba6565b5b80604052505050565b6000610c10610b77565b9050610c1c8282610bd5565b919050565b600067ffffffffffffffff821115610c3c57610c3b610ba6565b5b610c4582610b95565b9050602081019050919050565b82818337600083830152505050565b6000610c74610c6f84610c21565b610c06565b905082815260208101848484011115610c9057610c8f610b90565b5b610c9b848285610c52565b509392505050565b600082601f830112610cb857610cb7610b8b565b5b8135610cc8848260208601610c61565b91505092915050565b600060208284031215610ce757610ce6610b81565b5b600082013567ffffffffffffffff811115610d0557610d04610b86565b5b610d1184828501610ca3565b91505092915050565b6000819050919050565b610d2d81610d1a565b8114610d3857600080fd5b50565b600081359050610d4a81610d24565b92915050565b600060208284031215610d6657610d65610b81565b5b6000610d7484828501610d3b565b91505092915050565b6000819050919050565b610d9081610d7d565b82525050565b6000602082019050610dab6000830184610d87565b92915050565b600080fd5b600060608284031215610dcc57610dcb610db1565b5b81905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e0082610dd5565b9050919050565b610e1081610df5565b8114610e1b57600080fd5b50565b600081359050610e2d81610e07565b92915050565b610e3c81610d7d565b8114610e4757600080fd5b50565b600081359050610e5981610e33565b92915050565b600080fd5b600080fd5b60008083601f840112610e7f57610e7e610b8b565b5b8235905067ffffffffffffffff811115610e9c57610e9b610e5f565b5b602083019150836001820283011115610eb857610eb7610e64565b5b9250929050565b600080600080600060808688031215610edb57610eda610b81565b5b600086013567ffffffffffffffff811115610ef957610ef8610b86565b5b610f0588828901610db6565b9550506020610f1688828901610e1e565b9450506040610f2788828901610e4a565b935050606086013567ffffffffffffffff811115610f4857610f47610b86565b5b610f5488828901610e69565b92509250509295509295909350565b600060208284031215610f7957610f78610db1565b5b81905092915050565b600080600060408486031215610f9b57610f9a610b81565b5b6000610fa986828701610f63565b935050602084013567ffffffffffffffff811115610fca57610fc9610b86565b5b610fd686828701610e69565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b8381101561101c578082015181840152602081019050611001565b60008484015250505050565b600061103382610fe2565b61103d8185610fed565b935061104d818560208601610ffe565b61105681610b95565b840191505092915050565b6000602082019050818103600083015261107b8184611028565b905092915050565b60006020828403121561109957611098610b81565b5b60006110a784828501610e1e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006110d7826110b0565b6110e181856110bb565b93506110f1818560208601610ffe565b6110fa81610b95565b840191505092915050565b6000602082019050818103600083015261111f81846110cc565b905092915050565b600061113282610df5565b9050919050565b61114281611127565b811461114d57600080fd5b50565b60008135905061115f81611139565b92915050565b60008060006060848603121561117e5761117d610b81565b5b600061118c86828701611150565b935050602061119d86828701610e4a565b925050604084013567ffffffffffffffff8111156111be576111bd610b86565b5b6111ca86828701610ca3565b9150509250925092565b6000608082840312156111ea576111e9610db1565b5b81905092915050565b60006020828403121561120957611208610b81565b5b600082013567ffffffffffffffff81111561122757611226610b86565b5b611233848285016111d4565b91505092915050565b60008115159050919050565b6112518161123c565b82525050565b600060208201905061126c6000830184611248565b92915050565b600067ffffffffffffffff82111561128d5761128c610ba6565b5b61129682610b95565b9050602081019050919050565b60006112b66112b184611272565b610c06565b9050828152602081018484840111156112d2576112d1610b90565b5b6112dd848285610c52565b509392505050565b600082601f8301126112fa576112f9610b8b565b5b813561130a8482602086016112a3565b91505092915050565b60006020828403121561132957611328610b81565b5b600082013567ffffffffffffffff81111561134757611346610b86565b5b611353848285016112e5565b91505092915050565b61136581610df5565b82525050565b6000602082019050611380600083018461135c565b92915050565b600081905092915050565b600061139c82610fe2565b6113a68185611386565b93506113b6818560208601610ffe565b80840191505092915050565b60006113ce8284611391565b915081905092915050565b600081905092915050565b60006113ef826110b0565b6113f981856113d9565b9350611409818560208601610ffe565b80840191505092915050565b600061142182846113e4565b915081905092915050565b60008160601b9050919050565b60006114448261142c565b9050919050565b600061145682611439565b9050919050565b61146e61146982610df5565b61144b565b82525050565b600061148082856113e4565b915061148c828461145d565b6014820191508190509392505050565b60006060820190506114b1600083018661135c565b6114be602083018561135c565b6114cb6040830184610d87565b949350505050565b6114dc8161123c565b81146114e757600080fd5b50565b6000815190506114f9816114d3565b92915050565b60006020828403121561151557611514610b81565b5b6000611523848285016114ea565b91505092915050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126115585761155761152c565b5b80840192508235915067ffffffffffffffff82111561157a57611579611531565b5b60208301925060018202360383131561159657611595611536565b5b509250929050565b60006115aa8385611386565b93506115b7838584610c52565b82840190509392505050565b60006115d082848661159e565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b60006116126006836113d9565b915061161d826115dc565b600682019050919050565b600061163382611605565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061167782610d7d565b915061168283610d7d565b9250826116925761169161163d565b5b82820490509291505056fea2646970667358221220eabca6f5232e330b7bfacfcaa51280bd616323d8694afc461b86845313fcbed364736f6c634300081a0033" + "bin": "60c060405234801561001057600080fd5b50604051611ebb380380611ebb83398181016040528101906100329190610114565b8115156080811515815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250505050610154565b600080fd5b60008115159050919050565b6100938161007e565b811461009e57600080fd5b50565b6000815190506100b08161008a565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e1826100b6565b9050919050565b6100f1816100d6565b81146100fc57600080fd5b50565b60008151905061010e816100e8565b92915050565b6000806040838503121561012b5761012a610079565b5b6000610139858286016100a1565b925050602061014a858286016100ff565b9150509250929050565b60805160a051611d116101aa6000396000818161045b015281816104d40152818161084e0152610c730152600081816104a90152818161082301528181610abb01528181610c240152610c480152611d116000f3fe60806040526004361061010d5760003560e01c8063ad23b28b11610095578063c91f356711610064578063c91f35671461035b578063deb3b1e414610386578063e2842ed7146103a2578063f592cbfb146103df578063f936ae851461041c57610114565b8063ad23b28b146102a1578063c7a339a9146102de578063c85f843414610307578063c9028a361461033257610114565b80635bcfd616116100dc5780635bcfd616146101d3578063676cc054146101fc5780639291fe261461022c5780639ca016ed14610269578063a799911f1461028557610114565b8063116191b61461011957806336e980a01461014457806341a3cd4a1461016d5780634297a2631461019657610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610459565b60405161013b9190611005565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061117a565b61047d565b005b34801561017957600080fd5b50610194600480360381019061018f919061124f565b6104a7565b005b3480156101a257600080fd5b506101bd60048036038101906101b891906112e5565b6105ce565b6040516101ca919061132b565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f59190611396565b6105e6565b005b61021660048036038101906102119190611459565b6106cc565b6040516102239190611538565b60405180910390f35b34801561023857600080fd5b50610253600480360381019061024e919061117a565b6107de565b604051610260919061132b565b60405180910390f35b610283600480360381019061027e919061155a565b610821565b005b61029f600480360381019061029a919061117a565b610943565b005b3480156102ad57600080fd5b506102c860048036038101906102c3919061155a565b61096c565b6040516102d591906115dc565b60405180910390f35b3480156102ea57600080fd5b506103056004803603810190610300919061163c565b6109cc565b005b34801561031357600080fd5b5061031c610a80565b60405161032991906115dc565b60405180910390f35b34801561033e57600080fd5b50610359600480360381019061035491906116ca565b610ab9565b005b34801561036757600080fd5b50610370610c22565b60405161037d919061172e565b60405180910390f35b6103a0600480360381019061039b919061124f565b610c46565b005b3480156103ae57600080fd5b506103c960048036038101906103c491906112e5565b610d6e565b6040516103d6919061172e565b60405180910390f35b3480156103eb57600080fd5b506104066004803603810190610401919061117a565b610d8e565b604051610413919061172e565b60405180910390f35b34801561042857600080fd5b50610443600480360381019061043e91906117ea565b610dde565b6040516104509190611005565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b61048681610e27565b1561049057600080fd5b61049981610e7d565b6104a4816000610ed1565b50565b7f0000000000000000000000000000000000000000000000000000000000000000156104d257600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631becceb48484846040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518563ffffffff1660e01b8152600401610597949392919061194d565b600060405180830381600087803b1580156105b157600080fd5b505af11580156105c5573d6000803e3d6000fd5b50505050505050565b60036020528060005260406000206000915090505481565b61063382828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e27565b1561063d57600080fd5b60008083839050146106935782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506106af565b6106ae8660200160208101906106a9919061155a565b61096c565b5b90506106ba81610e7d565b6106c48185610ed1565b505050505050565b606060008084849050146107245783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610740565b61073f85600001602081019061073a919061155a565b61096c565b5b905061074b81610e7d565b6107558134610ed1565b846000016020810190610768919061155a565b60028260405161077891906119d0565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604051806020016040528060008152509150509392505050565b600060036000836040516020016107f59190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020549050919050565b7f00000000000000000000000000000000000000000000000000000000000000001561084c57600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663726ac97c34836040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518463ffffffff1660e01b815260040161090e929190611a3a565b6000604051808303818588803b15801561092757600080fd5b505af115801561093b573d6000803e3d6000fd5b505050505050565b61094c81610e27565b1561095657600080fd5b61095f81610e7d565b6109698134610ed1565b50565b60606040518060400160405280601681526020017f63616c6c65642077697468206e6f206d65737361676500000000000000000000815250826040516020016109b6929190611ab2565b6040516020818303038152906040529050919050565b6109d581610e27565b156109df57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401610a1c93929190611ada565b6020604051808303816000875af1158015610a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5f9190611b3d565b610a6857600080fd5b610a7181610e7d565b610a7b8183610ed1565b505050565b6040518060400160405280601681526020017f63616c6c65642077697468206e6f206d6573736167650000000000000000000081525081565b7f000000000000000000000000000000000000000000000000000000000000000015610ae857610ae7610f13565b5b610b43818060600190610afb9190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610e7d565b610ba0818060600190610b569190611b79565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000610ed1565b806000016020810190610bb3919061155a565b6002828060600190610bc59190611b79565b604051610bd3929190611c01565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000015610c7157600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663744b9b8b348585856040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052806000815250815260200160008152506040518663ffffffff1660e01b8152600401610d37949392919061194d565b6000604051808303818588803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b5050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b60006001600083604051602001610da59190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060009054906101000a900460ff169050919050565b6002818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000604051602001610e3890611c66565b6040516020818303038152906040528051906020012082604051602001610e5f9190611a23565b60405160208183030381529060405280519060200120149050919050565b600180600083604051602001610e939190611a23565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b806003600084604051602001610ee79190611a23565b604051602081830303815290604052805190602001208152602001908152602001600020819055505050565b60006207a12090506000614e20905060008183610f309190611caa565b905060005b81811015610f735760008190806001815401808255809150506001900390600052602060002001600090919091909150558080600101915050610f35565b50600080610f819190610f86565b505050565b5080546000825590600052602060002090810190610fa49190610fa7565b50565b5b80821115610fc0576000816000905550600101610fa8565b5090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610fef82610fc4565b9050919050565b610fff81610fe4565b82525050565b600060208201905061101a6000830184610ff6565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6110878261103e565b810181811067ffffffffffffffff821117156110a6576110a561104f565b5b80604052505050565b60006110b9611020565b90506110c5828261107e565b919050565b600067ffffffffffffffff8211156110e5576110e461104f565b5b6110ee8261103e565b9050602081019050919050565b82818337600083830152505050565b600061111d611118846110ca565b6110af565b90508281526020810184848401111561113957611138611039565b5b6111448482856110fb565b509392505050565b600082601f83011261116157611160611034565b5b813561117184826020860161110a565b91505092915050565b6000602082840312156111905761118f61102a565b5b600082013567ffffffffffffffff8111156111ae576111ad61102f565b5b6111ba8482850161114c565b91505092915050565b6111cc81610fe4565b81146111d757600080fd5b50565b6000813590506111e9816111c3565b92915050565b600080fd5b600080fd5b60008083601f84011261120f5761120e611034565b5b8235905067ffffffffffffffff81111561122c5761122b6111ef565b5b602083019150836001820283011115611248576112476111f4565b5b9250929050565b6000806000604084860312156112685761126761102a565b5b6000611276868287016111da565b935050602084013567ffffffffffffffff8111156112975761129661102f565b5b6112a3868287016111f9565b92509250509250925092565b6000819050919050565b6112c2816112af565b81146112cd57600080fd5b50565b6000813590506112df816112b9565b92915050565b6000602082840312156112fb576112fa61102a565b5b6000611309848285016112d0565b91505092915050565b6000819050919050565b61132581611312565b82525050565b6000602082019050611340600083018461131c565b92915050565b600080fd5b60006060828403121561136157611360611346565b5b81905092915050565b61137381611312565b811461137e57600080fd5b50565b6000813590506113908161136a565b92915050565b6000806000806000608086880312156113b2576113b161102a565b5b600086013567ffffffffffffffff8111156113d0576113cf61102f565b5b6113dc8882890161134b565b95505060206113ed888289016111da565b94505060406113fe88828901611381565b935050606086013567ffffffffffffffff81111561141f5761141e61102f565b5b61142b888289016111f9565b92509250509295509295909350565b6000602082840312156114505761144f611346565b5b81905092915050565b6000806000604084860312156114725761147161102a565b5b60006114808682870161143a565b935050602084013567ffffffffffffffff8111156114a1576114a061102f565b5b6114ad868287016111f9565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b60005b838110156114f35780820151818401526020810190506114d8565b60008484015250505050565b600061150a826114b9565b61151481856114c4565b93506115248185602086016114d5565b61152d8161103e565b840191505092915050565b6000602082019050818103600083015261155281846114ff565b905092915050565b6000602082840312156115705761156f61102a565b5b600061157e848285016111da565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006115ae82611587565b6115b88185611592565b93506115c88185602086016114d5565b6115d18161103e565b840191505092915050565b600060208201905081810360008301526115f681846115a3565b905092915050565b600061160982610fe4565b9050919050565b611619816115fe565b811461162457600080fd5b50565b60008135905061163681611610565b92915050565b6000806000606084860312156116555761165461102a565b5b600061166386828701611627565b935050602061167486828701611381565b925050604084013567ffffffffffffffff8111156116955761169461102f565b5b6116a18682870161114c565b9150509250925092565b6000608082840312156116c1576116c0611346565b5b81905092915050565b6000602082840312156116e0576116df61102a565b5b600082013567ffffffffffffffff8111156116fe576116fd61102f565b5b61170a848285016116ab565b91505092915050565b60008115159050919050565b61172881611713565b82525050565b6000602082019050611743600083018461171f565b92915050565b600067ffffffffffffffff8211156117645761176361104f565b5b61176d8261103e565b9050602081019050919050565b600061178d61178884611749565b6110af565b9050828152602081018484840111156117a9576117a8611039565b5b6117b48482856110fb565b509392505050565b600082601f8301126117d1576117d0611034565b5b81356117e184826020860161177a565b91505092915050565b600060208284031215611800576117ff61102a565b5b600082013567ffffffffffffffff81111561181e5761181d61102f565b5b61182a848285016117bc565b91505092915050565b600061183f83856114c4565b935061184c8385846110fb565b6118558361103e565b840190509392505050565b61186981610fe4565b82525050565b61187881611713565b82525050565b600082825260208201905092915050565b600061189a826114b9565b6118a4818561187e565b93506118b48185602086016114d5565b6118bd8161103e565b840191505092915050565b6118d181611312565b82525050565b600060a0830160008301516118ef6000860182611860565b506020830151611902602086018261186f565b5060408301516119156040860182611860565b506060830151848203606086015261192d828261188f565b915050608083015161194260808601826118c8565b508091505092915050565b60006060820190506119626000830187610ff6565b8181036020830152611975818587611833565b9050818103604083015261198981846118d7565b905095945050505050565b600081905092915050565b60006119aa826114b9565b6119b48185611994565b93506119c48185602086016114d5565b80840191505092915050565b60006119dc828461199f565b915081905092915050565b600081905092915050565b60006119fd82611587565b611a0781856119e7565b9350611a178185602086016114d5565b80840191505092915050565b6000611a2f82846119f2565b915081905092915050565b6000604082019050611a4f6000830185610ff6565b8181036020830152611a6181846118d7565b90509392505050565b60008160601b9050919050565b6000611a8282611a6a565b9050919050565b6000611a9482611a77565b9050919050565b611aac611aa782610fe4565b611a89565b82525050565b6000611abe82856119f2565b9150611aca8284611a9b565b6014820191508190509392505050565b6000606082019050611aef6000830186610ff6565b611afc6020830185610ff6565b611b09604083018461131c565b949350505050565b611b1a81611713565b8114611b2557600080fd5b50565b600081519050611b3781611b11565b92915050565b600060208284031215611b5357611b5261102a565b5b6000611b6184828501611b28565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112611b9657611b95611b6a565b5b80840192508235915067ffffffffffffffff821115611bb857611bb7611b6f565b5b602083019250600182023603831315611bd457611bd3611b74565b5b509250929050565b6000611be88385611994565b9350611bf58385846110fb565b82840190509392505050565b6000611c0e828486611bdc565b91508190509392505050565b7f7265766572740000000000000000000000000000000000000000000000000000600082015250565b6000611c506006836119e7565b9150611c5b82611c1a565b600682019050919050565b6000611c7182611c43565b9150819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611cb582611312565b9150611cc083611312565b925082611cd057611ccf611c7b565b5b82820490509291505056fea2646970667358221220c65e0c220554f807998419d73152c256b7cda9add6caf7336e420daca02bf0cf64736f6c634300081a0033" } diff --git a/pkg/contracts/testdappv2/TestDAppV2.sol b/pkg/contracts/testdappv2/TestDAppV2.sol index bf0f5887a4..a6404db1e8 100644 --- a/pkg/contracts/testdappv2/TestDAppV2.sol +++ b/pkg/contracts/testdappv2/TestDAppV2.sol @@ -1,6 +1,26 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.26; +struct RevertOptions { + address revertAddress; + bool callOnRevert; + address abortAddress; + bytes revertMessage; + uint256 onRevertGasLimit; +} + +interface IGatewayEVM { + function deposit(address receiver, RevertOptions calldata revertOptions) external payable; + function depositAndCall( + address receiver, + bytes calldata payload, + RevertOptions calldata revertOptions + ) + external + payable; + function call(address receiver, bytes calldata payload, RevertOptions calldata revertOptions) external; +} + interface IERC20 { function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } @@ -14,6 +34,9 @@ contract TestDAppV2 { // define if the chain is ZetaChain bool immutable public isZetaChain; + // address of the gateway + address immutable public gateway; + struct zContext { bytes origin; address sender; @@ -44,8 +67,9 @@ contract TestDAppV2 { mapping(bytes32 => uint256) public amountWithMessage; // the constructor is used to determine if the chain is ZetaChain - constructor(bool isZetaChain_) { + constructor(bool isZetaChain_, address gateway_) { isZetaChain = isZetaChain_; + gateway = gateway_; } // return the index used for the "WithMessage" mapping when the message for calls is empty @@ -144,6 +168,24 @@ contract TestDAppV2 { return ""; } + // deposit through Gateway EVM + function gatewayDeposit(address dst) external payable { + require(!isZetaChain); + IGatewayEVM(gateway).deposit{value: msg.value}(dst, RevertOptions(msg.sender, false, address(0), "", 0)); + } + + // deposit and call through Gateway EVM + function gatewayDepositAndCall(address dst, bytes calldata payload) external payable { + require(!isZetaChain); + IGatewayEVM(gateway).depositAndCall{value: msg.value}(dst, payload, RevertOptions(msg.sender, false, address(0), "", 0)); + } + + // call through Gateway EVM + function gatewayCall(address dst, bytes calldata payload) external { + require(!isZetaChain); + IGatewayEVM(gateway).call(dst, payload, RevertOptions(msg.sender, false, address(0), "", 0)); + } + function consumeGas() internal { // Approximate target gas consumption uint256 targetGas = 500000; diff --git a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go index ffc8e9aa7d..173093c771 100644 --- a/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go +++ b/x/crosschain/keeper/cctx_orchestrator_validate_outbound.go @@ -240,7 +240,7 @@ func (k Keeper) processSuccessfulOutbound( oldStatus := cctx.CctxStatus.Status switch oldStatus { case types.CctxStatus_PendingRevert: - cctx.SetReverted("", "revert executed") + cctx.SetReverted("", "") case types.CctxStatus_PendingOutbound: cctx.SetOutboundMined("") default: diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 00c08bf6f7..d67ec08ac6 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -13,7 +13,7 @@ func (m *Status) AbortRefunded() { func (m *Status) UpdateStatusAndErrorMessages(newStatus CctxStatus, statusMsg, errorMsg string) { m.UpdateStatus(newStatus, statusMsg) - if newStatus == CctxStatus_Aborted || newStatus == CctxStatus_Reverted || newStatus == CctxStatus_PendingRevert { + if errorMsg != "" { m.UpdateErrorMessage(errorMsg) } } diff --git a/x/fungible/keeper/v2_deposits_test.go b/x/fungible/keeper/v2_deposits_test.go index 7f25ec42e9..3f138ada9d 100644 --- a/x/fungible/keeper/v2_deposits_test.go +++ b/x/fungible/keeper/v2_deposits_test.go @@ -1,6 +1,9 @@ package keeper_test import ( + "math/big" + "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" @@ -11,8 +14,6 @@ import ( "github.com/zeta-chain/node/testutil/sample" fungiblekeeper "github.com/zeta-chain/node/x/fungible/keeper" "github.com/zeta-chain/node/x/fungible/types" - "math/big" - "testing" ) // getTestDAppNoMessageIndex queries the no message index of the test dapp v2 contract @@ -51,7 +52,7 @@ func getTestDAppNoMessageIndex( // deployTestDAppV2 deploys the test dapp v2 contract and returns its address func deployTestDAppV2(t *testing.T, ctx sdk.Context, k *fungiblekeeper.Keeper, evmk types.EVMKeeper) common.Address { - testDAppV2, err := k.DeployContract(ctx, testdappv2.TestDAppV2MetaData, true) + testDAppV2, err := k.DeployContract(ctx, testdappv2.TestDAppV2MetaData, true, sample.EthAddress()) require.NoError(t, err) require.NotEmpty(t, testDAppV2) assertContractDeployment(t, evmk, ctx, testDAppV2) diff --git a/zetaclient/chains/evm/observer/inbound.go b/zetaclient/chains/evm/observer/inbound.go index 8b3a160450..3f59fd8f56 100644 --- a/zetaclient/chains/evm/observer/inbound.go +++ b/zetaclient/chains/evm/observer/inbound.go @@ -145,35 +145,34 @@ func (ob *Observer) ProcessInboundTrackers(ctx context.Context) error { } ob.Logger().Inbound.Info().Msgf("checking tracker for inbound %s chain %d", tracker.TxHash, ob.Chain().ChainId) - // if the transaction is sent to the gateway, this is a v2 inbound - gatewayAddr, gateway, err := ob.GetGatewayContract() - if err != nil { - ob.Logger().Inbound.Debug().Err(err).Msg("error getting gateway contract for processing inbound tracker") + // try processing the tracker for v2 inbound + // filter error if event is not found, in this case we run v1 tracker process + if err := ob.ProcessInboundTrackerV2(ctx, tx, receipt); err != nil && + !errors.Is(err, ErrEventNotFound) && !errors.Is(err, ErrGatewayNotSet) { + return err + } else if err == nil { + // continue with next tracker + continue } - if err == nil && tx != nil && ethcommon.HexToAddress(tx.To) == gatewayAddr { - if err := ob.ProcessInboundTrackerV2(ctx, gateway, tx, receipt); err != nil { - return err - } - } else { - // check and vote on inbound tx - switch tracker.CoinType { - case coin.CoinType_Zeta: - _, err = ob.CheckAndVoteInboundTokenZeta(ctx, tx, receipt, true) - case coin.CoinType_ERC20: - _, err = ob.CheckAndVoteInboundTokenERC20(ctx, tx, receipt, true) - case coin.CoinType_Gas: - _, err = ob.CheckAndVoteInboundTokenGas(ctx, tx, receipt, true) - default: - return fmt.Errorf( - "unknown coin type %s for inbound %s chain %d", - tracker.CoinType, - tx.Hash, - ob.Chain().ChainId, - ) - } - if err != nil { - return errors.Wrapf(err, "error checking and voting for inbound %s chain %d", tx.Hash, ob.Chain().ChainId) - } + + // try processing the tracker for v1 inbound + switch tracker.CoinType { + case coin.CoinType_Zeta: + _, err = ob.CheckAndVoteInboundTokenZeta(ctx, tx, receipt, true) + case coin.CoinType_ERC20: + _, err = ob.CheckAndVoteInboundTokenERC20(ctx, tx, receipt, true) + case coin.CoinType_Gas: + _, err = ob.CheckAndVoteInboundTokenGas(ctx, tx, receipt, true) + default: + return fmt.Errorf( + "unknown coin type %s for inbound %s chain %d", + tracker.CoinType, + tx.Hash, + ob.Chain().ChainId, + ) + } + if err != nil { + return errors.Wrapf(err, "error checking and voting for inbound %s chain %d", tx.Hash, ob.Chain().ChainId) } } return nil diff --git a/zetaclient/chains/evm/observer/v2_inbound_tracker.go b/zetaclient/chains/evm/observer/v2_inbound_tracker.go index d559e9e9d6..407b25fd62 100644 --- a/zetaclient/chains/evm/observer/v2_inbound_tracker.go +++ b/zetaclient/chains/evm/observer/v2_inbound_tracker.go @@ -6,18 +6,30 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/onrik/ethrpc" - "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayevm.sol" + "github.com/pkg/errors" "github.com/zeta-chain/node/zetaclient/zetacore" ) +var ( + ErrEventNotFound = errors.New("event not found") + ErrGatewayNotSet = errors.New("gateway contract not set") +) + // ProcessInboundTrackerV2 processes inbound tracker events from the gateway +// TODO: add test coverage +// https://github.com/zeta-chain/node/issues/2669 func (ob *Observer) ProcessInboundTrackerV2( ctx context.Context, - gateway *gatewayevm.GatewayEVM, tx *ethrpc.Transaction, receipt *ethtypes.Receipt, ) error { + gatewayAddr, gateway, err := ob.GetGatewayContract() + if err != nil { + ob.Logger().Inbound.Debug().Err(err).Msg("error getting gateway contract for processing inbound tracker") + return ErrGatewayNotSet + } + // check confirmations if confirmed := ob.HasEnoughConfirmations(receipt, ob.LastBlock()); !confirmed { return fmt.Errorf( @@ -28,7 +40,7 @@ func (ob *Observer) ProcessInboundTrackerV2( } for _, log := range receipt.Logs { - if log == nil { + if log == nil || log.Address != gatewayAddr { continue } @@ -84,5 +96,5 @@ func (ob *Observer) ProcessInboundTrackerV2( } } - return fmt.Errorf("no gateway event found in inbound tracker %s", tx.Hash) + return errors.Wrapf(ErrEventNotFound, "inbound tracker %s", tx.Hash) }