Crate namada_token

Source
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.
ConversionLeaf
A representation of a leaf in the conversion tree
ConversionState
A representation of the conversion state
Dec
A 256 bit number with POS_DECIMAL_PRECISION number of Dec places.
DenominatedAmount
An amount with its denomination.
Denomination
Given a number represented as M*B^D, then M is the matissa, B is the base and D is the denomination, represented by this struct.
Key
A storage key is made of storage key segments DbKeySeg, separated by KEY_SEGMENT_SEPARATOR.
MaspEpoch
Wrapper type around Epoch for type safe operations involving the masp epoch
MaspTransaction
A MASP transaction.
MaspTxId
Wrapper for masp_primitive’s TxId
ShieldedParams
Token parameters for each kind of asset held on chain
Store
Transparent token storage Keys/Read/Write implementation
Transfer
Arguments for a multi-party token transfer
TransparentTransfersRef
References to the transparent sections of a Transfer.

Enums§

AmountError
AmountParseError
Error
EventLevel
Indicates if an event is emitted do to an individual Tx or the nature of a finalized block
MaspDigitPos
The four possible u64 words in a Uint. Used for converting to MASP amounts.
MaspValue
Represents any MASP value
UserAccount
A user account.

Constants§

NATIVE_MAX_DECIMAL_PLACES
Maximum decimal places in a native token Amount and Change. For non-native (e.g. ERC20 tokens) one must read the denom_key storage key.
NATIVE_SCALE
Decimal scale of a native token Amount and Change. For non-native (e.g. ERC20 tokens) one must read the denom_key storage key.

Traits§

Events
Abstract token events interface
Keys
Abstract token keys interface
OptionExt
An extension to Option to allow turning None case to an Error from a static string (handy for WASM).
Read
Abstract token storage read interface
ResultExt
Result extension to easily wrap custom errors into Error.
StorageRead
Common storage read interface
StorageWrite
Common storage write interface
WithConversionState
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 amount of token as minter to dest.
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 token from src to dest in 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.

Type Aliases§

Change
A change in tokens amount
Result
Result of a storage API call.