Skip to content

Commit

Permalink
Remove hard-coded addresses for FungibleToken & FlowToken contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Dec 12, 2024
1 parent bda9fd5 commit 04fd1d5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 8 additions & 2 deletions bootstrap/create-multi-key-account.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import (
"github.com/onflow/flow-go-sdk/access/grpc"
"github.com/onflow/flow-go-sdk/crypto"
"github.com/onflow/flow-go-sdk/templates"
"github.com/onflow/flow-go/fvm/systemcontracts"
flowGo "github.com/onflow/flow-go/model/flow"
"golang.org/x/exp/rand"
)

var sc = systemcontracts.SystemContractsForChain(flowGo.Emulator)
var ftAddress = sc.FungibleToken.Address.HexWithPrefix()
var flowAddress = sc.FlowToken.Address.HexWithPrefix()

// RunCreateMultiKeyAccount command creates a new account with multiple keys, which are saved to keys.json for later
// use with running the gateway in a key-rotation mode (used with --coa-key-file flag).
func RunCreateMultiKeyAccount() {
Expand All @@ -27,8 +33,8 @@ func RunCreateMultiKeyAccount() {
flag.IntVar(&keyCount, "key-count", 20, "how many keys you want to create and assign to account")
flag.StringVar(&keyFlag, "signer-key", "", "signer key used to create the new account")
flag.StringVar(&addressFlag, "signer-address", "", "signer address used to create new account")
flag.StringVar(&ftFlag, "ft-address", "0xee82856bf20e2aa6", "address of fungible token contract")
flag.StringVar(&flowFlag, "flow-token-address", "0x0ae53cb6e3f42a79", "address of flow token contract")
flag.StringVar(&ftFlag, "ft-address", ftAddress, "address of fungible token contract")
flag.StringVar(&flowFlag, "flow-token-address", flowAddress, "address of flow token contract")
flag.StringVar(&hostFlag, "access-node-grpc-host", "localhost:3569", "host to the flow access node gRPC API")

flag.Parse()
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ func servicesSetup(t *testing.T) (emulator.Emulator, func()) {
client,
keyCount,
service.Address,
"0xee82856bf20e2aa6",
"0x0ae53cb6e3f42a79",
sc.FungibleToken.Address.HexWithPrefix(),
sc.FlowToken.Address.HexWithPrefix(),
service.PrivateKey,
)
require.NoError(t, err)
Expand Down
16 changes: 8 additions & 8 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func Test_ConcurrentTransactionSubmissionWithTxSeal(t *testing.T) {
client,
keyCount,
service.Address,
"0xee82856bf20e2aa6",
"0x0ae53cb6e3f42a79",
sc.FungibleToken.Address.HexWithPrefix(),
sc.FlowToken.Address.HexWithPrefix(),
service.PrivateKey,
)
require.NoError(t, err)
Expand Down Expand Up @@ -164,8 +164,8 @@ func Test_ConcurrentTransactionSubmissionWithLocalIndex(t *testing.T) {
client,
keyCount,
service.Address,
"0xee82856bf20e2aa6",
"0x0ae53cb6e3f42a79",
sc.FungibleToken.Address.HexWithPrefix(),
sc.FlowToken.Address.HexWithPrefix(),
service.PrivateKey,
)
require.NoError(t, err)
Expand Down Expand Up @@ -268,8 +268,8 @@ func Test_EthClientTest(t *testing.T) {
client,
keyCount,
service.Address,
"0xee82856bf20e2aa6",
"0x0ae53cb6e3f42a79",
sc.FungibleToken.Address.HexWithPrefix(),
sc.FlowToken.Address.HexWithPrefix(),
service.PrivateKey,
)
require.NoError(t, err)
Expand Down Expand Up @@ -364,8 +364,8 @@ func Test_CloudKMSConcurrentTransactionSubmission(t *testing.T) {
client,
publicKeys,
service.Address,
"0xee82856bf20e2aa6",
"0x0ae53cb6e3f42a79",
sc.FungibleToken.Address.HexWithPrefix(),
sc.FlowToken.Address.HexWithPrefix(),
service.PrivateKey,
)
require.NoError(t, err)
Expand Down

0 comments on commit 04fd1d5

Please sign in to comment.