Documentation
¶
Overview ¶
Package protocols provides standardized protocol implementations for computing LP data, e.g. LP token prices and TVL values
Index ¶
- Constants
- type KodiakConfig
- type KodiakLPPriceProvider
- func (k *KodiakLPPriceProvider) GetConfig(ctx context.Context, address string, client *ethclient.Client) ([]byte, error)
- func (k *KodiakLPPriceProvider) Initialize(ctx context.Context, client *ethclient.Client) error
- func (k *KodiakLPPriceProvider) LPTokenPrice(ctx context.Context) (string, error)
- func (k *KodiakLPPriceProvider) TVL(ctx context.Context) (string, error)
- type Protocol
Constants ¶
View Source
const Version = "0.3.0"
Version information
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KodiakConfig ¶ added in v0.1.4
type KodiakLPPriceProvider ¶
type KodiakLPPriceProvider struct {
// contains filtered or unexported fields
}
KodiakLPPriceProvider defines the provider for Kodiak LP price and TVL.
func NewKodiakLPPriceProvider ¶
func NewKodiakLPPriceProvider(address common.Address, prices map[string]decimal.Decimal, logger zerolog.Logger, config []byte) *KodiakLPPriceProvider
NewKodiakLPPriceProvider creates a new instance of the KodiakLPPriceProvider.
func (*KodiakLPPriceProvider) Initialize ¶
Initialize instantiates the KodiakV1 smart contract.
func (*KodiakLPPriceProvider) LPTokenPrice ¶
func (k *KodiakLPPriceProvider) LPTokenPrice(ctx context.Context) (string, error)
LPTokenPrice returns the current price of the protocol's LP token in USD cents (1 USD = 100 cents).
type Protocol ¶
type Protocol interface { // GetConfig returns static configuration data needed for LP token price/TVL calculation. // Returns an error if the configuration cannot be prepared. GetConfig(ctx context.Context, address string, ethClient *ethclient.Client) ([]byte, error) // LPTokenPrice returns the current price of the protocol's LP token // in USD. // Returns an error if the price cannot be determined. LPTokenPrice(ctx context.Context) (string, error) // TVL returns the Total Value Locked in the protocol in USD. // Returns an error if the TVL cannot be determined. TVL(ctx context.Context) (string, error) }
Protocol defines methods for querying DeFi protocol metrics. Implementations must be safe for concurrent use.
Click to show internal directories.
Click to hide internal directories.