0

I am trying to understand what is the "workflow" (for the lack of a better word) of an ERC token in. Looking at this guy (nothing special about it, just a randon token), I can see that the first sucecssfull transaction on that contract is this one where an account (that starts with 3dc) called the Transfer function on contract and transfered 1 token (from its balance I believe) to an account that starts with "1caa". And then several hundred token transfers followed.

Im wondering how did account 0x3dc... have the token in the first place? I have been trought its transactions on etherscan and it never transfered ether to the contract.

Also, am I correct to assume that accounts get tokens by simply making ether transfers to the token's contract them, assuming the contract implement a payable function, the contract will get the ether and then updates the account's token balance on its "balances" variable?

Thanks

1

What you described in terms of selling tokens for ether is sometimes done, but it's more common for a token contract to just grant its creator an initial supply of tokens and for everything else to happen based on transfers from the creator. If tokens are to be sold in a crowdsale, it's common to have a second contract that handles the sale.

We have a few relevant posts on Program the Blockchain that should help explain the concept:

EDIT

In the token you mentioned, code in the constructor assigns the initial balance to the account that created the contract:

function Token( uint initial_balance, address wallet, uint256 crowdsaleTime) {
  _balances[msg.sender] = initial_balance;
  _supply = initial_balance;
  walletAddress = wallet;
  creationTime = crowdsaleTime;
  transferStop = true;
}
  • yeah that was my understanding. But did u have the chance to take a look at the accounts\transactions I mentioned? The contract code is available on etherscan and nowhere it assigns tokens to acc 0x3dc... neither that account sent ether to the contract. So Im still wondering how did 0x3dc had a token to transfer in the first place? Thanks for your help – Diego Mar 4 '18 at 20:29
  • 1
    Please see my edit. – user19510 Mar 4 '18 at 20:33
  • yeah but the account that created the contract is not 0x3dc... look here: etherscan.io/tx/… thanks for your help – Diego Mar 4 '18 at 21:59
  • I would guess that the walletAddress account called mintTokens. Some transactions made through contracts (so neither "to" nor "from" the account being viewed) with no ether attached just don't show up on Etherscan. – user19510 Mar 4 '18 at 23:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.