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

Tasks fixes & improvements #71

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
12 changes: 6 additions & 6 deletions tasks/add-to-whitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion tasks/mintburn-tokens.ts → tasks/get-mintburn-tokens.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tasks/quorum.ts → tasks/get-quorum.ts
Original file line number Diff line number Diff line change
@@ -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"));
Expand Down
61 changes: 61 additions & 0 deletions tasks/get-token-properties.ts
Original file line number Diff line number Diff line change
@@ -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);
});

});
18 changes: 18 additions & 0 deletions tasks/mintburn-test-tokens.ts
Original file line number Diff line number Diff line change
@@ -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);
}
});
24 changes: 0 additions & 24 deletions tasks/native-tokens.ts

This file was deleted.

Loading