Skip to content
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

Implement an FA2 wrapper for ctez #279

Closed
gkaracha opened this issue Oct 22, 2021 · 1 comment · Fixed by #290
Closed

Implement an FA2 wrapper for ctez #279

gkaracha opened this issue Oct 22, 2021 · 1 comment · Fixed by #290
Assignees

Comments

@gkaracha
Copy link
Contributor

Now that we've switched to the tez-wrapper-based design, the biggest remaining obstacle for finishing #213 is dealing with the structural differences between TEZ and FA2 that we've found no way to share between the two build/deployment paths. As far as I can tell, this boils down to two specific issues, interrelating with each other:

  1. Price calculation in touch:

    • collateral = TEZ: KIT/CHF = TEZ/CHF (from index) * CTEZ/TEZ (from ctez) * KIT/CTEZ (from cfmm)
    • collateral = FA2: KIT/CHF = FA2/CHF (from index) * KIT/FA2 (from cfmm)

    this issue is discussed here: Allow FA1.2/FA2 collaterals for minting #213 (comment)

  2. The token contained in the CFMM compared to the token used as collateral:

    • collateral = TEZ: cfmm.ml contains ctez specifically, also distinct from the collateral which is tez_token specifically
    • collateral = FA2: cfmm.ml contains the same token as is used for collateral, whichever token that is.

The comment on #213 is primarily focused on the first issue, but, while trying to make progress on the the second issue (on this branch), I came across another structural difference:

  1. Token standard used for fund transfer:
    • collateral = TEZ: cfmm.ml contains ctez and it uses ctez's FA1.2 API
    • collateral = FA2: cfmm.ml contains the same FA2 that is used as collateral so I expect it'll use the token's FA2 API

FA1.2 and FA2 are structurally different, so the branching as stated above is quite pervasive (i.e., we'll need conditional compilation or something equivalent to get generalization to work). Ideally we won't have to go that way. However, as far as I can tell, ctez does not offer an FA2 interface. To achieve uniformity in the %transfer calls we'd have to always use the FA1.2 standard for the cfmm, but then we require the token used to respect both the FA2 and the FA1.2 standard.

This looks like a blocker for #213.

@gkaracha
Copy link
Contributor Author

gkaracha commented Nov 1, 2021

After discussing this we have agreed to proceed with implementing an FA2 wrapper for ctez.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants