I have had this doubt for a long time.

I have a contract deployed that in the constructor mint 100 TOKENS (ERC20).

enter image description here

I have issues creatin a function in the smart contract WITHOUT Parameters that ANYONE can run it and the smart contract send to that person (msg.sender) that execute this function 1 of the TOKEN already minted.

Because i DONT need a function that i have to pass the address by parameter and without paremeters give me an error :(

  • we don't work for you! do some research, what you're asking for requires 1 minute of google search
    – Adam Boudj
    Mar 18, 2022 at 18:19
  • Of course, i know that you dont work for me, i ask here because i dont found the answer nowhere. Help me :'(
    – Fr4nc0
    Mar 18, 2022 at 21:17

1 Answer 1


You should really learn solidity, otherwise, you'll get stuck at every step

function claim() external {
    // require(totalSupply < the total supply required);
    _mint(msg.sender, 1 * (10**2));

this is an example of a function that you can add to your ERC20, if you want a limit to your supply you can add the require. 10**2, 2 here is your decimal, you can change it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.