econ

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollateralValue

func CollateralValue(av *big.Int) *big.Int

*

  • @notice Collateral Value (CV)
  • CV = Agent Value * Termination Penalty Ratio
  • The collateral value of an agent is the agent's balance multiplied by the
  • termination penalty ratio. The termination penalty ratio is the estimated percentage
  • of the agent's balance that will be lost if the agent is terminated.

func ComputeAgentData

func ComputeAgentData(
	ctx context.Context,
	sdk poolstypes.PoolsSDK,
	agentAvailableBalance *big.Int,
	principal *big.Int,
	aggMinerStats *mstat.MinerStats,
	agentAddr common.Address,
	tsk *types.TipSet,
) (*vc.AgentData, error)

TODO https://github.com/glif-confidential/ado/issues/9

func CreditScore

func CreditScore(ead *big.Int, ltv *big.Float, ltc *big.Float, edr *big.Int, dte *big.Float, faultRatio *big.Float, vestingToPledgeRatio *big.Float) *big.Int

* Credit Score * Credit Score = (DTE * 30%) - (LTC * 30%) - (FaultRatio * 20%) - (VestingRatio * 20%) * Score = 90-100 is excellent * Score = 80-90 is good * Score = 60-80 is fair * Score = 40-60 is poor

func CreditScoreSimple

func CreditScoreSimple(ead *big.Int, ltv *big.Float, ltc *big.Float, edr *big.Int, dte *big.Float, faultRatio *big.Float, vestingToPledgeRatio *big.Float) *big.Int

func DebtToEquityRatio

func DebtToEquityRatio(principal *big.Int, equity *big.Int) *big.Float

* Debt to Equity (DTE) * DTE = Pricipal / Equity * Debt to equity ratio is debt divided by equity

func DebtToEquityScore

func DebtToEquityScore(dte *big.Float) *big.Int

* Debt to Equity Credit Score * LTE < 80%: Score of 10 * LTE between 80% and 90%: Score of 8 * LTE between 90% and 100%: Score of 6 * LTE > 100%: Score of 4

func DebtToIncome

func DebtToIncome(edp *big.Int, edr *big.Int) *big.Float

* Debt to Income (DTI) * DTI = Estimated Daily Payments (EDP) / Estimated Daily Reward (EDR) * Debt to income ratio is debt payments divided by income

func DebtToIncomeScore

func DebtToIncomeScore(dti *big.Float) *big.Int

* Debt to Income Credit Score * DTI < 20%: Score of 10 * DTI between 20% and 35%: Score of 8 * DTI between 35% and 50%: Score of 6 * DTI > 50%: Score of 4

func EstimatedDailyPayment

func EstimatedDailyPayment(ead *big.Int, rate *big.Float) *big.Int

ead * rate / 365

func ExpectedLoss

func ExpectedLoss(ead *big.Int, pd *big.Float, lgd *big.Float) *big.Int

EL = EAD * PD% * LGD%

func ExposureAtDefault

func ExposureAtDefault(current *big.Int, principal *big.Int) *big.Int

EAD = current loans principal + new principal

func FaultScore

func FaultScore(faultRatio *big.Float) *big.Int

* Fault Ratio Credit Score

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 InterestRate

func InterestRate(gcred *big.Int) *big.Float

* Interest Rate * Interest Rate = 15 * e^(0.015 * (100 - CreditScore))

func LoanToCollateralRatio

func LoanToCollateralRatio(ead *big.Int, cv *big.Int) *big.Float

LTC = EAD / CV (Collateral Value)

func LoanToCollateralScore

func LoanToCollateralScore(ead *big.Int, ltv *big.Float, ltc *big.Float) *big.Int

* Loan to Collateral Credit Score * LTC < 80%: Score of 10 * LTC between 80% and 100%: Score of 8 * LTV between 80% and 100%: Score of 6 * LTV > 100%: Score of 4

func LoanToValueRatio

func LoanToValueRatio(ead *big.Int, mv *big.Int) *big.Float

LTV = EAD / MV (Miner Value)

func LossGivenDefault

func LossGivenDefault(cv *big.Int, ead *big.Int) *big.Float

CV = AV-TP AV Agent Value TP Termination Penalty LGD = 1 - (CV / EAD) LGD (in dollars) = Exposure at Risk (EAD) * (1 - Recovery Rate) LGD (as percentage) = 1 - (Agent Collateral Value / Outstanding Debt) LGD is loss given default and refers to the amount of money a bank loses when a borrower defaults on a loan. (Percentage)

func ProbabilityOfDefault

func ProbabilityOfDefault() *big.Float

PD = hard coded to 20% maybe a function of edr vs payments

func VestingScore

func VestingScore(vestingToPledgeRatio *big.Float) *big.Int

* Vesting to Pledge Credit Score * Vesting to Pledge Ratio > 10%: Score of 10 * Vesting to Pledge Ratio between 5% and 10%: Score of 8 * Vesting to Pledge Ratio between 1% and 5%: Score of 6 * Vesting to Pledge Ratio < 1%: Score of 4

Types

This section is empty.

Jump to

Keyboard shortcuts

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