diff --git a/blockchain/aave-v3/aave-v3-pool-data-provider.ts b/blockchain/aave-v3/aave-v3-pool-data-provider.ts index dfe4e65377..bb3aaa3a34 100644 --- a/blockchain/aave-v3/aave-v3-pool-data-provider.ts +++ b/blockchain/aave-v3/aave-v3-pool-data-provider.ts @@ -127,10 +127,15 @@ export function getAaveV3ReserveData({ new BigNumber(result.totalVariableDebt.toString()), token, ) + const accruedToTreasuryScaled = amountFromWei( + new BigNumber(result.accruedToTreasuryScaled.toString()), + token, + ) + return { availableLiquidity: totalAToken.minus(totalStableDebt).minus(totalVariableDebt), unbacked: new BigNumber(result.unbacked.toString()), - accruedToTreasuryScaled: new BigNumber(result.accruedToTreasuryScaled.toString()), + accruedToTreasuryScaled, liquidityRate: amountFromRay(new BigNumber(result.liquidityRate.toString())), variableBorrowRate: amountFromRay(new BigNumber(result.variableBorrowRate.toString())), stableBorrowRate: amountFromRay(new BigNumber(result.stableBorrowRate.toString())), diff --git a/blockchain/spark-v3/spark-v3-pool-data-provider.ts b/blockchain/spark-v3/spark-v3-pool-data-provider.ts index 4b2a9be624..485edd3676 100644 --- a/blockchain/spark-v3/spark-v3-pool-data-provider.ts +++ b/blockchain/spark-v3/spark-v3-pool-data-provider.ts @@ -108,10 +108,15 @@ export function getSparkV3ReserveData({ new BigNumber(result.totalVariableDebt.toString()), token, ) + const accruedToTreasuryScaled = amountFromWei( + new BigNumber(result.accruedToTreasuryScaled.toString()), + token, + ) + return { availableLiquidity: totalSpToken.minus(totalStableDebt).minus(totalVariableDebt), unbacked: new BigNumber(result.unbacked.toString()), - accruedToTreasuryScaled: new BigNumber(result.accruedToTreasuryScaled.toString()), + accruedToTreasuryScaled, liquidityRate: amountFromRay(new BigNumber(result.liquidityRate.toString())), variableBorrowRate: amountFromRay(new BigNumber(result.variableBorrowRate.toString())), stableBorrowRate: amountFromRay(new BigNumber(result.stableBorrowRate.toString())), diff --git a/lendingProtocols/aave-like-common/get-aave-like-reserve-data.ts b/lendingProtocols/aave-like-common/get-aave-like-reserve-data.ts index 56b95ae709..0572224c8a 100644 --- a/lendingProtocols/aave-like-common/get-aave-like-reserve-data.ts +++ b/lendingProtocols/aave-like-common/get-aave-like-reserve-data.ts @@ -42,7 +42,9 @@ export function getAaveLikeReserveData( totalSupply: reserveData.totalToken, availableToSupply: reserveCaps.supply.isZero() ? maxUint256 - : reserveCaps.supply.minus(reserveData.totalToken), + : reserveCaps.supply.minus( + reserveData.totalToken.plus(reserveData.accruedToTreasuryScaled), + ), availableToBorrow: BigNumber.maximum( reserveCaps.borrow.isZero() ? reserveData.availableLiquidity diff --git a/package.json b/package.json index 885b3a7f94..d0a36f4200 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@metamask/eth-sig-util": "^5.0.2", "@oasisdex/addresses": "0.1.75", "@oasisdex/automation": "1.6.5-morpho.6", - "@oasisdex/dma-library": "0.6.61", + "@oasisdex/dma-library": "0.6.62", "@oasisdex/multiply": "^0.2.11", "@oasisdex/transactions": "0.1.4-alpha.0", "@oasisdex/utils": "^0.0.8", diff --git a/yarn.lock b/yarn.lock index 420ede2206..7aaa9571e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2514,10 +2514,10 @@ dependencies: ethers "^5.6.2" -"@oasisdex/dma-library@0.6.61": - version "0.6.61" - resolved "https://registry.yarnpkg.com/@oasisdex/dma-library/-/dma-library-0.6.61.tgz#0a38413c253166c66735129934e7db576aec183c" - integrity sha512-k8ewPCNf2QG0u2zUs2GfQ4a/IAJkLQX3XvbGTrabKruvK4cjo2zPZYHZVDagT1FAdp6gqZwd3URiX4SCSu9r3w== +"@oasisdex/dma-library@0.6.62": + version "0.6.62" + resolved "https://registry.yarnpkg.com/@oasisdex/dma-library/-/dma-library-0.6.62.tgz#b542c53cb3587131379f86d8d8184159608e5533" + integrity sha512-oXVgiBzQZop8PQrn5bntycSazL69reIiEjDkktcVWWjjuFQlPb+/y8aU/jeSNaHmxVR3JsR3cmzkXGRjxVG0qA== dependencies: bignumber.js "9.0.1" ethers "^5.7.2"