Skip to content

Commit

Permalink
fix(liquidation): update example typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Oct 21, 2024
1 parent 6fe0925 commit a633833
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 19 deletions.
11 changes: 10 additions & 1 deletion packages/blue-sdk/src/position/Position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,41 +77,47 @@ export class AccrualPosition extends Position implements InputAccrualPosition {

/**
* The value of this position's collateral quoted in loan assets.
* Undefined iff the market's oracle is undefined or reverts.
*/
get collateralValue() {
return this.market.getCollateralValue(this.collateral);
}

/**
* The maximum amount of loan assets that can be borrowed against this position's collateral.
* Undefined iff the market's oracle is undefined or reverts.
*/
get maxBorrowAssets() {
return this.market.getMaxBorrowAssets(this.collateral);
}

/**
* The maximum additional amount of assets that can be borrowed against this position's collateral.
* Undefined iff the market's oracle is undefined or reverts.
*/
get maxBorrowableAssets() {
return this.market.getMaxBorrowableAssets(this);
}

/**
* The maximum amount of collateral that can be seized in exchange for the outstanding debt.
* Undefined iff the market's oracle is undefined or reverts.
*/
get seizableCollateral() {
return this.market.getSeizableCollateral(this);
}

/**
* The maximum amount of collateral that can be withdrawn.
* Undefined iff the market's oracle is undefined or reverts.
*/
get withdrawableCollateral() {
return this.market.getWithdrawableCollateral(this);
}

/**
* Whether this position is healthy.
* Undefined iff the market's oracle is undefined or reverts.
*/
get isHealthy() {
return this.market.isHealthy(this);
Expand All @@ -127,7 +133,8 @@ export class AccrualPosition extends Position implements InputAccrualPosition {
/**
* The price variation required for the position to reach its liquidation threshold (scaled by WAD).
* Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
* Returns null if the position is not a borrow.
* Undefined iff the market's oracle is undefined or reverts.
* Null if the position is not a borrow.
*/
get priceVariationToLiquidationPrice() {
return this.market.getPriceVariationToLiquidationPrice(this);
Expand All @@ -136,6 +143,7 @@ export class AccrualPosition extends Position implements InputAccrualPosition {
/**
* This position's Loan-To-Value (debt over collateral power, scaled by WAD).
* If the collateral price is 0, LTV is `MaxUint256`.
* Undefined iff the market's oracle is undefined or reverts.
*/
get ltv() {
return this.market.getLtv(this);
Expand All @@ -144,6 +152,7 @@ export class AccrualPosition extends Position implements InputAccrualPosition {
/**
* This position's health factor (collateral power over debt, scaled by WAD).
* If the debt is 0, health factor is `MaxUint256`.
* Undefined iff the market's oracle is undefined or reverts.
*/
get healthFactor() {
return this.market.getHealthFactor(this);
Expand Down
Loading

0 comments on commit a633833

Please sign in to comment.