celotokens

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CELOInfo = CeloTokenInfo{
	// contains filtered or unexported fields
}

CELOInfo contains info on the CELO token

View Source
var CEURInfo = CeloTokenInfo{
	// contains filtered or unexported fields
}

CEURInfo contains info on the cEUR token

View Source
var CREALInfo = CeloTokenInfo{
	// contains filtered or unexported fields
}

CREALInfo contains info on the cREAL token

View Source
var CUSDInfo = CeloTokenInfo{
	// contains filtered or unexported fields
}

CUSDInfo contains info on the cUSD token

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

func IsStableToken(token CeloToken) bool

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

const (
	// CELO - previously known as cGLD
	CELO CeloToken = "CELO"
	// CUSD - Celo Dollar
	CUSD CeloToken = "cUSD"
	// CEUR - Celo Euro
	CEUR CeloToken = "cEUR"
	// CREAL - Celo Real
	CREAL CeloToken = "cREAL"
)

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 New

func New(reg registry.Registry) *CeloTokens

New creates a new pointer to a CeloTokens

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL