-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [ISSUE-119] Format approveToken.ts file
- Loading branch information
1 parent
e4f4ccd
commit 9734d5d
Showing
1 changed file
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |