QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: high
Invalid

Wrong values passed during initialization of pool leading to loss of opportunity

the price of is either decreasing or increasing and the user wan't not to miss the opportunity however he can't change his possition as multiplier is 0

Summary

During the initialization of the pool initial weights is being set with initial values for both

  • lastPossibleInterpolationTime

  • lastUpdateIntervalTime
    to block.timestamp

This is the apply in _setInitialWeights called from initialize

File: QuantAMMWeightedPool.sol
679: //struct allows one SSTORE
680: poolSettings.quantAMMBaseInterpolationDetails = QuantAMMBaseInterpolationVariables({
681: lastPossibleInterpolationTime: uint40(block.timestamp), //given muliplier is 0 on start
682: lastUpdateIntervalTime: uint40(block.timestamp)
683: });

So initial multiplier is zero

Updating weights might be 1 hour or 1 day depends on updateInterval value
during that time weights move according to multiplier and time since lastupdate in the initial state till the update it will always be zero

during this time there is a severe issue where any swaps from or to the pool weights won't change causing loss of opportunity to LPs

Scenario

Assume pool with of 2 tokens USDC and WETH with weights:

  • WETH = 6.97e17

  • USDC = 3.03e17

A huge drop of eth price happen in the time between initialization and update

the eth price became 1300 no reflection happens to the weights in the pool users can't swap nor add or remove liquidity due static weights losing opportunity for users

The time of impact depends on updateInterval value.

Impact

Loss of opportunity as weights won't get changed in this period

Tools Used

Manual review

Recommendations

Apply this change in _setInitialWeights function

-- lastPossibleInterpolationTime: uint40(block.timestamp), //given muliplier is 0 on start
++ lastPossibleInterpolationTime: uint40(block.timestamp + updateInterval ), //given muliplier is 0 on start
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Appeal created

rzizah Submitter
10 months ago
rzizah Submitter
10 months ago
n0kto Lead Judge
10 months ago
n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!