Skip to content

Drop bug fix: replace MerkleProofindex with type casted address of claimer #254

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

Merged
merged 2 commits into from
Sep 29, 2022

Conversation

nkrishang
Copy link
Contributor

Before

// Setting the BitMap value when an allowlisted claimer claims tokens
claimCondition.limitMerkleProofClaim[activeConditionId].set(merkleProofIndex);

// Checking if 'BitMap value' has been set for a claimer. This 'BitMap value' is the `merkleProofIndex` of the claimer.
require(!claimCondition.limitMerkleProofClaim[_conditionId].get(merkleProofIndex), "proof claimed.");

After

address claimerAddress;

// Setting the BitMap value when an allowlisted claimer claims tokens
claimCondition.limitMerkleProofClaim[activeConditionId].set(uint256(uint160(claimerAddress)));

// Checking if 'BitMap value' has been set for a claimer. This 'BitMap value' is the type casted of the claimer.
require(!claimCondition.limitMerkleProofClaim[_conditionId].get(uint256(uint160(claimerAddress))), "proof claimed.");

Reason for the change.

In the After case, the BitMap value for a claimer x claim_condition is unique for the claimer. This is different from using merkleProofIndex, since that can be the same for 2 different addresses (each included in a separate allowlist of separate claim conditions, but at the same position i.e. with the same condition Id).

Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

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

can we add a couple of tests for this? can be in the SDK too if its easier.

@nkrishang nkrishang merged commit 0fdde7f into main Sep 29, 2022
@nkrishang nkrishang deleted the drop-merkleproofindex-bug-fix branch October 11, 2022 17:13
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