Source Code Docs

IUltraLRT

hasRole

function hasRole(bytes32 role, address user) external view returns (bool)

HARVESTER

function HARVESTER() external view returns (bytes32)

AffineDelegator

Delegator contract for stETH on Eigenlayer

vault

address vault

asset

contract ERC20 asset

onlyVaultOrHarvester

modifier onlyVaultOrHarvester()

Modifier to allow function calls only from the vault or harvester

onlyVault

modifier onlyVault()

Modifier to allow function calls only from the vault

onlyHarvester

modifier onlyHarvester()

Modifier to allow function calls only from the harvester

delegate

function delegate(uint256 amount) external

Delegate & restake stETH to operator

_delegate

function _delegate(uint256 amount) internal virtual

Delegate stETH to operator

requestWithdrawal

function requestWithdrawal(uint256 assets) external

Request withdrawal from eigenlayer

Request withdrawal from eigenlayer

Parameters

NameTypeDescription

assets

uint256

Amount to withdraw

_requestWithdrawal

function _requestWithdrawal(uint256 assets) internal virtual

Request withdrawal from eigenlayer

withdraw

function withdraw() external virtual

Withdraw stETH from delegator to vault

totalLockedValue

function totalLockedValue() public view virtual returns (uint256)

Get total locked value

Return Values

NameTypeDescription

[0]

uint256

Total locked value

withdrawableAssets

function withdrawableAssets() public view virtual returns (uint256)

Get withdrawable assets

Return Values

NameTypeDescription

[0]

uint256

Amount of withdrawable assets

queuedAssets

function queuedAssets() public view virtual returns (uint256)

Get queued assets

Return Values

NameTypeDescription

[0]

uint256

Amount of queued assets

AffineReStaking

initialize

function initialize(address _governance, address _weth) external

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

_Function that should revert when msg.sender is not authorized to upgrade the contract. Called by {upgradeTo} and {upgradeToAndCall}.

Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.

function _authorizeUpgrade(address) internal override onlyOwner {}
```_

### GUARDIAN_ROLE

```solidity
bytes32 GUARDIAN_ROLE

APPROVED_TOKEN

bytes32 APPROVED_TOKEN

WETH

contract IWETH WETH

balance

mapping(address => mapping(address => uint256)) balance

depositPaused

uint256 depositPaused

whenDepositNotPaused

modifier whenDepositNotPaused()

pauseDeposit

function pauseDeposit() external

resumeDeposit

function resumeDeposit() external

approveToken

function approveToken(address _token) external

revokeToken

function revokeToken(address _token) external

Deposit

event Deposit(uint256 eventId, address depositor, address token, uint256 amount)

depositFor

function depositFor(address _token, address _for, uint256 _amount) external

depositETHFor

function depositETHFor(address _for) external payable

Withdraw

event Withdraw(uint256 eventId, address withdrawer, address token, uint256 amount)

withdraw

function withdraw(address _token, uint256 _amount) external

pause

function pause() external

Pause the contract

unpause

function unpause() external

Unpause the contract

IDelegatorBeacon

owner

function owner() external returns (address)

DelegatorBeacon

Delegator Beacon contract

beacon

contract UpgradeableBeacon beacon

blueprint

address blueprint

constructor

constructor(address _initBlueprint, address governance) public

Constructor

Parameters

NameTypeDescription

_initBlueprint

address

Initial blueprint address

governance

address

Governance address

update

function update(address _newBlueprint) public

Update the blueprint

Parameters

NameTypeDescription

_newBlueprint

address

New blueprint address

implementation

function implementation() public view returns (address)

Get the implementation address

Return Values

NameTypeDescription

[0]

address

Implementation address

IDelegatorFactory

createDelegator

function createDelegator(address _operator) external returns (address)

vault

function vault() external returns (address)

DelegatorFactory

Delegator Factory contract

vault

address vault

onlyVault

modifier onlyVault()

Modifier to allow function calls only from the vault

constructor

constructor(address _vault) public

Constructor

Parameters

NameTypeDescription

_vault

address

Vault address

createDelegator

function createDelegator(address _operator) external returns (address)

Create a new delegator

Parameters

NameTypeDescription

_operator

address

Operator address

Return Values

NameTypeDescription

[0]

address

Delegator address

EigenDelegator

Delegator contract for stETH on Eigenlayer

STRATEGY_MANAGER

contract IStrategyManager STRATEGY_MANAGER

StrategyManager for Eigenlayer

DELEGATION_MANAGER

contract IDelegationManager DELEGATION_MANAGER

DelegationManager for Eigenlayer

STAKED_ETH_STRATEGY

contract IStrategy STAKED_ETH_STRATEGY

stETH strategy on Eigenlayer

withdrawals

mapping(bytes32 => uint256) withdrawals

initialize

function initialize(address _vault, address _operator) external

Initialize the contract

Parameters

NameTypeDescription

_vault

address

Vault address

_operator

address

Operator address

currentOperator

address currentOperator

stETH

contract IStEth stETH

queuedShares

uint256 queuedShares

_delegate

function _delegate(uint256 amount) internal

Modifier to allow function calls only from the vault or harvester

Delegate & restake stETH to operator on Eigenlayer

Parameters

NameTypeDescription

amount

uint256

Amount to delegate

_requestWithdrawal

function _requestWithdrawal(uint256 assets) internal

Request withdrawal from eigenlayer

Parameters

NameTypeDescription

assets

uint256

Amount to withdraw

completeWithdrawalRequest

function completeWithdrawalRequest(struct WithdrawalInfo[] withdrawalInfo) external

Complete withdrawal request

Parameters

NameTypeDescription

withdrawalInfo

struct WithdrawalInfo[]

Withdrawal info

recordWithdrawalsRequest

function recordWithdrawalsRequest(struct WithdrawalInfo withdrawal) external

Record withdrawal request from External requests

Parameters

NameTypeDescription

withdrawal

struct WithdrawalInfo

Withdrawal info

withdraw

function withdraw() external

Withdraw stETH from delegator to vault

withdrawableAssets

function withdrawableAssets() public view returns (uint256)

Get withdrawable assets

Return Values

NameTypeDescription

[0]

uint256

withdrawable assets

queuedAssets

function queuedAssets() public view returns (uint256)

Get queued assets

Return Values

NameTypeDescription

[0]

uint256

queued assets

_delegateToOperator

function _delegateToOperator() internal

Delegate to operator

IDelegator

requestWithdrawal

function requestWithdrawal(uint256 assets) external

checkAssetAvailability

function checkAssetAvailability(uint256 assets) external view returns (bool)

delegate

function delegate(uint256 amount) external

withdraw

function withdraw() external

totalLockedValue

function totalLockedValue() external returns (uint256)

withdrawableAssets

function withdrawableAssets() external view returns (uint256)

queuedAssets

function queuedAssets() external view returns (uint256)

SymDelegatorFactory

SymDelegator Factory contract

vault

address vault

onlyVault

modifier onlyVault()

Modifier to allow function calls only from the vault

constructor

constructor(address _vault) public

Constructor

Parameters

NameTypeDescription

_vault

address

Vault address

createDelegator

function createDelegator(address _collateral) external returns (address proxy)

Create a new delegator

Parameters

NameTypeDescription

_collateral

address

Collateral address

Return Values

NameTypeDescription

proxy

address

Delegator address

SymbioticDelegator

Delegator contract for wStETH on Symbiotic

collateral

contract IDefaultCollateral collateral

initialize

function initialize(address _vault, address _collateral) external

Initialize the contract

Parameters

NameTypeDescription

_vault

address

Vault address

_collateral

address

Collateral address

_delegate

function _delegate(uint256 amount) internal

Delegate & restake wStETH to operator on Symbiotic

Parameters

NameTypeDescription

amount

uint256

Amount to delegate

_requestWithdrawal

function _requestWithdrawal(uint256 assets) internal

Request withdrawal from Symbiotic

Parameters

NameTypeDescription

assets

uint256

Amount to withdraw

withdrawableAssets

function withdrawableAssets() public view returns (uint256)

Get the withdrawable assets

Return Values

NameTypeDescription

[0]

uint256

withdrawable assets

queuedAssets

function queuedAssets() public view returns (uint256)

Get the queued assets

Return Values

NameTypeDescription

[0]

uint256

queued assets

UltraLRT

UltraLRT is a liquid staking vault that allows users to deposit staked assets and receive shares in return. The shares can be redeemed for the underlying assets at any time. Vault will delegate the assets to the delegators and harvest the profit. The vault will also distribute the profits to the holders.

initialize

function initialize(address _governance, address _asset, address _delegatorBeacon, string _name, string _symbol) external

Initialize the UltraLRT contract

Parameters

NameTypeDescription

_governance

address

The address of the governance contract

_asset

address

The address of the asset token

_delegatorBeacon

address

The address of the delegator beacon

_name

string

The name of the token

_symbol

string

The symbol of the token

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

Upgrade the UltraLRT contract

Parameters

NameTypeDescription

newImplementation

address

The address of the new implementation contract

maxDeposit

function maxDeposit(address) public view virtual returns (uint256)

The maximum amount of assets that can be deposited into the vault

See {IERC4262-maxDeposit}.

Return Values

NameTypeDescription

[0]

uint256

The maximum amount of assets that can be deposited

maxMint

function maxMint(address) public view virtual returns (uint256)

The maximum amount of shares that can be minted

See {IERC4262-maxMint}.

Return Values

NameTypeDescription

[0]

uint256

The maximum amount of shares that can be minted

setDelegatorFactory

function setDelegatorFactory(address _factory) external

set the delegator factory

factory must have the vault set to this vault

Parameters

NameTypeDescription

_factory

address

The address of the delegator factory

setMaxUnresolvedEpochs

function setMaxUnresolvedEpochs(uint256 _maxUnresolvedEpochs) external

set max unresolved epoch

delegation of assets will be stopped if the unresolved epoch is greater than the max unresolved epoch

Parameters

NameTypeDescription

_maxUnresolvedEpochs

uint256

The maximum unresolved epoch

pause

function pause() external

Pause the contract

unpause

function unpause() external

Unpause the contract

initialSharesPerAsset

function initialSharesPerAsset() public pure virtual returns (uint256)

The amount of shares to mint per wei of asset at genesis.

_initialShareDecimals

function _initialShareDecimals() internal pure virtual returns (uint8)

Each wei of asset at genesis is worth 10 ** (initialShareDecimals) shares.

pauseDeposit

function pauseDeposit() external

Pause the deposit

unpauseDeposit

function unpauseDeposit() external

Unpause the deposit

deposit

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

Deposit assets into the vault

Parameters

NameTypeDescription

assets

uint256

receiver

address

The address of the receiver

Return Values

NameTypeDescription

[0]

uint256

The amount of shares minted

mint

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

mint specific amount of shares

Parameters

NameTypeDescription

shares

uint256

The amount of shares to mint

receiver

address

The address of the receiver

Return Values

NameTypeDescription

[0]

uint256

The amount of assets minted

withdraw

function withdraw(uint256 assets, address receiver, address owner) public returns (uint256)

Withdraw assets from the vault

See {IERC4262-withdraw}.

Parameters

NameTypeDescription

assets

uint256

The amount of assets to withdraw

receiver

address

The address of the receiver

owner

address

The address of the owner

Return Values

NameTypeDescription

[0]

uint256

The amount of shares burned

redeem

function redeem(uint256 shares, address receiver, address owner) public returns (uint256)

Redeem shares from the vault

See {IERC4262-redeem}.

Parameters

NameTypeDescription

shares

uint256

The amount of shares to redeem

receiver

address

The address of the receiver

owner

address

The address of the owner

Return Values

NameTypeDescription

[0]

uint256

The amount of assets redeemed

_withdraw

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

withdraw from the vault

Parameters

NameTypeDescription

caller

address

The address of the caller

receiver

address

The address of the receiver

owner

address

The address of the owner

assets

uint256

The amount of assets to withdraw

shares

