diff --git a/packages/dma-library/package.json b/packages/dma-library/package.json index e26adc598..44319a1b9 100644 --- a/packages/dma-library/package.json +++ b/packages/dma-library/package.json @@ -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", diff --git a/packages/dma-library/src/strategies/aave-like/omni/validation/validate-target-ltv-exceeds-cap.ts b/packages/dma-library/src/strategies/aave-like/omni/validation/validate-target-ltv-exceeds-cap.ts index 412b3cf85..471f009bb 100644 --- a/packages/dma-library/src/strategies/aave-like/omni/validation/validate-target-ltv-exceeds-cap.ts +++ b/packages/dma-library/src/strategies/aave-like/omni/validation/validate-target-ltv-exceeds-cap.ts @@ -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', @@ -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), }, }, ]