Skip to content

Commit

Permalink
Fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dimriou committed Dec 19, 2023
1 parent 1d624c3 commit 94d2a08
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/scripts/chaincli/handler/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

evm21 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21"

commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex"
"github.com/smartcontractkit/chainlink/core/scripts/chaincli/config"
"github.com/smartcontractkit/chainlink/core/scripts/common"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/automation_utils_2_1"
Expand All @@ -34,7 +35,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/encoding"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/streams"
"github.com/smartcontractkit/chainlink/v2/core/utils"
bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math"
)

Expand Down Expand Up @@ -86,7 +86,7 @@ func (k *Keeper) Debug(ctx context.Context, args []string) {
}
// get upkeepID from command args
upkeepID := big.NewInt(0)
upkeepIDNoPrefix := utils.RemoveHexPrefix(args[0])
upkeepIDNoPrefix := commonhex.TrimPrefix(args[0])
_, wasBase10 := upkeepID.SetString(upkeepIDNoPrefix, 10)
if !wasBase10 {
_, wasBase16 := upkeepID.SetString(upkeepIDNoPrefix, 16)
Expand Down
3 changes: 2 additions & 1 deletion core/scripts/chaincli/handler/keeper_launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"

"github.com/smartcontractkit/chainlink-common/pkg/utils/hex"
"github.com/smartcontractkit/chainlink/v2/core/cmd"
iregistry21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1"
registry12 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_2"
Expand Down Expand Up @@ -409,7 +410,7 @@ func (k *Keeper) createOCR2KeeperJob(client cmd.HTTPClient, contractAddr, nodeAd

// addKeyToKeeper imports the provided ETH sending key to the keeper
func (k *Keeper) addKeyToKeeper(client cmd.HTTPClient, privKeyHex string) (string, error) {
privkey, err := crypto.HexToECDSA(utils.RemoveHexPrefix(privKeyHex))
privkey, err := crypto.HexToECDSA(hex.TrimPrefix(privKeyHex))
if err != nil {
log.Fatalf("Failed to decode priv key %s: %v", privKeyHex, err)
}
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/ocr2vrf/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/smartcontractkit/chainlink-vrf/ocr2vrf"
ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils"
"github.com/smartcontractkit/chainlink/v2/core/cmd"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface"
Expand All @@ -35,7 +36,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_beacon_consumer"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator"
"github.com/smartcontractkit/chainlink/v2/core/utils"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
)
Expand Down
3 changes: 2 additions & 1 deletion core/scripts/vrfv1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/shopspring/decimal"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store"
linktoken "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_coordinator_interface"
Expand Down Expand Up @@ -203,7 +204,7 @@ func main() {
}
link, err := linktoken.NewLinkToken(common.HexToAddress(*linkAddr), e.Ec)
helpers.PanicErr(err)
data, err := utils.ABIEncode(`[{"type":"bytes32"}]`, common.HexToHash(*keyHash))
data, err := evmutils.ABIEncode(`[{"type":"bytes32"}]`, common.HexToHash(*keyHash))
helpers.PanicErr(err)
tx, err := link.TransferAndCall(e.Owner, common.HexToAddress(*consumerAddr), payment, data)
helpers.PanicErr(err)
Expand Down
3 changes: 2 additions & 1 deletion core/scripts/vrfv2/genvrfnum/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/shopspring/decimal"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey"
"github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1"
"github.com/smartcontractkit/chainlink/v2/core/services/vrf/proof"
Expand Down Expand Up @@ -227,7 +228,7 @@ func main() {
}

func preseed(keyHash common.Hash, sender common.Address, subID, nonce uint64) [32]byte {
encoded, err := utils.ABIEncode(
encoded, err := evmutils.ABIEncode(
`[{"type":"bytes32"}, {"type":"address"}, {"type":"uint64"}, {"type", "uint64"}]`,
keyHash,
sender,
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/vrfv2/testnet/v2scripts/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store"
Expand All @@ -22,7 +23,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_external_sub_owner_example"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2_wrapper"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2_wrapper_consumer_example"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

func DeployBHS(e helpers.Environment) (blockhashStoreAddress common.Address) {
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/vrfv2plus/testnet/v2plusscripts/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_vrf_coordinator_v2plus"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_v2plus_sub_owner"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2plus_wrapper"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrfv2plus_wrapper_consumer_example"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

func DeployBHS(e helpers.Environment) (blockhashStoreAddress common.Address) {
Expand Down

0 comments on commit 94d2a08

Please sign in to comment.