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

feat(protocol): add airdrop contracts (not final) #15122

Closed
wants to merge 120 commits into from

Conversation

adaki2004
Copy link
Contributor

As per issue: #15026
(The merkle tree build up is on purpose written in typescript - not solidity in foundry tests - hence we can reuse at production.)

dantaik and others added 30 commits September 18, 2023 05:01
Co-authored-by: adaki2004 <[email protected]>
Co-authored-by: Daniel Wang <[email protected]>
Co-authored-by: Daniel Wang <[email protected]>
@dantaik dantaik changed the title feat(protocol): add airdrop contracts (no final) feat(protocol): add airdrop contracts (not final) Nov 12, 2023
@dantaik dantaik self-requested a review November 12, 2023 06:32
@@ -39,6 +44,7 @@ abstract contract MerkleClaimable is OwnableUpgradeable {
bytes32[] calldata proof
)
external
nonReentrant
Copy link
Contributor Author

@adaki2004 adaki2004 Nov 12, 2023

Choose a reason for hiding this comment

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

I think this (reentrancy check) is not necessary, we solved it 'in-house' already.
A contract is vulnerable if it calls, sends or transfers to an untrusted address (e.g.: contract with malicious fallback function).
A design to prevent that is check-effects interaction. (https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html)
We already have that given (by line 52 + line 58), because the only place an untrusted address can be invoked, is within _claimWIthData() but we already marked the hash as used.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you are sending an ERC1155 token to an target address and the target address is a contract and implement a ERC1155 callback, then the callback can call this contract to re-enter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are sending an ERC1155 token to an target address and the target address is a contract and implement a ERC1155 callback, then the callback can call this contract to re-enter.

Yes. But it would revert because the hash is already “used”. (Line 60)

@dantaik dantaik requested a review from Brechtpd November 13, 2023 18:37
@adaki2004
Copy link
Contributor Author

Lots of conflicts, so rebased to a clean base branch.

@adaki2004 adaki2004 closed this Nov 20, 2023
@dantaik dantaik deleted the airdrop_mechanism branch January 10, 2024 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Airdrop contract (+mock backend) creation with merkle proofs
7 participants