Skip to content

Conversation

@nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Oct 31, 2022

Users shouldn't be able to claim on behalf of other users, but the AcceleratingDistributor should be able to in order to make claimAndStake work

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
@nicholaspai nicholaspai requested review from amateima, chrismaree, kevinuma, mrice32 and pxrl and removed request for pxrl October 31, 2022 16:54
@nicholaspai
Copy link
Member Author

nicholaspai commented Oct 31, 2022

I just realized this change would make claimAndStake impossible

Resolved this by adding claimFor

Resolved this by storing list of whitelisted addresses

@nicholaspai nicholaspai changed the title feat(merkle-distributor): Make claim only callable by recipient feat(merkle-distributor): Make claim only callable by recipient and add claimFor that whitelisted claimer can use Oct 31, 2022
@nicholaspai nicholaspai changed the title feat(merkle-distributor): Make claim only callable by recipient and add claimFor that whitelisted claimer can use feat(merkle-distributor): Make claim only callable by recipient or whitelisted claimer Oct 31, 2022
// 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() {
Copy link
Member

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.

@nicholaspai nicholaspai marked this pull request as ready for review November 1, 2022 19:18
Copy link
Member

@chrismaree chrismaree left a 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);
Copy link
Member

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!

Copy link
Member Author

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

@nicholaspai nicholaspai merged commit b74624d into master Nov 1, 2022
@nicholaspai nicholaspai deleted the npai/merle branch November 1, 2022 20:25
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.

3 participants