1

I noticed some smart contracts have the wallet address of the creator in the smart contract to send the tokens to the wallet like example #1:

Example #1:

constructor() public {
        symbol = "0PUCKS";
        name = "0 Pucks Token";
        decimals = 18;
        _totalSupply = 100000000000000000000000000;
        balances[0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222] = _totalSupply;
        emit Transfer(address(0), 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222, _totalSupply);

But below example #2 there is is no visble wallet address for the creator within the smart contract code:

Example: #2

contract BTClite is StandardToken, Ownable {

      string public constant name = "BTC LITE";
      string public constant symbol = "BTCL";
      uint8 public constant decimals = 8;

      uint256 public constant SUPPLY_CAP = 21000000 * (10 ** uint256(decimals));

      address NULL_ADDRESS = address(0);

When the smart contract for example #2 was created/ deployed, did they just send the tokens to the wallet that deployed and verified the contract? Or did they set it up another way?

2 Answers 2

1

The tokens are just numbers on a variable. On the contract #1 he sets the variable _totalSupply as equal to the integer the integer 100000000000000000000000000. Then he makes the integer value on the array balances[0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222] equals to the value that is on the _totalSupply

On the contract #2 he does the same to the variable SUPPLY_CAP, but he is not creating variables that say how much any user has.

The total supply is just a variable to make easier for people to know how many "numbers" are out there, not necessary, so much that you can for example put the value of the supply less than the amount you give to the owner. They are just variables with a value on them.

Tokens lose it's magic once you understand that they are just numbers, not "real", they do not necessarily need to come or go to or from anywhere. It is all just logical.

1
  • Agreed. Tokens are just numbers mapped to addresses. Bank accounts are pretty much the same thing. Just numbers in someones database. :) Commented Feb 12, 2019 at 17:09
0

Its an optional thing to do.

In the first Example they are giving themselves a premine by using the special constructor function. The constructor function creates the initial state of the contract.

In the second example they could do the same thing in the constructor function if they wanted but not everyone does.

3
  • If they don't set it up like example #1, what are the other options? Do they do an airdrop? When they don't put the creators wallet address in the smart contract, do the tokens just go to the wallet that deployed the contract automatically?
    – Trapkang
    Commented Feb 11, 2019 at 21:11
  • The sky is the limit here but nothing is really automatic. You would have to set balances[some_address] = someValue either in the constructor, or create a new method like function giveMeCoins(uint _amt) isAbleToMintCoins { balances[msg.sender]+= _amt;} Commented Feb 12, 2019 at 17:05
  • isAbleToMintCoins is a "modifier" (middleware) function that you would create to check if the person trying to mint coins has that ability. Also if you make a function like that you would want to make sure to increase the totalSupply also and maybe put in checks to make sure you dont go over a max supply. Commented Feb 12, 2019 at 17:07

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.