Skip to content

Commit

Permalink
fix withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 7, 2024
1 parent 0529500 commit c127300
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/localnet/src/createToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ export const createToken = async (
deployOpts
);

await (zrc20 as any)
.connect(deployer)
.transfer(
fungibleModuleSigner.getAddress(),
ethers.parseUnits("100", await (zrc20 as any).decimals()),
deployOpts
);

await (wzeta as any)
.connect(deployer)
.deposit({ value: ethers.parseEther("1000"), ...deployOpts });
Expand Down
7 changes: 7 additions & 0 deletions packages/localnet/src/handleOnRevertZEVM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ export const handleOnRevertZEVM = async ({
if (callOnRevert) {
log("ZetaChain", "Gateway: calling executeRevert");
try {
const assetContract = new ethers.Contract(
asset,
["function transfer(address to, uint256 amount) public returns (bool)"],
fungibleModuleSigner
);
const transferTx = await assetContract.transfer(revertAddress, amount);
await transferTx.wait();
tss.reset();
const tx = await gatewayZEVM
.connect(fungibleModuleSigner)
Expand Down
3 changes: 1 addition & 2 deletions packages/localnet/src/handleOnZEVMWithdrawnAndCalled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const handleOnZEVMWithdrawnAndCalled = async ({
const coinType = await zrc20Contract.COIN_TYPE();
const isGasToken = coinType === 1n;
const isERC20orZETA = coinType === 2n;
// The message is not empty, so this is a withdrawAndCall operation
log(chainID, `Calling ${receiver} with message ${message}`);
if (isGasToken) {
const executeTx = await evmContracts[chainID].gatewayEVM
Expand Down Expand Up @@ -95,7 +94,7 @@ export const handleOnZEVMWithdrawnAndCalled = async ({
err,
provider,
tss,
asset: getERC20ByZRC20(zrc20),
asset: zrc20,
amount,
log,
fungibleModuleSigner,
Expand Down

0 comments on commit c127300

Please sign in to comment.