Function: withdraw(uint256 side)

This function is to withdraw that withdraw is divided into FIXED or VARIABLE and vault conditions.

Inputs

  • side

    • Control: Arbitrary.

    • Constraints: It is expected FIXED or VARIABLE value.

    • Impact: The value of side.

Branches and code coverage

Intended branches

  • Before vault starts, during, and after it ends, execute withdraw divided into each side.

Negative behavior

  • Reverts if the side is not FIXED or VARIABLE.

  • Reverts if all kinds of WithdrawalRequestIdss' length is not zero.

  • Reverts if the claimBalance is smaller than one.

  • Reverts if the sendAmount is smaller than one.

  • Reverts if the feeEarningsShare is smaller than one.

Function call analysis

  • this.requestWithdrawViaShares(msg.sender, claimBalance) -> LidoVault.lido.getPooledEthByShares(shares)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.requestWithdrawViaShares(msg.sender, claimBalance) -> this.requestWithdrawViaETH(user, stETHAmount) -> this._requestWithdraw(user, stETHAmount) -> LidoVault.lido.approve(address(LidoVault.lidoWithdrawalQueue), stETHAmount)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.requestWithdrawViaShares(msg.sender, claimBalance) -> this.requestWithdrawViaETH(user, stETHAmount) -> this._requestWithdraw(user, stETHAmount) -> LidoVault.lidoWithdrawalQueue.requestWithdrawals(amounts, address(this))

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.stakingBalance() -> LidoVault.lido.balanceOf(address(this))

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • Math.mulDiv(lidoStETHBalance, initialDepositAmount, fixedETHDeposits)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.calculateVariableWithdrawState(lidoStETHBalance - fixedETHDeposits + this.withdrawnStakingEarnings + this.totalProtocolFee, Math.mulDiv(this.variableToWithdrawnStakingEarnings[msg.sender], 10000, 10000 - this.protocolFeeBps)) -> Math.mulDiv(bearerBalance, totalEarnings, this.variableSideCapacity)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • Math.mulDiv(this.variableToWithdrawnStakingEarnings[msg.sender], 10000, 10000 - this.protocolFeeBps)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • Math.mulDiv(ethAmountOwed, this.protocolFeeBps, 10000)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • Math.mulDiv(currentState, this.protocolFeeBps, 10000)

    • What is controllable? None.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> this.claimWithdrawals(msg.sender, requestIds) -> this._claimWithdrawals(user, requestIds) -> LidoVault.lidoWithdrawalQueue.claimWithdrawal(requestIds[i])

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> this.calculateFixedEarlyExitFees(upfrontPremium, request.timestamp) -> Math.mulDiv(this.endTime > timestampRequested ? this.endTime - timestampRequested : 0, 1000000000000000000, this.duration)

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> this.calculateFixedEarlyExitFees(upfrontPremium, request.timestamp) -> Math.mulDiv(upfrontPremium, Math.mulDiv(1 + this.earlyExitFeeBps, remainingProportion, 1000000000000000000), 10000)

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> this.calculateFixedEarlyExitFees(upfrontPremium, request.timestamp) -> Math.mulDiv(1 + this.earlyExitFeeBps, remainingProportion, 1000000000000000000)

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> this.calculateFixedEarlyExitFees(upfrontPremium, request.timestamp) -> Math.mulDiv(upfrontPremium, timestampRequested - this.startTime, this.duration)

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> this.claimOngoingFixedWithdrawals() -> this.claimFixedVaultOngoingWithdrawal(fixedUser) -> Math.min(earlyExitFees, amountWithdrawn)

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

  • this.vaultEndedWithdraw(side) -> Math.mulDiv(this.fixedBearerToken[msg.sender], this.vaultEndedFixedDepositsFunds, this.fixedLidoSharesTotalSupply())

    • What is controllable? side.

    • If the return value is controllable, how is it used and how can it go wrong? None.

    • What happens if it reverts, reenters or does other unusual control flow? N/A.

Zellic © 2024Back to top ↑