ethprotocol

package module
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: 30 Imported by: 0

README

Protocols

graph LR
commonapys[apy info struct]
commonapys-->commonapy[apy]
commonapys-->commonapr[apr]
commonapys-->commonincy[incentive apy]
commonapys-->commonincr[incentive apr]

commonerc20s[erc20 info struct]
commonerc20s-->commonerc20address[address]
commonerc20s-->commonerc20symbol[symbol]
commonerc20s-->commonerc20decimals[decimals]

pro[protocol]

pro-->probasic[protocol basic info]
pro-->bps[lend pools]
pro-->lps[liquidity pools]
pro-->sps[stake pools]

probasic-->network
probasic-->proname[protocol name]
probasic-->client[eth client]
probasic-->geckokey[coingecko caller]

bps--aave-like-->avstoken[a,v,stoken]
bps--compound-like-->ctoken
bps-->bpstype[lend pool type]

bpstype-->aave-like
bpstype-->compound-like

avstoken-->erc20lendaave[basic erc20 info]-->erc201[erc20 info struct]
avstoken-->underlyinglendaave[underlying erc20 info]-->erc202[erc20 info struct]
avstoken-->apyslendaave[apy info]

apyslendaave-->apylendaave[apy info struct]

ctoken-->erc20lendcomp[basic erc20 info]-->erc203[erc20 info struct]
ctoken-->underlyinglendcomp[underlying erc20 info]-->erc204[erc20 info struct]
ctoken-->apyslendcompdepo[deposit apy info]-->apys1[apy info struct]
ctoken-->apyslendcomplend[borrow apy info]-->apys2[apy info struct]




Targets

  • Pool

    • tokens

    • lp

    • apys(apr)

    • volume (day)

    • tvl

    • otherinfo(platypus)

    • userinfo

      • deposited

      • ?

  • Lend

    • atoken

      • basic

      • underlying

    • vtoken

      • basic

      • underlying

    • stoken

      • basic

      • underlying

    • ctoken

      • basic

      • underlying

    • deposit apys(apr)

    • borrow apys(apr)

    • collateral factor

    • liquidation limit

    • allow borrow

    • allow collateral

    • liquidation penalty

  • Stake

    • tokens

    • stake contract

    • volume

    • tvl

    • apys(apr)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol struct {
	ProtocolBasic  *model.ProtocolBasic
	LiquidityPools []*liquidity.LiquidityPool
	StakePools     []*stake.StakePool
	LendingPools   []*lending.LendingPool
}

func New

func New(input ProtocolInput) (*Protocol, error)

Create a new protocol, with basic info and empty pools.

func (*Protocol) CheckNetwork added in v0.2.1

func (prot *Protocol) CheckNetwork() error

func (*Protocol) Token added in v0.2.0

func (p *Protocol) Token() string

Return protocol token according to network.

func (*Protocol) UpdateLending added in v0.2.1

func (prot *Protocol) UpdateLending(underlyings ...string) error

Update some of the protocol's lend pools apys by given underlying addresses.

If "underlyings" is empty, update all pools.

func (*Protocol) UpdateLendingPoolTokens added in v0.2.0

func (prot *Protocol) UpdateLendingPoolTokens() error

Update lending pool tokens.

func (*Protocol) UpdateLiquidity added in v0.2.1

func (prot *Protocol) UpdateLiquidity() error

func (*Protocol) UpdateProtocolBasic added in v0.2.0

func (prot *Protocol) UpdateProtocolBasic(input ProtocolInput)

Update the protocol basic info.

Will not update the empty params.

type ProtocolInput added in v0.2.0

type ProtocolInput struct {
	Network   string               // Network of the protocol.
	Name      string               // Name of the protocol, given by github.com/0xVanfer/ethaddr.
	Client    bind.ContractBackend // Contract backend to call the contracts. Can be nil, but most functions will not work properly.
	Coingecko coingecko.Gecko      // Coingecko. Can also input the key only.
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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