-
Notifications
You must be signed in to change notification settings - Fork 29
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
Inconsistent use of return and input arguments in (pool) redeemAuto()/redeemAuto2() and (tco2) retire() #5
Comments
Aside from the fact that
I think this is the way to go. Fixing it in the OffsetHelper feels like patchwork to me. Fixing the root problem here is better. I'll take this internally and see if the guys have any objections to such a check. Otherwise, we should be able to upgrade the core pool contracts soon. |
I'm literally just realizing it's super hard to work around Solidity's intricacies (can't really delete an item from an array, can't create dynamic arrays, etc) |
Just fixed the |
Just wanted to update this and say that we have merged a fix in the core contracts so they do not return TCO2s with |
@danceratopz this is finally fixed for NCT in Polygon Mainnet and soon we will release the fix for BCT too. I am going to close this issue but feel free to reopen if it persists. Thanks! |
Great, thanks for heads up @0xmichalis! |
This is fixed now also in BCT cc @cujowolf |
This is a minor issue that impacts developers working directly with the Toucan core contracts.
redeemAuto()
andredeemAuto2()
return arrays of TCO2 addresses and corresponding amounts that were redeemed in exchange for the pool token. These arrays contain entries corresponding to the TCO2s with the lowest scores fromscoredTCO2s
. In particular, if the lowest scored TCO2 is not present in the NCT pool (i.e., the pool has balance 0) then these functions still return the TCO2 address with a corresponding entry of 0 in theamounts
array.retire()
function (from ToucanCarbonOffsets.sol) takes a uint256 specifying theamount
to retire. If this value is zero the transaction gets reverted, as_retire()
then callsregisterEvent()
fromRetirementCertifiates.sol
which understandably requires that amount to be non-zero, see:contracts/contracts/RetirementCertificates.sol
Line 137 in cf3d9e5
A user would intuitively expect to be able to loop over the outputs of
redeemAuto()
and provide them toretire()
as inputs, which is currently the case in theOffsetHelper
, see example-implementations/blob/d5e6...94cf8/contracts/OffsetHelper.sol#L494.Perhaps it would be better to remove TCO2 addresses with corresponding amount 0 from the output of the redeemAuto functions?
The background that led to this observation is described in ToucanProtocol/example-implementations#31.
The text was updated successfully, but these errors were encountered: