Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the order of withdraw and call #43

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions packages/localnet/src/handleOnZEVMWithdrawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,7 @@ export const handleOnZEVMWithdrawn = async ({
const amount = args[4];
const message = args[7];
(tss as NonceManager).reset();
if (message !== "0x") {
log("EVM", `Calling ${receiver} with message ${message}`);
const executeTx = await protocolContracts.gatewayEVM
.connect(tss)
.execute(receiver, message, deployOpts);
await executeTx.wait();
const logs = await provider.getLogs({
address: receiver,
fromBlock: "latest",
});
logs.forEach((data) => {
log("EVM", `Event from contract: ${JSON.stringify(data)}`);
});
}

const zrc20Contract = new ethers.Contract(zrc20, ZRC20.abi, deployer);
const coinType = await zrc20Contract.COIN_TYPE();
if (coinType === 1n) {
Expand Down Expand Up @@ -76,6 +63,20 @@ export const handleOnZEVMWithdrawn = async ({
`Transferred ${amount} ERC-20 tokens from Custody to ${receiver}`
);
}
if (message !== "0x") {
log("EVM", `Calling ${receiver} with message ${message}`);
const executeTx = await protocolContracts.gatewayEVM
.connect(tss)
.execute(receiver, message, deployOpts);
await executeTx.wait();
const logs = await provider.getLogs({
address: receiver,
fromBlock: "latest",
});
logs.forEach((data) => {
log("EVM", `Event from contract: ${JSON.stringify(data)}`);
});
}
} catch (err) {
const revertOptions = args[9];
return await handleOnRevertZEVM({
Expand Down