Hello everyone, I deployed a smart contract via Hardhat on the Goerli testnet, but when I try to send tokens to another wallet, the transaction fails. Could someone more experienced take a look at it?
If the issue might be in the code in the tax logic
In your HardHat test, you have something like:
it('should transfer tokens correctly', async () => {
...
});
Somewhere probably above that, you have something like:
beforeEach(async () => {
...
});
Please provide the code inside that clause in plaintext (no screenshots or images).
If that code interacts with one or more contract functions (including constructors), then please provide the code of those functions as well (again, in plaintext).
More generally, please post ALL the relevant code and ONLY the relevant code in PLAINTEXT.
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("CustomToken", function () {
let Token, token, owner, addr1, addr2;
beforeEach(async function () {
// Getting signers
[owner, addr1, addr2, _] = await ethers.getSigners();
// Deploying the contract
Token = await ethers.getContractFactory("CustomToken");
token = await Token.deploy("0x70Cf9E7FBDd52CC5Ea313e50f37c4CE263e5c926", "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", owner.address);
await token.deployed();
});
// Testing token transfer
it("should transfer tokens correctly", async function () {
// Transferring tokens to addr1
let transferAmount = ethers.utils.parseUnits("1000", 18);
await token.transfer(addr1.address, transferAmount);
// Checking balances
expect(await token.balanceOf(addr1.address)).to.equal(transferAmount);
});
// Additional tests...
});
Your test most likely fails here, at the deployment of your contract.
Please post the relevant code (your contract's constructor and whatever other code it may depend on).
Alternatively, you can just verify and public your contract's source code on goerli.etherscan.