Adjust Contract For Use Case

Published by Marianne Poser on

From a developer perspective, we need two different types of fungible tokens for this scenario – namely, Coins and Keys. They should have the IDs 0 and 1 and for a better overview, the constants COINS and KEYS are defined for them. Accordingly, the two mint operations in the constructor are adapted. The mint operations for the NFT can be removed from the constructor.

Instead, two variables are defined in it. One is the owner of the contract, i.e., the address that also owns all coins and keys at the beginning. The variable treasureCount is defined to know at any time which IDs for tokens are already assigned since this will be increased with each further mint call. Since the IDs 0 and 1 are already assigned, the counter is set to 1.