lending

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 6 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.
	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   float64 // The maximum of collateral factor.
	LiquidationLimit   float64 // Liquidation will occur when liquidation limit is reached.
	LiquidationPenalty float64 // Penalty when liquidation occurs.
	AllowBorrow        bool    //
	AllowCollateral    bool    //

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

	EModeCategoryId       int
	EModeCollateralFactor float64
	EModeLiquidationLimit float64

	BorrowableInIsolation bool
}

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