uint256

The amount of shares to burn

canWithdraw

function canWithdraw(uint256 assets) public view returns (bool)

Check if the withdrawal can be done

Parameters

NameTypeDescription

assets

uint256

The amount of assets to withdraw

Return Values

NameTypeDescription

[0]

bool

True if the withdrawal can be done

setWithdrawalEscrow

function setWithdrawalEscrow(contract WithdrawalEscrowV2 _escrow) external

Set the withdrawal escrow

The escrow must have the vault set to this vault @dev existing escrow debt must be zero

Parameters

NameTypeDescription

_escrow

contract WithdrawalEscrowV2

The address of the withdrawal escrow

endEpoch

function endEpoch() external

End the current epoch

Only the harvester can end the epoch anytime for other The epoch can only be ended if the last epoch was ended at least LOCK_INTERVAL seconds ago

liquidationRequest

function liquidationRequest(uint256 assets) external

Do liquidation request to delegators

Only the harvester can do the liquidation request

Parameters

NameTypeDescription

assets

uint256

The amount of assets to liquidate

_liquidationRequest

function _liquidationRequest(uint256 assets) internal

Do liquidation request to delegators

Parameters

NameTypeDescription

assets

uint256

The amount of assets to liquidate

delegatorWithdrawRequest

function delegatorWithdrawRequest(contract IDelegator delegator, uint256 assets) external

Withdraw from speicific delegator

Parameters

NameTypeDescription

delegator

contract IDelegator

The address of the delegator

assets

uint256

The amount of assets to withdraw

resolveDebt

function resolveDebt() external

Resolve the debt

createDelegator

function createDelegator(address _operator) external

Create a new delegator

Parameters

NameTypeDescription

_operator

address

The address of the operator

dropDelegator

function dropDelegator(address _delegator) external

Drop a delegator

Parameters

NameTypeDescription

_delegator

address

The address of the delegator

harvest

function harvest() external

Harvest the profit

collectDelegatorDebt

function collectDelegatorDebt() external

Collect the delegator debt

will withdraw the liquid assets from the delegators

withdrawFromDelegator

function withdrawFromDelegator(address _delegator) external

TODO check for price change on profit and loss

_getDelegatorLiquidAssets

function _getDelegatorLiquidAssets(uint256 requiredVaultAssets) internal

Get the delegator liquid assets

Each time this will check the vault assets, if it meets required assets then it will stop

Parameters

NameTypeDescription

requiredVaultAssets

uint256

The amount of liquid assets required in vault

delegateToDelegator

function delegateToDelegator(address _delegator, uint256 amount) external

Delegate the assets to the delegator

Parameters

NameTypeDescription

_delegator

address

The address of the delegator

amount

uint256

The amount of assets to delegate

lockedProfit

function lockedProfit() public view virtual returns (uint256)

Current locked profit amount.

Profit unlocks uniformly over LOCK_INTERVAL seconds after the last harvest

totalAssets

function totalAssets() public view returns (uint256)

Get the total assets

vaultAssets

function vaultAssets() public view returns (uint256)

Get the vault liquid assets

setManagementFee

function setManagementFee(uint256 feeBps) external

Set the management fee

setWithdrawalFee

function setWithdrawalFee(uint256 feeBps) external

Set the withdrawal fee

getRate

function getRate() external view returns (uint256)

returns the per share assets

UltraLRTRouter

handle deposits from native, weth, stEth, wStEth to vaults

weth

contract IWETH weth

stEth

contract IStEth stEth

wStEth

contract IWSTETH wStEth

permit2

contract IPermit2 permit2

initialize

function initialize(address _governance, address _weth, address _stEth, address _wStEth, address _permit2) external

Initialize the contract

Parameters

NameTypeDescription

_governance

address

Governance address

_weth

address

WETH address

_stEth

address

stETH address

_wStEth

address

wstETH address

_permit2

address

Permit2 address

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

Upgrade the contract

Parameters

NameTypeDescription

newImplementation

address

New implementation address

pause

function pause() external

Pause the contract

unpause

function unpause() external

Unpause the contract

receive

receive() external payable

Fallback function to receive native tokens

depositNative

function depositNative(address vault, address to) public payable

Deposit native tokens to vault

Parameters

NameTypeDescription

vault

address

Vault address

to

address

Receiver address

_processNativeDeposit

function _processNativeDeposit(uint256 amount, address vault, address to) internal

Deposit native tokens to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

_receiveAssetFromThroughPermit2

function _receiveAssetFromThroughPermit2(address token, uint256 amount, uint256 nonce, uint256 deadline, bytes signature) internal

Receive asset from user through permit2

Parameters

NameTypeDescription

token

address

Token address

amount

uint256

Amount to receive

nonce

uint256

Nonce

deadline

uint256

Deadline of the permit2 approval

signature

bytes

Signature of the permit2 approval

depositWeth

function depositWeth(uint256 amount, address vault, address to, uint256 nonce, uint256 deadline, bytes signature) external

Deposit WETH to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

nonce

uint256

Nonce

deadline

uint256

Deadline of the permit2 approval

signature

bytes

Signature of the permit2 approval

depositStEth

function depositStEth(uint256 amount, address vault, address to, uint256 nonce, uint256 deadline, bytes signature) external

Deposit stETH to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

nonce

uint256

Nonce

deadline

uint256

Deadline of the permit2 approval

signature

bytes

Signature of the permit2 approval

depositWStEth

function depositWStEth(uint256 amount, address vault, address to, uint256 nonce, uint256 deadline, bytes signature) external

Deposit wStETH to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

nonce

uint256

Nonce

deadline

uint256

Deadline of the permit2 approval

signature

bytes

Signature of the permit2 approval

_processDepositFromStEth

function _processDepositFromStEth(uint256 amount, address vault, address to) internal

Process deposit from stEth

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

_depositStEthToVault

function _depositStEthToVault(uint256 amount, address vault, address to) internal

Deposit stEth to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

_depositWStEthToVault

function _depositWStEthToVault(uint256 amount, address vault, address to) internal

Deposit wStEth to vault

Parameters

NameTypeDescription

amount

uint256

Amount to deposit

vault

address

Vault address

to

address

Receiver address

UltraLRTStorage

DelegatorInfo

struct DelegatorInfo {
  bool isActive;
  uint248 balance;
}

GUARDIAN_ROLE

bytes32 GUARDIAN_ROLE

HARVESTER

bytes32 HARVESTER

MAX_BPS

uint256 MAX_BPS

MAX_DELEGATOR

uint256 MAX_DELEGATOR

ST_ETH_TRANSFER_BUFFER

uint256 ST_ETH_TRANSFER_BUFFER

depositPaused

uint256 depositPaused

STETH

contract IStEth STETH

escrow

contract WithdrawalEscrowV2 escrow

beacon

address beacon

delegatorFactory

address delegatorFactory

delegatorAssets

uint256 delegatorAssets

managementFee

uint256 managementFee

Fee charged to vault over a year, number is in bps

withdrawalFee

uint256 withdrawalFee

Fee charged on redemption of shares, number is in bps

lastHarvest

uint256 lastHarvest

A timestamp representing when the most recent harvest occurred.

Since the time since the last harvest is used to calculate management fees, this is set to block.timestamp (instead of 0) during initialization.

maxLockedProfit

uint256 maxLockedProfit

The amount of profit originally locked after harvesting from a strategy

LOCK_INTERVAL

uint256 LOCK_INTERVAL

Amount of time in seconds that profit takes to fully unlock. See lockedProfit().

delegatorQueue

contract IDelegator[50] delegatorQueue

delegatorMap

mapping(address => struct UltraLRTStorage.DelegatorInfo) delegatorMap

delegatorCount

uint256 delegatorCount

lastEpochTime

uint256 lastEpochTime

maxUnresolvedEpochs

uint256 maxUnresolvedEpochs

whenDepositNotPaused

modifier whenDepositNotPaused()

WithdrawalEscrowV2

Escrow contract for withdrawal requests

asset

contract ERC20 asset

The vault asset.

vault

contract UltraLRT vault

The vault this escrow attached to.

userDebtShare

mapping(uint256 => mapping(address => uint256)) userDebtShare

EpochInfo

struct EpochInfo {
  uint128 shares;
  uint128 assets;
}

currentEpoch

uint256 currentEpoch

resolvingEpoch

uint256 resolvingEpoch

totalDebt

uint256 totalDebt

epochInfo

mapping(uint256 => struct WithdrawalEscrowV2.EpochInfo) epochInfo

constructor

constructor(contract UltraLRT _vault) public

Parameters

NameTypeDescription

_vault

contract UltraLRT

UltraLRT vault address

onlyVault

modifier onlyVault()

Modifier to allow function calls only from the vault

onlyGovernance

modifier onlyGovernance()

Modifier to allow function calls only from the governance

WithdrawalRequest

event WithdrawalRequest(address user, uint256 epoch, uint256 shares)

Withdrawal Request event

will makes things easy to search for each user withdrawal requests

Parameters

NameTypeDescription

user

address

user address

epoch

uint256

epoch of the request

shares

uint256

withdrawal vault shares

registerWithdrawalRequest

function registerWithdrawalRequest(address user, uint256 shares) external

Register withdrawal request as debt

Parameters

NameTypeDescription

user

address

user address

shares

uint256

amount of vault shares user requested to withdraw

endEpoch

function endEpoch() external

End the epoch

will be called by the vault after closing a position

getDebtToResolve

function getDebtToResolve() external view returns (uint256)

Get the debt to resolve

Return Values

NameTypeDescription

[0]

uint256

amount of debt to resolve

resolveDebtShares

function resolveDebtShares() external

resolve the locked shares for current epoch

This function will be triggered after closing a position will check for available shares to burn after resolving vault will send the assets to escrow and burn the share

redeemMultiEpoch

function redeemMultiEpoch(address user, uint256[] epochs) public returns (uint256 totalAssets)

Redeem multiple epochs

Parameters

NameTypeDescription

user

address

user address

epochs

uint256[]

withdrawal request epochs

Return Values

NameTypeDescription

totalAssets

uint256

received

redeem

function redeem(address user, uint256 epoch) public returns (uint256)

Redeem withdrawal request

Parameters

NameTypeDescription

user

address

address

epoch

uint256

withdrawal request epoch

Return Values

NameTypeDescription

[0]

uint256

received assets

_epochSharesToAssets

function _epochSharesToAssets(address user, uint256 epoch) internal view returns (uint256)

Convert epoch shares to assets

Parameters

NameTypeDescription

user

address

User address

epoch

uint256

withdrawal request epoch

Return Values

NameTypeDescription

[0]

uint256

converted assets

canWithdraw

function canWithdraw(uint256 epoch) public view returns (bool)

Check if an epoch is completed or not

Parameters

NameTypeDescription

epoch

uint256

Epoch number

Return Values

NameTypeDescription

[0]

bool

True if epoch is completed

withdrawableAssets

function withdrawableAssets(address user, uint256 epoch) public view returns (uint256)

Get withdrawable assets of a user

Parameters

NameTypeDescription

user

address

User address

epoch

uint256

The vault epoch

Return Values

NameTypeDescription

[0]

uint256

Amount of assets user will receive

withdrawableShares

function withdrawableShares(address user, uint256 epoch) public view returns (uint256)

Get withdrawable shares of a user

Parameters

NameTypeDescription

user

address

user address

epoch

uint256

requests epoch

Return Values

NameTypeDescription

[0]

uint256

amount of shares to withdraw

getAssets

function getAssets(address user, uint256[] epochs) public view returns (uint256 assets)

Get total withdrawable assets of a user for multiple epochs

Parameters

NameTypeDescription

user

address

User address

epochs

uint256[]

withdrawal request epochs

Return Values

NameTypeDescription

assets

uint256

total withdrawable assets

sweep

function sweep(address _asset) external

sweep the assets to governance

only use case in case of emergency

Parameters

NameTypeDescription

_asset

address

Asset address

Last updated