Open hats-bug-reporter[bot] opened 6 months ago
At first I got confused about this too, but it turns out the comments are wrong, the curve pool is correct: "Actually coin0 is CVX1 and coin1 is cvgCVX so the side is correct for the get_dy and the exchange (you can check the order of the coins in the convex-fixture at the deployment of the curve pool)"
Github username: -- Twitter username: -- Submission hash (on-chain): 0xffc3d587d0270c23b1a00817a61891e2057aa0f433cba7a38cdfa8ea6d506fb9 Severity: high
Description: Description\ Let's examine
_convertCvxToCvgCvx
.The function does 2 calls to
curvePool
, callingget_dy
and potentiallyexchange
.When either of these 2 functions are called, the first two parameters specify
tokenIn
andtokenOut
, represented with id's.Since the pool is CvgCvx/CVX1, CvgCvx will be 0 and CVX1 will be 1.
Knowing this, the 2 calls are wrong, as for
tokenIn
we are using 0, meaning CvgCvx and fortokenOut
we are using 1, meaning CVX1.This is especially problematic in
curvePool.exchange
as we are supposed to swapCVX1 -> CvgCvx
and we call:In reality we are doing the oposite, as CvgCvx = 0 and CVX1 = 1, we are attempting to swap
CvgCvx -> CVX1
since the first value istokenIn
and the second istokenOut
.This is an issue all throught the code, wherever we are calling
curvePool
. Assuming that the comment above the variable is correct, this is an issue.Attachments
Proof of Concept (PoC) File PoC in comments
Revised Code File (Optional) If the pool will be
cvgCvx/CVX1
then the indeces for the tokens will becvgCvx = 0
andCVX1 = 1
and that's how they should be used in the protocol.