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

added rent page #31

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

added rent page #31

wants to merge 2 commits into from

Conversation

JSmithOner
Copy link
Collaborator

No description provided.

@JSmithOner
Copy link
Collaborator Author

@jycssu-com I cannot see the Drawer, I've created the branch then executed git pull any ideas?

@JSmithOner
Copy link
Collaborator Author

@jycssu-com ok you meant the menu on the left, got it

@JSmithOner
Copy link
Collaborator Author

@jycssu-com Is it possible to retrieve the trnasactions in USDC ETH WXDAI ... to calculate the buying and seeling cost of a token. I've called the "rent page" "statistics" where we can find detailed statistics on profits.Thanks

@NandyBa
Copy link
Member

NandyBa commented Dec 13, 2023

@jycssu-com Is it possible to retrieve the trnasactions in USDC ETH WXDAI ... to calculate the buying and seeling cost of a token. I've called the "rent page" "statistics" where we can find detailed statistics on profits.Thanks

You want the current price (aka oracle current price) or explicitly need price on the past ?

@JSmithOner
Copy link
Collaborator Author

@NandyBa I would like the price bought on the YAM no need for RealT because it can be any wallet an prices are stable

@jycssu-com
Copy link
Collaborator

I had already started to imagine a solution to recover this information. In the graph on which we retrieve the transfers (TransferEvent), there is information on the transaction that triggered them (TransferEvent.transaction). We already recover certain data from it, in particular the id and the recipient (id, to)

This Transaction object has an input property, with data sent to the blockchain. In the case of a Yam/Swapcat transaction, they therefore make it possible to determine the purchase price since it is included in the call. It will be necessary to parse this data via the ABI of these contracts (close example in currencies.repository.ts).

The problem is that we cannot afford to retrieve the input property for all transactions. In the case of sending tokens by RealT (purchase or reinvestment), it contains all the data from their batch, which would cause us to reach too quickly the size limit of a query response from TheGraph (2MB), and they are not necessary for us.

The idea would therefore be to make a more complex query to the SubGraph. One to retrieve Yam-related transactions (and perhaps another for Swapcat), with the input property included, and a final one containing all other transactions, without the input property.

I don't know if you are comfortable with TheGraph/GraphQL and SmartContract, but if you want, I can help implement this logic fairly quickly

@JSmithOner
Copy link
Collaborator Author

@jycssu-com I'll make a deep dive into the code and get back to you soon, I'm not comfortable with GraphQl but I can learn also I executing multiple queries for 1 token at a time which could possibly avoid the 2Mb problem

@jycssu-com
Copy link
Collaborator

Ideally, the number of requests should still be limited (in the http sense). It should not be a problem to do everything in a single http request given that it is possible to make several GraphQL queries within the same http request. If this is not possible (because too heavy), above all, you should not make queries per property, but one for all transactions on the YAM (for all properties) and another for all other transactions (also for all properties).

And in all cases, it will probably be necessary to set up pagination in a second step (TheGraph limiting to 1000 objects per request), which means that we should never reach the limit of 2MB, as long as we do not fetch the input field of transactions made by RealT

When using TheGraph, you must keep in mind that you must limit the number of http requests as much as possible, because there is a chance that its use will eventually become payable, with billing per http call

@JSmithOner
Copy link
Collaborator Author

JSmithOner commented Dec 14, 2023

@jycssu-com Ok I've looked at a tutorial on ABI and understand a bit more now.

Did you know we can create an API out of Google Sheets also firebase would be a good option to store any data and updates made to the RealT properties with a free tier. There is also supabase which is in postgresql (only ideas but I know all the technologies mentionned).

Retrieving all transactions from RealT input seems unnecessary as an api call is already made to realT community API to get the tokens infos (for example price).

Please let me know what you think of my ideas and please tell me if you want me to work on something particular.

Also one last thing, I'm using GetRealTokenTransfers and this function doesn't allow me to see quickly which transfer is related to which token, wouldn't it ba a good idea to update this function and perhaps add the ABI thing in a lower level to retrieve all informations in a clean manner?Best.

@JSmithOner
Copy link
Collaborator Author

@jycssu-com I've made a quick api with a unique API key using firebase which enables yu to get updates are you interested?

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

Successfully merging this pull request may close these issues.

3 participants