DocumentationOpen App

Pool (PoolV3)

PoolV3 is the central vault for a specific underlying asset (e.g., USDC, WETH). It implements the ERC-4626 tokenized vault standard, allowing users to deposit assets and receive Diesel Tokens (LP shares). Only whitelisted Credit Managers can borrow from the pool.


Write Methods

ERC-4626 Standard

deposit

Deposits underlying assets and receives diesel tokens (shares).

Solidity
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
ParameterTypeDescription
assetsuint256Amount of underlying tokens to deposit
receiveraddressAddress to receive the minted shares

Returns: Number of shares minted.


mint

Mints an exact number of shares, depositing the required underlying assets.

Solidity
function mint(uint256 shares, address receiver) external returns (uint256 assets);
ParameterTypeDescription
sharesuint256Exact number of shares to mint
receiveraddressAddress to receive the minted shares

Returns: Amount of underlying assets deposited.


withdraw

Withdraws an exact amount of underlying assets, burning the required shares.

Solidity
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
ParameterTypeDescription
assetsuint256Exact amount of underlying to withdraw
receiveraddressAddress to receive the assets
owneraddressAddress whose shares are burned

Returns: Number of shares burned. Reverts if pool is paused or insufficient liquidity.


redeem

Burns an exact number of shares and receives underlying assets.

Solidity
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
ParameterTypeDescription
sharesuint256Exact number of shares to burn
receiveraddressAddress to receive the assets
owneraddressAddress whose shares are burned

Returns: Amount of underlying assets received.


Gearbox Extensions

depositWithReferral

Deposits underlying assets with on-chain referral tracking.

Solidity
function depositWithReferral(uint256 assets, address receiver, uint256 referralCode) external returns (uint256 shares);
ParameterTypeDescription
assetsuint256Amount of underlying tokens to deposit
receiveraddressAddress to receive the minted shares
referralCodeuint256Referral code for tracking

Returns: Number of shares minted.


lendCreditAccount

Lends underlying assets to a Credit Account. Called by the Credit Manager during debt increase.

Solidity
function lendCreditAccount(uint256 borrowedAmount, address creditAccount) external;
ParameterTypeDescription
borrowedAmountuint256Amount to lend
creditAccountaddressReceiving Credit Account

Access: Whitelisted Credit Manager only.


repayCreditAccount

Repays borrowed assets from a Credit Account. Called by the Credit Manager during debt decrease, closure, or liquidation.

Solidity
function repayCreditAccount(uint256 repaidAmount, uint256 profit, uint256 loss) external;
ParameterTypeDescription
repaidAmountuint256Amount being repaid
profituint256Profit amount (added to treasury)
lossuint256Loss amount (may burn treasury shares or socialize)

Access: Whitelisted Credit Manager only.


View Methods

ERC-4626 Standard

totalAssets

Returns the total value of underlying assets held by the pool.

Solidity
function totalAssets() external view returns (uint256);

convertToShares / convertToAssets

Preview conversion between assets and shares.

Solidity
function convertToShares(uint256 assets) external view returns (uint256 shares); function convertToAssets(uint256 shares) external view returns (uint256 assets);

previewDeposit / previewMint / previewWithdraw / previewRedeem

Preview the result of deposit, mint, withdraw, or redeem operations.

Solidity
function previewDeposit(uint256 assets) external view returns (uint256 shares); function previewMint(uint256 shares) external view returns (uint256 assets); function previewWithdraw(uint256 assets) external view returns (uint256 shares); function previewRedeem(uint256 shares) external view returns (uint256 assets);

maxDeposit / maxMint / maxWithdraw / maxRedeem

Returns the maximum amount that can be deposited, minted, withdrawn, or redeemed.

Solidity
function maxDeposit(address receiver) external view returns (uint256); function maxMint(address receiver) external view returns (uint256); function maxWithdraw(address owner) external view returns (uint256); function maxRedeem(address owner) external view returns (uint256);

asset

Returns the underlying token address.

Solidity
function asset() external view returns (address);

Gearbox-Specific Views

availableLiquidity

Returns the amount of underlying tokens available for borrowing.

Solidity
function availableLiquidity() external view returns (uint256);

dieselRate

Returns the current share price in RAY (27 decimals). Starts at 10^27 and increases as interest accrues.

Solidity
function dieselRate() external view returns (uint256);

supplyRate

Returns the annualized supply rate for lenders in RAY.

Solidity
function supplyRate() external view returns (uint256);

baseInterestRate

Returns the annualized borrow rate for Credit Accounts in RAY.

Solidity
function baseInterestRate() external view returns (uint256);

baseInterestIndex

Returns the cumulative interest index used for debt tracking.

Solidity
function baseInterestIndex() external view returns (uint256);

poolQuotaKeeper

Returns the address of the associated PoolQuotaKeeper.

Solidity
function poolQuotaKeeper() external view returns (address);

interestRateModel

Returns the address of the Interest Rate Model contract.

Solidity
function interestRateModel() external view returns (address);

Events

Deposit

Solidity
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

Emitted on deposit or mint (ERC-4626 standard).

Withdraw

Solidity
event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares );

Emitted on withdraw or redeem (ERC-4626 standard).

Borrow

Solidity
event Borrow(address indexed creditManager, address indexed creditAccount, uint256 amount);

Emitted when a Credit Manager borrows from the pool.

Repay

Solidity
event Repay(address indexed creditManager, uint256 borrowedAmount, uint256 profit, uint256 loss);

Emitted when a Credit Manager repays to the pool.