StETHQueueCore
validAddress
modifier validAddress(address value_)
validates that an address is not the zero address
_getLiquidityExchangePrice
function _getLiquidityExchangePrice() internal view returns (uint256 borrowExchangePrice_)
reads the current, updated borrow exchange price for Native ETH at Liquidity
ReentrancyGuard
ReentrancyGuard based on OpenZeppelin implementation. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/security/ReentrancyGuard.sol
REENTRANCY_NOT_ENTERED
uint8 REENTRANCY_NOT_ENTERED
REENTRANCY_ENTERED
uint8 REENTRANCY_ENTERED
constructor
constructor() internal
nonReentrant
modifier nonReentrant()
Prevents a contract from calling itself, directly or indirectly. See OpenZeppelin implementation for more info
StETHQueueAdmin
FluidStETHQueue admin related methods
onlyAuths
modifier onlyAuths()
only auths guard
isAuth
function isAuth(address auth_) public view returns (bool)
reads if a certain auth_
address is an allowed auth or not
isGuardian
function isGuardian(address guardian_) public view returns (bool)
reads if a certain guardian_
address is an allowed guardian or not
isUserAllowed
function isUserAllowed(address user_) public view returns (bool)
reads if a certain user_
address is an allowed user or not
isPaused
function isPaused() public view returns (bool)
reads if the protocol is paused or not
setAuth
function setAuth(address auth_, bool allowed_) external
Sets an address as allowed auth or not. Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
auth_ | address | address to set auth value for |
allowed_ | bool | bool flag for whether address is allowed as auth or not |
setGuardian
function setGuardian(address guardian_, bool allowed_) external
Sets an address as allowed guardian or not. Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
guardian_ | address | address to set guardian value for |
allowed_ | bool | bool flag for whether address is allowed as guardian or not |
setUserAllowed
function setUserAllowed(address user_, bool allowed_) external
Sets an address as allowed user or not. Only callable by auths.
Parameters
Name | Type | Description |
---|---|---|
user_ | address | address to set allowed value for |
allowed_ | bool | bool flag for whether address is allowed as user or not |
setMaxLTV
function setMaxLTV(uint16 maxLTV_) external
Sets maxLTV
to maxLTV_
(in 1e2: 1% = 100, 100% = 10000). Must be > 0 and < 100%.
pause
function pause() external
Pauses the protocol (blocks queue() and claim()). Only callable by guardians.
unpause
function unpause() external
Unpauses the protocol (enables queue() and claim()). Only callable by owner.
setAllowListActive
function setAllowListActive(bool status_) external
Sets allowListActive
flag to status_
. Only callable by owner.
FluidStETHQueue
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.
constructor
constructor(contract IFluidLiquidity liquidity_, contract ILidoWithdrawalQueue lidoWithdrawalQueue_, contract IERC20 stETH_) public
initialize
function initialize(address owner_) public
initializes the contract with owner_
as owner
receive
receive() external payable
_authorizeUpgrade
function _authorizeUpgrade(address) internal
renounceOwnership
function renounceOwnership() public view
override renounce ownership as it could leave the contract in an unwanted state if called by mistake.
queue
function queue(uint256 ethBorrowAmount_, uint256 stETHAmount_, address borrowTo_, address claimTo_) public returns (uint256 requestIdFrom_)
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.
Parameters
Name | Type | Description |
---|---|---|
ethBorrowAmount_ | uint256 | amount of ETH to borrow and send to borrowTo_ |
stETHAmount_ | uint256 | amount of stETH to queue at Lido Withdrawal Queue and use as collateral |
borrowTo_ | address | receiver of the ethBorrowAmount_ |
claimTo_ | address | receiver of the left over stETH funds at time of claim() |
Return Values
Name | Type | Description |
---|---|---|
requestIdFrom_ | uint256 | first request id at Lido withdrawal queue. Used to identify claims |
claim
function claim(address claimTo_, uint256 requestIdFrom_) public returns (uint256 claimedAmount_, uint256 repayAmount_)
claims all open requests at LidoWithdrawalQueue for claimTo_
, repays the borrowed ETH amount at Liquidity
and sends the rest of funds to claimTo_
.
Parameters
Name | Type | Description |
---|---|---|
claimTo_ | address | claimTo receiver to process the claim for |
requestIdFrom_ | uint256 | Lido requestId from (start), as emitted at time of queuing (queue() ) via LogQueue |
Return Values
Name | Type | Description |
---|---|---|
claimedAmount_ | uint256 | total amount of claimed stETH |
repayAmount_ | uint256 | total repaid ETH amount at Liquidity |
onERC721Received
function onERC721Received(address, address, uint256, bytes) public view returns (bytes4)
accept ERC721 token transfers ONLY from LIDO_WITHDRAWAL_QUEUE
liquidityCallback
function liquidityCallback(address, uint256, bytes) external pure
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.