Documentation ¶
Index ¶
- Variables
- func CurrencyWhitelist(vmRunner vm.EVMRunner) ([]common.Address, error)
- func GetBalanceOf(vmRunner vm.EVMRunner, accountOwner common.Address, ...) (result *big.Int, err error)
- func IsWhitelisted(vmRunner vm.EVMRunner, feeCurrency *common.Address) bool
- type Currency
- type CurrencyManager
- type ExchangeRate
Constants ¶
This section is empty.
Variables ¶
var CELOCurrency = Currency{ Address: common.ZeroAddress, // contains filtered or unexported fields }
var NoopExchangeRate = ExchangeRate{common.Big1, common.Big1}
NoopExchangeRate represents an exchange rate of 1 to 1
Functions ¶
func CurrencyWhitelist ¶
CurrencyWhitelist retrieves the list of currencies that can be used to pay transaction fees
Types ¶
type Currency ¶
Currency represent a system currency than can be converted to CELO Two currencies are deemed equal if they have the same address
func (*Currency) CmpToCurrency ¶
func (c *Currency) CmpToCurrency(currencyAmount *big.Int, sndCurrencyAmount *big.Int, sndCurrency *Currency) int
CmpToCurrency compares a currency amount to an amount in a different currency
type CurrencyManager ¶
type CurrencyManager struct {
// contains filtered or unexported fields
}
CurrencyManager provides an interface to access different fee currencies on a given point in time (header,state) and doing comparison or fetching exchange rates
It's implements an internal cache to avoid perfoming duplicated EVM calls
func NewManager ¶
func NewManager(vmRunner vm.EVMRunner) *CurrencyManager
NewManager creates a new CurrencyManager
func (*CurrencyManager) CmpValues ¶
func (cc *CurrencyManager) CmpValues(val1 *big.Int, currencyAddr1 *common.Address, val2 *big.Int, currencyAddr2 *common.Address) int
CmpValues compares values of potentially different currencies
func (*CurrencyManager) GetCurrency ¶
func (cc *CurrencyManager) GetCurrency(currencyAddress *common.Address) (*Currency, error)
GetCurrency retrieves fee currency
type ExchangeRate ¶
type ExchangeRate struct {
// contains filtered or unexported fields
}
ExchangeRate represent the exchangeRate [Base -> Token] Follows the equation: 1 base * ExchangeRate = X token
func GetExchangeRate ¶
GetExchangeRate retrieves currency-to-CELO exchange rate
func NewExchangeRate ¶
NewExchangeRate creates an exchange rate. Requires numerator >=0 && denominator >= 0