Skip to content

Commit

Permalink
Fix eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Sep 19, 2024
1 parent 775978f commit 5f4a6f8
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions test-tokens/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "@nomiclabs/hardhat-web3";
import "@nomiclabs/hardhat-ethers";
import * as dotenv from "dotenv"
import { promises as fs } from "fs";
import { TaskArguments } from "hardhat/types";
import { Interface } from "ethers/lib/utils";

dotenv.config();

Expand Down Expand Up @@ -36,8 +38,8 @@ function validateInteger( value, radix ) {
)
return true;
} catch ( err ) {
return false;
}
return false;
}

function toInteger( value, radix ) {
Expand All @@ -47,8 +49,8 @@ function toInteger( value, radix ) {
return NaN;
return parseInt( value, radix );
} catch ( err ) {
return false;
}
return false;
}

function verifyArgumentIsArrayOfIntegers( joArg ) {
Expand Down Expand Up @@ -85,13 +87,13 @@ task("erc20", "Deploy ERC20 Token sample to chain")
.addOptionalParam("contract", "ERC20 Token contract")
.addParam("name", "ERC20 Token name")
.addParam("symbol", "ERC20 Token symbol")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = taskArgs.contract ? taskArgs.contract : "ERC20Example";
const erc20Factory = await ethers.getContractFactory(contractName);
const erc20 = await erc20Factory.deploy(taskArgs.name, taskArgs.symbol);
console.log("ERC20 Token with name", taskArgs.name, "and symbol", taskArgs.symbol, "was deployed");
console.log("Address:", erc20.address);
const jsonObj: {[str: string]: any} = {};
const jsonObj: {[str: string]: string | Interface} = {};
jsonObj.erc20_address = erc20.address;
jsonObj.erc20_abi = erc20.interface;
await fs.writeFile("data/" + contractName + "-" + taskArgs.name + "-" + taskArgs.symbol + "-" + erc20.address + ".json", JSON.stringify(jsonObj, null, 4));
Expand All @@ -102,13 +104,13 @@ task("erc721", "Deploy ERC721 Token sample to chain")
.addOptionalParam("contract", "ERC721 Token contract")
.addParam("name", "ERC721 Token name")
.addParam("symbol", "ERC721 Token symbol")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = taskArgs.contract ? taskArgs.contract : "ERC721Example";
const erc721Factory = await ethers.getContractFactory(contractName);
const erc721 = await erc721Factory.deploy(taskArgs.name, taskArgs.symbol);
console.log("ERC721 Token with name", taskArgs.name, "and symbol", taskArgs.symbol, "was deployed");
console.log("Address:", erc721.address);
const jsonObj: {[str: string]: any} = {};
const jsonObj: {[str: string]: string | Interface} = {};
jsonObj.erc721_address = erc721.address;
jsonObj.erc721_abi = erc721.interface;
await fs.writeFile("data/" + contractName + "-" + taskArgs.name + "-" + taskArgs.symbol + "-" + erc721.address + ".json", JSON.stringify(jsonObj, null, 4));
Expand All @@ -118,13 +120,13 @@ task("erc721", "Deploy ERC721 Token sample to chain")
task("erc1155", "Deploy ERC1155 Token sample to chain")
.addOptionalParam("contract", "ERC1155 Token contract")
.addParam("uri", "ERC1155 Base Token URI")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = taskArgs.contract ? taskArgs.contract : "ERC1155Example";
const erc1155Factory = await ethers.getContractFactory(contractName);
const erc1155 = await erc1155Factory.deploy(taskArgs.uri);
console.log("ERC1155 Token with Base Token URI", taskArgs.uri, "was deployed");
console.log("Address:", erc1155.address);
const jsonObj: {[str: string]: any} = {};
const jsonObj: {[str: string]: string | Interface} = {};
jsonObj.erc1155_address = erc1155.address;
jsonObj.erc1155_abi = erc1155.interface;
await fs.writeFile("data/" + contractName + "-" + taskArgs.uri + "-" + erc1155.address + ".json", JSON.stringify(jsonObj, null, 4));
Expand All @@ -135,7 +137,7 @@ task("mint-erc20", "Mint ERC20 Token")
.addParam("tokenAddress", "Address of ERC20 token")
.addParam("receiverAddress", "Address of receiver")
.addParam("amount", "Amount of tokens")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC20Example";
const erc20Factory = await ethers.getContractFactory(contractName);
const erc20 = erc20Factory.attach(taskArgs.tokenAddress);
Expand All @@ -151,7 +153,7 @@ task("mint-erc721", "Mint ERC721 Token")
.addParam("tokenAddress", "Address of ERC721 token")
.addParam("receiverAddress", "Address of receiver")
.addParam("tokenId", "Token ID of ERC721 Token")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC721Example";
const erc721Factory = await ethers.getContractFactory(contractName);
const erc721 = erc721Factory.attach(taskArgs.tokenAddress);
Expand All @@ -169,7 +171,7 @@ task("mint-erc1155", "Mint ERC1155 Token")
.addParam("amount", "Token Amount of ERC1155 Token")
.addOptionalParam("data", "Bytes data for minting Token")
.addOptionalParam("batch", "Bytes data for minting Token")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC1155Example";
const erc1155Factory = await ethers.getContractFactory(contractName);
const erc1155 = erc1155Factory.attach(taskArgs.tokenAddress);
Expand All @@ -196,7 +198,7 @@ task("mint-erc1155", "Mint ERC1155 Token")
task("add-minter-erc20", "Add minter to ERC20 Token")
.addParam("tokenAddress", "Address of ERC20 token")
.addParam("address", "Minter Address of ERC20 token")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC20Example";
const erc20Factory = await ethers.getContractFactory(contractName);
const erc20 = erc20Factory.attach(taskArgs.tokenAddress);
Expand All @@ -211,7 +213,7 @@ task("add-minter-erc20", "Add minter to ERC20 Token")
task("add-minter-erc721", "Add minter to ERC721 Token")
.addParam("tokenAddress", "Address of ERC721 token")
.addParam("address", "Minter Address of ERC721 token")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC721Example";
const erc721Factory = await ethers.getContractFactory(contractName);
const erc721 = erc721Factory.attach(taskArgs.tokenAddress);
Expand All @@ -226,7 +228,7 @@ task("add-minter-erc721", "Add minter to ERC721 Token")
task("add-minter-erc1155", "Add minter to ERC1155 Token")
.addParam("tokenAddress", "Address of ERC1155 token")
.addParam("address", "Minter Address of ERC1155 token")
.setAction(async (taskArgs: any, { ethers }) => {
.setAction(async (taskArgs: TaskArguments, { ethers }) => {
const contractName = "ERC1155Example";
const erc1155Factory = await ethers.getContractFactory(contractName);
const erc1155 = erc1155Factory.attach(taskArgs.tokenAddress);
Expand Down

0 comments on commit 5f4a6f8

Please sign in to comment.