-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump protocol contracts to use erc20 auth calls * bump protocol contracts and fix test dapp * rename current test to arbitrary call * rename existing tests * e2e test wip * new test fix * fix test * fix * PR comment * revert staking abi change * fmt * changelog * fix test * PR comment * PR comment * fix test
- Loading branch information
Showing
26 changed files
with
290 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package e2etests | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" | ||
|
||
"github.com/zeta-chain/node/e2e/runner" | ||
"github.com/zeta-chain/node/e2e/utils" | ||
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" | ||
) | ||
|
||
const payloadMessageWithdrawERC20 = "this is a test ERC20 withdraw and call payload" | ||
|
||
func TestV2ERC20WithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { | ||
require.Len(r, args, 1) | ||
|
||
amount, ok := big.NewInt(0).SetString(args[0], 10) | ||
require.True(r, ok, "Invalid amount specified for TestV2ERC20WithdrawAndCall") | ||
|
||
r.AssertTestDAppEVMCalled(false, payloadMessageWithdrawERC20, amount) | ||
|
||
r.ApproveERC20ZRC20(r.GatewayZEVMAddr) | ||
r.ApproveETHZRC20(r.GatewayZEVMAddr) | ||
|
||
// perform the withdraw | ||
tx := r.V2ERC20WithdrawAndArbitraryCall( | ||
r.TestDAppV2EVMAddr, | ||
amount, | ||
r.EncodeERC20Call(r.ERC20Addr, amount, payloadMessageWithdrawERC20), | ||
gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, | ||
) | ||
|
||
// wait for the cctx to be mined | ||
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) | ||
r.Logger.CCTX(*cctx, "withdraw") | ||
require.Equal(r, crosschaintypes.CctxStatus_OutboundMined, cctx.CctxStatus.Status) | ||
|
||
r.AssertTestDAppEVMCalled(true, payloadMessageWithdrawERC20, amount) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.