Feat: onchain impacts and proof generation #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Centralize the creation of the proof in the X2EarnRewardsPool contract. Apps now only need to pass:
This will allow easier integration from apps and fewer errors, and it will open up the possibility of using impacts to do calculations.
A new version of the proof is created now, and indexers will need to align (by checking the version number, if no version is present then it should be treated as version 1):
The new function to call is called
distributeRewardWithProof()
.The original
distributeReward()
function will now only distribute the reward without emitting any proof (the proof param wasdeprecated
, but left there for retro compatibility).A new
distributeRewardDeprecated
can be called to distribute rewards + provide a json proof built by you, but it will removed as well in the future.The available impacts are:
The deprecated impacts are:
An additional
buildProof()
function was added allowing devs to preview what their proof will look like.Impacts can be added or removed by an address that has the IMPACT_KEY_MANAGER_ROLE.
Gas increase
Current mainnet gas usage:
distributeReward 98959
This PR:
distributeRewards 99519
distributeRewardWithProof 115531 (14.89% increase)