How to track supply of FA/Coin from event #41
-
Question asked by BackgroundWe are currently building an ERP solution on Aptos that does Accounting/Supply Management(questions regarding burn/mint come from here) and Performance Analytics. Question 1We got the idea of comparing between withdrawEvent / depositEvent and deriving the mint/burn (mint if depositEvent - withdrawEvent > 0, burn if vice versa) from a single transaction(version) but, peeping into this version However, here(https://aptoscan.com/transaction/488564958#events): I'm confused that this method might not work for us. We would expect total of four events emitted from swap transaction of A asset to B asset interacted with pancakeswap:
however we only get two events emitted which is just the results from zUSDC to Cake swap transaction, rest of the events recorded on a separate swapEvent how should we handle this case or come up with a framework to cover such cases? Question 2Regarding the sample token contract you sent us: https://explorer.aptoslabs.com/object/0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12/resources?network=mainnet could you please elaborate further on how we can catch burn/mint cases in the above example? (I'm more of a researcher than a dev... so my understanding falls short.. haha..) and bit more questions.. regarding the example contract(object) you gave:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Regarding how to track supply using eventsI'll defer to @movekevin or @gregnazario Regarding object and FA
Object is similar to contract account in Ethereum or PDA in Solana. You use it to store data (i.e. resource in move). The object you linked stores metadata of a fungible asset
Correct, fungible asset is the successor to coin, FA builds on top of Object, providing better performance and extendability. You can learn more about FA here and how to create a FA here. |
Beta Was this translation helpful? Give feedback.
-
Question 1Coins are be replaced by Fungible Assets for specifically what you're talking about. It's really hard to track coins, because the events only come when they are in a CoinStore. But, when they're in a DEX or elsewhere, those events are not available. So, in that case you only get as you said. Fungible assets will be easier, as you'll always have a withdraw and deposit event as the fungible assets must be stored in a fungible store, and we're thinking about adding mint and burn events as well. The cases would increase based on the platforms you support for Coin (e.g. liquidswap, thala, etc.) Question 2There's a lot here:
|
Beta Was this translation helpful? Give feedback.
Question 1
Coins are be replaced by Fungible Assets for specifically what you're talking about.
It's really hard to track coins, because the events only come when they are in a CoinStore. But, when they're in a DEX or elsewhere, those events are not available. So, in that case you only get as you said.
Fungible assets will be easier, as you'll always have a withdraw and deposit event as the fungible assets must be stored in a fungible store, and we're thinking about adding mint and burn events as well.
The cases would increase based on the platforms you support for Coin (e.g. liquidswap, thala, etc.)
Question 2
There's a lot here: