lending

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LendingPool

type LendingPool struct {
	ProtocolBasic     *model.ProtocolBasic // Protocol basic info.
	UnderlyingBasic   *erc.ERC20Info       // The underlying erc20 info.
	PoolType          LendingPoolType      // Only support aave-like and compound-like.
	SupportedNetworks []string             // Protocol can run on which networks.
	AToken            lendingtoken.AToken  // AToken info, if the protocol is aave-like.
	VToken            lendingtoken.VToken  // VToken info, if the protocol is aave-like.
	SToken            lendingtoken.SToken  // SToken info, if the protocol is aave-like.
	CToken            lendingtoken.CToken  // CToken info, if the protocol is compound-like.
	Status            LendingPoolStatus    // Pool status.
}

func (*LendingPool) Init

func (p *LendingPool) Init(protocolBasic model.ProtocolBasic) error

Initialize the lend pool protocol basic and pool type.

func (*LendingPool) UpdateTokensByAToken

func (p *LendingPool) UpdateTokensByAToken(atoken string) error

Update pool tokens info by a token.

func (*LendingPool) UpdateTokensByCToken

func (p *LendingPool) UpdateTokensByCToken(ctoken string) error

Update pool tokens info by c token.

func (*LendingPool) UpdateTokensBySToken

func (p *LendingPool) UpdateTokensBySToken(stoken string) error

Update pool tokens info by s token.

func (*LendingPool) UpdateTokensByUnderlying

func (p *LendingPool) UpdateTokensByUnderlying(underlying string) error

Update pool tokens info by underlying token.

func (*LendingPool) UpdateTokensByVToken

func (p *LendingPool) UpdateTokensByVToken(vtoken string) error

Update pool tokens info by v token.

type LendingPoolStatus

type LendingPoolStatus struct {
	CollateralFactor   decimal.Decimal // The maximum of collateral factor.
	LiquidationLimit   decimal.Decimal // Liquidation will occur when liquidation limit is reached.
	LiquidationPenalty decimal.Decimal // Penalty when liquidation occurs.
	AllowBorrow        bool            // If the token can be borrowed in this protocol.
	AllowCollateral    bool            // If the token can be used as collateral in this protocol.

	BorrowLimit     decimal.Decimal // The borrow limit of the pool.
	SupplyLimit     decimal.Decimal // The supply limit of the pool.
	SupplyCapacity  decimal.Decimal // SupplyCapacity = SupplyLimit - TotalSupply.
	TotalSupply     decimal.Decimal // Total amount supplied into the pool.
	TotalVBorrow    decimal.Decimal // Total variable amount borrowed from the pool.
	TotalSBorrow    decimal.Decimal // Total stable amount borrowed from the pool.
	TotalCBorrow    decimal.Decimal // Total (compound like) amount borrowed from the pool.
	UtilizationRate decimal.Decimal // = TotalBorrow / TotalSupply

	EModeCategoryId       int             // Aave v3 emode category id.
	EModeCollateralFactor decimal.Decimal // Aave v3 emode collateral factor.
	EModeLiquidationLimit decimal.Decimal // Aave v3 emode liquidation limit.

	BorrowableInIsolation bool // Aave v3 isolation mode can be borrowed.
}

type LendingPoolType

type LendingPoolType struct {
	IsAaveLike     bool // Whether the protocol is aave-like.
	IsCompoundLike bool // Whether the protocol is compound-like.
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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