Documentation
¶
Index ¶
- 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 ComputePerc(numerator, denominator *big.Int) *big.Float
- 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
- 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(maxDTL *big.Int) *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(maxDTL *big.Int) *big.Int
- func (afi *AgentFi) MaxBorrowAndWithdraw(maxDTL *big.Int) *big.Int
- func (afi *AgentFi) WithdrawLimit(maxDTL *big.Int) *big.Int
- type AgentInfo
- type AgentMarginJSON
- type BaseFi
- type Liability
- type MinerDetailsJSON
- type MinerFi
- type PoolMetrics
- type PoolsMetricsJSON
- type TerminateSectorResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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)
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"`
MaxDTL float64 `json:"maxDTL"`
LeverageRatio float64 `json:"leverageRatio"`
Tier uint8 `json:"tier"`
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
type PoolMetrics ¶ added in v1.2.0
type PoolMetrics struct {
Height uint64
Timestamp uint64
PoolTotalAssets *big.Int
PoolTotalBorrowed *big.Int
PoolTotalBorrowableAssets *big.Int
PoolExitReserve *big.Int
TotalAgentCount uint64
TotalMinerCollaterals *big.Int
TotalMinersCount uint64
TotalValueLocked *big.Int
TotalMinersSectors *big.Int
TotalMinerQAP *big.Int
TotalMinerRBP *big.Int
TotalMinerEDR *big.Int
}
func GetPoolMetricsFromAPI ¶ added in v1.2.0
func GetPoolMetricsFromAPI(eventsURL string) (*PoolMetrics, error)
type PoolsMetricsJSON ¶ added in v1.2.0
type PoolsMetricsJSON struct {
Height uint64 `json:"height"`
Timestamp uint64 `json:"timestamp"`
PoolTotalAssets string `json:"poolTotalAssets"`
PoolTotalBorrowed string `json:"poolTotalBorrowed"`
PoolTotalBorrowableAssets string `json:"poolTotalBorrowableAssets"`
PoolExitReserve string `json:"poolExitReserve"`
TotalAgentCount uint64 `json:"totalAgentCount"`
TotalMinerCollaterals string `json:"totalMinerCollaterals"`
TotalMinersCount uint64 `json:"totalMinersCount"`
TotalValueLocked string `json:"totalValueLocked"`
TotalMinersSectors string `json:"totalMinersSectors"`
TotalMinerQAP string `json:"totalMinerQAP"`
TotalMinerRBP string `json:"totalMinerRBP"`
TotalMinerEDR string `json:"totalMinerEDR"`
}
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
EstimatedTerminationFee *big.Int
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 ComputeMaxTerminationFee ¶ added in v1.3.0
func ComputeMaxTerminationFee(ctx context.Context, api *lotusapi.FullNodeStruct, minerAddr address.Address, ts *types.TipSet) (*TerminateSectorResult, error)
func EstimateTerminationFeeMiner ¶ added in v1.1.0
func EstimateTerminationFeeMiner(ctx context.Context, api *lotusapi.FullNodeStruct, minerAddr address.Address, ts *types.TipSet) (*TerminateSectorResult, error)
func (*TerminateSectorResult) ToBaseFi ¶ added in v1.1.0
func (termRes *TerminateSectorResult) ToBaseFi() *BaseFi