Skip to content

Commit

Permalink
feat: Add nonce parameter to approve and transfer methods in Blockcha…
Browse files Browse the repository at this point in the history
…inService
  • Loading branch information
PleBea committed Sep 25, 2024
1 parent 318bc23 commit baf3357
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/blockchain/blockchain.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ export class BlockchainService {
async transfer(to: string, amount: number, address: string): Promise<void> {
const erc20 = await ethers.getContractAt('ShockiToken', address, this.deployer);

await erc20.approve(this.deployer.address, ethers.parseUnits(amount.toString(), 18));
await erc20.approve(this.deployer.address, ethers.parseUnits(amount.toString(), 18), {
nonce: await this.getTransactionCount(),
});

await erc20.waitForDeployment();

await erc20.transfer(to, ethers.parseUnits(amount.toString(), 18), {
gasLimit: 100000,
nonce: await this.getTransactionCount(),
});

return;
Expand Down

0 comments on commit baf3357

Please sign in to comment.