[TCFMM-10] Add FA2 entrypoints to manage positions #9
Conversation
6561fc2
to
b88fb7c
Compare
@dcastro @Martoon-00 This PR is ready for review. A few things to note/ask is that:
|
b88fb7c
to
f31452f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me 👍
Only one thing that worries me: swap_position
effectively performs many of the checks that are already performed in transfer_item
.
I think we should remove duplications in one function or another, and in swap_position
state clearly what preconditions should hold upon calling it (e.g. whether amt
must be 1
, 0 or 1
, or do not mention anything if we completely check amt
inside).
Regarding your points, I personally think everything is properly done now. |
bb6c9e6
to
3aab852
Compare
@Martoon-00 Make sense, I've move all the |
c3350e3
to
c9b980e
Compare
Looks good to me 👍 The last point: since you already seemed to rebase on top of the Errors PR, shouldn't you replace |
Since FA2 has its own error standard, should we turn it into error nat or not? It may not play well with other FA2 contract client (Not sure if it is that important or not anyway). What do you think about this? |
It's indeed tricky in general case, but I think for internal errors we are free to choose any desired format. |
3aab852
to
afc90a8
Compare
570aafe
to
750822d
Compare
My bad, I thought you referred to FA2 errors 🤦. I've updated this now. |
4075214
to
499e986
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now looks great 👍
Thanks for addressing my comments.
9dc992a
to
8a78ba5
Compare
499e986
to
cd26c0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the later rereview, left a couple of minor comments.
The change of the structure looks good, nice that it could be made simpler.
ligo/token/fa2.mligo
Outdated
Add_operator p -> (Some unit, p) | ||
| Remove_operator p -> ((None : unit option), p) | ||
in | ||
let _ = get_position_index (operator_param.token_id, store) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is also better to be documented I think. AFAIU FA2 does not mention that Update_operators
can throw an error when token_id
does not yet exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Martoon-00 Strange that in tzip-12, Update_operators
does not throw error for that. Do you know any reason why? Should we adhere to the tzip-12 (no error thrown, just leave storage not updated) or keep the error but update our spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure too. I remember one contract that allowed a user to reserve a sequence of token_id
s and later mint money at them, for such a contract it could be reasonable to allow setting operators in advance.
For our contract, setting an operator in advance does not make sense I think, so throwing an error seems justified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In our use case, when setting an operator of an owner, that means he can transfer any of the owner positions right? In this case, ensuring a position exist or not may not be necessary.
cd26c0f
to
c74347a
Compare
Problem: Currently, the contract lacks support for FA2 entrypoints. We should add this. Solution: Add support for FA2 entrypoints: `transer`, `balance_of`, and `update_operator`.
979901f
to
46d46b2
Compare
Description
Problem: Currently, the contract lacks support for FA2 entrypoints.
We should add this.
Solution: Add support for FA2 entrypoints:
transer
,balance_of
,and
update_operator
.Related issue(s)
Resolves TCFMM-10
Depends on #8
✅ Checklist for your Pull Request
Related changes (conditional)
silently reappearing again.
Stylistic guide (mandatory)