I am facing an issue with my contract while trying to execute the claimFreeToken function. Even though the contract does not have enough tokens, the function does not return an error and the token also does not get received. Can anyone point out where I might have missed something?
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Test Token", "TET") {
_mint(msg.sender, initialSupply * (10**decimals()));
}
function claimFreeToken() public payable {
transfer(msg.sender, 1000 * (10**decimals()));
}
}