-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
make billing more flexible in VRF 2.5 #11909
make billing more flexible in VRF 2.5 #11909
Conversation
jinhoonbang
commented
Jan 26, 2024
- percentage based billing - flat fee denominated in native
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
…nd-flat-fee-denominated-in-native
977d5c5
to
365dba3
Compare
uint256 baseFeeWei = weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()); | ||
// calculate flat fee in native | ||
uint256 flatFeeWei = 1e12 * uint256(s_config.fulfillmentFlatFeeNativePPM); | ||
if (onlyPremium) { | ||
return uint96((((l1CostWei + baseFeeWei) * (s_config.nativePremiumPercentage)) / 100) + flatFeeWei); | ||
} else { | ||
return uint96((((l1CostWei + baseFeeWei) * (100 + s_config.nativePremiumPercentage)) / 100) + flatFeeWei); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can save some bytecode
uint8 nativePercentage = s_config.nativePremiumPercentage;
if (!onlyPremium) {
nativePercentage += 100;
}
return uint96((((l1CostWei + baseFeeWei) * nativePercentage) / 100) + flatFeeWei);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will result in higher gas cost. leaving as is
SonarQube Quality Gate |
* make billing more flexible in VRF 2.5 - percentage based billing - flat fee denominated in native * fix linting issues * address comments and fix failing tests * run goimports * fix linting issue
* make billing more flexible in VRF 2.5 - percentage based billing - flat fee denominated in native * fix linting issues * address comments and fix failing tests * run goimports * fix linting issue
* make billing more flexible in VRF 2.5 - percentage based billing - flat fee denominated in native * fix linting issues * address comments and fix failing tests * run goimports * fix linting issue
…9.1-vrf-20240216 make billing more flexible in VRF 2.5 (#11909)
* make billing more flexible in VRF 2.5 - percentage based billing - flat fee denominated in native * fix linting issues * address comments and fix failing tests * run goimports * fix linting issue
* make billing more flexible in VRF 2.5 - percentage based billing - flat fee denominated in native * fix linting issues * address comments and fix failing tests * run goimports * fix linting issue