Skip to content

Commit

Permalink
sp/untracked/aavelike-cap-validation-adjustment (#695)
Browse files Browse the repository at this point in the history
AaveLike cap validation adjustment
  • Loading branch information
piekczyk authored Jul 16, 2024
1 parent 19ba03c commit f69746b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/dma-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oasisdex/dma-library",
"version": "0.6.61",
"version": "0.6.62",
"typings": "lib/index.d.ts",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function validateTargetLtvExceedsCap(
const maxSupply = position.reserveData.collateral.availableToSupply
const maxBorrow = position.reserveData.debt.availableToBorrow

if (targetPosition.collateralAmount.gt(maxSupply)) {
if (targetPosition.collateralAmount.minus(position.collateralAmount).gt(maxSupply)) {
return [
{
name: 'target-ltv-exceeds-supply-cap',
Expand All @@ -19,12 +19,12 @@ export function validateTargetLtvExceedsCap(
]
}

if (targetPosition.debtAmount.gt(maxBorrow)) {
if (targetPosition.debtAmount.minus(position.debtAmount).gt(maxBorrow)) {
return [
{
name: 'target-ltv-exceeds-borrow-cap',
data: {
cap: formatCryptoBalance(maxSupply),
cap: formatCryptoBalance(maxBorrow),
},
},
]
Expand Down

0 comments on commit f69746b

Please sign in to comment.