neo-ico-template
neo-ico-template copied to clipboard
Trigger transfer event in deploy
https://github.com/neo-project/proposals/blob/master/nep-5.mediawiki
A token contract which creates new tokens MUST trigger a transfer event with the from address set to null when tokens are created.
Blockchain explorers like neoscan need the event to keep track of balance correctly.
if not Get(ctx, 'initialized'):
# do deploy logic
Put(ctx, 'initialized', 1)
Put(ctx, TOKEN_OWNER, TOKEN_INITIAL_AMOUNT)
OnTransfer(None, TOKEN_OWNER, TOKEN_INITIAL_AMOUNT)
return add_to_circulation(ctx, TOKEN_INITIAL_AMOUNT)```