Skip to content

Commit feb2103

Browse files
committed
Remove hard-coded addresses for FungibleToken & FlowToken contracts
1 parent 791a8d8 commit feb2103

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

bootstrap/create-multi-key-account.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ import (
1313
"github.com/onflow/flow-go-sdk/access/grpc"
1414
"github.com/onflow/flow-go-sdk/crypto"
1515
"github.com/onflow/flow-go-sdk/templates"
16+
"github.com/onflow/flow-go/fvm/systemcontracts"
17+
flowGo "github.com/onflow/flow-go/model/flow"
1618
"golang.org/x/exp/rand"
1719
)
1820

21+
var sc = systemcontracts.SystemContractsForChain(flowGo.Emulator)
22+
var ftAddress = sc.FungibleToken.Address.HexWithPrefix()
23+
var flowAddress = sc.FlowToken.Address.HexWithPrefix()
24+
1925
// RunCreateMultiKeyAccount command creates a new account with multiple keys, which are saved to keys.json for later
2026
// use with running the gateway in a key-rotation mode (used with --coa-key-file flag).
2127
func RunCreateMultiKeyAccount() {
@@ -27,8 +33,8 @@ func RunCreateMultiKeyAccount() {
2733
flag.IntVar(&keyCount, "key-count", 20, "how many keys you want to create and assign to account")
2834
flag.StringVar(&keyFlag, "signer-key", "", "signer key used to create the new account")
2935
flag.StringVar(&addressFlag, "signer-address", "", "signer address used to create new account")
30-
flag.StringVar(&ftFlag, "ft-address", "0xee82856bf20e2aa6", "address of fungible token contract")
31-
flag.StringVar(&flowFlag, "flow-token-address", "0x0ae53cb6e3f42a79", "address of flow token contract")
36+
flag.StringVar(&ftFlag, "ft-address", ftAddress, "address of fungible token contract")
37+
flag.StringVar(&flowFlag, "flow-token-address", flowAddress, "address of flow token contract")
3238
flag.StringVar(&hostFlag, "access-node-grpc-host", "localhost:3569", "host to the flow access node gRPC API")
3339

3440
flag.Parse()

tests/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ func servicesSetup(t *testing.T) (emulator.Emulator, func()) {
147147
client,
148148
keyCount,
149149
service.Address,
150-
"0xee82856bf20e2aa6",
151-
"0x0ae53cb6e3f42a79",
150+
sc.FungibleToken.Address.HexWithPrefix(),
151+
sc.FlowToken.Address.HexWithPrefix(),
152152
service.PrivateKey,
153153
)
154154
require.NoError(t, err)

tests/integration_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func Test_ConcurrentTransactionSubmissionWithTxSeal(t *testing.T) {
5454
client,
5555
keyCount,
5656
service.Address,
57-
"0xee82856bf20e2aa6",
58-
"0x0ae53cb6e3f42a79",
57+
sc.FungibleToken.Address.HexWithPrefix(),
58+
sc.FlowToken.Address.HexWithPrefix(),
5959
service.PrivateKey,
6060
)
6161
require.NoError(t, err)
@@ -164,8 +164,8 @@ func Test_ConcurrentTransactionSubmissionWithLocalIndex(t *testing.T) {
164164
client,
165165
keyCount,
166166
service.Address,
167-
"0xee82856bf20e2aa6",
168-
"0x0ae53cb6e3f42a79",
167+
sc.FungibleToken.Address.HexWithPrefix(),
168+
sc.FlowToken.Address.HexWithPrefix(),
169169
service.PrivateKey,
170170
)
171171
require.NoError(t, err)
@@ -268,8 +268,8 @@ func Test_EthClientTest(t *testing.T) {
268268
client,
269269
keyCount,
270270
service.Address,
271-
"0xee82856bf20e2aa6",
272-
"0x0ae53cb6e3f42a79",
271+
sc.FungibleToken.Address.HexWithPrefix(),
272+
sc.FlowToken.Address.HexWithPrefix(),
273273
service.PrivateKey,
274274
)
275275
require.NoError(t, err)
@@ -364,8 +364,8 @@ func Test_CloudKMSConcurrentTransactionSubmission(t *testing.T) {
364364
client,
365365
publicKeys,
366366
service.Address,
367-
"0xee82856bf20e2aa6",
368-
"0x0ae53cb6e3f42a79",
367+
sc.FungibleToken.Address.HexWithPrefix(),
368+
sc.FlowToken.Address.HexWithPrefix(),
369369
service.PrivateKey,
370370
)
371371
require.NoError(t, err)

0 commit comments

Comments
 (0)