Skip to content

Commit

Permalink
- added 2 more tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau committed Oct 2, 2024
1 parent ac815b3 commit fc4c25c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import "./tasks/get-statuses-after-execution";
import "./tasks/depositSC";
import "./tasks/set-batch-settle-limit-on-safe"
import "./tasks/deploy";
import "./tasks/native-tokens"
import "./tasks/mintburn-tokens"

import { resolve } from "path";

Expand Down
24 changes: 24 additions & 0 deletions tasks/mintburn-tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "@nomicfoundation/hardhat-toolbox";
import fs from "fs";

task("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;

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
.mintBurnTokens(address)
.then((isMintBurn: any) => {
console.log(`Token ${address} is mint-burn: ${isMintBurn.toString()}`);
})
.catch((err: any) => {
console.log(err);
});
});
24 changes: 24 additions & 0 deletions tasks/native-tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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);
});
});

0 comments on commit fc4c25c

Please sign in to comment.