I created a erc20 contract with a total supply of 40,000,000. 10 mil was sent to my wallet and 30 mil suppose to go to investors.
When someone invest, how can I send him tokens from my contract to his erc20 wallet?
Thanks.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThere is no such thing as ERC20 wallet, unless you have created your own.
The smart contract of your ERC20 token is a place where all tokens are and they are not travelling to other contracts and wallets. The way someone can actually have a number of tokens is just the the mapping usually called balances
in which by query balances[address]
you can receive amount
of tokens this particular address hold.
When someone invest, how can I send him tokens from my contract to his erc20 wallet?
You just update the state by executing something like:
balances[addr_of_investor] = amount_of_tokens;