Documentation ¶
Index ¶
- Variables
- func GetExchangeRegistryID(token CeloToken) (registry.ContractID, error)
- func GetRegistryID(token CeloToken) (registry.ContractID, error)
- func IsStableToken(token CeloToken) bool
- type CeloToken
- type CeloTokenInfo
- type CeloTokens
- func (ct *CeloTokens) GetAddresses(ctx context.Context, blockNumber *big.Int, onlyStables bool) (map[CeloToken]common.Address, error)
- func (ct *CeloTokens) GetContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (contracts.CeloTokenContract, error)
- func (ct *CeloTokens) GetContracts(ctx context.Context, blockNumber *big.Int, onlyStables bool) (map[CeloToken]contracts.CeloTokenContract, error)
- func (ct *CeloTokens) GetExchangeContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (*contracts.Exchange, error)
- func (ct *CeloTokens) GetExchangeContracts(ctx context.Context, blockNumber *big.Int) (map[CeloToken]*contracts.Exchange, error)
- func (ct *CeloTokens) GetStableTokenContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (*contracts.StableToken, error)
Constants ¶
This section is empty.
Variables ¶
var CELOInfo = CeloTokenInfo{ // contains filtered or unexported fields }
CELOInfo contains info on the CELO token
var CEURInfo = CeloTokenInfo{ // contains filtered or unexported fields }
CEURInfo contains info on the cEUR token
var CREALInfo = CeloTokenInfo{ // contains filtered or unexported fields }
CREALInfo contains info on the cREAL token
var CUSDInfo = CeloTokenInfo{ // contains filtered or unexported fields }
CUSDInfo contains info on the cUSD token
var CeloTokenInfos = map[CeloToken]CeloTokenInfo{ CELO: CELOInfo, CUSD: CUSDInfo, CEUR: CEURInfo, CREAL: CREALInfo, }
CeloTokenInfos contains a CeloTokenInfo entry for each CeloToken key. This is used for functions that iterate on all tokens or stable tokens.
Functions ¶
func GetExchangeRegistryID ¶
func GetExchangeRegistryID(token CeloToken) (registry.ContractID, error)
GetExchangeRegistryID gets the exchange contract's registry ID for a given stable token
func GetRegistryID ¶
func GetRegistryID(token CeloToken) (registry.ContractID, error)
GetRegistryID gets the contract's registry ID for a given token
func IsStableToken ¶
IsStableToken returns whether the provided token is a stable token
Types ¶
type CeloToken ¶
type CeloToken string
CeloToken is a token native to Celo, eg CELO and stable tokens
type CeloTokenInfo ¶
type CeloTokenInfo struct {
// contains filtered or unexported fields
}
CeloTokenInfo provides basic info for a Celo token
type CeloTokens ¶
type CeloTokens struct {
// contains filtered or unexported fields
}
CeloTokens provides a friendly interface for interacting with Celo tokens
func (*CeloTokens) GetAddresses ¶
func (ct *CeloTokens) GetAddresses(ctx context.Context, blockNumber *big.Int, onlyStables bool) (map[CeloToken]common.Address, error)
GetAddresses gets the addresses for all token contracts. If onlyStables is true, addresses for only stable tokens are provided. If a contract has not been registered with the Registry as of blockNumber, the address is set to the zero address and no error is returned.
func (*CeloTokens) GetContract ¶
func (ct *CeloTokens) GetContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (contracts.CeloTokenContract, error)
GetContract gets the contract for a provided celo token. Note that if the contract has not been registered with the Registry as of blockNumber, an error is returned.
func (*CeloTokens) GetContracts ¶
func (ct *CeloTokens) GetContracts(ctx context.Context, blockNumber *big.Int, onlyStables bool) (map[CeloToken]contracts.CeloTokenContract, error)
GetContracts gets the contracts for all tokens. If onlyStables is true, contracts for only stable tokens are provided. If a contract has not been registered with the Registry as of blockNumber, the contract is set to nil and no error is returned.
func (*CeloTokens) GetExchangeContract ¶
func (ct *CeloTokens) GetExchangeContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (*contracts.Exchange, error)
GetExchangeContract gets the exchange contract for a provided stable token. Note that if the contract has not been registered with the Registry as of blockNumber, an error is returned.
func (*CeloTokens) GetExchangeContracts ¶
func (ct *CeloTokens) GetExchangeContracts(ctx context.Context, blockNumber *big.Int) (map[CeloToken]*contracts.Exchange, error)
GetExchangeContracts gets the exchange contracts for all stable tokens. If an exchange contract has not been registered with the Registry as of blockNumber, the contract is set to nil and no error is returned.
func (*CeloTokens) GetStableTokenContract ¶
func (ct *CeloTokens) GetStableTokenContract(ctx context.Context, token CeloToken, blockNumber *big.Int) (*contracts.StableToken, error)
GetStableTokenContract gets the stabletoken contract for a provided stable token. Note that if the contract has not been registered with the Registry as of blockNumber, an error is returned.