diff --git a/hardhat.config.ts b/hardhat.config.ts index 5d029dd..cc7d7d4 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -26,16 +26,16 @@ import "./tasks/recover-lost-funds"; import "./tasks/get-batch"; import "./tasks/get-batch-deposits"; import "./tasks/deploy/mint-burn-tokens"; -import "./tasks/quorum"; +import "./tasks/get-quorum"; import "./tasks/get-statuses-after-execution"; import "./tasks/depositSC"; import "./tasks/set-batch-settle-limit-on-safe" import "./tasks/deploy"; import "./tasks/token-balance-query" import "./tasks/get-relayers" -import "./tasks/native-tokens" -import "./tasks/mintburn-tokens" +import "./tasks/get-token-properties" import "./tasks/reset-total-balance" +import "./tasks/mintburn-test-tokens" import { resolve } from "path"; diff --git a/tasks/add-to-whitelist.ts b/tasks/add-to-whitelist.ts index a5e75ad..8cabd87 100644 --- a/tasks/add-to-whitelist.ts +++ b/tasks/add-to-whitelist.ts @@ -8,18 +8,18 @@ task("add-to-whitelist", "Whitelists a new address in the bridge.") .addOptionalParam("price", "Gas price in gwei for this transaction", undefined) .addOptionalParam("mintburn", "flag if the token is mintable/burnable", false, types.boolean) .addOptionalParam("native", "flag if the token is native", true, types.boolean) - .addOptionalParam("totalBalance", "total balance") - .addOptionalParam("mintBalance", "minted balance") - .addOptionalParam("burnBalance", "burn balance") + .addOptionalParam("totalbalance", "total balance") + .addOptionalParam("mintbalance", "minted balance") + .addOptionalParam("burnbalance", "burn balance") .setAction(async (taskArgs, hre) => { const minAmount = taskArgs.min ?? 25; const maxAmount = taskArgs.max ?? 100; const address = taskArgs.address; const mintBurn = taskArgs.mintburn ?? false; const native = taskArgs.native ?? false; - const totalBalance = taskArgs.totalBalance ?? 0 - const mintBalance = taskArgs.mintBalance ?? 0 - const burnBalance = taskArgs.burnBalance ?? 0 + const totalBalance = taskArgs.totalbalance ?? 0 + const mintBalance = taskArgs.mintbalance ?? 0 + const burnBalance = taskArgs.burnbalance ?? 0 const [adminWallet] = await hre.ethers.getSigners(); const fs = require("fs"); const filename = "setup.config.json"; diff --git a/tasks/mintburn-tokens.ts b/tasks/get-mintburn-tokens.ts similarity index 91% rename from tasks/mintburn-tokens.ts rename to tasks/get-mintburn-tokens.ts index e4e14fa..e6ebe6b 100644 --- a/tasks/mintburn-tokens.ts +++ b/tasks/get-mintburn-tokens.ts @@ -1,7 +1,7 @@ import "@nomicfoundation/hardhat-toolbox"; import fs from "fs"; -task("mintburn-tokens", "Returns if the token is mint-burn or not") +task("get-mintburn-tokens", "Returns if the token is mint-burn or not") .addParam("address", "Address of the token") .setAction(async (taskArgs, hre) => { const address = taskArgs.address; diff --git a/tasks/quorum.ts b/tasks/get-quorum.ts similarity index 85% rename from tasks/quorum.ts rename to tasks/get-quorum.ts index 9bc14bd..c870263 100644 --- a/tasks/quorum.ts +++ b/tasks/get-quorum.ts @@ -1,6 +1,6 @@ import "@nomicfoundation/hardhat-toolbox"; -task("get-quorum", "Get batch information").setAction(async (taskArgs, hre) => { +task("get-quorum", "Get quorum information").setAction(async (taskArgs, hre) => { const [adminWallet] = await hre.ethers.getSigners(); const fs = require("fs"); const config = JSON.parse(fs.readFileSync("setup.config.json", "utf8")); diff --git a/tasks/get-token-properties.ts b/tasks/get-token-properties.ts new file mode 100644 index 0000000..3b3aa1b --- /dev/null +++ b/tasks/get-token-properties.ts @@ -0,0 +1,61 @@ +import "@nomicfoundation/hardhat-toolbox"; +import fs from "fs"; + +task("get-token-properties", "Returns the token's properties") + .addParam("address", "Address of the token") + .setAction(async (taskArgs, hre) => { + const address = taskArgs.address; + + const filename = "setup.config.json"; + const config = JSON.parse(fs.readFileSync(filename, "utf8")); + const safeAddress = config["erc20Safe"]; + + const safeContractFactory = await hre.ethers.getContractFactory("ERC20Safe"); + const contract = safeContractFactory.attach(safeAddress) + + await contract + .totalBalances(address) + .then((balance: any) => { + console.log(`Token ${address} has a set balance of: ${balance.toString()}`); + }) + .catch((err: any) => { + console.log(err); + }); + + await contract + .mintBalances(address) + .then((balance: any) => { + console.log(`Token ${address} has a set mint balance of: ${balance.toString()}`); + }) + .catch((err: any) => { + console.log(err); + }); + + await contract + .burnBalances(address) + .then((balance: any) => { + console.log(`Token ${address} has a set burn balance of: ${balance.toString()}`); + }) + .catch((err: any) => { + console.log(err); + }); + + await contract + .nativeTokens(address) + .then((isNative: any) => { + console.log(`Token ${address} is native: ${isNative.toString()}`); + }) + .catch((err: any) => { + console.log(err); + }); + + await contract + .mintBurnTokens(address) + .then((isMintBurn: any) => { + console.log(`Token ${address} is mint-burn: ${isMintBurn.toString()}`); + }) + .catch((err: any) => { + console.log(err); + }); + + }); diff --git a/tasks/mintburn-test-tokens.ts b/tasks/mintburn-test-tokens.ts new file mode 100644 index 0000000..67d14b1 --- /dev/null +++ b/tasks/mintburn-test-tokens.ts @@ -0,0 +1,18 @@ +import "@nomicfoundation/hardhat-toolbox"; + +task("mintburn-test-tokens", "Mints tests tokens and sends them to the recipientAddress") + .addParam("address", "Address of wallet to be funded") + .setAction(async (taskArgs, hre) => { + const fs = require("fs"); + const filename = "setup.config.json"; + let config = JSON.parse(fs.readFileSync(filename, "utf8")); + const address = taskArgs.address; + + for (let token of config["tokens"]) { + console.log("minting tokens for contract: ", token); + const tokenContract = (await hre.ethers.getContractFactory("MintBurnERC20")).attach(token); + + await tokenContract.mint(address, "10000000000000000"); + console.log("minted tokens for contract: ", token, address); + } + }); diff --git a/tasks/native-tokens.ts b/tasks/native-tokens.ts deleted file mode 100644 index 72fdb39..0000000 --- a/tasks/native-tokens.ts +++ /dev/null @@ -1,24 +0,0 @@ -import "@nomicfoundation/hardhat-toolbox"; -import fs from "fs"; - -task("native-tokens", "Returns if the token is native or not") - .addParam("address", "Address of the token") - .setAction(async (taskArgs, hre) => { - const address = taskArgs.address; - - const filename = "setup.config.json"; - const config = JSON.parse(fs.readFileSync(filename, "utf8")); - const safeAddress = config["erc20Safe"]; - - const safeContractFactory = await hre.ethers.getContractFactory("ERC20Safe"); - const contract = safeContractFactory.attach(safeAddress) - - await contract - .nativeTokens(address) - .then((isNative: any) => { - console.log(`Token ${address} is native: ${isNative.toString()}`); - }) - .catch((err: any) => { - console.log(err); - }); - });