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

Make owner count changes idempotent #164

Merged
merged 14 commits into from
Jul 1, 2022
Merged

Conversation

awfm9
Copy link
Contributor

@awfm9 awfm9 commented Jun 30, 2022

The idea behind this PR is to make every owner change in itself uniquely identifiable in the SQL table. This means that if the same owner change is processed multiple times, we will trigger the conflict clause in the SQL and simply do nothing.

For retrieval of owner counts, we simply have to select the sum by owner address and/or NFT ID, which will automatically include all the relevant rows.

Copy link
Contributor

@ricardomgoncalves ricardomgoncalves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left just a comment

"golang.org/x/crypto/sha3"
)

func Event(hash string, index uint) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should name the first parameter hash as it makes readers read as event hash and not transaction hash. WDYT?

@awfm9 awfm9 force-pushed the make-owner-operations-idempotent branch from 292dc94 to 3acedaf Compare June 30, 2022 21:14
@awfm9 awfm9 force-pushed the make-owner-operations-idempotent branch from 8a6eec7 to dae6def Compare June 30, 2022 21:56
@awfm9 awfm9 force-pushed the make-owner-operations-idempotent branch 2 times, most recently from 44e01c8 to d68a4db Compare June 30, 2022 22:40
@awfm9 awfm9 force-pushed the make-owner-operations-idempotent branch from d68a4db to 5878090 Compare June 30, 2022 22:41
@awfm9
Copy link
Contributor Author

awfm9 commented Jun 30, 2022

Fixes #157
Fixes #161

@awfm9 awfm9 merged commit 55bf486 into master Jul 1, 2022
@ricardomgoncalves ricardomgoncalves deleted the make-owner-operations-idempotent branch July 14, 2022 09:49
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.

2 participants