models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 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 AccountResponse

type AccountResponse struct {
	Accounts []struct {
		Address      string      `json:"address"`
		BlockUpdated interface{} `json:"block_updated"`
		Health       struct {
			Value string `json:"value"`
		} `json:"health"`
		Tokens                []Token `json:"tokens"`
		TotalBorrowValueInEth struct {
			Value string `json:"value"`
		} `json:"total_borrow_value_in_eth"`
		TotalCollateralValueInEth struct {
			Value string `json:"value"`
		} `json:"total_collateral_value_in_eth"`
	} `json:"accounts"`
	CloseFactor          float64     `json:"close_factor"`
	Error                interface{} `json:"error"`
	LiquidationIncentive float64     `json:"liquidation_incentive"`
	PaginationSummary    struct {
		PageNumber   int `json:"page_number"`
		PageSize     int `json:"page_size"`
		TotalEntries int `json:"total_entries"`
		TotalPages   int `json:"total_pages"`
	} `json:"pagination_summary"`
	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"`
	} `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 Token

type Token struct {
	Address                 string `json:"address"`
	BorrowBalanceUnderlying struct {
		Value string `json:"value"`
	} `json:"borrow_balance_underlying"`
	LifetimeBorrowInterestAccrued struct {
		Value string `json:"value"`
	} `json:"lifetime_borrow_interest_accrued"`
	LifetimeSupplyInterestAccrued struct {
		Value string `json:"value"`
	} `json:"lifetime_supply_interest_accrued"`
	SupplyBalanceUnderlying struct {
		Value string `json:"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

Jump to

Keyboard shortcuts

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