XFI & Other coins
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.
Decimals
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, like this one (use ether-wei pair).
Smart contracts
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 (link to GitHub):
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.
You can learn more about generics in Move in the Move book.
Other coins
Current mainnet supports other coins along with XFI (just for test purposes):
IMPORTANT: DON'T DEPOSIT REAL MAINNET ETH VIA PEGZONE
ETH - ETH representation, can be transfered through PegZone.
BTC - simulation of BTC, can be recieved by faucet.
USDT - simulation of Tether USDT, can be recieved also by faucet.
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:
Coins module follows the same pattern as XFI but has multiple types (link to GitHub):
Last updated