1

I am creating 3 erc20 tokens and I want 2 of these token contracts to be able to send tokens of the 3rd type. e.g. When I create the third token, I want 1m total supply, but allow 500k to be accessed by the other 2 token contracts.

The idea is to send a bonus amount of the 3rd token to the buyer on purchase (minting) of the other two tokens.

Would the best way to achieve this be sending 500k of the 3rd token to each of the other token contracts upon token creation? Then would the other token contracts be able to access these tokens and distribute them easily?

  • 1
    The answer to your first question is (- IMO, since you're using best- ) yes. – goodvibration Sep 2 '18 at 17:43
  • 1
    With regards to the second question, ERC20 implements transfer. So on every buy of any of the other two tokens, that token's contract can transfer from itself to the buyer. – goodvibration Sep 2 '18 at 17:45
  • 1
    You should separate concerns. Keep the token contracts themselves as simple immutable ledgers that keep track of where things are. Construct sale contracts or other forms of transactional contracts to address business logic. Such a contract would necessarily have knowledge of all the different tokens it needs to deal with in a single atomic transaction. Importantly, I recommend that don't conflate the character of the tokens with the usage of the tokens in a single contract. – Rob Hitchens - B9lab Sep 2 '18 at 20:25
  • @Rob, what is the rationale behind having multiple contracts? – Jaime Sep 3 '18 at 14:20
  • 1
    @Jaime. It works best to separate concerns such that the token contracts describe only the character of the tokens. Those three token contracts would be instances of the same, well-solved ERC20 pattern. Sale rules belong in a separate contract that has balances in each token and does whatever it does when payment is received. It can and should be short and on point. This style will help keep all 4 contracts succinct and minimally complex, which is precisely what is needed in this unforgiving space. – Rob Hitchens - B9lab Sep 3 '18 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.