Skip to content

Trigger transfer event in deploy #29

@arrix

Description

@arrix

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)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions