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
- type Provider
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 NewCurrency ¶ added in v1.6.0
func NewCurrency(address common.Address, toCELORate ExchangeRate) *Currency
NewCurrency creates a new currency object
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 NewCacheOnlyManager ¶ added in v1.8.1
func NewCacheOnlyManager(currencyCache map[common.Address]*Currency) *CurrencyManager
NewCacheOnlyManager creates a cache-full currency manager. TESTING PURPOSES ONLY
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