-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support calculating fees for atomic multi-TCO2 redemptions #35
Comments
This is interesting remark. Because each redemption / deposit is changing the composition the fee for next redeption / deposit for n+1 asset will change as well. We will look at this more thoroughly. |
Copying from #36 (review)
|
As mentioned in https://github.com/ToucanProtocol/tokenizer/pull/3210#discussion_r1456078288 I wonder if it makes sense to do this change ASAP, since it avoids another change to |
@aspiers I just realized today as part of looking into the interface refactoring that one question we'd need to answer is how to calculate the TCO2 amounts to redeem for the individual redemptions. Today we calculate the fee to be charged based on the provided amount, then deduct the fee from the amount and return If we supported the alternative option where the provided amounts are exactly what the user will be receiving, then it'd be simpler because we would only need to require them to pay |
@0xmichalis @aspiers understand you approach, we also tried to implement this such that for given amount of pool token we return the amount of tco2. Given the assumption that fee is denominated in pool token and calculated based on a change of the ratio for chosen tco2, I'm not sure if there is a analytical way to solve this. Let's try to walk this through, let assume that we have 10 POOL tokens and we want to know how much of selected tco2 we get. Part of the 10 POOL tokens will be a fee and rest will be used for redemption, given we don't know yet the fee, not sure we can calc this. The proposed solution was done by implementing it with the assumption that we start with TCO2 you wish to get and we return the quote in POOL. To workaround this one would need to find the optimal solution by providing the TCO2 number until you get the closest POOL amount. |
@kosecki123 @aspiers we should probably create a new issue to track this discussion as it's different from the multi-TCO2 support. Currently the fee module supports "I have X TCO2, how much POOL do I get?" and we have incorrectly integrated this in the pool (I have a WIP PR internally to change this). I am extending the pool code to support both flows:
|
Forking discussion on POOL -> TCO2 to separate issue #38 |
Opened #39 for this. PTAL |
Currently if a client tries to estimate the fees to be charged during a multi-TCO2 redemption they will only be able to calculate the sum of the fees charged if any of the underlying TCO2 redemptions were done in isolation. This sounds incorrect though since the user should be charged based on the resulting composition of the pool after the multi-redemption and not based on the sum of all redemptions done in isolation?
Previous attempt at this was #28
The text was updated successfully, but these errors were encountered: