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

fix - add multiple deposits from native bridge contract instead of replacing #44

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

debjit-bw
Copy link
Member

If an address received multiple deposits (say, 100, 200 and 300) In the earlier implementation, the final credit was 300 because each value replaced the earlier. The current implementation changes that so the address receives 600 (=100+200+300).

@debjit-bw debjit-bw marked this pull request as ready for review January 3, 2025 12:08
@debjit-bw debjit-bw requested a review from dapplion January 3, 2025 12:09
src/gnosis.rs Outdated
balance_increments
.entry(*address)
.and_modify(|e| *e += amount.to::<u128>())
.or_insert_with(|| amount.to::<u128>());
Copy link
Member

Choose a reason for hiding this comment

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

You can do
.entry()
.or_default()

and then add the amount

Copy link
Member Author

@debjit-bw debjit-bw Jan 7, 2025

Choose a reason for hiding this comment

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

made the change

@debjit-bw debjit-bw requested a review from dapplion January 7, 2025 11:29
Copy link
Member

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

LGTM

@debjit-bw debjit-bw merged commit fd46614 into master Jan 7, 2025
7 checks passed
@debjit-bw debjit-bw deleted the bridge-rewards-fix branch January 7, 2025 12:12
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