Skip to content

Commit

Permalink
refactor: [ISSUE-119] Format approveToken.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjoaovpsantos committed Dec 19, 2023
1 parent e4f4ccd commit 9734d5d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions scripts/approveToken.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { ethers } from "hardhat"
import { ethers } from "hardhat";
import { ERC20ABI } from "../test/utils/utils";

export async function main() {
// Get the first account from the list of accounts
const [signer] = await ethers.getSigners();
// Get the first account from the list of accounts
const [signer] = await ethers.getSigners();

// Get the Swaplace address from .env file
const swaplaceAddress: string = process.env.SWAPLACE_ADDRESS || "";
// Get the Swaplace address from .env file
const swaplaceAddress: string = process.env.SWAPLACE_ADDRESS || "";

// Get the token contract, replace to the token that you want approve
const tokenContract = '';
// Get the token contract, replace to the token that you want approve
const tokenContract = "";

// Get the token instance
const Token = new ethers.Contract(tokenContract, ERC20ABI, signer);
// Get the token instance
const Token = new ethers.Contract(tokenContract, ERC20ABI, signer);

// Get the value to approve token, replace to value that you need
const valueApproveToken = BigInt(99999 * (10**18));

// Make the approve
const tx = Token.approve(swaplaceAddress, valueApproveToken)
// Get the value to approve token, replace to value that you need
const valueApproveToken = BigInt(99999 * 10 ** 18);

// Wait for the transaction to be mined
await tx.wait();
// Make the approve
const tx = Token.approve(swaplaceAddress, valueApproveToken);

// Log the transaction hash
console.log("\nTransaction Hash: ", tx);
// Wait for the transaction to be mined
await tx.wait();

// Log the transaction hash
console.log("\nTransaction Hash: ", tx);
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
console.error(error);
process.exitCode = 1;
});

0 comments on commit 9734d5d

Please sign in to comment.