comptroller

package
v0.0.0-...-09f7846 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInsurance

func AddInsurance(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken, from OntCommon.Address, addAmount *big.Int)

func AddReserves

func AddReserves(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken, from OntCommon.Address, addAmount *big.Int)

func ApproveAndMint

func ApproveAndMint(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, otoken OntCommon.Address, from OntCommon.Address, amount *big.Int)

Mint ftoken (supply)

func ApproveAndMintWing

func ApproveAndMintWing(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, otoken OntCommon.Address, from OntCommon.Address, amount *big.Int)

Mint ftoken (supply)

func Borrow

func Borrow(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, borrower OntCommon.Address, borrowAmount *big.Int)

func BorrowBalanceCurrent

func BorrowBalanceCurrent(sdk *goSdk.OntologySdk, ftoken, account OntCommon.Address)

func EnterMarkets

func EnterMarkets(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, comptroller OntCommon.Address, from OntCommon.Address, markets []interface{})

EnterMarkets ftoken address

func ExchangeRateCurrent

func ExchangeRateCurrent(sdk *goSdk.OntologySdk, ftoken OntCommon.Address)

func ExitMarkets

func ExitMarkets(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, comptroller OntCommon.Address, from OntCommon.Address, market OntCommon.Address)

ExitMarkets ftoken address

func GetAllMarkets

func GetAllMarkets(genSdk *goSdk.OntologySdk, flashAddress string) ([]OntCommon.Address, error)

func LiquidateBorrow

func LiquidateBorrow(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, liquidator, ftoken OntCommon.Address, borrower OntCommon.Address, repayAmount *big.Int)

func Mint

func Mint(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, from OntCommon.Address, amount uint64)

Mint ftoken (supply)

func Mint2

func Mint2(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken, from OntCommon.Address, amount string)

Mint ftoken (supply)

func MintFtoken

func MintFtoken(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, from OntCommon.Address, amount uint64)

Mint ftoken MintFtoken

func RedeemToken

func RedeemToken(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, from OntCommon.Address, amount *big.Int)

RedeemToken ftoken

func RedeemToken2

func RedeemToken2(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, from OntCommon.Address, amount uint64)

RedeemToken ftoken

func RedeemUnderlying

func RedeemUnderlying(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, redeemer OntCommon.Address, redeemAmount *big.Int)

func RepayBorrow

func RepayBorrow(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, ftoken OntCommon.Address, borrower OntCommon.Address, repayAmount *big.Int)

func RepayBorrowBehalf

func RepayBorrowBehalf(cfg *config.Config, account *goSdk.Account, sdk *goSdk.OntologySdk, payer, ftoken OntCommon.Address, borrower OntCommon.Address, repayAmount *big.Int)

func SerializeUserAllowance

func SerializeUserAllowance(sink *common.ZeroCopySink, allowance *UserAllowance) []byte

func TotalBorrowCurrent

func TotalBorrowCurrent(sdk *goSdk.OntologySdk, ftoken OntCommon.Address)

Types

type AccountLiquidity

type AccountLiquidity struct {
	Error     string
	Liquidity common.I128
	Shortfall common.I128
}

func DeserializeAccountLiquidity

func DeserializeAccountLiquidity(data []byte) (*AccountLiquidity, error)

type Comptroller

type Comptroller struct {
	// contains filtered or unexported fields
}

func NewComptroller

func NewComptroller(sdk *ontSDK.OntologySdk, contractAddr string, signer *ontSDK.Account, gasPrice,
	gasLimit uint64) (*Comptroller, error)

func (*Comptroller) AcceptAdmin

func (this *Comptroller) AcceptAdmin() (string, error)

func (*Comptroller) AccountAssets

func (this *Comptroller) AccountAssets(account common.Address) ([]common.Address, error)

func (*Comptroller) AddWingMarkets

func (this *Comptroller) AddWingMarkets(markets []common.Address, weights []uint64) (string, error)

func (*Comptroller) Admin

func (this *Comptroller) Admin() (common.Address, error)

func (*Comptroller) AllMarkets

func (this *Comptroller) AllMarkets() ([]common.Address, error)

func (*Comptroller) AllRawMarkets

func (this *Comptroller) AllRawMarkets() ([]common.Address, error)

func (*Comptroller) ApproveWing

func (this *Comptroller) ApproveWing(allowance []*UserAllowance) (string, error)

func (*Comptroller) AssetsIn

func (this *Comptroller) AssetsIn(account common.Address) ([]common.Address, error)

func (*Comptroller) BorrowAllowed

func (this *Comptroller) BorrowAllowed(market, borrower common.Address, borrowAmount *big.Int) (bool, error)

func (*Comptroller) BorrowGuardianPaused

func (this *Comptroller) BorrowGuardianPaused(market common.Address) (bool, error)

func (*Comptroller) CheckMembership

func (this *Comptroller) CheckMembership(account, market common.Address) (bool, error)

func (*Comptroller) ClaimAllWing

func (this *Comptroller) ClaimAllWing(holder common.Address, markets []common.Address, borrows, suppliers,
	insurance bool, preExecute bool) (hash string, distributed, remains *big.Int, err error)

func (*Comptroller) ClaimWing

func (this *Comptroller) ClaimWing(holder common.Address, preExecute bool) (hash string,
	remains *big.Int, err error)

func (*Comptroller) ClaimWingAtMarkets

func (this *Comptroller) ClaimWingAtMarkets(holder common.Address, markets []common.Address,
	preExecute bool) (hash string, distributed, remains *big.Int, err error)

func (*Comptroller) CloseFactorMantissa

func (this *Comptroller) CloseFactorMantissa() (*big.Int, error)

func (*Comptroller) CouldRepayByInsurance

func (this *Comptroller) CouldRepayByInsurance(account common.Address) (bool, error)

func (*Comptroller) DropWingMarket

func (this *Comptroller) DropWingMarket(market common.Address) (string, error)

func (*Comptroller) EnterMarkets

func (this *Comptroller) EnterMarkets(from common.Address, markets []common.Address, preExecute bool) ([]string,
	string, error)

func (*Comptroller) ExitMarket

func (this *Comptroller) ExitMarket(from, market common.Address) (string, error)

func (*Comptroller) GetAccountLiquidity

func (this *Comptroller) GetAccountLiquidity(account common.Address) (*AccountLiquidity, error)

func (*Comptroller) GetAddr

func (this *Comptroller) GetAddr() common.Address

func (*Comptroller) GetHypotheticalAccountLiquidity

func (this *Comptroller) GetHypotheticalAccountLiquidity(account, fTokenModify common.Address, redeemTokens,
	borrowAmount *big.Int) (*AccountLiquidity, error)

func (*Comptroller) GetNewMarketId

func (this *Comptroller) GetNewMarketId(newMarket common.Address) (common.Address, error)

func (*Comptroller) GetOldMarketId

func (this *Comptroller) GetOldMarketId(oldMarket common.Address) (common.Address, error)

func (*Comptroller) GetWingIndexFactorInfo

func (this *Comptroller) GetWingIndexFactorInfo(market common.Address) (*WingIndexFactorInfo, error)

func (*Comptroller) GlobalParam

func (this *Comptroller) GlobalParam() (common.Address, error)

func (*Comptroller) Init

func (this *Comptroller) Init(admin, globalParam common.Address) (string, error)

func (*Comptroller) InsuranceRepayFactorMantissa

func (this *Comptroller) InsuranceRepayFactorMantissa() (*big.Int, error)

func (*Comptroller) IsMarketExisted

func (this *Comptroller) IsMarketExisted(market common.Address) (bool, error)

func (*Comptroller) LiquidateBorrowAllowed

func (this *Comptroller) LiquidateBorrowAllowed(borrowedMarket, collateralMarket, liquidator, borrower common.Address, repayAmount *big.Int) (bool, error)

func (*Comptroller) LiquidateCalculateSeizeTokens

func (this *Comptroller) LiquidateCalculateSeizeTokens(account common.Address) (string, *big.Int, error)

func (*Comptroller) LiquidationIncentiveMantissa

func (this *Comptroller) LiquidationIncentiveMantissa() (*big.Int, error)

func (*Comptroller) MarketMeta

func (this *Comptroller) MarketMeta(market common.Address) (*MarketMeta, error)

func (*Comptroller) MarketUtilities

func (this *Comptroller) MarketUtilities() ([]*MarketUtility, error)

func (*Comptroller) MaxAssets

func (this *Comptroller) MaxAssets() (*big.Int, error)

func (*Comptroller) MintAllowed

func (this *Comptroller) MintAllowed(market, minter common.Address) (bool, error)

func (*Comptroller) MintGuardianPaused

func (this *Comptroller) MintGuardianPaused(market common.Address) (bool, error)

func (*Comptroller) Oracle

func (this *Comptroller) Oracle() (common.Address, error)

func (*Comptroller) PauseGuardian

func (this *Comptroller) PauseGuardian() (common.Address, error)

func (*Comptroller) PendingAdmin

func (this *Comptroller) PendingAdmin() (common.Address, error)

func (*Comptroller) RedeemAllowed

func (this *Comptroller) RedeemAllowed(market, redeemer common.Address, redeemTokens *big.Int) (bool, error)

func (*Comptroller) RefreshWingRate

func (this *Comptroller) RefreshWingRate() (string, error)

func (*Comptroller) RepayBorrowAllowed

func (this *Comptroller) RepayBorrowAllowed(market, payer, borrower common.Address, repayAmount *big.Int) (bool, error)

func (*Comptroller) RepayByInsurance

func (this *Comptroller) RepayByInsurance(borrower common.Address) (string, error)

func (*Comptroller) SeizeAllowed

func (this *Comptroller) SeizeAllowed(collateralMarket, borrowedMarket, liquidator, borrower common.Address, seizeTokens *big.Int) (bool, error)

func (*Comptroller) SeizeGuardianPaused

func (this *Comptroller) SeizeGuardianPaused() (bool, error)

func (*Comptroller) SetBorrowPaused

func (this *Comptroller) SetBorrowPaused(market common.Address, state bool) (string, error)

func (*Comptroller) SetCloseFactor

func (this *Comptroller) SetCloseFactor(factor *big.Int) (string, error)

func (*Comptroller) SetCollateralFactor

func (this *Comptroller) SetCollateralFactor(market common.Address, factor *big.Int) (string, error)

func (*Comptroller) SetDistributeWingSwitch

func (this *Comptroller) SetDistributeWingSwitch(state bool) (string, error)

func (*Comptroller) SetGlobalParam

func (this *Comptroller) SetGlobalParam(globalParam common.Address) (string, error)

func (*Comptroller) SetInsuranceRepayFactor

func (this *Comptroller) SetInsuranceRepayFactor(factor *big.Int) (string, error)

func (*Comptroller) SetLiquidationIncentive

func (this *Comptroller) SetLiquidationIncentive(incentive *big.Int) (string, error)

func (*Comptroller) SetMaxAssets

func (this *Comptroller) SetMaxAssets(max *big.Int) (string, error)

func (*Comptroller) SetMintPaused

func (this *Comptroller) SetMintPaused(market common.Address, state bool) (string, error)

func (*Comptroller) SetNewMarketId

func (this *Comptroller) SetNewMarketId(newMarket, oldMarket common.Address) (string, error)

func (*Comptroller) SetOldMarketId

func (this *Comptroller) SetOldMarketId(oldMarket, newMarket common.Address) (string, error)

func (*Comptroller) SetPauseGuardian

func (this *Comptroller) SetPauseGuardian(newPausedGuardian common.Address) (string, error)

func (*Comptroller) SetPendingAdmin

func (this *Comptroller) SetPendingAdmin(newPendingAdmin common.Address) (string, error)

func (*Comptroller) SetPriceOracle

func (this *Comptroller) SetPriceOracle(oracle common.Address) (string, error)

func (*Comptroller) SetSeizePaused

func (this *Comptroller) SetSeizePaused(state bool) (string, error)

func (*Comptroller) SetTransferPaused

func (this *Comptroller) SetTransferPaused(state bool) (string, error)

func (*Comptroller) SetWingAddr

func (this *Comptroller) SetWingAddr(wing common.Address) (string, error)

func (*Comptroller) SetWingIndexFactor

func (this *Comptroller) SetWingIndexFactor(market common.Address, factor *big.Int) (string, error)

func (*Comptroller) SetWingRate

func (this *Comptroller) SetWingRate(rate *big.Int) (string, error)

func (*Comptroller) SetWingSBIPortion

func (this *Comptroller) SetWingSBIPortion(market common.Address, supplyPortion, borrowPortion, insurancePortion *big.Int) (string, error)

func (*Comptroller) SupportMarket

func (this *Comptroller) SupportMarket(fToken, insurance common.Address, underlyingDecimals uint64) (string, error)

func (*Comptroller) TransferAllowed

func (this *Comptroller) TransferAllowed(collateralMarket, borrowedMarket, liquidator, borrower common.Address, seizeTokens *big.Int) (bool, error)

func (*Comptroller) TransferGuardianPaused

func (this *Comptroller) TransferGuardianPaused() (bool, error)

func (*Comptroller) UpdateMarketUnderlyingDecimals

func (this *Comptroller) UpdateMarketUnderlyingDecimals(fToken common.Address, underlyingDecimals uint64) (string, error)

func (*Comptroller) UpdateMarketWingWeight

func (this *Comptroller) UpdateMarketWingWeight(market common.Address, weight *big.Int) (string, error)

func (*Comptroller) UpdateSigner

func (this *Comptroller) UpdateSigner(newSigner *ontSDK.Account)

func (*Comptroller) WingAccrued

func (this *Comptroller) WingAccrued(account common.Address) (*big.Int, error)

func (*Comptroller) WingAddr

func (this *Comptroller) WingAddr() (common.Address, error)

func (*Comptroller) WingBorrowState

func (this *Comptroller) WingBorrowState(market common.Address) (*WingMarketState, error)

func (*Comptroller) WingBorrowerIndex

func (this *Comptroller) WingBorrowerIndex(market, account common.Address) (*big.Int, error)

func (*Comptroller) WingDistributedNum

func (this *Comptroller) WingDistributedNum(market common.Address) (*big.Int, error)

func (*Comptroller) WingInsuranceIndex

func (this *Comptroller) WingInsuranceIndex(market, account common.Address) (*big.Int, error)

func (*Comptroller) WingInsuranceState

func (this *Comptroller) WingInsuranceState(market common.Address) (*WingMarketState, error)

func (*Comptroller) WingRate

func (this *Comptroller) WingRate() (*big.Int, error)

func (*Comptroller) WingSBIPortion

func (this *Comptroller) WingSBIPortion(market common.Address) (*WingSBI, error)

func (*Comptroller) WingSpeeds

func (this *Comptroller) WingSpeeds(market common.Address) (*big.Int, error)

func (*Comptroller) WingSupplierIndex

func (this *Comptroller) WingSupplierIndex(market, account common.Address) (*big.Int, error)

func (*Comptroller) WingSupplyState

func (this *Comptroller) WingSupplyState(market common.Address) (*WingMarketState, error)

type MarketMeta

type MarketMeta struct {
	Addr          common.Address
	InsuranceAddr common.Address

	IsListed    bool
	ReceiveWing bool

	WingWeight               *big.Int
	CollateralFactorMantissa *big.Int

	UnderlyingDecimals uint32
}

func DeserializeMarketMeta

func DeserializeMarketMeta(data []byte) (*MarketMeta, error)

type MarketUtility

type MarketUtility struct {
	MarketAddress string
	Utility       string
}

func (*MarketUtility) Deserialize

func (this *MarketUtility) Deserialize(source *common.ZeroCopySource) error

type UserAllowance

type UserAllowance struct {
	User   common.Address
	Amount *big.Int
}

func UnmarshalWholeUserAllowance

func UnmarshalWholeUserAllowance(filePath string) ([]*UserAllowance, error)

type WingIndexFactorInfo

type WingIndexFactorInfo struct {
	Factor         *big.Int
	SupplyIndex    *big.Int
	InsuranceIndex *big.Int
}

func DeserializeWingIndexFactorInfo

func DeserializeWingIndexFactorInfo(data []byte) (*WingIndexFactorInfo, error)

type WingMarketState

type WingMarketState struct {
	Index          *big.Int
	BlockTimestamp uint64
}

func DeserializeWingMarketState

func DeserializeWingMarketState(data []byte) (*WingMarketState, error)

type WingSBI

type WingSBI struct {
	SupplyPortion    uint64
	BorrowPortion    uint64
	InsurancePortion uint64
}

func DeserializeWingSBI

func DeserializeWingSBI(data []byte) (*WingSBI, error)

Jump to

Keyboard shortcuts

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