Skip to main content
Equivalent to SDK’s getWithdrawalFee(). Reads from the WithdrawQueue’s FeeModule on-chain.

Contract Methods

Reading withdrawal fees requires two calls — first to get the FeeModule address, then to calculate the fee.

Step 1: WithdrawQueue.feeModule()

Returns the address of the FeeModule contract. Returns: address — FeeModule contract address

Step 2: FeeModule.calculateOfferFees(amount, offerAsset, wantAsset, receiver)

Calculates the fee that will be deducted from a withdrawal order.
ParameterTypeDescription
amountuint256Vault shares to offer
offerAssetaddressBoringVault address (the share token being offered)
wantAssetaddressToken the user wants to receive (e.g., USDC)
receiveraddressAddress that will receive the want asset
Returns: uint256 feeAmount — fee in vault shares (18 decimals)

FeeModule.offerFeePercentage()

Returns the fee percentage applied to withdrawal orders. Returns: uint256 — fee percentage with 18-decimal precision (e.g., 5000000000000000 = 0.5%)

ABI

WithdrawQueue (fee module lookup)

[
  {
    "inputs": [],
    "name": "feeModule",
    "outputs": [{ "name": "", "type": "address" }],
    "stateMutability": "view",
    "type": "function"
  }
]

FeeModule

[
  {
    "inputs": [
      { "name": "amount", "type": "uint256" },
      { "name": "offerAsset", "type": "address" },
      { "name": "wantAsset", "type": "address" },
      { "name": "receiver", "type": "address" }
    ],
    "name": "calculateOfferFees",
    "outputs": [{ "name": "feeAmount", "type": "uint256" }],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "offerFeePercentage",
    "outputs": [{ "name": "", "type": "uint256" }],
    "stateMutability": "view",
    "type": "function"
  }
]

Usage

Call feeModule() on the WithdrawQueue contract (vault.withdrawQueueModuleId from Vault Discovery), then call calculateOfferFees() on the returned FeeModule address.
feeModuleAddress = WithdrawQueue.feeModule()
feeAmount        = FeeModule.calculateOfferFees(shareAmount, boringVaultAddress, wantAssetAddress, receiverAddress)
feePercentage    = FeeModule.offerFeePercentage()
The fee is subtracted from the vault shares you offer. If you offer 100 shares and the fee is 0.5 shares, only 99.5 shares worth of the want asset will be sent to the receiver. Account for this when displaying withdrawal amounts to users.