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

Use a library for reward collection #3

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

enriquefynn
Copy link
Member

To ease the cost of deploying a new collector contract, we should decrease the size of its code, but the tradeoff is that we need to do an extra delegate_call to the library when collecting rewards.

@enriquefynn enriquefynn force-pushed the use_library_for_reward_collection branch from 6deef53 to d452359 Compare November 23, 2023 15:51
@jenpaff
Copy link
Contributor

jenpaff commented Nov 23, 2023

To ease the cost of deploying a new collector contract, we should decrease the size of its code, but the tradeoff is that we need to do an extra delegate_call to the library when collecting rewards.

How much of a trade-off are we talking?

@enriquefynn
Copy link
Member Author

enriquefynn commented Nov 23, 2023

How much of a trade-off are we talking?

The main functions, from Foundry:

without lib:
createFeeContract: 309633 gas, $31
collectRewards: 42435 gas $4.24

with lib:
createFeeContract: 220584 gas, $22 (-30%)
collectRewards: 43219 gas, $4.32 (+2.9%)

@enriquefynn enriquefynn force-pushed the use_library_for_reward_collection branch from d452359 to aa1d996 Compare November 27, 2023 23:18
Copy link
Contributor

@jenpaff jenpaff left a comment

Choose a reason for hiding this comment

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

just update README, but other than that LGTM

@enriquefynn enriquefynn merged commit 059b77d into main Nov 29, 2023
1 check passed
@enriquefynn enriquefynn deleted the use_library_for_reward_collection branch November 29, 2023 14:54
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