Skip to content

Commit

Permalink
VRF-782: Fix setup-env script in order to include flag for deploying … (
Browse files Browse the repository at this point in the history
#11445)

* VRF-782: Fix setup-env script in order to include flag for deploying VRFOwner contract

* Update main.go

* VRF-782: Fix setup-env script to create ETH key

---------

Co-authored-by: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com>
  • Loading branch information
iljapavlovs and kidambisrinivas authored Dec 5, 2023
1 parent 9d49a20 commit cf9ab4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/scripts/common/vrf/setup-envs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ go run . \
--batch-fulfillment-enabled="true" \
--min-confs=3 \
--register-vrf-key-against-address=<vrf key will be registered against this address
in order to call oracleWithdraw from this address>
in order to call oracleWithdraw from this address> \
--deploy-vrfv2-owner="true"
```

Optional parameters - will not be deployed if specified
Expand Down Expand Up @@ -71,7 +72,7 @@ go run . \
--sending-key-funding-amount="1e17" \
--deploy-contracts-and-create-jobs="false"
```
Then update corresponding deployment scripts with the new ETH addresses, specifying max gas price for each key
Then update corresponding deployment scripts in infra-k8s repo with the new ETH addresses, specifying max gas price for each key

e.g.:
```
Expand All @@ -98,6 +99,7 @@ go run . \
--batch-fulfillment-enabled="true" \
--min-confs=3 \
--register-vrf-key-against-address="<eoa address>" \
--deploy-vrfv2-owner="true" \
--link-address "<link address>" \
--link-eth-feed "<link eth feed address>"
```
Expand Down
6 changes: 5 additions & 1 deletion core/scripts/common/vrf/setup-envs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/shopspring/decimal"
"github.com/urfave/cli"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
"github.com/smartcontractkit/chainlink/core/scripts/common/vrf/constants"
"github.com/smartcontractkit/chainlink/core/scripts/common/vrf/model"
Expand All @@ -21,7 +23,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_v2_5"
"github.com/smartcontractkit/chainlink/v2/core/web/presenters"
"github.com/urfave/cli"
)

func newApp(remoteNodeURL string, writer io.Writer) (*clcmd.Shell, *cli.App) {
Expand Down Expand Up @@ -87,6 +88,7 @@ func main() {
batchCoordinatorAddressString := flag.String("batch-coordinator-address", "", "address Batch VRF Coordinator contract")
registerVRFKeyAgainstAddress := flag.String("register-vrf-key-against-address", "", "VRF Key registration against address - "+
"from this address you can perform `coordinator.oracleWithdraw` to withdraw earned funds from rand request fulfilments")
deployVRFOwner := flag.Bool("deploy-vrfv2-owner", true, "whether to deploy VRF owner contracts")

e := helpers.SetupEnv(false)
flag.Parse()
Expand Down Expand Up @@ -211,6 +213,7 @@ func main() {
coordinatorConfigV2,
*batchFulfillmentEnabled,
nodesMap,
*deployVRFOwner,
)
case "v2plus":
feeConfigV2Plus := vrf_coordinator_v2_5.VRFCoordinatorV25FeeConfig{
Expand Down Expand Up @@ -503,6 +506,7 @@ func createETHKeysIfNeeded(client *clcmd.Shell, app *cli.App, output *bytes.Buff
var newKey presenters.ETHKeyResource

flagSet := flag.NewFlagSet("blah", flag.ExitOnError)
flagSet.String("evm-chain-id", os.Getenv("ETH_CHAIN_ID"), "chain id")
if *maxGasPriceGwei > 0 {
helpers.PanicErr(flagSet.Set("max-gas-price-gwei", fmt.Sprintf("%d", *maxGasPriceGwei)))
}
Expand Down

0 comments on commit cf9ab4e

Please sign in to comment.