Whenever A user deposits tokens to vault, vault create a leverage position depending[delta or delta neutral] in the GMX POOl. performing a proportional deposit is not optimal in every case and depositng tokens in such case will result in fewer LP tokens due to sub optimal trade. Eventually leading to a loss of gain for the strategy vault
Alice deposits token A() into the vault to make Delta.Neutral position
vault refer to deposit to GMXDeposit library to execute the further logic
https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/strategy/gmx/GMXDeposit.sol#L54
which calls calcBorrow on GMXManager Library for borrowing assets and making the position IN GMX POOL
https://github.com/Cyfrin/2023-10-SteadeFi/blob/main/contracts/strategy/gmx/GMXManager.sol#L70
Here it consider the current reserve ratio of the pool and deposits in the same ratio.
While GMX docs clearly state that If deposits try to create balance in the pool[depositing in such way which will make actual token weight of index Token towards the TOKEN_WEIGHT defined in the pool] will get benefit technically more LP tokens and oppose to this less LP token if current deposits imbalance the Pool reserve the ratio
Reference
Even Curve pools work in the same way. Depositer get benefit if they try to balance the pool reserve making them optimal
It is clear that Weight of index token will not be always near equal to the Defined Total_Weight of the Pool.
So if the pool is imbalanced Depositing into GMXPool will not give optimal returns( resulting in fewer LP token), eventually leading to the loss of gain for the depositers affecting net APR
Manual Review
consider implementing check and if the pool is imablanced depositing(making levearge position) towards balancing the Index Token's weight will give optimal returns[extra LP tokens ]
More of a design choice. Leaving open for now for the sponsor's review.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.