Skip to content

Commit

Permalink
chore: return native premium from wrapper getConfig (#10979)
Browse files Browse the repository at this point in the history
* chore:return native premium from wrapper getConfig

Update docstrings accordingly

* fix: tests
  • Loading branch information
makramkd authored Oct 17, 2023
1 parent 49b2fc0 commit ef4240f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 31 deletions.
33 changes: 25 additions & 8 deletions contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,29 @@ contract VRFV2PlusWrapper is ConfirmedOwner, TypeAndVersionInterface, VRFConsume
* @param _wrapperPremiumPercentage is the premium ratio in percentage for wrapper requests.
*
* @param _keyHash to use for requesting randomness.
* @param _maxNumWords is the max number of words that can be requested in a single wrapped VRF request
* @param _stalenessSeconds is the number of seconds before we consider the feed price to be stale
* and fallback to fallbackWeiPerUnitLink.
*
* @param _fallbackWeiPerUnitLink is the backup LINK exchange rate used when the LINK/NATIVE feed
* is stale.
*
* @param _fulfillmentFlatFeeLinkPPM is the flat fee in millionths of LINK that VRFCoordinatorV2Plus
* charges.
*
* @param _fulfillmentFlatFeeNativePPM is the flat fee in millionths of native that VRFCoordinatorV2Plus
* charges.
*/
function setConfig(
uint32 _wrapperGasOverhead,
uint32 _coordinatorGasOverhead,
uint8 _wrapperPremiumPercentage,
bytes32 _keyHash,
uint8 _maxNumWords,
uint32 stalenessSeconds,
int256 fallbackWeiPerUnitLink,
uint32 fulfillmentFlatFeeLinkPPM,
uint32 fulfillmentFlatFeeNativePPM
uint32 _stalenessSeconds,
int256 _fallbackWeiPerUnitLink,
uint32 _fulfillmentFlatFeeLinkPPM,
uint32 _fulfillmentFlatFeeNativePPM
) external onlyOwner {
s_wrapperGasOverhead = _wrapperGasOverhead;
s_coordinatorGasOverhead = _coordinatorGasOverhead;
Expand All @@ -205,10 +217,10 @@ contract VRFV2PlusWrapper is ConfirmedOwner, TypeAndVersionInterface, VRFConsume
s_configured = true;

// Get other configuration from coordinator
s_stalenessSeconds = stalenessSeconds;
s_fallbackWeiPerUnitLink = fallbackWeiPerUnitLink;
s_fulfillmentFlatFeeLinkPPM = fulfillmentFlatFeeLinkPPM;
s_fulfillmentFlatFeeNativePPM = fulfillmentFlatFeeNativePPM;
s_stalenessSeconds = _stalenessSeconds;
s_fallbackWeiPerUnitLink = _fallbackWeiPerUnitLink;
s_fulfillmentFlatFeeLinkPPM = _fulfillmentFlatFeeLinkPPM;
s_fulfillmentFlatFeeNativePPM = _fulfillmentFlatFeeNativePPM;
}

/**
Expand All @@ -223,6 +235,9 @@ contract VRFV2PlusWrapper is ConfirmedOwner, TypeAndVersionInterface, VRFConsume
* @return fulfillmentFlatFeeLinkPPM is the flat fee in millionths of LINK that VRFCoordinatorV2Plus
* charges.
*
* @return fulfillmentFlatFeeNativePPM is the flat fee in millionths of native that VRFCoordinatorV2Plus
* charges.
*
* @return wrapperGasOverhead reflects the gas overhead of the wrapper's fulfillRandomWords
* function. The cost for this gas is passed to the user.
*
Expand All @@ -245,6 +260,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, TypeAndVersionInterface, VRFConsume
int256 fallbackWeiPerUnitLink,
uint32 stalenessSeconds,
uint32 fulfillmentFlatFeeLinkPPM,
uint32 fulfillmentFlatFeeNativePPM,
uint32 wrapperGasOverhead,
uint32 coordinatorGasOverhead,
uint8 wrapperPremiumPercentage,
Expand All @@ -256,6 +272,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, TypeAndVersionInterface, VRFConsume
s_fallbackWeiPerUnitLink,
s_stalenessSeconds,
s_fulfillmentFlatFeeLinkPPM,
s_fulfillmentFlatFeeNativePPM,
s_wrapperGasOverhead,
s_coordinatorGasOverhead,
s_wrapperPremiumPercentage,
Expand Down
1 change: 1 addition & 0 deletions contracts/test/v0.8/foundry/vrf/VRFV2Wrapper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ contract VRFV2PlusWrapperTest is BaseTest {
,
,
,
,
uint32 _wrapperGasOverhead,
uint32 _coordinatorGasOverhead,
uint8 _wrapperPremiumPercentage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ contract VRFV2PlusWrapperTest is BaseTest {
,
,
,
,
uint32 _wrapperGasOverhead,
uint32 _coordinatorGasOverhead,
uint8 _wrapperPremiumPercentage,
Expand Down
46 changes: 24 additions & 22 deletions core/gethwrappers/generated/vrfv2plus_wrapper/vrfv2plus_wrapper.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ vrfv2plus_client: ../../contracts/solc/v0.8.6/VRFV2PlusClient.abi ../../contract
vrfv2plus_consumer_example: ../../contracts/solc/v0.8.6/VRFV2PlusConsumerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusConsumerExample.bin 2c480a6d7955d33a00690fdd943486d95802e48a03f3cc243df314448e4ddb2c
vrfv2plus_malicious_migrator: ../../contracts/solc/v0.8.6/VRFV2PlusMaliciousMigrator.abi ../../contracts/solc/v0.8.6/VRFV2PlusMaliciousMigrator.bin 80dbc98be5e42246960c889d29488f978d3db0127e95e9b295352c481d8c9b07
vrfv2plus_reverting_example: ../../contracts/solc/v0.8.6/VRFV2PlusRevertingExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusRevertingExample.bin 34743ac1dd5e2c9d210b2bd721ebd4dff3c29c548f05582538690dde07773589
vrfv2plus_wrapper: ../../contracts/solc/v0.8.6/VRFV2PlusWrapper.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapper.bin bd5f9c8972cb12af4e76bfdc85caf67ef3d824276468b10d6e6e82df2925982f
vrfv2plus_wrapper: ../../contracts/solc/v0.8.6/VRFV2PlusWrapper.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapper.bin 934bafba386b934f491827e535306726069f4cafef9125079ea88abf0d808877
vrfv2plus_wrapper_consumer_example: ../../contracts/solc/v0.8.6/VRFV2PlusWrapperConsumerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapperConsumerExample.bin a14c4c6e2299cd963a8f0ed069e61dd135af5aad4c13a94f6ea7e086eced7191
vrfv2plus_wrapper_load_test_consumer: ../../contracts/solc/v0.8.6/VRFV2PlusWrapperLoadTestConsumer.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapperLoadTestConsumer.bin 55e3bd534045125fb6579a201ab766185e9b0fac5737b4f37897bb69c9f599fa

0 comments on commit ef4240f

Please sign in to comment.