Mint-on-demand is a great way to make your operation smooth and effective. We have created a regular basic crypto, a coin that is mintable, a crypto faucet and a self-drop contract. Let’s combine a mintable coin with a self-drop contract and also drop the ownership of the coin and contract.
Having control over a coin and/or it’s contract is really only useful for playing around and testing out new stuff. But if you wish to sell it and want other people to trust it enough to be willing to invest in it, they have to know that you can’t just make new coins directly to your own wallet whenever you want.
You can copy the full code from GitHub
Next, follow the usual steps and compile the contract. Once you have compiled the code without errors, you need to choose the SaleDeployer contract on the deployment page.
Name: Give your token a name
Symbol: Set the symbol for the token (i.e ETH for Ethereum)
Wallet: This is the wallet where you want the profit to be sent (so make sure it’s yours).
When you are done naming your token, and have set a symbol as well as beneficiary address, click “Transact”
Once you have confirmed the deployment in metamask you get a dropdown menu under “Deployed Contracts”. Reveal the address of the token as well as the sales contract by clicking on its respective button.
Next, we choose the “Demand – demand.sol” contract. If you renamed the contract, not the token, then you choose the contract as you named it. Copy the token_address and put it in the “At Address” text field and press the “At Address” button. Then choose the DemandSale contract, copy the token_sale_address and put it in the “At Address” text field and press the “At Address” button.
When you expand the DemandSale contract under deployed contracts, you can see the sales rate, token address, which address the currency from the sales will be sent to and the amount of currency raised so far.
You should now see three different contract under “Deployed Contracts”.
Demand (token contract)
The rate is set to 10000. This can be changed in the code itself. A rate of 10000 means that you will get 10,000 of your tokens for 1 BNB (or ETH).
If you expand the Demand contract you also get various types of information. You can try to mint coins or add a new minter, but you will get error messages. You are no longer the owner of the contract, and only the sales contract is allowed to mint new coins. By putting the address of the sales contract in the “isMinter” box and press the button, you will get confirmation that the sales contract is the minter.
When you send currency (in this case BNB) to the sales contract, it will mint your coins and send it back to you. The picture below shows how I’m sending 0.05 BNB to the sales contract, the sales contract forwards the 0.05 BNB to the address we provided as the beneficiary when we first deployed the SaleDeployer contract, and finally 500 Print (MOAR) tokens is minted and sent to the address of the buyer.
If you found this guide helpful, then please share it with your friends!
Note: Investing and trading with cryptocurrencies can result in significant loss