-
Notifications
You must be signed in to change notification settings - Fork 75
feat(merkle-distributor): Make claim only callable by recipient or whitelisted claimer #195
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
Conversation
Intended use case is for `claim` to reset user's off-chain reward rate (used to produce rewards that would be seeded into this contract). Therefore, claim should only be callable by end recipient
|
Resolved this by storing list of whitelisted addresses |
| // Note: uses a packed array of bools for gas optimization on tracking certain claims. Copied from Uniswap's contract. | ||
| mapping(uint256 => mapping(uint256 => uint256)) private claimedBitMap; | ||
|
|
||
| modifier onlyWhitelistedClaimer() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't use this modifier.
chrismaree
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| require(claims[i].account == msg.sender, "invalid claimer"); | ||
| } | ||
| } | ||
| super.claimMulti(claims); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming claimMulti and claim from within the MerkleDistributor works correctly, this wrapper contract looks perfect to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup and the tests give me confidence, which i didn't modify and should work against the parent's behavior
Co-authored-by: Chris Maree <christopher.maree@gmail.com>
Users shouldn't be able to claim on behalf of other users, but the AcceleratingDistributor should be able to in order to make
claimAndStakework