XFI & Other coins
Last updated
Was this helpful?
Last updated
Was this helpful?
XFI is the main currency in dfinance network.
XFI is used for:
PoS - to stake or delegate XFI.
Fees - to pay fees in XFI to process transactions.
Gov - to vote with XFI per proposals: updates, improvements, etc.
Economic model - users can provide liquidity, loans with XFI.
XFI coin has 18 decimals places, which means 1.0 XFI can be represented as integer as 1000000000000000000, while 0.000000000000000001 XFI as 1 as integer.
When working with dncli amounts need to be integers, so convert your amount to integer before executing any command.
As it's the same 18 decimals places, like in ETH, you can use same resources to convert amounts, (use ether-wei pair).
XFI is a built-in type inside Dfinance's standard library which you can use to send transactions envolving XFI coin. Here's how it looks like ():
Module can be imported from standard library:
The type XFI::T
inside module 0x1::XFI
can be used as type parameter in generic functions, like in this example:
Provided script uses functions withdraw_from_sender<T>
and deposit<T>
which contain generic type T
. By passing XFI::T
as type parameter into these generic functions, we make them work with XFI balances. Note that other coin types can too be passed as type parameters.
Current mainnet supports other coins along with XFI (just for test purposes):
IMPORTANT: DON'T DEPOSIT REAL MAINNET ETH VIA PEGZONE
Same as XFI, all coins can be sent between accounts with CLI:
Also, coins types can be imported from 0x1::Coins
module to use in smart contracts:
You can learn more about generics in Move in the .
ETH - ETH representation, can be transfered through .
BTC - simulation of BTC, can be recieved by .
USDT - simulation of Tether USDT, can be recieved also by .
Coins module follows the same pattern as XFI but has multiple types ():