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:
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:
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.
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:
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: https://github.com/tezos-checker/checker/issues/213#issuecomment-923758356
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 specificallycollateral = 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:
collateral = TEZ
:cfmm.ml
contains ctez and it uses ctez's FA1.2 APIcollateral = FA2
:cfmm.ml
contains the same FA2 that is used as collateral so I expect it'll use the token's FA2 APIFA1.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.