diff --git a/contracts/vaults/common/WithdrawRequestBase.sol b/contracts/vaults/common/WithdrawRequestBase.sol index 4c53754d..1d7ffade 100644 --- a/contracts/vaults/common/WithdrawRequestBase.sol +++ b/contracts/vaults/common/WithdrawRequestBase.sol @@ -5,6 +5,7 @@ import {Constants} from "@contracts/global/Constants.sol"; import {TypeConvert} from "@contracts/global/TypeConvert.sol"; import {Deployments} from "@deployments/Deployments.sol"; import {VaultStorage, WithdrawRequest, SplitWithdrawRequest} from "./VaultStorage.sol"; +import {IERC20} from "@interfaces/IERC20.sol"; /** * Library to handle potentially illiquid withdraw requests of staking tokens where there @@ -76,8 +77,11 @@ abstract contract WithdrawRequestBase { // Otherwise, apply the proper exchange rate (int256 rate, /* */) = Deployments.TRADING_MODULE.getOraclePrice(redeemToken, borrowToken); - return (s.totalWithdraw * rate.toUint() * w.vaultShares) / - (s.totalVaultShares * Constants.EXCHANGE_RATE_PRECISION); + uint256 borrowPrecision = 10 ** IERC20(borrowToken).decimals(); + uint256 redeemPrecision = 10 ** IERC20(redeemToken).decimals(); + + return (s.totalWithdraw * rate.toUint() * w.vaultShares * borrowPrecision) / + (s.totalVaultShares * Constants.EXCHANGE_RATE_PRECISION * redeemPrecision); } }