Expand description
Namada transparent and shielded token types, storage keys and storage fns.
Modules§
- conversion
- MASP rewards conversions
- event
- Token transaction events.
- storage_
key - Token storage keys
- tx
- Token transaction
- utils
- MASP utilities
- validation
- MASP verification wrappers.
- vp
- Validity predicates
Structs§
- Account
- Accounts can send or receive funds in a transparent token transfer
- Amount
- Amount in micro units. For different granularity another representation might be more appropriate.
- Conversion
Leaf - A representation of a leaf in the conversion tree
- Conversion
State - A representation of the conversion state
- Dec
- A 256 bit number with
POS_DECIMAL_PRECISIONnumber of Dec places. - 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. - Masp
Epoch - Wrapper type around
Epochfor type safe operations involving the masp epoch - Masp
Transaction - A MASP transaction.
- Masp
TxId - Wrapper for masp_primitive’s TxId
- Shielded
Params - Token parameters for each kind of asset held on chain
- Store
- Transparent token storage
Keys/Read/Writeimplementation - Transfer
- Arguments for a multi-party token transfer
- Transparent
Transfers Ref - References to the transparent sections of a
Transfer.
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. - Masp
Value - Represents any MASP value
- 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
- Option
Ext - An extension to
Optionto allow turningNonecase to an Error from a static string (handy for WASM). - 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
- With
Conversion State - Able to borrow mutable conversion state.
- 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.
- finalize_
block - Apply token logic for finalizing block (i.e. shielded token rewards)
- 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_
rewards - Mint MASP rewards tokens and increment the stored total rewards.
- 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_
token_ map - Read the masp token map.
- read_
total_ rewards - Read the total rewards minted by MASP.
- read_
total_ supply - Read the total network supply of a given token.
- read_
undated_ balance - Read the undated balance of the given token in the MASP.
- 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.
- validate_
transfer_ in_ out - Validate the inputs and outputs in a transparent transfer.
- write_
denom - Write the denomination of a given token.
- write_
params - Initialize parameters for the token in storage during the genesis block.
- write_
token_ map - Write a new masp token map.