Skip to content

Commit

Permalink
vrfv2plus: rename link eth to link native in super script (#12623)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeyikjiun authored Mar 28, 2024
1 parent cd2dfa3 commit d5b5c5f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions core/scripts/vrfv2plus/testnet/v2plusscripts/super_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func SmokeTestVRF(e helpers.Environment) {

// required flags
linkAddress := smokeCmd.String("link-address", "", "address of link token")
linkEthAddress := smokeCmd.String("link-eth-feed", "", "address of link eth feed")
linkNativeAddress := smokeCmd.String("link-native-feed", "", "address of link native feed")
bhsAddressStr := smokeCmd.String("bhs-address", "", "address of blockhash store")
batchBHSAddressStr := smokeCmd.String("batch-bhs-address", "", "address of batch blockhash store")
coordinatorAddressStr := smokeCmd.String("coordinator-address", "", "address of the vrf coordinator v2 contract")
Expand All @@ -69,7 +69,7 @@ func SmokeTestVRF(e helpers.Environment) {
maxGasLimit := smokeCmd.Int64("max-gas-limit", 2.5e6, "max gas limit")
stalenessSeconds := smokeCmd.Int64("staleness-seconds", 86400, "staleness in seconds")
gasAfterPayment := smokeCmd.Int64("gas-after-payment", 33285, "gas after payment calculation")
flatFeeEthPPM := smokeCmd.Int64("flat-fee-eth-ppm", 500, "fulfillment flat fee ETH ppm")
flatFeeNativePPM := smokeCmd.Int64("flat-fee-native-ppm", 500, "fulfillment flat fee Native ppm")
flatFeeLinkDiscountPPM := smokeCmd.Int64("flat-fee-link-discount-ppm", 100, "fulfillment flat fee discount for LINK payment denominated in native ppm")
nativePremiumPercentage := smokeCmd.Int64("native-premium-percentage", 1, "premium percentage for native payment")
linkPremiumPercentage := smokeCmd.Int64("link-premium-percentage", 1, "premium percentage for LINK payment")
Expand All @@ -95,10 +95,10 @@ func SmokeTestVRF(e helpers.Environment) {
linkAddress = &address
}

if len(*linkEthAddress) == 0 {
fmt.Println("\nDeploying LINK/ETH Feed...")
if len(*linkNativeAddress) == 0 {
fmt.Println("\nDeploying LINK/Native Feed...")
address := helpers.DeployLinkEthFeed(e, *linkAddress, fallbackWeiPerUnitLink).String()
linkEthAddress = &address
linkNativeAddress = &address
}

var bhsContractAddress common.Address
Expand All @@ -120,7 +120,7 @@ func SmokeTestVRF(e helpers.Environment) {
var coordinatorAddress common.Address
if len(*coordinatorAddressStr) == 0 {
fmt.Println("\nDeploying Coordinator...")
coordinatorAddress = DeployCoordinator(e, *linkAddress, bhsContractAddress.String(), *linkEthAddress)
coordinatorAddress = DeployCoordinator(e, *linkAddress, bhsContractAddress.String(), *linkNativeAddress)
} else {
coordinatorAddress = common.HexToAddress(*coordinatorAddressStr)
}
Expand All @@ -146,7 +146,7 @@ func SmokeTestVRF(e helpers.Environment) {
uint32(*stalenessSeconds),
uint32(*gasAfterPayment),
fallbackWeiPerUnitLink,
uint32(*flatFeeEthPPM),
uint32(*flatFeeNativePPM),
uint32(*flatFeeLinkDiscountPPM),
uint8(*nativePremiumPercentage),
uint8(*linkPremiumPercentage),
Expand Down Expand Up @@ -259,7 +259,7 @@ func SmokeTestVRF(e helpers.Environment) {
fmt.Println(
"\nDeployment complete.",
"\nLINK Token contract address:", *linkAddress,
"\nLINK/ETH Feed contract address:", *linkEthAddress,
"\nLINK/Native Feed contract address:", *linkNativeAddress,
"\nBlockhash Store contract address:", bhsContractAddress,
"\nBatch Blockhash Store contract address:", batchBHSAddress,
"\nVRF Coordinator Address:", coordinatorAddress,
Expand Down Expand Up @@ -474,7 +474,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {
// required flags
nativeOnly := deployCmd.Bool("native-only", false, "if true, link and link feed are not set up")
linkAddress := deployCmd.String("link-address", "", "address of link token")
linkEthAddress := deployCmd.String("link-eth-feed", "", "address of link eth feed")
linkNativeAddress := deployCmd.String("link-native-feed", "", "address of link native feed")
bhsContractAddressString := deployCmd.String("bhs-address", "", "address of BHS contract")
batchBHSAddressString := deployCmd.String("batch-bhs-address", "", "address of Batch BHS contract")
coordinatorAddressString := deployCmd.String("coordinator-address", "", "address of VRF Coordinator contract")
Expand Down Expand Up @@ -503,7 +503,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {
maxGasLimit := deployCmd.Int64("max-gas-limit", constants.MaxGasLimit, "max gas limit")
stalenessSeconds := deployCmd.Int64("staleness-seconds", constants.StalenessSeconds, "staleness in seconds")
gasAfterPayment := deployCmd.Int64("gas-after-payment", constants.GasAfterPayment, "gas after payment calculation")
flatFeeEthPPM := deployCmd.Int64("flat-fee-eth-ppm", 500, "fulfillment flat fee ETH ppm")
flatFeeNativePPM := deployCmd.Int64("flat-fee-native-ppm", 500, "fulfillment flat fee Native ppm")
flatFeeLinkDiscountPPM := deployCmd.Int64("flat-fee-link-discount-ppm", 100, "fulfillment flat fee discount for LINK payment denominated in native ppm")
nativePremiumPercentage := deployCmd.Int64("native-premium-percentage", 1, "premium percentage for native payment")
linkPremiumPercentage := deployCmd.Int64("link-premium-percentage", 1, "premium percentage for LINK payment")
Expand All @@ -514,8 +514,8 @@ func DeployUniverseViaCLI(e helpers.Environment) {
)

if *nativeOnly {
if *linkAddress != "" || *linkEthAddress != "" {
panic("native-only flag is set, but link address or link eth address is provided")
if *linkAddress != "" || *linkNativeAddress != "" {
panic("native-only flag is set, but link address or link native address is provided")
}
if *subscriptionBalanceJuelsString != "0" {
panic("native-only flag is set, but link subscription balance is provided")
Expand Down Expand Up @@ -551,7 +551,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {

contractAddresses := model.ContractAddresses{
LinkAddress: *linkAddress,
LinkEthAddress: *linkEthAddress,
LinkEthAddress: *linkNativeAddress,
BhsContractAddress: bhsContractAddress,
BatchBHSAddress: batchBHSAddress,
CoordinatorAddress: coordinatorAddress,
Expand All @@ -564,7 +564,7 @@ func DeployUniverseViaCLI(e helpers.Environment) {
StalenessSeconds: *stalenessSeconds,
GasAfterPayment: *gasAfterPayment,
FallbackWeiPerUnitLink: fallbackWeiPerUnitLink,
FulfillmentFlatFeeNativePPM: uint32(*flatFeeEthPPM),
FulfillmentFlatFeeNativePPM: uint32(*flatFeeNativePPM),
FulfillmentFlatFeeLinkDiscountPPM: uint32(*flatFeeLinkDiscountPPM),
NativePremiumPercentage: uint8(*nativePremiumPercentage),
LinkPremiumPercentage: uint8(*linkPremiumPercentage),
Expand Down Expand Up @@ -657,7 +657,7 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
}

if !nativeOnly && len(contractAddresses.LinkEthAddress) == 0 {
fmt.Println("\nDeploying LINK/ETH Feed...")
fmt.Println("\nDeploying LINK/Native Feed...")
contractAddresses.LinkEthAddress = helpers.DeployLinkEthFeed(e, contractAddresses.LinkAddress, coordinatorConfig.FallbackWeiPerUnitLink).String()
}

Expand Down Expand Up @@ -836,7 +836,7 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
fmt.Println(
"\nDeployment complete.",
"\nLINK Token contract address:", contractAddresses.LinkAddress,
"\nLINK/ETH Feed contract address:", contractAddresses.LinkEthAddress,
"\nLINK/Native Feed contract address:", contractAddresses.LinkEthAddress,
"\nBlockhash Store contract address:", contractAddresses.BhsContractAddress,
"\nBatch Blockhash Store contract address:", contractAddresses.BatchBHSAddress,
"\nVRF Coordinator Address:", contractAddresses.CoordinatorAddress,
Expand Down Expand Up @@ -865,7 +865,7 @@ func VRFV2PlusDeployUniverse(e helpers.Environment,
func DeployWrapperUniverse(e helpers.Environment) {
cmd := flag.NewFlagSet("wrapper-universe-deploy", flag.ExitOnError)
linkAddress := cmd.String("link-address", "", "address of link token")
linkETHFeedAddress := cmd.String("link-eth-feed", "", "address of link-eth-feed")
linkNativeFeedAddress := cmd.String("link-native-feed", "", "address of link-native-feed")
coordinatorAddress := cmd.String("coordinator-address", "", "address of the vrf coordinator v2 contract")
subscriptionID := cmd.String("subscription-id", "", "subscription ID for the wrapper")
wrapperGasOverhead := cmd.Uint("wrapper-gas-overhead", 50_000, "amount of gas overhead in wrapper fulfillment")
Expand All @@ -880,7 +880,7 @@ func DeployWrapperUniverse(e helpers.Environment) {
stalenessSeconds := cmd.Uint("staleness-seconds", 86400, "the number of seconds of staleness to allow")
fulfillmentFlatFeeNativePPM := cmd.Uint("fulfillment-flat-fee-native-ppm", 500, "the native flat fee in ppm to charge for fulfillment denominated in native")
fulfillmentFlatFeeLinkDiscountPPM := cmd.Uint("fulfillment-flat-fee-link-discount-ppm", 500, "the link flat fee discount in ppm to charge for fulfillment denominated in native")
helpers.ParseArgs(cmd, os.Args[2:], "link-address", "link-eth-feed", "coordinator-address", "key-hash", "fallback-wei-per-unit-link")
helpers.ParseArgs(cmd, os.Args[2:], "link-address", "link-native-feed", "coordinator-address", "key-hash", "fallback-wei-per-unit-link")

amount, s := big.NewInt(0).SetString(*subFunding, 10)
if !s {
Expand All @@ -890,7 +890,7 @@ func DeployWrapperUniverse(e helpers.Environment) {
subId := parseSubID(*subscriptionID)
wrapper := WrapperDeploy(e,
common.HexToAddress(*linkAddress),
common.HexToAddress(*linkETHFeedAddress),
common.HexToAddress(*linkNativeFeedAddress),
common.HexToAddress(*coordinatorAddress),
subId,
)
Expand Down

0 comments on commit d5b5c5f

Please sign in to comment.