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 vaultasset
contract ERC20 assetonlyVaultOrHarvester
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) externalDelegate & restake stETH to operator
_delegate
function _delegate(uint256 amount) internal virtualDelegate stETH to operator
requestWithdrawal
function requestWithdrawal(uint256 assets) externalRequest withdrawal from eigenlayer
Request withdrawal from eigenlayer
Parameters
assets
uint256
Amount to withdraw
_requestWithdrawal
function _requestWithdrawal(uint256 assets) internal virtualRequest withdrawal from eigenlayer
withdraw
function withdraw() external virtualWithdraw stETH from delegator to vault
totalLockedValue
function totalLockedValue() public view virtual returns (uint256)Get total locked value
Return Values
[0]
uint256
Total locked value
withdrawableAssets
function withdrawableAssets() public view virtual returns (uint256)Get withdrawable assets
Return Values
[0]
uint256
Amount of withdrawable assets
queuedAssets
function queuedAssets() public view virtual returns (uint256)Get queued assets
Return Values
[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_ROLEAPPROVED_TOKEN
bytes32 APPROVED_TOKENWETH
contract IWETH WETHbalance
mapping(address => mapping(address => uint256)) balancedepositPaused
uint256 depositPausedwhenDepositNotPaused
modifier whenDepositNotPaused()pauseDeposit
function pauseDeposit() externalresumeDeposit
function resumeDeposit() externalapproveToken
function approveToken(address _token) externalrevokeToken
function revokeToken(address _token) externalDeposit
event Deposit(uint256 eventId, address depositor, address token, uint256 amount)depositFor
function depositFor(address _token, address _for, uint256 _amount) externaldepositETHFor
function depositETHFor(address _for) external payableWithdraw
event Withdraw(uint256 eventId, address withdrawer, address token, uint256 amount)withdraw
function withdraw(address _token, uint256 _amount) externalpause
function pause() externalPause the contract
unpause
function unpause() externalUnpause the contract
IDelegatorBeacon
owner
function owner() external returns (address)DelegatorBeacon
Delegator Beacon contract
beacon
contract UpgradeableBeacon beaconblueprint
address blueprintconstructor
constructor(address _initBlueprint, address governance) publicConstructor
Parameters
_initBlueprint
address
Initial blueprint address
governance
address
Governance address
update
function update(address _newBlueprint) publicUpdate the blueprint
Parameters
_newBlueprint
address
New blueprint address
implementation
function implementation() public view returns (address)Get the implementation address
Return Values
[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 vaultonlyVault
modifier onlyVault()Modifier to allow function calls only from the vault
constructor
constructor(address _vault) publicConstructor
Parameters
_vault
address
Vault address
createDelegator
function createDelegator(address _operator) external returns (address)Create a new delegator
Parameters
_operator
address
Operator address
Return Values
[0]
address
Delegator address
EigenDelegator
Delegator contract for stETH on Eigenlayer
STRATEGY_MANAGER
contract IStrategyManager STRATEGY_MANAGERStrategyManager for Eigenlayer
DELEGATION_MANAGER
contract IDelegationManager DELEGATION_MANAGERDelegationManager for Eigenlayer
STAKED_ETH_STRATEGY
contract IStrategy STAKED_ETH_STRATEGYstETH strategy on Eigenlayer
withdrawals
mapping(bytes32 => uint256) withdrawalsinitialize
function initialize(address _vault, address _operator) externalInitialize the contract
Parameters
_vault
address
Vault address
_operator
address
Operator address
currentOperator
address currentOperatorstETH
contract IStEth stETHqueuedShares
uint256 queuedShares_delegate
function _delegate(uint256 amount) internalModifier to allow function calls only from the vault or harvester
Delegate & restake stETH to operator on Eigenlayer
Parameters
amount
uint256
Amount to delegate
_requestWithdrawal
function _requestWithdrawal(uint256 assets) internalRequest withdrawal from eigenlayer
Parameters
assets
uint256
Amount to withdraw
completeWithdrawalRequest
function completeWithdrawalRequest(struct WithdrawalInfo[] withdrawalInfo) externalComplete withdrawal request
Parameters
withdrawalInfo
struct WithdrawalInfo[]
Withdrawal info
recordWithdrawalsRequest
function recordWithdrawalsRequest(struct WithdrawalInfo withdrawal) externalRecord withdrawal request from External requests
Parameters
withdrawal
struct WithdrawalInfo
Withdrawal info
withdraw
function withdraw() externalWithdraw stETH from delegator to vault
withdrawableAssets
function withdrawableAssets() public view returns (uint256)Get withdrawable assets
Return Values
[0]
uint256
withdrawable assets
queuedAssets
function queuedAssets() public view returns (uint256)Get queued assets
Return Values
[0]
uint256
queued assets
_delegateToOperator
function _delegateToOperator() internalDelegate to operator
IDelegator
requestWithdrawal
function requestWithdrawal(uint256 assets) externalcheckAssetAvailability
function checkAssetAvailability(uint256 assets) external view returns (bool)delegate
function delegate(uint256 amount) externalwithdraw
function withdraw() externaltotalLockedValue
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 vaultonlyVault
modifier onlyVault()Modifier to allow function calls only from the vault
constructor
constructor(address _vault) publicConstructor
Parameters
_vault
address
Vault address
createDelegator
function createDelegator(address _collateral) external returns (address proxy)Create a new delegator
Parameters
_collateral
address
Collateral address
Return Values
proxy
address
Delegator address
SymbioticDelegator
Delegator contract for wStETH on Symbiotic
collateral
contract IDefaultCollateral collateralinitialize
function initialize(address _vault, address _collateral) externalInitialize the contract
Parameters
_vault
address
Vault address
_collateral
address
Collateral address
_delegate
function _delegate(uint256 amount) internalDelegate & restake wStETH to operator on Symbiotic
Parameters
amount
uint256
Amount to delegate
_requestWithdrawal
function _requestWithdrawal(uint256 assets) internalRequest withdrawal from Symbiotic
Parameters
assets
uint256
Amount to withdraw
withdrawableAssets
function withdrawableAssets() public view returns (uint256)Get the withdrawable assets
Return Values
[0]
uint256
withdrawable assets
queuedAssets
function queuedAssets() public view returns (uint256)Get the queued assets
Return Values
[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) externalInitialize the UltraLRT contract
Parameters
_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) internalUpgrade the UltraLRT contract
Parameters
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
[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
[0]
uint256
The maximum amount of shares that can be minted
setDelegatorFactory
function setDelegatorFactory(address _factory) externalset the delegator factory
factory must have the vault set to this vault
Parameters
_factory
address
The address of the delegator factory
setMaxUnresolvedEpochs
function setMaxUnresolvedEpochs(uint256 _maxUnresolvedEpochs) externalset max unresolved epoch
delegation of assets will be stopped if the unresolved epoch is greater than the max unresolved epoch
Parameters
_maxUnresolvedEpochs
uint256
The maximum unresolved epoch
pause
function pause() externalPause the contract
unpause
function unpause() externalUnpause 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() externalPause the deposit
unpauseDeposit
function unpauseDeposit() externalUnpause the deposit
deposit
function deposit(uint256 assets, address receiver) public returns (uint256)Deposit assets into the vault
Parameters
assets
uint256
receiver
address
The address of the receiver
Return Values
[0]
uint256
The amount of shares minted
mint
function mint(uint256 shares, address receiver) public returns (uint256)mint specific amount of shares
Parameters
shares
uint256
The amount of shares to mint
receiver
address
The address of the receiver
Return Values
[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
assets
uint256
The amount of assets to withdraw
receiver
address
The address of the receiver
owner
address
The address of the owner
Return Values
[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
shares
uint256
The amount of shares to redeem
receiver
address
The address of the receiver
owner
address
The address of the owner
Return Values
[0]
uint256
The amount of assets redeemed
_withdraw
function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares) internalwithdraw from the vault
Parameters
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
assets
uint256
The amount of assets to withdraw
Return Values
[0]
bool
True if the withdrawal can be done
setWithdrawalEscrow
function setWithdrawalEscrow(contract WithdrawalEscrowV2 _escrow) externalSet the withdrawal escrow
The escrow must have the vault set to this vault @dev existing escrow debt must be zero
Parameters
_escrow
contract WithdrawalEscrowV2
The address of the withdrawal escrow
endEpoch
function endEpoch() externalEnd 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) externalDo liquidation request to delegators
Only the harvester can do the liquidation request
Parameters
assets
uint256
The amount of assets to liquidate
_liquidationRequest
function _liquidationRequest(uint256 assets) internalDo liquidation request to delegators
Parameters
assets
uint256
The amount of assets to liquidate
delegatorWithdrawRequest
function delegatorWithdrawRequest(contract IDelegator delegator, uint256 assets) externalWithdraw from speicific delegator
Parameters
delegator
contract IDelegator
The address of the delegator
assets
uint256
The amount of assets to withdraw
resolveDebt
function resolveDebt() externalResolve the debt
createDelegator
function createDelegator(address _operator) externalCreate a new delegator
Parameters
_operator
address
The address of the operator
dropDelegator
function dropDelegator(address _delegator) externalDrop a delegator
Parameters
_delegator
address
The address of the delegator
harvest
function harvest() externalHarvest the profit
collectDelegatorDebt
function collectDelegatorDebt() externalCollect the delegator debt
will withdraw the liquid assets from the delegators
withdrawFromDelegator
function withdrawFromDelegator(address _delegator) externalTODO check for price change on profit and loss
_getDelegatorLiquidAssets
function _getDelegatorLiquidAssets(uint256 requiredVaultAssets) internalGet the delegator liquid assets
Each time this will check the vault assets, if it meets required assets then it will stop
Parameters
requiredVaultAssets
uint256
The amount of liquid assets required in vault
delegateToDelegator
function delegateToDelegator(address _delegator, uint256 amount) externalDelegate the assets to the delegator
Parameters
_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) externalSet the management fee
setWithdrawalFee
function setWithdrawalFee(uint256 feeBps) externalSet 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 wethstEth
contract IStEth stEthwStEth
contract IWSTETH wStEthpermit2
contract IPermit2 permit2initialize
function initialize(address _governance, address _weth, address _stEth, address _wStEth, address _permit2) externalInitialize the contract
Parameters
_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) internalUpgrade the contract
Parameters
newImplementation
address
New implementation address
pause
function pause() externalPause the contract
unpause
function unpause() externalUnpause the contract
receive
receive() external payableFallback function to receive native tokens
depositNative
function depositNative(address vault, address to) public payableDeposit native tokens to vault
Parameters
vault
address
Vault address
to
address
Receiver address
_processNativeDeposit
function _processNativeDeposit(uint256 amount, address vault, address to) internalDeposit native tokens to vault
Parameters
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) internalReceive asset from user through permit2
Parameters
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) externalDeposit WETH to vault
Parameters
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) externalDeposit stETH to vault
Parameters
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) externalDeposit wStETH to vault
Parameters
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) internalProcess deposit from stEth
Parameters
amount
uint256
Amount to deposit
vault
address
Vault address
to
address
Receiver address
_depositStEthToVault
function _depositStEthToVault(uint256 amount, address vault, address to) internalDeposit stEth to vault
Parameters
amount
uint256
Amount to deposit
vault
address
Vault address
to
address
Receiver address
_depositWStEthToVault
function _depositWStEthToVault(uint256 amount, address vault, address to) internalDeposit wStEth to vault
Parameters
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_ROLEHARVESTER
bytes32 HARVESTERMAX_BPS
uint256 MAX_BPSMAX_DELEGATOR
uint256 MAX_DELEGATORST_ETH_TRANSFER_BUFFER
uint256 ST_ETH_TRANSFER_BUFFERdepositPaused
uint256 depositPausedSTETH
contract IStEth STETHescrow
contract WithdrawalEscrowV2 escrowbeacon
address beacondelegatorFactory
address delegatorFactorydelegatorAssets
uint256 delegatorAssetsmanagementFee
uint256 managementFeeFee charged to vault over a year, number is in bps
withdrawalFee
uint256 withdrawalFeeFee charged on redemption of shares, number is in bps
lastHarvest
uint256 lastHarvestA 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 maxLockedProfitThe amount of profit originally locked after harvesting from a strategy
LOCK_INTERVAL
uint256 LOCK_INTERVALAmount of time in seconds that profit takes to fully unlock. See lockedProfit().
delegatorQueue
contract IDelegator[50] delegatorQueuedelegatorMap
mapping(address => struct UltraLRTStorage.DelegatorInfo) delegatorMapdelegatorCount
uint256 delegatorCountlastEpochTime
uint256 lastEpochTimemaxUnresolvedEpochs
uint256 maxUnresolvedEpochswhenDepositNotPaused
modifier whenDepositNotPaused()WithdrawalEscrowV2
Escrow contract for withdrawal requests
asset
contract ERC20 assetThe vault asset.
vault
contract UltraLRT vaultThe vault this escrow attached to.
userDebtShare
mapping(uint256 => mapping(address => uint256)) userDebtShareEpochInfo
struct EpochInfo {
uint128 shares;
uint128 assets;
}currentEpoch
uint256 currentEpochresolvingEpoch
uint256 resolvingEpochtotalDebt
uint256 totalDebtepochInfo
mapping(uint256 => struct WithdrawalEscrowV2.EpochInfo) epochInfoconstructor
constructor(contract UltraLRT _vault) publicParameters
_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
user
address
user address
epoch
uint256
epoch of the request
shares
uint256
withdrawal vault shares
registerWithdrawalRequest
function registerWithdrawalRequest(address user, uint256 shares) externalRegister withdrawal request as debt
Parameters
user
address
user address
shares
uint256
amount of vault shares user requested to withdraw
endEpoch
function endEpoch() externalEnd 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
[0]
uint256
amount of debt to resolve
resolveDebtShares
function resolveDebtShares() externalresolve 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
user
address
user address
epochs
uint256[]
withdrawal request epochs
Return Values
totalAssets
uint256
received
redeem
function redeem(address user, uint256 epoch) public returns (uint256)Redeem withdrawal request
Parameters
user
address
address
epoch
uint256
withdrawal request epoch
Return Values
[0]
uint256
received assets
_epochSharesToAssets
function _epochSharesToAssets(address user, uint256 epoch) internal view returns (uint256)Convert epoch shares to assets
Parameters
user
address
User address
epoch
uint256
withdrawal request epoch
Return Values
[0]
uint256
converted assets
canWithdraw
function canWithdraw(uint256 epoch) public view returns (bool)Check if an epoch is completed or not
Parameters
epoch
uint256
Epoch number
Return Values
[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
user
address
User address
epoch
uint256
The vault epoch
Return Values
[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
user
address
user address
epoch
uint256
requests epoch
Return Values
[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
user
address
User address
epochs
uint256[]
withdrawal request epochs
Return Values
assets
uint256
total withdrawable assets
sweep
function sweep(address _asset) externalsweep the assets to governance
only use case in case of emergency
Parameters
_asset
address
Asset address
Last updated