Expand description
Transparent token types, storage functions, and validation.
Modules§
- event
- Token transaction events.
- storage_
key - Transparent token storage keys
- tx
- Token transfers
- vp
- Native VP for multitokens
Structs§
- Amount
- Amount in micro units. For different granularity another representation might be more appropriate.
- Denominated
Amount - An amount with its denomination.
- Denomination
- Given a number represented as
M*B^D, thenMis the matissa,Bis the base andDis the denomination, represented by this struct. - Key
- A storage key is made of storage key segments
DbKeySeg, separated byKEY_SEGMENT_SEPARATOR. - Store
- Transparent token storage
Keys/Read/Writeimplementation
Enums§
- Amount
Error - Amount
Parse Error - Error
- Event
Level - Indicates if an event is emitted do to an individual Tx or the nature of a finalized block
- Masp
Digit Pos - The four possible u64 words in a
Uint. Used for converting to MASP amounts. - User
Account - A user account.
Constants§
- NATIVE_
MAX_ DECIMAL_ PLACES - Maximum decimal places in a native token
AmountandChange. For non-native (e.g. ERC20 tokens) one must read thedenom_keystorage key. - NATIVE_
SCALE - Decimal scale of a native token
AmountandChange. For non-native (e.g. ERC20 tokens) one must read thedenom_keystorage key.
Traits§
- Events
- Abstract token events interface
- Keys
- Abstract token keys interface
- Read
- Abstract token storage read interface
- Result
Ext - Result extension to easily wrap custom errors into
Error. - Storage
Read - Common storage read interface
- Storage
Write - Common storage write interface
- Write
- Abstract token storage write interface
Functions§
- burn_
tokens - Burn a specified amount of tokens from some address.
- credit_
tokens - Credit tokens to an account, to be used only by protocol. In transactions,
this would get rejected by the default
vp_token. - decrement_
balance - Decrement the balance of a given token and owner.
- decrement_
total_ supply - Decrement the total network supply of a given token.
- denom_
to_ amount - Convert this denominated amount into a plain amount by increasing its precision to the given token’s denomination and then taking the significand.
- denominated
- Add denomination info if it exists in storage.
- get_
effective_ total_ native_ supply - Get the effective circulating total supply of native tokens.
- increment_
balance - Increment the balance of a given token and owner.
- increment_
total_ supply - Increment the total network supply of a given token.
- mint_
tokens - Mint
amountoftokenasmintertodest. - read_
balance - Read the balance of a given token and owner.
- read_
denom - Read the denomination of a given token, if any. Note that native
transparent tokens do not have this set and instead use the constant
token::NATIVE_MAX_DECIMAL_PLACES. - read_
total_ supply - Read the total network supply of a given token.
- transfer
- Apply transfer of a
tokenfromsrctodestin storage. - update_
balance - Update the balance of a given token and owner.
- update_
total_ supply - Update the total network supply of a given token.
- write_
denom - Write the denomination of a given token.
- write_
params - Initialize parameters for the token in storage during the genesis block.