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

Index order events #145

Merged
merged 56 commits into from
Dec 19, 2023
Merged

Index order events #145

merged 56 commits into from
Dec 19, 2023

Conversation

mariacarmina
Copy link
Member

@mariacarmina mariacarmina commented Dec 6, 2023

Fixes #125 .

Changes proposed in this PR:

  • index OrderStarted
  • index OrderReused
  • tests
  • create orderSchema
  • store orders in the db

@mariacarmina mariacarmina self-assigned this Dec 6, 2023
@mariacarmina
Copy link
Member Author

mariacarmina commented Dec 6, 2023

needs integration tests + price

@mariacarmina
Copy link
Member Author

CURRENT PROBLEM:

getERC721Address smart contract function retruns a different NFT address -> returns a different DID checksum which cannot be identified in the DB.
For metadata events, event.address (which is == NFT address) is a different address (rather than getERC721Address) and stores the DDO with a certain checksum which does not correspond with the one generated in OrderStarted processor.

@mariacarmina
Copy link
Member Author

Here is the source code from the contracts which sets the erc721Address https://github.com/oceanprotocol/contracts/blob/main/contracts/templates/ERC20Template.sol#L268.

src/components/Indexer/utils.ts Outdated Show resolved Hide resolved
tests/integration/indexer.test.ts Outdated Show resolved Hide resolved
tests/data/orderSchema.ts Outdated Show resolved Hide resolved
src/components/Indexer/eventProcessor.ts Show resolved Hide resolved
src/components/Indexer/eventProcessor.ts Outdated Show resolved Hide resolved
src/components/Indexer/eventProcessor.ts Outdated Show resolved Hide resolved
@bogdanfazakas
Copy link
Member

we can still merge the PR as it is since it is working, without the more detailed things like the order schema or how we work with the db

@mariacarmina
Copy link
Member Author

mariacarmina commented Dec 13, 2023

without the more detailed things like the order schema or how we work with the db

From what I've discussed with @alexcos20, the preferred schema was something that follows this model:

{
 id:   txID,
 type: 'startOrder' | 'reuseOrder'
 timestamp: block.timestamp,
 consumer,
 payer,
 startOrderId: (if type reuse)
}

@alexcos20 can you confirm as well and review it?

@mariacarmina mariacarmina merged commit 8b69f76 into develop Dec 19, 2023
6 checks passed
@mariacarmina mariacarmina deleted the feature/order-events branch December 19, 2023 15:42
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