WithdrawalManager

Git Source

Inherits: WithdrawalManagerStorage, IWithdrawalManager, VersionedInitializable

State Variables

WITHDRAWAL_MANAGER_REVISION

uint256 public constant WITHDRAWAL_MANAGER_REVISION = 0x1;

ADDRESSES_PROVIDER

IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;

Functions

onlyPoolAdmin

modifier onlyPoolAdmin();

onlyPoolConfigurator

modifier onlyPoolConfigurator();

whenProtocolNotPaused

modifier whenProtocolNotPaused();

getRevision

Returns the revision number of the contract

Needs to be defined in the inherited class as a constant.

function getRevision() public pure virtual override returns (uint256 revision_);

Returns

NameTypeDescription

revision_

uint256

The revision number

constructor

constructor(IPoolAddressesProvider provider_);

initialize

Initializes the Withdrawal Manager.

Function is invoked by the proxy contract when the Withdrawal Manager Contract is added to the PoolAddressesProvider of the market.

function initialize(
    IPoolAddressesProvider provider_,
    uint256 cycleDuration_,
    uint256 windowDuration_
)
    external
    override
    initializer;

Parameters

NameTypeDescription

provider_

IPoolAddressesProvider

The address of the PoolAddressesProvider.

cycleDuration_

uint256

The total duration of a withdrawal cycle.

windowDuration_

uint256

The duration of the withdrawal window.

setExitConfig

Pool admin sets a new configuration for the withdrawal manager.

function setExitConfig(uint256 cycleDuration_, uint256 windowDuration_) external override whenProtocolNotPaused;

Parameters

NameTypeDescription

cycleDuration_

uint256

The total duration of a withdrawal cycle.

windowDuration_

uint256

The total duration of a withdrawal window.

addShares

Add more shares for withdrawal.

function addShares(uint256 shares_, address owner_) external override onlyPoolConfigurator;

Parameters

NameTypeDescription

shares_

uint256

The amount of shares to add.

owner_

address

The owner of the shares.

removeShares

Remove shares from withdrawal.

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

Parameters

NameTypeDescription

shares_

uint256

The amount of shares to remove from withdrawal.

owner_

address

The owner of the shares.

processExit

Process the exit of requested shares of a owner.

function processExit(
    uint256 requestedShares_,
    address owner_
)
    external
    override
    onlyPoolConfigurator
    returns (uint256 redeemableShares_, uint256 resultingAssets_);

Parameters

NameTypeDescription

requestedShares_

uint256

The amount of shares to redeem.

owner_

address

The owner of the shares.

Returns

NameTypeDescription

redeemableShares_

uint256

The amount of redeemable shares.

resultingAssets_

uint256

The corresponding amount of assets with the redeemable shares.

isInExitWindow

Checks if the owner has a withdrawal request in the exit window.

function isInExitWindow(address owner_) external view override returns (bool isInExitWindow_);

Parameters

NameTypeDescription

owner_

address

The owner address to check.

Returns

NameTypeDescription

isInExitWindow_

bool

True if the owner has a withdrawal request in the exit window.

lockedLiquidity

Gets the total amount of liquidity locked in the current cycle.

function lockedLiquidity() external view override returns (uint256 lockedLiquidity_);

Returns

NameTypeDescription

lockedLiquidity_

uint256

The total amount of liquidity locked in the current cycle.

previewRedeem

Previews the amount of shares and assets that can be redeemed.

function previewRedeem(
    address owner_,
    uint256 shares_
)
    external
    view
    override
    returns (uint256 redeemableShares_, uint256 resultingAssets_);

Parameters

NameTypeDescription

owner_

address

The owner of the shares.

shares_

uint256

The amount of shares to redeem.

Returns

NameTypeDescription

redeemableShares_

uint256

The amount of redeemable shares.

resultingAssets_

uint256

The corresponding amount of assets with the redeemable shares.

getCycleConfig

Gets the configuration of a config id.

function getCycleConfig(uint256 configId_) public view override returns (WM.CycleConfig memory config_);

Parameters

NameTypeDescription

configId_

uint256

The id of the config.

Returns

NameTypeDescription

config_

WM.CycleConfig

The config.

getConfigAtId

Gets the configuration of a given cycle id.

function getConfigAtId(uint256 cycleId_) public view override returns (WM.CycleConfig memory config_);

Parameters

NameTypeDescription

cycleId_

uint256

The cycle id.

Returns

NameTypeDescription

config_

WM.CycleConfig

The configuration used at the cycle id.

getCurrentConfig

Gets the configuration of the current cycle id.

function getCurrentConfig() public view override returns (WM.CycleConfig memory config_);

Returns

NameTypeDescription

config_

WM.CycleConfig

The configuration used at the current cycle id.

getCurrentCycleId

Gets the current cycle id.

function getCurrentCycleId() public view override returns (uint256 cycleId_);

Returns

NameTypeDescription

cycleId_

uint256

The id of the current cycle.

getWindowStart

Gets the starting time of a window for a given cycle id.

function getWindowStart(uint256 cycleId_) public view override returns (uint64 windowStart_);

Parameters

NameTypeDescription

cycleId_

uint256

The id of the cycle.

Returns

NameTypeDescription

windowStart_

uint64

The starting time of the window.

getWindowAtId

Gets the start and end time of a window for a given cycle id.

function getWindowAtId(uint256 cycleId_) public view override returns (uint64 windowStart_, uint64 windowEnd_);

Parameters

NameTypeDescription

cycleId_

uint256

The id of the cycle.

Returns

NameTypeDescription

windowStart_

uint64

The starting time of the window.

windowEnd_

uint64

The ending time of the window.

getRedeemableAmounts

function getRedeemableAmounts(
    uint256 lockedShares_,
    address owner_
)
    public
    view
    override
    returns (uint256 redeemableShares_, uint256 resultingAssets_, bool partialLiquidity_);

_poolConfigurator

function _poolConfigurator() internal view returns (address poolConfigurator_);

_poolAdmin

function _poolAdmin() internal view returns (address poolAdmin_);

_globals

function _globals() internal view returns (address globals_);

_asset

function _asset() internal view returns (address asset_);

_pool

function _pool() internal view returns (address pool_);

_emitUpdate

function _emitUpdate(address account_, uint256 lockedShares_, uint256 exitCycleId_) internal;

_emitProcess

function _emitProcess(address account_, uint256 sharesToRedeem_, uint256 assetsToWithdraw_) internal;

_revertIfNotPoolAdmin

function _revertIfNotPoolAdmin() internal view;

_revertIfNotPoolConfigurator

function _revertIfNotPoolConfigurator() internal view;

Last updated