-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow FA1.2/FA2 collaterals for minting #213
Comments
One way to implement this would be via conditional compilation. We can abstract away collateral handling to a separate module, and conditionally compile different versions of it based on whether the collateral is Another way I can think of is to have a wrapper FA2 contract for The advantage would mainly be avoiding conditional compilation, and shrinking the main contract complexity a bit (since those two components can be tested separately), the cost is the cost increase for using |
Using a FA2 token as a collateral would also require us to obtain the "collateral token / tez" price, so we can use the existing CFMM (which is ctez-kit) and the oracle feed. As far as I know, there is no standard way obtain this information. Unless we use the collateral token instead of @murbard, what do you think? Is there a convention for getting a FA2 tokens price in tez, or should we also make the CFMM work with the collateral token? |
Another thing I am not entirely clear about: What about the creation deposit? Do we want it to have the same type as the collateral or is it always going to be tez? |
This comment has been minimized.
This comment has been minimized.
Just hid my earlier comment above since that design had a few flaws; we now have a more accurate design I'll add below. |
So, to realize the design @utdemir described above we need two sets of changes:
OverviewSo, overall, the system after the changes we describe below would look somewhat like this:
Detailed Description of tez/FA2 WrapperMain ContractState / Storage
|
Pasting here the cases we discussed in different channels, so that we have all the info on the issue itself: Concerning prices (assuming an index-based checker), we have the following two scenaria:
It's currently unclear whether we can achieve this deviation without conditional compilation (we could use the storage for dynamic checks but that doesn't sound great either). Perhaps when we generalize in the 3rd direction specified in #171 we'll be able to come up with a better design. I expect the build system to be even more complicated at that point and more code to be generated at deployment time anyway. |
This is only an early untested draft. Hopefully minimal changes will be needed, but both changes and relevant tests will be added when the contract becomes integrated into checker (i.e., when the rest of the changes described in #213 are implemented).
First part of #213: integration of the tez wrapper into checker's workflow. In essence this PR makes checker deal with FA2 exclusively. To keep CI green, usage of the tez wrapper is hardwired; adding the switch to be able to change the collateral type should be part of a separate PR. This PR is already pretty big. Other changes: * Removed the restrictions on `from_` and `to_` in `TezWrapper.transfer` to save on gas costs (they were optional anyway). * Fixed a bug in `TezWrapper.transfer` (transfer of zero tez should not fail due to non-originated vaults). * Made `tezWrapper.ml` more verbose to significantly reduce its gas costs (see bot message below).
🎉 |
From the original issue #171:
Currently, Checker only allows
tez
as a collateral for minting kit. Thesetez
end up in "burrow" contracts that are still controlled by checker, but delegation rights can be set individually.This issue is to allow different tokens as collaterals instead of
tez
. Likely,burrow
's won't be necessary for that case.The text was updated successfully, but these errors were encountered: