diff --git a/core/scripts/vrfv2plus/testnet/main.go b/core/scripts/vrfv2plus/testnet/main.go index 7bc64108669..00737fd8272 100644 --- a/core/scripts/vrfv2plus/testnet/main.go +++ b/core/scripts/vrfv2plus/testnet/main.go @@ -1112,7 +1112,11 @@ func main() { wrapperPremiumPercentage := cmd.Uint("wrapper-premium-percentage", 25, "gas premium charged by wrapper") keyHash := cmd.String("key-hash", "", "the keyhash that wrapper requests should use") maxNumWords := cmd.Uint("max-num-words", 10, "the keyhash that wrapper requests should use") - helpers.ParseArgs(cmd, os.Args[2:], "wrapper-address", "key-hash") + fallbackWeiPerUnitLink := cmd.String("fallback-wei-per-unit-link", "", "the fallback wei per unit link") + stalenessSeconds := cmd.Uint("staleness-seconds", 86400, "the number of seconds of staleness to allow") + fulfillmentFlatFeeLinkPPM := cmd.Uint("fulfillment-flat-fee-link-ppm", 500, "the link flat fee in ppm to charge for fulfillment") + fulfillmentFlatFeeNativePPM := cmd.Uint("fulfillment-flat-fee-native-ppm", 500, "the native flat fee in ppm to charge for fulfillment") + helpers.ParseArgs(cmd, os.Args[2:], "wrapper-address", "key-hash", "fallback-wei-per-unit-link") wrapperConfigure(e, common.HexToAddress(*wrapperAddress), @@ -1120,7 +1124,11 @@ func main() { *coordinatorGasOverhead, *wrapperPremiumPercentage, *keyHash, - *maxNumWords) + *maxNumWords, + decimal.RequireFromString(*fallbackWeiPerUnitLink).BigInt(), + uint32(*stalenessSeconds), + uint32(*fulfillmentFlatFeeLinkPPM), + uint32(*fulfillmentFlatFeeNativePPM)) case "wrapper-get-fulfillment-tx-size": cmd := flag.NewFlagSet("wrapper-get-fulfillment-tx-size", flag.ExitOnError) wrapperAddress := cmd.String("wrapper-address", "", "address of the VRFV2Wrapper contract") diff --git a/core/scripts/vrfv2plus/testnet/super_scripts.go b/core/scripts/vrfv2plus/testnet/super_scripts.go index f9efde8f148..3f18e18db9a 100644 --- a/core/scripts/vrfv2plus/testnet/super_scripts.go +++ b/core/scripts/vrfv2plus/testnet/super_scripts.go @@ -492,6 +492,8 @@ func deployUniverse(e helpers.Environment) { // required flags linkAddress := deployCmd.String("link-address", "", "address of link token") linkEthAddress := deployCmd.String("link-eth-feed", "", "address of link eth feed") + bhsAddress := deployCmd.String("bhs-address", "", "address of blockhash store") + batchBHSAddress := deployCmd.String("batch-bhs-address", "", "address of batch blockhash store") subscriptionBalanceString := deployCmd.String("subscription-balance", "1e19", "amount to fund subscription") // optional flags @@ -548,11 +550,21 @@ func deployUniverse(e helpers.Environment) { linkEthAddress = &address } - fmt.Println("\nDeploying BHS...") - bhsContractAddress := deployBHS(e) + var bhsContractAddress common.Address + if len(*bhsAddress) == 0 { + fmt.Println("\nDeploying BHS...") + bhsContractAddress = deployBHS(e) + } else { + bhsContractAddress = common.HexToAddress(*bhsAddress) + } - fmt.Println("\nDeploying Batch BHS...") - batchBHSAddress := deployBatchBHS(e, bhsContractAddress) + var batchBHSContractAddress common.Address + if len(*batchBHSAddress) == 0 { + fmt.Println("\nDeploying Batch BHS...") + batchBHSContractAddress = deployBatchBHS(e, bhsContractAddress) + } else { + batchBHSContractAddress = common.HexToAddress(*batchBHSAddress) + } var coordinatorAddress common.Address fmt.Println("\nDeploying Coordinator...") @@ -637,11 +649,12 @@ func deployUniverse(e helpers.Environment) { ) fmt.Println( + "\n----------------------------", "\nDeployment complete.", "\nLINK Token contract address:", *linkAddress, "\nLINK/ETH Feed contract address:", *linkEthAddress, "\nBlockhash Store contract address:", bhsContractAddress, - "\nBatch Blockhash Store contract address:", batchBHSAddress, + "\nBatch Blockhash Store contract address:", batchBHSContractAddress, "\nVRF Coordinator Address:", coordinatorAddress, "\nBatch VRF Coordinator Address:", batchCoordinatorAddress, "\nVRF Consumer Address:", consumerAddress, @@ -651,6 +664,7 @@ func deployUniverse(e helpers.Environment) { fmt.Sprintf("go run . eoa-request --consumer-address %s --sub-id %d --key-hash %s", consumerAddress, subID, keyHash), "\nA node can now be configured to run a VRF job with the below job spec :\n", formattedJobSpec, + "\n----------------------------", ) } @@ -666,7 +680,11 @@ func deployWrapperUniverse(e helpers.Environment) { maxNumWords := cmd.Uint("max-num-words", 10, "the keyhash that wrapper requests should use") subFunding := cmd.String("sub-funding", "10000000000000000000", "amount to fund the subscription with") consumerFunding := cmd.String("consumer-funding", "10000000000000000000", "amount to fund the consumer with") - helpers.ParseArgs(cmd, os.Args[2:], "link-address", "link-eth-feed", "coordinator-address", "key-hash") + fallbackWeiPerUnitLink := cmd.String("fallback-wei-per-unit-link", "", "the fallback wei per unit link") + stalenessSeconds := cmd.Uint("staleness-seconds", 86400, "the number of seconds of staleness to allow") + fulfillmentFlatFeeLinkPPM := cmd.Uint("fulfillment-flat-fee-link-ppm", 500, "the link flat fee in ppm to charge for fulfillment") + fulfillmentFlatFeeNativePPM := cmd.Uint("fulfillment-flat-fee-native-ppm", 500, "the native flat fee in ppm to charge for fulfillment") + helpers.ParseArgs(cmd, os.Args[2:], "link-address", "link-eth-feed", "coordinator-address", "key-hash", "fallback-wei-per-unit-link") amount, s := big.NewInt(0).SetString(*subFunding, 10) if !s { @@ -684,7 +702,12 @@ func deployWrapperUniverse(e helpers.Environment) { *coordinatorGasOverhead, *wrapperPremiumPercentage, *keyHash, - *maxNumWords) + *maxNumWords, + decimal.RequireFromString(*fallbackWeiPerUnitLink).BigInt(), + uint32(*stalenessSeconds), + uint32(*fulfillmentFlatFeeLinkPPM), + uint32(*fulfillmentFlatFeeNativePPM), + ) consumer := wrapperConsumerDeploy(e, common.HexToAddress(*linkAddress), diff --git a/core/scripts/vrfv2plus/testnet/util.go b/core/scripts/vrfv2plus/testnet/util.go index 904a3f6ba4f..2aeb71bd598 100644 --- a/core/scripts/vrfv2plus/testnet/util.go +++ b/core/scripts/vrfv2plus/testnet/util.go @@ -205,6 +205,10 @@ func wrapperConfigure( wrapperGasOverhead, coordinatorGasOverhead, premiumPercentage uint, keyHash string, maxNumWords uint, + fallbackWeiPerUnitLink *big.Int, + stalenessSeconds uint32, + fulfillmentFlatFeeLinkPPM uint32, + fulfillmentFlatFeeNativePPM uint32, ) { wrapper, err := vrfv2plus_wrapper.NewVRFV2PlusWrapper(wrapperAddress, e.Ec) helpers.PanicErr(err) @@ -215,7 +219,13 @@ func wrapperConfigure( uint32(coordinatorGasOverhead), uint8(premiumPercentage), common.HexToHash(keyHash), - uint8(maxNumWords)) + uint8(maxNumWords), + stalenessSeconds, + fallbackWeiPerUnitLink, + fulfillmentFlatFeeLinkPPM, + fulfillmentFlatFeeNativePPM, + ) + helpers.PanicErr(err) helpers.ConfirmTXMined(context.Background(), e.Ec, tx, e.ChainID) }