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

refactor: set surcharge rates in constructor #440

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

BenSparksCode
Copy link
Contributor

We may want different Atlas gas surcharge and bundler surcharge rates on different chains, as they are proportionate to the gas cost of the metacall tx. On lower gas cost chains, we'd increase these surcharges above the default {10%, 10%} settings assumed for Ethereum mainnet.

This PR allows for setting both surcharges in the constructor.

Changes to AccountingMath functions:

  • withAtlasSurcharge(uint x) and withBundlerSurcharge(uint x) are now both withSurcharge(uint x, CHOSEN_SURCHARGE_RATE)
  • withoutAtlasSurcharge(uint x) and withoutBundlerSurcharge(uint x) are now both withoutSurcharge(uint x, CHOSEN_SURCHARGE_RATE)
  • withAtlasAndBundlerSurcharges(uint x) is now withSurcharges(uint x, ATLAS_SURCHARGE_RATE, BUNDLER_SURCHARGE_RATE)
  • These changes are necessary because the rates are no longer hardcoded in the lib, and must be passed in as an arg using the immutable rate vars from Storage.sol.

Copy link
Contributor

@0x1NotMe 0x1NotMe left a comment

Choose a reason for hiding this comment

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

LGTM

@BenSparksCode BenSparksCode merged commit 52cfec4 into atlas-v1.1 Oct 11, 2024
3 checks passed
@BenSparksCode BenSparksCode deleted the set-surcharge-rates branch October 14, 2024 11:59
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