-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in retireCarbonSpecific #25
Comments
Reported by Discord user aliad010#0292 |
@mahdiGhorbanzadeh thanks for the heads up! I'm not sure I follow where this bug is going though. Let's trace through the function call using your example values.
A quick note on the values supplied to the
|
hi @cujowolf. we agree that in our case this part execute
and gives us 4.95 for _amount and 0.05 for the fee.
also execute. and wrongly update the fee and _amount. |
when
executes and wrongly updates _amount (that is more than 4.95)
in the retireToucanSpecific function we got wrong value for _amount and fee and try to retire that wrong value. |
Ah yeah I see that now. Will get working on the fix here. |
great 👍 |
You can do something like this (add return in else) @cujowolf
or change check like this
|
Hi,there is a bug in retireCarbonSpecific when poolToken and sourceToken is not equal and amountInCarbon is false
example :
sourceToken : usdc
poolToken : bct
amountInCarbon:false
amount : 10 usdc
we consider 2 usdc equal to 1 bct
in this case _swapExactForCarbon return amount of bct (that is 4.95 bct if feeAmount is 1 %)
then because _amountInCarbon is false the below code also run:
and _amount updated here again with a value greater than the actual value that is 4.95
based on the calculations totalCarbon is 10 and _amount updated to something near to 9.9
in this case the above if must not be executed .
The text was updated successfully, but these errors were encountered: