Pool

Git Source

Inherits: IPool, ERC20Permit

See the documentation in {IPool}.

State Variables

configurator

address public configurator;

_asset

ERC20Permit private immutable _asset;

_underlyingDecimals

uint8 private immutable _underlyingDecimals;

Functions

constructor

constructor(
    address configurator_,
    address asset_,
    string memory name_,
    string memory symbol_
)
    ERC20Permit(name_)
    ERC20(name_, symbol_);

depositWithPermit

Deposits assets into the pool with the permit signature

function depositWithPermit(
    uint256 assets_,
    address receiver_,
    uint256 deadline_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
)
    external
    returns (uint256 shares_);

Parameters

NameTypeDescription

assets_

uint256

receiver_

address

deadline_

uint256

v_

uint8

r_

bytes32

s_

bytes32

Returns

NameTypeDescription

shares_

uint256

The corresponding amount of shares minted

mintWithPermit

Mints shares from the pool with the permit signature

function mintWithPermit(
    uint256 shares_,
    address receiver_,
    uint256 maxAssets_,
    uint256 deadline_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
)
    external
    returns (uint256 assets_);

Parameters

NameTypeDescription

shares_

uint256

receiver_

address

maxAssets_

uint256

deadline_

uint256

v_

uint8

r_

bytes32

s_

bytes32

Returns

NameTypeDescription

assets_

uint256

The corresponding amount of assets deposited

removeShares

Remove shares from the pool

function removeShares(uint256 shares_, address owner_) external override returns (uint256 sharesReturned_);

Parameters

NameTypeDescription

shares_

uint256

The amount of shares to remove

owner_

address

The owner of the shares

Returns

NameTypeDescription

sharesReturned_

uint256

The amount of shares returned

requestRedeem

Request the redemption of shares from the pool

function requestRedeem(uint256 shares_, address owner_) external override;

Parameters

NameTypeDescription

shares_

uint256

The amount of shares to redeem

owner_

address

The owner of the shares

balanceOfAssets

Returns of the balance of the account

function balanceOfAssets(address account_) public view override returns (uint256 balanceOfAssets_);

Parameters

NameTypeDescription

account_

address

The address of the account

Returns

NameTypeDescription

balanceOfAssets_

uint256

assets_ The amount of assets

convertToExitAssets

Returns the amount of assets that can be withdrawn for the amount of shares

function convertToExitAssets(uint256 shares_) public view override returns (uint256 assets_);

Parameters

NameTypeDescription

shares_

uint256

The amount of shares

Returns

NameTypeDescription

assets_

uint256

The amount of assets

convertToExitShares

Returns the amount of shares that will be burned to withdraw the amount of assets

function convertToExitShares(uint256 assets_) public view override returns (uint256 shares_);

Parameters

NameTypeDescription

assets_

uint256

The amount of assets to withdraw

Returns

NameTypeDescription

shares_

uint256

The amount of shares

unrealizedLosses

Returns the unrealized losses of the pool

function unrealizedLosses() public view override returns (uint256 unrealizedLosses_);

Returns

NameTypeDescription

unrealizedLosses_

uint256

The unrealized losses

deposit

See {IERC4626-deposit}.

function deposit(uint256 assets, address receiver) public override returns (uint256);

mint

See {IERC4626-mint}. As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero. In this case, the shares will be minted without requiring any assets to be deposited.

function mint(uint256 shares, address receiver) public override returns (uint256);

withdraw

See {IERC4626-withdraw}.

function withdraw(uint256 assets_, address receiver_, address owner_) public pure override returns (uint256 shares_);

redeem

See {IERC4626-redeem}.

function redeem(uint256 shares_, address receiver_, address owner_) public override returns (uint256 assets_);

maxDeposit

See {IERC4626-maxDeposit}.

function maxDeposit(address receiver_) public view override returns (uint256 maxAssets_);

maxMint

See {IERC4626-maxMint}.

function maxMint(address receiver_) public view override returns (uint256 maxShares_);

maxWithdraw

See {IERC4626-maxWithdraw}.

function maxWithdraw(address owner_) public pure override returns (uint256 maxAssets_);

maxRedeem

See {IERC4626-maxRedeem}.

function maxRedeem(address owner_) public view override returns (uint256 maxShares_);

previewWithdraw

See {IERC4626-previewWithdraw}.

function previewWithdraw(uint256 assets_) public pure override returns (uint256 shares_);

previewRedeem

See {IERC4626-previewRedeem}.

function previewRedeem(uint256 shares_) public view override returns (uint256 assets_);

convertToShares

See {IERC4626-convertToShares}.

function convertToShares(uint256 assets_) public view override returns (uint256 shares_);

convertToAssets

See {IERC4626-convertToAssets}.

function convertToAssets(uint256 shares_) public view override returns (uint256 assets_);

previewDeposit

See {IERC4626-previewDeposit}.

function previewDeposit(uint256 assets_) public view override returns (uint256 shares_);

previewMint

See {IERC4626-previewMint}.

function previewMint(uint256 shares_) public view override returns (uint256 assets_);

decimals

Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals.

function decimals() public view override(IERC20Metadata, ERC20) returns (uint8);

asset

See {IERC4626-asset}.

function asset() public view override returns (address);

totalAssets

See {IERC4626-totalAssets}.

function totalAssets() public view override returns (uint256);

_deposit

Deposit/mint common workflow.

function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal;

_withdraw

Withdraw/redeem common workflow.

function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares) internal;

_decimalsOffset

function _decimalsOffset() internal pure returns (uint8);

_convertToShares

function _convertToShares(uint256 assets_, Math.Rounding rounding_) internal view virtual returns (uint256 shares_);

_convertToExitShares

function _convertToExitShares(
    uint256 assets_,
    Math.Rounding rounding_
)
    internal
    view
    virtual
    returns (uint256 shares_);

_convertToAssets

function _convertToAssets(uint256 shares_, Math.Rounding rounding_) internal view virtual returns (uint256 assets_);

_convertToExitAssets

function _convertToExitAssets(
    uint256 shares_,
    Math.Rounding rounding_
)
    internal
    view
    virtual
    returns (uint256 assets_);

Last updated