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

make billing more flexible in VRF 2.5 #11909

Conversation

jinhoonbang
Copy link
Contributor

- percentage based billing
- flat fee denominated in native

	- percentage based billing
	- flat fee denominated in native
Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@jinhoonbang jinhoonbang force-pushed the VRF-831-billing-support-both-percentage-and-flat-fee-denominated-in-native branch from 977d5c5 to 365dba3 Compare January 26, 2024 17:45
Comment on lines +511 to +518
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);
}
Copy link
Collaborator

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);

Copy link
Contributor Author

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

@cl-sonarqube-production
Copy link

@jinhoonbang jinhoonbang enabled auto-merge January 26, 2024 18:58
@jinhoonbang jinhoonbang added this pull request to the merge queue Jan 26, 2024
Merged via the queue into develop with commit 9635b27 Jan 26, 2024
105 checks passed
@jinhoonbang jinhoonbang deleted the VRF-831-billing-support-both-percentage-and-flat-fee-denominated-in-native branch January 26, 2024 19:27
jinhoonbang added a commit that referenced this pull request Feb 15, 2024
* 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
jinhoonbang added a commit that referenced this pull request Feb 16, 2024
* 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
jinhoonbang added a commit that referenced this pull request Feb 16, 2024
* 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
snehaagni added a commit that referenced this pull request Feb 20, 2024
…9.1-vrf-20240216

make billing more flexible in VRF 2.5 (#11909)
kidambisrinivas pushed a commit that referenced this pull request Mar 18, 2024
* 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
kidambisrinivas pushed a commit that referenced this pull request Mar 18, 2024
* 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
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