-
Notifications
You must be signed in to change notification settings - Fork 0
/
withdraw.ts
32 lines (27 loc) · 1.13 KB
/
withdraw.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { parseEther } from "@ethersproject/units";
import { getAddress } from "@zetachain/protocol-contracts";
import { prepareData, trackCCTX } from "@zetachain/toolkit/helpers";
const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
const [signer] = await hre.ethers.getSigners();
const data = prepareData(args.contract, ["uint8"], ["4"]);
const to = getAddress("tss", hre.network.name);
const value = parseEther("0");
const tx = await signer.sendTransaction({ data, to, value });
if (args.json) {
console.log(JSON.stringify(tx, null, 2));
} else {
console.log(`🔑 Using account: ${signer.address}\n`);
console.log(`🚀 Successfully broadcasted a token transfer transaction on ${hre.network.name} network.
📝 Transaction hash: ${tx.hash}
`);
}
};
task(
"set-withdraw",
"Set the address on a connected chain to which unstaked tokens will be withdrawn",
main
)
.addParam("contract", "The address of the contract on ZetaChain")
.addFlag("json", "Output in JSON");