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

Estimate for cross-chain collateral deposit breakdown #61

Open
hetfly opened this issue Jul 22, 2024 · 4 comments
Open

Estimate for cross-chain collateral deposit breakdown #61

hetfly opened this issue Jul 22, 2024 · 4 comments

Comments

@hetfly
Copy link
Collaborator

hetfly commented Jul 22, 2024

There are cross-chain collateral types now, ie ETH. It's represented by a single token on ICON network, but can be deposited from multiple chains. Can we track how much was deposited from which chain? It would have to be read from xCalls executeCall method, I think, that confirms the deposit to Balanced Loans contract from the spoke chain.

@robcxyz
Copy link
Contributor

robcxyz commented Jul 22, 2024

Can you give me an address(es) so I can start poking around?

It doesn't sound like you need to hit other chains and can do this all through inspecting the logs from ICON. If this requires hitting other chains though then this is going to take a while.

@hetfly
Copy link
Collaborator Author

hetfly commented Jul 22, 2024

cxa07f426062a1384bdd762afa6a87d123fbc81c75 is the xCall address, I'd probably start with looking for CallExecuted, if it's successful, check it's request id, find CallMessage with the same id and see the data there

@robcxyz
Copy link
Contributor

robcxyz commented Aug 26, 2024

Ok so as I understand it, a CallMessage event will be emitted which has a request ID (_reqId) which then needs to joined with the request ID of the associated CallExecuted event which may or may not exist depending on if the transaction went through.

So no matter what it seems like this contract needs a full index of these two events which will then be joined on _reqId and then in turn there will be a lookup based on some key to associate the message with a given pool - not sure how that is done (_sn? or _to / _from) and only then can we associate the transaction volume to the spoke chain.

Does this seem right? This is only after some cursory investigations and definitely would want to run this by Andell to see if this all makes sense. Definitely will need a full index of the CallMessage and CallExecuted events but then after that it seems like there could be a couple ways to join the data from the two events. Then after that associating the event with the spoke chain hopefully is simple. Would need to stage the data in a table and then create a view on top of that to sum up the values.

Hope I am not making this too complex in my understanding but it seems very non-trivial to do this properly. Also seems like various incantations of this indexing pattern will show up in multiple places with xcall Txs.

Could this be done instead by simply tracking the balances of contrcts themselves or do we need to associate the balance with this type of Tx to get the right data?

@CyrusVorwald
Copy link

xcallscan api might support this @kryptopoo

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

No branches or pull requests

3 participants