Skip to content

Introduce Token module wasm host #602

@limemloh

Description

@limemloh

Introduce a new wasm host type for running the upcoming Token modules, with some similarities to smart contracts.

A token module will export several functions:

  • holder_operation return status code.
  • governance_operation return status code.
  • Arbitrary read-only functions for reading the state.

The host functions should be:

  • Mint
    • Mint some amount of tokens to the provided account, and log an event.
    • Arguments: account, amount, memo
  • Burn
    • Burn some amount of tokens from the given account, and log an event.
    • Arguments: account, amount, memo
    • Return: success or failure
  • Transfer
    • This will immediately transfer funds from one account to another account and log event.
    • Arguments: sender, receiver, amount, memo
    • Callable from both holder_operation and token_governance
  • Query account balance
    • Get the balance of a specific account.
  • State functions
    • TBD
  • Log custom event
    • Arguments: event (bytes)
  • Spend energy
    • Arguments: energy amount
    • Aborts transaction if insufficient available, rolling back the state mutations

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions