models

package
v2.0.0-...-c896575 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Address                   string      `json:"address"`
	BlockUpdated              interface{} `json:"block_updated"`
	Health                    Value       `json:"health"`
	Tokens                    []Token     `json:"tokens"`
	TotalBorrowValueInEth     Value       `json:"total_borrow_value_in_eth"`
	TotalCollateralValueInEth Value       `json:"total_collateral_value_in_eth"`
}

type AccountResponse

type AccountResponse struct {
	Accounts             []Account         `json:"accounts"`
	CloseFactor          float64           `json:"close_factor"`
	Error                interface{}       `json:"error"`
	LiquidationIncentive float64           `json:"liquidation_incentive"`
	PaginationSummary    PaginationSummary `json:"pagination_summary"`
	Request              Request           `json:"request"`
}

AccountResponse is a response to a https://api.compound.finance/api/v2/account?addresses[]= call

type CTokenResponse

type CTokenResponse struct {
	CToken []struct {
		BorrowRate struct {
			Value string `json:"value,omitempty"`
		} `json:"borrow_rate,omitempty"`
		Cash struct {
			Value string `json:"value,omitempty"`
		} `json:"cash,omitempty"`
		CollateralFactor struct {
			Value string `json:"value,omitempty"`
		} `json:"collateral_factor,omitempty"`
		ExchangeRate struct {
			Value string `json:"value,omitempty"`
		} `json:"exchange_rate,omitempty"`
		InterestRateModelAddress string `json:"interest_rate_model_address,omitempty"`
		Name                     string `json:"name,omitempty"`
		NumberOfBorrowers        int    `json:"number_of_borrowers,omitempty"`
		NumberOfSuppliers        int    `json:"number_of_suppliers,omitempty"`
		Reserves                 struct {
			Value string `json:"value,omitempty"`
		} `json:"reserves,omitempty"`
		SupplyRate struct {
			Value string `json:"value,omitempty"`
		} `json:"supply_rate,omitempty"`
		Symbol       string `json:"symbol,omitempty"`
		TokenAddress string `json:"token_address,omitempty"`
		TotalBorrows struct {
			Value string `json:"value,omitempty"`
		} `json:"total_borrows,omitempty"`
		TotalSupply struct {
			Value string `json:"value,omitempty"`
		} `json:"total_supply,omitempty"`
		UnderlyingAddress string `json:"underlying_address,omitempty"`
		UnderlyingName    string `json:"underlying_name,omitempty"`
		UnderlyingPrice   struct {
			Value string `json:"value,omitempty"`
		} `json:"underlying_price,omitempty"`
		UnderlyingSymbol string `json:"underlying_symbol,omitempty"`
	} `json:"cToken,omitempty"`
	Error   interface{} `json:"error,omitempty"`
	Request struct {
		Addresses      []string `json:"addresses,omitempty"`
		BlockNumber    int      `json:"block_number,omitempty"`
		BlockTimestamp int      `json:"block_timestamp,omitempty"`
	} `json:"request,omitempty"`
}

CTokenResponse is a response to a https://api.compound.finance/api/v2/ctoken?addresses[]= call

type PaginationSummary

type PaginationSummary struct {
	PageNumber   int `json:"page_number"`
	PageSize     int `json:"page_size"`
	TotalEntries int `json:"total_entries"`
	TotalPages   int `json:"total_pages"`
}

type Request

type Request struct {
	Addresses           []string    `json:"addresses"`
	BlockNumber         int         `json:"block_number"`
	BlockTimestamp      int         `json:"block_timestamp"`
	MaxHealth           interface{} `json:"max_health"`
	MinBorrowValueInEth interface{} `json:"min_borrow_value_in_eth"`
	PageNumber          int         `json:"page_number"`
	PageSize            int         `json:"page_size"`
}

type Token

type Token struct {
	Address                       string      `json:"address"`
	BorrowBalanceUnderlying       Value       `json:"borrow_balance_underlying"`
	LifetimeBorrowInterestAccrued Value       `json:"lifetime_borrow_interest_accrued"`
	LifetimeSupplyInterestAccrued Value       `json:"lifetime_supply_interest_accrued"`
	SupplyBalanceUnderlying       Value       `json:"supply_balance_underlying"`
	Symbol                        interface{} `json:"symbol"`
}

Token is an individual token

func GetTokenByAddress

func GetTokenByAddress(address string, resp *AccountResponse) (Token, error)

GetTokenByAddress is used to retrieve a token by its address from an AccountResponse type

type Value

type Value struct {
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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