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(rewards): implement solo claims #31

Merged
merged 15 commits into from
Jun 14, 2024
Merged

feat(rewards): implement solo claims #31

merged 15 commits into from
Jun 14, 2024

Conversation

aliXsed
Copy link
Collaborator

@aliXsed aliXsed commented May 27, 2024

  1. Enable an individual reward as a typed structure matching "Reward(address recipient,uint256 amount,uint256 sequence)" which should be issued by an authorised oracle and signed off-chain based on EIP-712 for the rewards.depin.nodle domain and the version "1" to be minted as NODL tokens for the recipient.
  2. For security, the contract sets a periodic quota for rewards and would not mint beyond that limit for all the claims together. If mintReward fails due to RewardQuotaExceeded, the submitter should wait for quotaRenewalTimestamp to resubmit.
  3. For replay protection, there is a sequence number in the issued reward which should match the contract's expectation as stored for each recipient.
  4. The reward quota (limit) is adjustable by the governance of the NODL contract.

@aliXsed aliXsed requested a review from ETeissonniere May 27, 2024 04:56
Copy link
Member

@ETeissonniere ETeissonniere left a comment

Choose a reason for hiding this comment

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

@aliXsed can we at the very least agree to keep tests and scripts in solidity to be compatible with forge? It is ok if we have hardhat as an added compatibility layer but I'd like to remain 100% support for forge and not break apart our testing/scripting suite.

@aliXsed
Copy link
Collaborator Author

aliXsed commented May 28, 2024

@aliXsed can we at the very least agree to keep tests and scripts in solidity to be compatible with forge? It is ok if we have hardhat as an added compatibility layer but I'd like to remain 100% support for forge and not break apart our testing/scripting suite.

Sure, this is a draft just to test things and share my script with you while we were discussing the efficiency of batching.

src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
test/Rewards.t.sol Show resolved Hide resolved
test/Rewards.t.sol Outdated Show resolved Hide resolved
test/Rewards.t.sol Outdated Show resolved Hide resolved
test/Rewards.t.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
@aliXsed aliXsed changed the title feat(rewards): test efficiency feat(rewards): implement solo claims Jun 12, 2024
@aliXsed aliXsed marked this pull request as ready for review June 13, 2024 23:12
Copy link
Member

@ETeissonniere ETeissonniere left a comment

Choose a reason for hiding this comment

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

This is looking good. Just suggested some miscellaneous cleanup though control logic looks fine from my pov.

src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
src/Rewards.sol Show resolved Hide resolved
src/Rewards.sol Outdated Show resolved Hide resolved
@aliXsed aliXsed merged commit 1c7e5ec into main Jun 14, 2024
1 check passed
@aliXsed aliXsed deleted the aliX/test-reward-batch branch June 14, 2024 00:48
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