Question about swap code example in move-examples #303
-
I have some questions about swap example using FungibleAsset. In the function
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Explanation of the First Three QuestionsThis is a weird one... I'm not entirely sure what it means by "We don't enable automatic primary store creation". We still use primary stores for LP tokens in the module. LP tokens will be stored in liqudity provider's primary stores, based on the current implementation in this example. As for "because we need LPs to call into this module for transfers so the fees accounting can be updated correctly", you can refer to this part of the code. Basically, we want liquidity providers to call directly into the
New SolutionAlthough, we now have dispatchable FA, so this problem is irrelevant since we can just implement deposit/withdraw overrides and not have to worry about liquidity providers calling into Explanation of the Fourth QuestionI'm not sure, but this part looks like a mistake to me. Since, we're not using the store object returned by Hope that helps, please let me know if you have any follow ups. |
Beta Was this translation helpful? Give feedback.
Explanation of the First Three Questions
This is a weird one... I'm not entirely sure what it means by "We don't enable automatic primary store creation". We still use primary stores for LP tokens in the module. LP tokens will be stored in liqudity provider's primary stores, based on the current implementation in this example.
As for "because we need LPs to call into this module for transfers so the fees accounting can be updated correctly", you can refer to this part of the code. Basically, we want liquidity providers to call directly into the
liquidity_pool.move
module for transfers, instead of calling intopfs::transfer
orfa::transfer
. This is because in our transfer function, we defi…