Documentation ¶
Index ¶
- Variables
- func AllSectors(ctx context.Context, api *lotusapi.FullNodeStruct, minerAddr address.Address, ...) ([]uint64, error)
- func ComputeAgentData(ctx context.Context, agentAddr common.Address, agentBalDelta *big.Int, ...) (*vc.AgentData, error)
- func ComputeBorrowAgentData(ctx context.Context, agentAddr common.Address, amount *big.Int, ...) (*vc.AgentData, error)
- func ComputeEDR(ctx context.Context, minerAddr address.Address, ts *types.TipSet, ...) (*big.Int, error)
- func ComputePayAgentData(ctx context.Context, agentAddr common.Address, value *big.Int, ...) (*vc.AgentData, error)
- func ComputePushFundsAgentData(ctx context.Context, agentAddr common.Address, minerAddr address.Address, ...) (*vc.AgentData, error)
- func ComputeRmMinerAgentData(ctx context.Context, agentAddr common.Address, miner address.Address, ...) (*vc.AgentData, error)
- func ComputeWithdrawAgentData(ctx context.Context, agentAddr common.Address, withdrawAmount *big.Int, ...) (*vc.AgentData, error)
- func GetAgentEcon(ctx context.Context, agentAddr common.Address, psdk pooltypes.PoolsSDK, ...) (*big.Int, *big.Int, error)
- func InterestOwed(ctx context.Context, account abigen.Account, rate *big.Int, ...) *big.Int
- func SampleSectors(sectors []uint64, samples int) []uint64
- type AgentFi
- func EmptyAgentFi() *AgentFi
- func EstimateTerminationFeeAgent(ctx context.Context, agentAddr common.Address, withoutMiner address.Address, ...) (*AgentFi, error)
- func GetAgentFiFromAPI(agentAddr common.Address, eventsURL string) (*AgentFi, error)
- func NewAgentFi(agentAvailableBalance *big.Int, liability Liability, minerFis []*BaseFi) *AgentFi
- func (afi *AgentFi) BorrowLimit() *big.Int
- func (afi *AgentFi) DTL() *big.Float
- func (afi *AgentFi) LeverageRatio() *big.Float
- func (afi *AgentFi) Margin() *big.Int
- func (afi *AgentFi) MarginCall() *big.Int
- func (afi *AgentFi) MaxBorrowAndSeal() *big.Int
- func (afi *AgentFi) MaxBorrowAndWithdraw() *big.Int
- func (afi *AgentFi) WithdrawLimit() *big.Int
- type AgentInfo
- type AgentMarginJSON
- type BaseFi
- type Liability
- type MinerDetailsJSON
- type MinerFi
- type TerminateSectorResult
Constants ¶
This section is empty.
Variables ¶
var INITIAL_PLEDGE_INTERPOLATION_REL_DIFF = big.NewFloat(3.00) // 3%
var MAX_SAMPLED_SECTORS = 1000
Functions ¶
func AllSectors ¶ added in v1.1.0
func ComputeAgentData ¶
func ComputeAgentData( ctx context.Context, agentAddr common.Address, agentBalDelta *big.Int, principal *big.Int, rmMiner address.Address, sdk poolstypes.PoolsSDK, tsk *types.TipSet, ) (*vc.AgentData, error)
TODO https://github.com/glif-confidential/ado/issues/9 note that this function is supposed to implement a post action credential in some cases, it's incomplete example 1 - pay - if the amount should reduce principal, principal in the credential is not updated - V2 pools does not use principal in the cred anyways example 2 - add miner - there are no cred checks on adding miner
func ComputeBorrowAgentData ¶ added in v1.1.0
func ComputeEDR ¶ added in v1.1.0
func ComputePayAgentData ¶ added in v1.1.0
func ComputePushFundsAgentData ¶ added in v1.1.0
func ComputeRmMinerAgentData ¶ added in v1.1.0
func ComputeWithdrawAgentData ¶ added in v1.1.0
func GetAgentEcon ¶ added in v1.1.0
func InterestOwed ¶
func InterestOwed(ctx context.Context, account abigen.Account, rate *big.Int, chainHeadHeight abi.ChainEpoch) *big.Int
@dev rates have 2 WADs worth of precision (1e36) to maintain per epoch rate precision
func SampleSectors ¶ added in v1.1.0
Types ¶
type AgentFi ¶ added in v1.1.0
type AgentFi struct { BaseFi Liability // represents the amount of FIL and WFIL that is held by the Agent's smart contract SpendableBalance *big.Int `json:"spendableBalance"` }
func EmptyAgentFi ¶ added in v1.1.0
func EmptyAgentFi() *AgentFi
func EstimateTerminationFeeAgent ¶ added in v1.1.0
func GetAgentFiFromAPI ¶ added in v1.1.0
func NewAgentFi ¶ added in v1.1.0
func (*AgentFi) BorrowLimit ¶ added in v1.1.0
func (*AgentFi) LeverageRatio ¶ added in v1.1.0
leverage ratio = liquidation value / margin
func (*AgentFi) MarginCall ¶ added in v1.1.0
func (*AgentFi) MaxBorrowAndSeal ¶ added in v1.1.0
MaxBorrowAndSeal = margin / (1 - max borrow DTL) - margin
func (*AgentFi) MaxBorrowAndWithdraw ¶ added in v1.1.0
MaxBorrowAndWithdraw = margin - lv * (1 - max borrow DTL)
func (*AgentFi) WithdrawLimit ¶ added in v1.1.0
type AgentInfo ¶ added in v1.1.0
type AgentInfo struct { TxHash string `json:"txHash"` Height uint64 `json:"height"` Id uint64 `json:"id"` Address string `json:"address"` AddressNative common.Address `json:"addressNative"` // BALANCE DEPRECATED Balance string `json:"balance"` Miners uint64 `json:"miners"` AvailableBalance string `json:"availableBalance"` PrincipalBalance string `json:"principalBalance"` }
type AgentMarginJSON ¶ added in v1.1.0
type AgentMarginJSON struct { AgentId uint64 `json:"agentId"` Balance string `json:"balance"` SpendableBalance string `json:"spendableBalance"` AvailableBalance string `json:"availableBalance"` LockedRewards string `json:"lockedRewards"` FeeDebt string `json:"feeDebt"` InitialPledge string `json:"initialPledge"` TerminationFee string `json:"terminationFee"` LiquidationValue string `json:"liquidationValue"` Margin string `json:"margin"` MarginCall string `json:"marginCall"` Principal string `json:"principal"` Interest string `json:"interest"` DTL float64 `json:"dtl"` LeverageRatio float64 `json:"leverageRatio"` BorrowLimit string `json:"borrowLimit"` BorrowAndWithdrawLimit string `json:"borrowAndWithdrawLimit"` WithdrawLimit string `json:"withdrawLimit"` LiveSectors string `json:"liveSectors"` FaultySectors string `json:"faultySectors"` }
type BaseFi ¶ added in v1.1.0
type BaseFi struct { // total balance of the miner (and in the case of an Agent, includes Agent balance and locked FIL) Balance *big.Int `json:"balance"` // liquid FIL on the miner (and in the case of an Agent, includes Agent available balance, does not account for any fee debt) AvailableBalance *big.Int `json:"availableBalance"` LockedRewards *big.Int `json:"lockedRewards"` InitialPledge *big.Int `json:"initialPledge"` FeeDebt *big.Int `json:"feeDebt"` TerminationFee *big.Int `json:"terminationFee"` LiveSectors *big.Int `json:"liveSectors"` FaultySectors *big.Int `json:"faultySectors"` }
func EmptyBaseFi ¶ added in v1.1.0
func EmptyBaseFi() *BaseFi
func GetBaseFisFromAPI ¶ added in v1.1.0
func (*BaseFi) LiquidationValue ¶ added in v1.1.0
func (*BaseFi) RecoveryRate ¶ added in v1.1.0
type MinerDetailsJSON ¶ added in v1.1.0
type MinerDetailsJSON struct { Miner uint64 `json:"miner"` AgentId uint64 `json:"agentId"` Actions uint16 `json:"actions"` MinerAddr address.Address `json:"minerAddr"` AvailableBalance string `json:"availableBalance"` InitialPledge string `json:"initialPledge"` LockedRewards string `json:"lockedRewards"` FeeDebt string `json:"feeDebt"` Balance string `json:"balance"` EstimatedWeeklyRewards string `json:"estimatedWeeklyRewards"` QAP string `json:"qap"` RBP string `json:"rbp"` LiveSectors string `json:"liveSectors"` FaultySectors string `json:"faultySectors"` RecoveringSectors string `json:"recoveringSectors"` Ratio string `json:"ratio"` TerminationFee string `json:"terminationFee"` LiquidationValue string `json:"liquidationValue"` }
type MinerFi ¶ added in v1.1.0
type MinerFi struct {
BaseFi
}
func EmptyMinerFi ¶ added in v1.1.0
func EmptyMinerFi() *MinerFi
func NewMinerFi ¶ added in v1.1.0
func (*MinerFi) MaxBorrowAndSeal ¶ added in v1.1.0
func (*MinerFi) MaxBorrowAndWithdraw ¶ added in v1.1.0
type TerminateSectorResult ¶ added in v1.1.0
type TerminateSectorResult struct { TotalBalance *big.Int AvailableBalance *big.Int VestingFunds *big.Int InitialPledge *big.Int FeeDebt *big.Int EstimatedInitialPledge *big.Int InitialPledgeFromSample *big.Int AvgInitialPledgePerSector *big.Int EstimatedTerminationFee *big.Int TerminationFeeFromSample *big.Int AvgTerminationFeePerPledge *big.Int SampledSectors uint64 LiveSectors uint64 FaultySectors uint64 }
note that in feeDebt, AvailableBalance will be kept at 0, and feeDebt will be a positive number lotus actually returns a negative number for availableBalance, but we scrap that and return 0
func EstimateTerminationFeeMiner ¶ added in v1.1.0
func EstimateTerminationFeeMiner(ctx context.Context, api *lotusapi.FullNodeStruct, minerAddr address.Address, ts *types.TipSet) (*TerminateSectorResult, error)
func TerminateSectors ¶ added in v1.1.0
func TerminateSectors(ctx context.Context, api *lotusapi.FullNodeStruct, minerAddr address.Address, sectors *bitfield.BitField, ts *types.TipSet) (*TerminateSectorResult, error)
func (*TerminateSectorResult) ToBaseFi ¶ added in v1.1.0
func (termRes *TerminateSectorResult) ToBaseFi() *BaseFi