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

[feature] Synthetic match query from the database and the chain #18

Closed
Gelassen opened this issue Feb 21, 2023 · 3 comments
Closed

[feature] Synthetic match query from the database and the chain #18

Gelassen opened this issue Feb 21, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@Gelassen
Copy link
Owner

Gelassen commented Feb 21, 2023

User story:

As a user I want to receive match between my demands and available offers from others who also needs things I am offering on this platform

Tech details:

V1 version did matching on the contract level. This solution requires a lot of gas which force us to minimise operations on-chain to the most valuable ones. V2 version utilise blockchain feature of unreversible storage records, but keep the most time consuming operations like find matches on the server. When user wants to receive all matches, data from the chain and the backend's db should be combined in single result set.

It should be double checked, but all chain data should be already on the backend and the SQL query is ready too. It might require optimisation. For more information check tech documentation on GDrive.

            await Promise.all(model.map(async (matchItem) => {
                let matchOnChain = await chain.getSwapChainContractInstance()
                                            .getMatches(
                                                matchItem.userFirstService.userAddress,
                                                matchItem.userFirstService.userAddress
                                            );
                logger.log(`[end] within callback of aggregated matches ${matchOnChain}`);
                matchItem.chainObject = matchOnChain;
                aggregatedModel.add(matchItem);
            }));
@Gelassen
Copy link
Owner Author

On delete action burn token function is not called on chain. It is a tech debt or part of functionality that should be, but hasn't been implemented yet. Write it for a record; move in a separate ticket if necessary.

@Gelassen
Copy link
Owner Author

Current implementation of the contract would store matched offers only after approveSwap() call.

Keeping all potential matches will definitely grow storage size of the contract with unclear impact which requires more research. It is known ethereum block has limit on max gas for transaction, it is also known iteration over structure on the contract layer is very expensive operation -- all this popping up in my head about general estimation of the scope of work.

For now it is more important to deliver a complete project with required functional. This issue is not a blocker at all, so design would be left as is. It would be good to have potential matches on chain, but for now it is just a wish from an engineer, not a demand from market or\and potential customer which should drive project aims.

Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 1, 2023
…have to fix bunch of tests before continue
Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 1, 2023
Gelassen pushed a commit that referenced this issue Jun 2, 2023
Gelassen pushed a commit that referenced this issue Jun 2, 2023
Gelassen pushed a commit that referenced this issue Jun 7, 2023
Gelassen pushed a commit that referenced this issue Jun 7, 2023
@Gelassen Gelassen closed this as completed Jun 9, 2023
@Gelassen
Copy link
Owner Author

Gelassen commented Jun 9, 2023

Ref. #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant