FluidStETHQueue

Git Source

Inherits:Variables, StETHQueueCore, StETHQueueAdmin, UUPSUpgradeable

queues an amount of stETH at the Lido WithdrawalQueue, using it as collateral to borrow an amount of ETH that is paid back when Lido Withdrawal is claimable. Useful e.g. to deleverage a stETH / ETH borrow position. User target group are whales that want to deleverage stETH / ETH without having to swap (no slippage).

claims are referenced to via the claimTo address and the Lido requestIdFrom, which must be tracked from the moment of queuing, where it is emitted in the LogQueue event, to pass in that information later for claim().

For view methods / accessing data, use the "StETHResolver" periphery contract.

Functions

constructor

constructor(IFluidLiquidity liquidity_, ILidoWithdrawalQueue lidoWithdrawalQueue_, IERC20 stETH_)
    validAddress(address(liquidity_))
    validAddress(address(lidoWithdrawalQueue_))
    validAddress(address(stETH_))
    Variables(liquidity_, lidoWithdrawalQueue_, stETH_);

initialize

initializes the contract with owner_ as owner

function initialize(address owner_) public initializer validAddress(owner_);

receive

receive() external payable;

_authorizeUpgrade

function _authorizeUpgrade(address) internal override onlyOwner;

renounceOwnership

override renounce ownership as it could leave the contract in an unwanted state if called by mistake.

function renounceOwnership() public view override onlyOwner;

queue

queues an amount of stETH at the Lido WithdrawalQueue, using it as collateral to borrow an amount of ETH from Liquidity that is paid back when Lido Withdrawal is claimable, triggered with claim().

if allowListActive == true, then only allowed users can call this method.

function queue(uint256 ethBorrowAmount_, uint256 stETHAmount_, address borrowTo_, address claimTo_)
    public
    nonReentrant
    validAddress(borrowTo_)
    validAddress(claimTo_)
    returns (uint256 requestIdFrom_);

Parameters

NameTypeDescription
ethBorrowAmount_uint256amount of ETH to borrow and send to borrowTo_
stETHAmount_uint256amount of stETH to queue at Lido Withdrawal Queue and use as collateral
borrowTo_addressreceiver of the ethBorrowAmount_
claimTo_addressreceiver of the left over stETH funds at time of claim()

Returns

NameTypeDescription
requestIdFrom_uint256first request id at Lido withdrawal queue. Used to identify claims

claim

claims all open requests at LidoWithdrawalQueue for claimTo_, repays the borrowed ETH amount at Liquidity and sends the rest of funds to claimTo_.

function claim(address claimTo_, uint256 requestIdFrom_)
    public
    nonReentrant
    returns (uint256 claimedAmount_, uint256 repayAmount_);

Parameters

NameTypeDescription
claimTo_addressclaimTo receiver to process the claim for
requestIdFrom_uint256Lido requestId from (start), as emitted at time of queuing (queue()) via LogQueue

Returns

NameTypeDescription
claimedAmount_uint256total amount of claimed stETH
repayAmount_uint256total repaid ETH amount at Liquidity

onERC721Received

accept ERC721 token transfers ONLY from LIDO_WITHDRAWAL_QUEUE

function onERC721Received(address, address, uint256, bytes memory) public view returns (bytes4);

liquidityCallback

liquidityCallback as used by Liquidity -> But unsupported in this contract as it only ever uses native token as borrowed asset, which is repaid directly via msg.value. Always reverts.

function liquidityCallback(address, uint256, bytes calldata) external pure;