diff --git a/lib/go/contracts/go.mod b/lib/go/contracts/go.mod index 7a08fe668..6ba9bea1d 100644 --- a/lib/go/contracts/go.mod +++ b/lib/go/contracts/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/kevinburke/go-bindata v3.23.0+incompatible - github.com/onflow/flow-ft/lib/go/contracts v0.5.0 + github.com/onflow/flow-ft/lib/go/contracts v0.7.0 github.com/stretchr/testify v1.8.0 ) diff --git a/lib/go/contracts/go.sum b/lib/go/contracts/go.sum index 982be9a23..6739deeac 100644 --- a/lib/go/contracts/go.sum +++ b/lib/go/contracts/go.sum @@ -12,15 +12,14 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/onflow/flow-ft/lib/go/contracts v0.5.0 h1:Cg4gHGVblxcejfNNG5Mfj98Wf4zbY76O0Y28QB0766A= -github.com/onflow/flow-ft/lib/go/contracts v0.5.0/go.mod h1:1zoTjp1KzNnOPkyqKmWKerUyf0gciw+e6tAEt0Ks3JE= +github.com/onflow/flow-ft/lib/go/contracts v0.7.0 h1:XEKE6qJUw3luhsYmIOteXP53gtxNxrwTohgxJXCYqBE= +github.com/onflow/flow-ft/lib/go/contracts v0.7.0/go.mod h1:kTMFIySzEJJeupk+7EmXs0EJ6CBWY/MV9fv9iYQk+RU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= diff --git a/lib/go/templates/internal/assets/assets.go b/lib/go/templates/internal/assets/assets.go index c109ac6a2..5f31a242a 100644 --- a/lib/go/templates/internal/assets/assets.go +++ b/lib/go/templates/internal/assets/assets.go @@ -66,7 +66,7 @@ // epoch/scripts/get_randomize.cdc (121B) // flowToken/burn_tokens.cdc (1.085kB) // flowToken/create_forwarder.cdc (1.815kB) -// flowToken/mint_tokens.cdc (893B) +// flowToken/mint_tokens.cdc (1.026kB) // flowToken/scripts/get_balance.cdc (453B) // flowToken/scripts/get_supply.cdc (207B) // flowToken/setup_account.cdc (1.147kB) @@ -1674,7 +1674,7 @@ func flowtokenCreate_forwarderCdc() (*asset, error) { return a, nil } -var _flowtokenMint_tokensCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\xcb\x6e\xdb\x30\x10\xbc\xeb\x2b\x16\x3e\x04\x12\xd0\xc8\x3d\x14\x3d\x18\x4e\x02\xb5\xb1\x8b\xa2\xad\x0b\xc4\x71\xef\x14\xb5\x56\x16\xa5\x48\x61\xb9\xaa\x1c\x04\xf9\xf7\x82\x7a\xc4\x56\x1a\x97\x17\x01\xd4\xcc\xec\xcc\x0e\xa9\xaa\x1d\x0b\xac\x1b\x5b\x52\x6e\xf0\xde\xfd\x46\x0b\x7b\x76\x15\xbc\x3f\xac\x77\x9b\x2f\x5f\x3f\x7d\x5f\xdd\xff\xfc\xb6\xda\x64\xb7\xb7\x77\xab\xed\x36\x1a\x09\xc6\xb5\x13\xf0\x04\x14\x09\x2b\xeb\x95\x16\x72\x36\x66\xd4\x54\x13\x5a\x59\x40\x56\x14\x8c\xde\xbf\x03\x55\xb9\x26\x5c\xec\xd6\x74\xf8\xf8\x21\x81\xa7\x08\x00\xc0\xa0\x80\x04\xd1\xac\xa8\xc8\x2e\xe0\xe2\x65\x4a\xda\xdd\x90\x17\x56\xe2\x78\x0a\xbe\x43\x8d\xf4\x07\x79\x01\x17\x4f\x93\x1c\xe9\xf8\xe7\x39\xea\x18\x35\x63\xad\x18\x63\x4f\xa5\x0d\xf0\xac\x91\x87\x4c\xeb\xe0\x64\x74\x10\x8e\x47\xb3\x4f\x8f\x36\xe0\x0a\x7a\xc2\x0b\x20\x9c\x34\x77\xcc\xae\x5d\x9e\xb3\x78\x1d\x87\xbd\x2c\x60\xee\xc5\xb1\x2a\x71\xbe\x1f\x71\x1d\x2c\x99\x88\xdd\xdc\x40\xad\x2c\xe9\x78\xb6\xed\x26\x01\x79\xb0\x4e\x40\x1e\xb0\x8f\x08\x2a\x90\x66\x49\xf4\x86\xc9\x31\x24\x5c\x41\x89\x32\xe4\x39\x2e\x7d\x3a\x29\x2d\x51\x3e\xab\x5a\xe5\x64\x48\x1e\xe3\x79\xdd\xe4\x86\xf4\xd1\xdc\x28\x96\xbc\x1d\xf6\xdc\x7e\xaf\xe3\x73\x81\x76\x56\xe5\x26\xa4\x80\x5e\x03\x78\xb4\xcb\xb8\x47\x46\xab\x71\xd6\x73\x87\x92\xf0\x80\xba\x11\x3c\xe9\x23\x14\x5d\x91\x15\x64\x58\x5e\xbe\x6e\x27\xd5\x8c\x4a\x70\x83\xed\x8f\x0e\x12\x2b\x63\x5c\x8b\x45\x36\x3c\xb0\xfe\xa1\x25\xff\x8a\x15\xbf\x54\x63\x24\x28\xf6\xda\x69\xf8\x74\xb1\x7c\xac\x5e\x91\xff\xb3\xf5\xb4\xc0\xda\x79\x92\xa1\xee\xe5\xe5\x89\xf8\x09\xb1\x40\x2f\xec\x1e\x87\x59\x43\xde\xe7\xbf\x01\x00\x00\xff\xff\x40\xd9\x16\x66\x7d\x03\x00\x00" +var _flowtokenMint_tokensCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\xcd\x6e\xda\x40\x10\xbe\xfb\x29\x46\x1c\x22\x23\x35\x76\x0f\x55\x0f\x88\x24\x72\x1b\xa8\xaa\xa6\x44\x0a\xd0\x9e\x97\xf5\x60\x46\x35\xbb\xd6\xec\x38\x10\xa1\xbc\x7b\xb5\x5e\x1b\x70\x1a\xba\x17\x4b\xeb\x6f\xbe\xbf\x59\xda\x56\x96\x05\xa6\xb5\x29\x68\x55\xe2\xc2\xfe\x41\x03\x6b\xb6\x5b\xf8\xb8\x9f\x2e\x67\xdf\xbe\x7f\x79\x98\x2c\x1e\x7f\x4c\x66\xd9\xfd\xfd\xd3\x64\x3e\x8f\xba\x81\xd2\xee\xfa\xe0\x87\xc7\xdf\x3d\x60\x94\xa6\x29\x2c\x36\xe4\x40\x58\x19\xa7\xb4\x90\x35\xb0\x25\x23\x0e\xc4\x4f\x3a\xa8\x1d\x99\x02\x64\x83\xa0\xb4\xb6\xb5\x11\x90\x8d\x12\x70\x62\x19\x5d\x73\xef\x65\x20\xe8\x64\xf9\x96\x0c\x30\x3a\x5b\xb3\xc6\x13\x3b\x05\xa4\x43\x7e\x26\x7d\x64\x8a\xa2\x33\xd5\x98\x51\x53\x45\x68\x64\x04\x59\x9e\x33\x3a\xf7\x01\xd4\xd6\xe3\x46\xb0\x9c\xd2\xfe\xf3\xa7\x21\x1c\xa2\x08\x00\xa0\x44\x09\xf6\x1a\xbd\x11\x5c\x1d\x93\x26\xcd\x0d\x39\x61\x25\x96\xfb\xe0\x27\xd4\x48\xcf\xc8\x23\xb8\x3a\xf4\xba\x4c\xba\x3f\xaf\x81\xbe\x62\xac\x14\x63\xec\xa8\x30\x1e\x9e\xd5\xb2\xc9\x82\xe5\xa3\x05\x7f\x1c\x96\xeb\xe4\xe4\x03\x6e\x20\x4c\x1c\x01\xfe\x24\x2b\xcb\x6c\x77\xe3\x4b\x1e\x6f\x63\xbf\x9c\x11\xa4\xbe\x51\x55\x60\xba\xee\x70\x0d\x6c\xd8\x23\xbb\xbb\x83\x4a\x19\xd2\xf1\x60\xde\x28\xf9\x62\x8d\x95\xa6\xdc\xc6\x08\x28\x3f\x34\x18\xbe\x67\xb2\x4b\x09\x37\x50\xa0\xb4\x81\x4e\xb5\xf7\x95\x92\x02\xe5\xab\xaa\xd4\x8a\x4a\x92\x97\x38\xad\xea\x55\x49\xfa\x64\xae\x23\x1b\xbe\x1f\xf6\x52\xc1\xb7\xf1\xa5\x40\x4b\xa3\x56\xa5\x4f\x01\x81\x03\xb8\xb3\xcb\xb8\x46\x46\xa3\x71\x10\x66\xdb\x2d\xe1\x1e\x75\x2d\x08\x87\x23\xa1\xdf\xb4\x7f\xbb\xc8\x30\xbe\x7e\xbb\x9d\x44\x33\x2a\xc1\x19\xee\x7e\x36\x90\x58\x95\xa5\xdd\x61\x9e\xb5\x4f\x2c\x3c\xb5\xe1\xbf\x64\xf9\x2f\x55\x97\xe2\x19\x03\x77\xe2\x3f\x4d\x2c\x17\xab\x37\xc3\xff\x69\x3d\xc9\xb1\xb2\x8e\xa4\x5d\xf7\xf8\xfa\x8c\xfc\x6c\x30\x47\x27\x6c\x5f\x5a\xad\x36\xef\xeb\xdf\x00\x00\x00\xff\xff\xac\x61\xd6\x4a\x02\x04\x00\x00" func flowtokenMint_tokensCdcBytes() ([]byte, error) { return bindataRead( @@ -1690,7 +1690,7 @@ func flowtokenMint_tokensCdc() (*asset, error) { } info := bindataFileInfo{name: "flowToken/mint_tokens.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2e, 0x2f, 0x55, 0x1f, 0xdb, 0xa9, 0xbe, 0x6, 0xcc, 0x5b, 0x37, 0x28, 0xd4, 0xbc, 0x78, 0xb6, 0xba, 0x4d, 0xe, 0xcd, 0xfc, 0x89, 0x28, 0xbe, 0x17, 0x6b, 0x27, 0x8f, 0xe6, 0xe5, 0x49, 0x89}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0xc6, 0x66, 0x5d, 0xee, 0x48, 0xe, 0xb9, 0xea, 0x2f, 0xd, 0xc1, 0xe8, 0xcf, 0x70, 0x67, 0x81, 0x67, 0x29, 0x35, 0x1, 0x39, 0x44, 0x65, 0x4b, 0xc, 0x19, 0x1e, 0xcd, 0x6a, 0x57, 0x65}} return a, nil } diff --git a/lib/go/templates/service_templates.go b/lib/go/templates/service_templates.go index 89fb59b2f..65da666ff 100644 --- a/lib/go/templates/service_templates.go +++ b/lib/go/templates/service_templates.go @@ -6,6 +6,10 @@ import ( const ( + // FlowToken Templates + mintFlowFilename = "flowToken/mint_tokens.cdc" + getFlowBalanceFilename = "flowToken/scripts/get_balance.cdc" + // FlowStorageFees templates changeStorageFeeParametersFilename = "storageFees/admin/set_parameters.cdc" @@ -36,6 +40,19 @@ const ( setExecutionMemoryLimit = "FlowServiceAccount/set_execution_memory_limit.cdc" ) +// FlowToken Templates +func GenerateMintFlowScript(env Environment) []byte { + code := assets.MustAssetString(mintFlowFilename) + + return []byte(ReplaceAddresses(code, env)) +} + +func GenerateGetFlowBalanceScript(env Environment) []byte { + code := assets.MustAssetString(getFlowBalanceFilename) + + return []byte(ReplaceAddresses(code, env)) +} + // StorageFees Templates func GenerateChangeStorageFeeParametersScript(env Environment) []byte { diff --git a/lib/go/test/flow_epoch_test.go b/lib/go/test/flow_epoch_test.go index 2eafb38c6..38c3b1360 100644 --- a/lib/go/test/flow_epoch_test.go +++ b/lib/go/test/flow_epoch_test.go @@ -108,7 +108,7 @@ func TestEpochClusters(t *testing.T) { }) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) _, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, @@ -290,7 +290,7 @@ func TestEpochPhaseMetadataChange(t *testing.T) { }) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) _, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, @@ -412,7 +412,7 @@ func TestEpochAdvance(t *testing.T) { }) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, dkgIDs := generateNodeIDs(numEpochAccounts) _, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, @@ -552,7 +552,7 @@ func TestEpochQCDKGNodeRegistration(t *testing.T) { rewardIncreaseFactor) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) _, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, @@ -644,7 +644,7 @@ func TestEpochFullNodeRegistration(t *testing.T) { rewardIncreaseFactor) // create new user accounts, mint tokens for them, and register them for staking - addresses, publicKeys, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, publicKeys, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) _, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForEpochs(t, b, env, @@ -676,7 +676,7 @@ func TestEpochQCDKG(t *testing.T) { rewardIncreaseFactor) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) stakingPrivateKeys, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, @@ -979,7 +979,7 @@ func TestEpochQCDKG(t *testing.T) { t.Run("Can set the rewards with high fee amount, which should not increase the supply at all", func(t *testing.T) { - mintTokensForAccount(t, b, idTableAddress, "6572144.3875") + mintTokensForAccount(t, b, env, idTableAddress, "6572144.3875") tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateDepositFeesScript(env), idTableAddress) @@ -1052,7 +1052,7 @@ func TestEpochReset(t *testing.T) { rewardIncreaseFactor) // create new user accounts, mint tokens for them, and register them for staking - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numEpochAccounts) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numEpochAccounts) ids, _, _ := generateNodeIDs(numEpochAccounts) stakingPrivateKeys, stakingPublicKeys, _, networkingPublicKeys := generateManyNodeKeys(t, numEpochAccounts) registerNodesForStaking(t, b, env, diff --git a/lib/go/test/flow_idtable_nodes_test.go b/lib/go/test/flow_idtable_nodes_test.go index 53f440c05..0b3a58c94 100644 --- a/lib/go/test/flow_idtable_nodes_test.go +++ b/lib/go/test/flow_idtable_nodes_test.go @@ -13,8 +13,6 @@ import ( "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flow-go-sdk/test" - ft_templates "github.com/onflow/flow-ft/lib/go/templates" - "github.com/onflow/flow-core-contracts/lib/go/templates" ) @@ -78,11 +76,7 @@ func TestManyNodesIDTable(t *testing.T) { totalMint := numberOfNodes * nodeMintAmount mintAmount := fmt.Sprintf("%d.0", totalMint) - script := ft_templates.GenerateMintTokensScript( - flow.HexToAddress(emulatorFTAddress), - flow.HexToAddress(emulatorFlowTokenAddress), - "FlowToken", - ) + script := templates.GenerateMintFlowScript(env) tx := createTxWithTemplateAndAuthorizer(b, script, b.ServiceKey().Address) @@ -396,11 +390,7 @@ func TestUnstakeAllManyDelegatorsIDTable(t *testing.T) { for i := 0; i < unstakeAllNumNodes; i++ { - script := ft_templates.GenerateMintTokensScript( - flow.HexToAddress(emulatorFTAddress), - flow.HexToAddress(emulatorFlowTokenAddress), - "FlowToken", - ) + script := templates.GenerateMintFlowScript(env) tx := createTxWithTemplateAndAuthorizer(b, script, b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(nodeAddresses[i])) diff --git a/lib/go/test/flow_idtable_staking_test.go b/lib/go/test/flow_idtable_staking_test.go index 6d0630b79..2bffd463e 100644 --- a/lib/go/test/flow_idtable_staking_test.go +++ b/lib/go/test/flow_idtable_staking_test.go @@ -297,7 +297,7 @@ func TestIDTableRegistration(t *testing.T) { IDTableAccountKey, IDTableSigner := accountKeys.NewWithSigner() idTableAddress, feesAddr := deployStakingContract(t, b, IDTableAccountKey, IDTableSigner, &env, true, []uint64{1, 1, 1, 1, 1}) _, adminStakingKey, _, adminNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, idTableAddress, "1000000000.0") + mintTokensForAccount(t, b, env, idTableAddress, "1000000000.0") setNodeRoleSlotLimits(t, b, env, idTableAddress, IDTableSigner, [5]uint16{1, 1, 1, 1, 1}) @@ -307,19 +307,19 @@ func TestIDTableRegistration(t *testing.T) { // Create new user accounts joshAddress, _, joshSigner := newAccountWithAddress(b, accountKeys) _, joshStakingKey, _, joshNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, joshAddress, "1000000000.0") + mintTokensForAccount(t, b, env, joshAddress, "1000000000.0") maxAddress, _, maxSigner := newAccountWithAddress(b, accountKeys) _, maxStakingKey, _, maxNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, maxAddress, "1000000000.0") + mintTokensForAccount(t, b, env, maxAddress, "1000000000.0") bastianAddress, _, bastianSigner := newAccountWithAddress(b, accountKeys) _, bastianStakingKey, _, bastianNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, bastianAddress, "1000000000.0") + mintTokensForAccount(t, b, env, bastianAddress, "1000000000.0") accessAddress, _, accessSigner := newAccountWithAddress(b, accountKeys) _, accessStakingKey, _, accessNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, accessAddress, "1000000000.0") + mintTokensForAccount(t, b, env, accessAddress, "1000000000.0") committed := make(map[string]interpreter.UFix64Value) @@ -759,15 +759,15 @@ func TestIDTableApprovals(t *testing.T) { IDTableAccountKey, IDTableSigner := accountKeys.NewWithSigner() _, adminStakingKey, _, adminNetworkingKey := generateKeysForNodeRegistration(t) idTableAddress, feesAddr := deployStakingContract(t, b, IDTableAccountKey, IDTableSigner, &env, true, []uint64{3, 3, 3, 3, 3}) - mintTokensForAccount(t, b, idTableAddress, "1000000000.0") + mintTokensForAccount(t, b, env, idTableAddress, "1000000000.0") accessAddress, _, accessSigner := newAccountWithAddress(b, accountKeys) _, accessStakingKey, _, accessNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, accessAddress, "1000000000.0") + mintTokensForAccount(t, b, env, accessAddress, "1000000000.0") joshAddress, _, joshSigner := newAccountWithAddress(b, accountKeys) _, joshStakingKey, _, joshNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, joshAddress, "1000000000.0") + mintTokensForAccount(t, b, env, joshAddress, "1000000000.0") env.IDTableAddress = idTableAddress.Hex() env.FlowFeesAddress = feesAddr.Hex() @@ -1051,7 +1051,7 @@ func TestIDTableStaking(t *testing.T) { IDTableAccountKey, IDTableSigner := accountKeys.NewWithSigner() _, adminStakingKey, _, adminNetworkingKey := generateKeysForNodeRegistration(t) idTableAddress, feesAddr := deployStakingContract(t, b, IDTableAccountKey, IDTableSigner, &env, true, []uint64{3, 3, 3, 3, 3}) - mintTokensForAccount(t, b, idTableAddress, "1000000000.0") + mintTokensForAccount(t, b, env, idTableAddress, "1000000000.0") env.IDTableAddress = idTableAddress.Hex() env.FlowFeesAddress = feesAddr.Hex() @@ -1068,32 +1068,32 @@ func TestIDTableStaking(t *testing.T) { // Create new user accounts joshAddress, _, joshSigner := newAccountWithAddress(b, accountKeys) _, joshStakingKey, _, joshNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, joshAddress, "1000000000.0") + mintTokensForAccount(t, b, env, joshAddress, "1000000000.0") maxAddress, _, maxSigner := newAccountWithAddress(b, accountKeys) _, maxStakingKey, _, maxNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, maxAddress, "1000000000.0") + mintTokensForAccount(t, b, env, maxAddress, "1000000000.0") bastianAddress, _, bastianSigner := newAccountWithAddress(b, accountKeys) _, bastianStakingKey, _, bastianNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, bastianAddress, "1000000000.0") + mintTokensForAccount(t, b, env, bastianAddress, "1000000000.0") accessAddress, _, accessSigner := newAccountWithAddress(b, accountKeys) _, accessStakingKey, _, accessNetworkingKey := generateKeysForNodeRegistration(t) - mintTokensForAccount(t, b, accessAddress, "1000000000.0") + mintTokensForAccount(t, b, env, accessAddress, "1000000000.0") // Create new delegator user accounts adminDelegatorAddress, _, adminDelegatorSigner := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, adminDelegatorAddress, "1000000000.0") + mintTokensForAccount(t, b, env, adminDelegatorAddress, "1000000000.0") joshDelegatorOneAddress, _, joshDelegatorOneSigner := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, joshDelegatorOneAddress, "1000000000.0") + mintTokensForAccount(t, b, env, joshDelegatorOneAddress, "1000000000.0") maxDelegatorOneAddress, _, maxDelegatorOneSigner := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, maxDelegatorOneAddress, "1000000000.0") + mintTokensForAccount(t, b, env, maxDelegatorOneAddress, "1000000000.0") maxDelegatorTwoAddress, _, maxDelegatorTwoSigner := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, maxDelegatorTwoAddress, "1000000000.0") + mintTokensForAccount(t, b, env, maxDelegatorTwoAddress, "1000000000.0") // Register the First nodes var amountToCommit interpreter.UFix64Value = 25000000000000 @@ -2900,19 +2900,19 @@ func TestIDTableSlotSelection(t *testing.T) { // Create new user accounts and generate staking info access1Address, _, access1Signer := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, access1Address, "1000000.0") + mintTokensForAccount(t, b, env, access1Address, "1000000.0") _, access1StakingKey, _, access1NetworkingKey := generateKeysForNodeRegistration(t) access2Address, _, access2Signer := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, access2Address, "1000000.0") + mintTokensForAccount(t, b, env, access2Address, "1000000.0") _, access2StakingKey, _, access2NetworkingKey := generateKeysForNodeRegistration(t) access3Address, _, access3Signer := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, access3Address, "1000000.0") + mintTokensForAccount(t, b, env, access3Address, "1000000.0") _, access3StakingKey, _, access3NetworkingKey := generateKeysForNodeRegistration(t) access4Address, _, access4Signer := newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, access4Address, "1000000.0") + mintTokensForAccount(t, b, env, access4Address, "1000000.0") _, access4StakingKey, _, access4NetworkingKey := generateKeysForNodeRegistration(t) t.Run("Should be able to set new slot limits", func(t *testing.T) { @@ -3230,7 +3230,7 @@ func TestIDTableRewardsWitholding(t *testing.T) { for i := 0; i < numNodes; i++ { // Fund the node account - mintTokensForAccount(t, b, nodeAddresses[i], "1000000.0") + mintTokensForAccount(t, b, env, nodeAddresses[i], "1000000.0") // Register the node committed[adminID] = registerNode(t, b, env, @@ -3252,7 +3252,7 @@ func TestIDTableRewardsWitholding(t *testing.T) { for i := 0; i < numDelegators; i++ { // Fund the delegator account - mintTokensForAccount(t, b, delegatorAddresses[i], "1000000.0") + mintTokensForAccount(t, b, env, delegatorAddresses[i], "1000000.0") // Register the delegator tx := createTxWithTemplateAndAuthorizer(b, templates.GenerateRegisterDelegatorScript(env), delegatorAddresses[i]) diff --git a/lib/go/test/flow_lockedtokens_test.go b/lib/go/test/flow_lockedtokens_test.go index 0b5f0711c..9ff7113d7 100644 --- a/lib/go/test/flow_lockedtokens_test.go +++ b/lib/go/test/flow_lockedtokens_test.go @@ -10,7 +10,6 @@ import ( jsoncdc "github.com/onflow/cadence/encoding/json" "github.com/onflow/flow-core-contracts/lib/go/contracts" "github.com/onflow/flow-core-contracts/lib/go/templates" - ft_templates "github.com/onflow/flow-ft/lib/go/templates" "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" sdktemplates "github.com/onflow/flow-go-sdk/templates" @@ -100,7 +99,7 @@ func TestLockedTokensStaker(t *testing.T) { adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.StakingProxyAddress = stakingProxyAddress.Hex() env.LockedTokensAddress = lockedTokensAddress.Hex() @@ -115,7 +114,7 @@ func TestLockedTokensStaker(t *testing.T) { var joshSharedAddress flow.Address var joshAddress flow.Address - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -276,7 +275,7 @@ func TestLockedTokensStaker(t *testing.T) { assertEqual(t, CadenceUFix64("1000000.0"), result) // make sure balance of unlocked account hasn't changed - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("0.0"), result) }) @@ -322,7 +321,7 @@ func TestLockedTokensStaker(t *testing.T) { assertEqual(t, CadenceUFix64("990000.0"), result) // check balance of unlocked account - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("10000.0"), result) // withdraw limit should have decreased to zero @@ -349,7 +348,7 @@ func TestLockedTokensStaker(t *testing.T) { assertEqual(t, CadenceUFix64("995000.0"), result) // check balance of unlocked account - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("5000.0"), result) // make sure unlock limit has increased by 5000 @@ -508,7 +507,7 @@ func TestLockedTokensStaker(t *testing.T) { ) // Unlocked account balance should increase by 500 - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("5500.0"), result) // Unlock limit should be unchanged @@ -529,7 +528,7 @@ func TestLockedTokensStaker(t *testing.T) { ) // Unlocked account balance should remain the same - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("5500.0"), result) // Unlock limit should increase by 500 @@ -539,7 +538,7 @@ func TestLockedTokensStaker(t *testing.T) { t.Run("Should be able to register a node with tokens from the locked vault first and then the unlocked vault", func(t *testing.T) { - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) // locked tokens balance should increase by 500 result = executeScriptAndCheck(t, b, @@ -567,7 +566,7 @@ func TestLockedTokensStaker(t *testing.T) { assertEqual(t, CadenceString(joshID), result) // Check unlocked balance - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("4500.0"), result) // Unlock limit should not have changed @@ -611,11 +610,11 @@ func TestLockedTokensStaker(t *testing.T) { ) // Check balance of locked account - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) assertEqual(t, CadenceUFix64("0.0"), result) // Check unlocked balance - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("3500.0"), result) // unlock limit should not have changed @@ -713,7 +712,7 @@ func TestLockedTokensDelegator(t *testing.T) { adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.LockedTokensAddress = lockedTokensAddress.Hex() @@ -728,7 +727,7 @@ func TestLockedTokensDelegator(t *testing.T) { var joshSharedAddress flow.Address var joshAddress flow.Address - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -830,7 +829,7 @@ func TestLockedTokensDelegator(t *testing.T) { ) // Check balance of locked account - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) assertEqual(t, CadenceUFix64("948000.0"), result) // make sure the unlock limit is zero @@ -922,7 +921,7 @@ func TestLockedTokensDelegator(t *testing.T) { assertEqual(t, CadenceUFix64("948500.0"), result) // unlocked account balance should not increase - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("0.0"), result) // make sure the unlock limit hasn't changed @@ -951,7 +950,7 @@ func TestLockedTokensDelegator(t *testing.T) { assertEqual(t, CadenceUFix64("948500.0"), result) // Unlocked account balance should increase by 500 - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("1000.0"), result) // Unlock limit should be unchanged @@ -977,7 +976,7 @@ func TestLockedTokensDelegator(t *testing.T) { assertEqual(t, CadenceUFix64("949000.0"), result) // Unlocked account balance should be unchanged - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("1000.0"), result) // Unlock limit should increase by 500 @@ -1046,11 +1045,11 @@ func TestLockedTokensDelegator(t *testing.T) { ) // Check balance of locked account - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) assertEqual(t, CadenceUFix64("0.0"), result) // Check balance of unlocked account - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("100.0"), result) // Unlock limit should increase by 500 @@ -1177,7 +1176,7 @@ func TestCustodyProviderAccountCreation(t *testing.T) { adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.LockedTokensAddress = lockedTokensAddress.Hex() @@ -1185,7 +1184,7 @@ func TestCustodyProviderAccountCreation(t *testing.T) { custodyAccountKey, custodySigner := accountKeys.NewWithSigner() custodyAddress, _ := b.CreateAccount([]*flow.AccountKey{custodyAccountKey}, nil) - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -1207,7 +1206,7 @@ func TestCustodyProviderAccountCreation(t *testing.T) { false, ) - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(custodyAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -1480,7 +1479,7 @@ func TestLockedTokensRealStaking(t *testing.T) { adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.StakingProxyAddress = stakingProxyAddress.Hex() env.LockedTokensAddress = lockedTokensAddress.Hex() @@ -1495,7 +1494,7 @@ func TestLockedTokensRealStaking(t *testing.T) { var joshSharedAddress flow.Address var joshAddress flow.Address - tx := createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx := createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -1813,7 +1812,7 @@ func TestLockedTokensRealDelegating(t *testing.T) { adminAccountKey, adminSigner := accountKeys.NewWithSigner() adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.LockedTokensAddress = lockedTokensAddress.Hex() // Create new keys for the user account @@ -1827,7 +1826,7 @@ func TestLockedTokensRealDelegating(t *testing.T) { var joshSharedAddress flow.Address var joshAddress flow.Address - tx := createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx := createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -1963,7 +1962,7 @@ func TestLockedTokensRealDelegating(t *testing.T) { ) // Check balance of locked account - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshSharedAddress))}) assertEqual(t, CadenceUFix64("628000.0"), result) // make sure the unlock limit is zero @@ -2017,7 +2016,7 @@ func TestLockedTokensRealDelegating(t *testing.T) { assertEqual(t, CadenceUFix64("628500.0"), result) // unlocked account balance should not increase - result = executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) + result = executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(joshAddress))}) assertEqual(t, CadenceUFix64("0.0"), result) }) @@ -2159,7 +2158,7 @@ func TestLockedTokensUnlockMultipleAccounts(t *testing.T) { } // Deposit 0.001 FLOW into the shared account to increase its unlock limit - mintTokensForAccount(t, b, sharedAccountAddresses[0], "0.001") + mintTokensForAccount(t, b, env, sharedAccountAddresses[0], "0.001") // Make sure the unlock limit has increased by 0.001 result := executeScriptAndCheck(t, b, diff --git a/lib/go/test/flow_qc_test.go b/lib/go/test/flow_qc_test.go index 7ea8e2f8c..d5d7467b2 100644 --- a/lib/go/test/flow_qc_test.go +++ b/lib/go/test/flow_qc_test.go @@ -498,7 +498,7 @@ func TestQuorumCertificateMoreNodes(t *testing.T) { numberOfNodesPerCluster := 4 // Create new user accounts - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numberOfClusters*numberOfNodesPerCluster) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numberOfClusters*numberOfNodesPerCluster) clusterNodeIDStrings := make([][]string, numberOfClusters*numberOfNodesPerCluster) @@ -763,7 +763,7 @@ func TestQuorumCertificateNotSubmittedVote(t *testing.T) { numberOfNodesPerCluster := 4 // Create new user accounts - addresses, _, signers := registerAndMintManyAccounts(t, b, accountKeys, numberOfClusters*numberOfNodesPerCluster) + addresses, _, signers := registerAndMintManyAccounts(t, b, env, accountKeys, numberOfClusters*numberOfNodesPerCluster) clusterNodeIDStrings := make([][]string, numberOfClusters*numberOfNodesPerCluster) diff --git a/lib/go/test/flow_stakingcollection_test.go b/lib/go/test/flow_stakingcollection_test.go index 82cb5d878..0f0e2cc48 100644 --- a/lib/go/test/flow_stakingcollection_test.go +++ b/lib/go/test/flow_stakingcollection_test.go @@ -61,7 +61,7 @@ func TestStakingCollectionGetTokens(t *testing.T) { regAccountAddress, _, regAccountSigner := newAccountWithAddress(b, accountKeys) // Add 1Billion tokens to regular account - mintTokensForAccount(t, b, regAccountAddress, "1000000000.0") + mintTokensForAccount(t, b, env, regAccountAddress, "1000000000.0") // add a staking collection to a regular account with no locked account t.Run("should be able to setup an account with a staking collection", func(t *testing.T) { @@ -309,7 +309,7 @@ func TestStakingCollectionDepositTokens(t *testing.T) { // create regular account regAccountAddress, _, regAccountSigner := newAccountWithAddress(b, accountKeys) // Add 1Billion tokens to regular account - mintTokensForAccount(t, b, regAccountAddress, "1000000000.0") + mintTokensForAccount(t, b, env, regAccountAddress, "1000000000.0") addStakingCollectionToRegAcctWithNoLockedAcctTx := createTxWithTemplateAndAuthorizer(b, templates.GenerateCollectionSetup(env), regAccountAddress) signAndSubmit( t, b, addStakingCollectionToRegAcctWithNoLockedAcctTx, @@ -448,7 +448,7 @@ func TestStakingCollectionRegisterNode(t *testing.T) { deployAllCollectionContracts(t, b, accountKeys, &env, adminAddress, adminSigner) // Create regular accounts - userAddresses, _, userSigners := registerAndMintManyAccounts(t, b, accountKeys, 4) + userAddresses, _, userSigners := registerAndMintManyAccounts(t, b, env, accountKeys, 4) _, adminStakingKey, _, adminNetworkingKey := generateKeysForNodeRegistration(t) var amountToCommit interpreter.UFix64Value = 48000000000000 @@ -714,7 +714,7 @@ func TestStakingCollectionRegisterNode(t *testing.T) { t.Run("Should be able to deposit and withdraw tokens from the machine account", func(t *testing.T) { // Add 100 tokens to the machine account - mintTokensForAccount(t, b, machineAccounts[CadenceString(bastianID).(cadence.String)], "100.0") + mintTokensForAccount(t, b, env, machineAccounts[CadenceString(bastianID).(cadence.String)], "100.0") // Should fail because this node does not exist in the collection tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateCollectionWithdrawFromMachineAccountScript(env), joshAddress) @@ -754,7 +754,7 @@ func TestStakingCollectionRegisterNode(t *testing.T) { t.Run("Should be able to register a execution and verification node in the staking collection and not create machine accounts", func(t *testing.T) { - mintTokensForAccount(t, b, joshAddress, "2000000.0") + mintTokensForAccount(t, b, env, joshAddress, "2000000.0") _, executionStakingKey, _, executionNetworkingKey := generateKeysForNodeRegistration(t) @@ -855,7 +855,7 @@ func TestStakingCollectionCreateMachineAccountForExistingNode(t *testing.T) { deployAllCollectionContracts(t, b, accountKeys, &env, adminAddress, adminSigner) // Create regular accounts - userAddresses, _, userSigners := registerAndMintManyAccounts(t, b, accountKeys, 4) + userAddresses, _, userSigners := registerAndMintManyAccounts(t, b, env, accountKeys, 4) _, adminStakingKey, _, adminNetworkingKey := generateKeysForNodeRegistration(t) var amountToCommit interpreter.UFix64Value = 48000000000000 diff --git a/lib/go/test/flow_stakingproxy_test.go b/lib/go/test/flow_stakingproxy_test.go index 77cd5d779..36265ec29 100644 --- a/lib/go/test/flow_stakingproxy_test.go +++ b/lib/go/test/flow_stakingproxy_test.go @@ -6,7 +6,6 @@ import ( "github.com/onflow/cadence" jsoncdc "github.com/onflow/cadence/encoding/json" - ft_templates "github.com/onflow/flow-ft/lib/go/templates" "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" sdktemplates "github.com/onflow/flow-go-sdk/templates" @@ -109,17 +108,13 @@ func TestStakingProxy(t *testing.T) { adminAddress, _ := b.CreateAccount([]*flow.AccountKey{adminAccountKey}, nil) lockedTokensAccountKey, _ := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, env, idTableAddress, stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.LockedTokensAddress = lockedTokensAddress.Hex() t.Run("Should be able to set up the admin account", func(t *testing.T) { - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript( - flow.HexToAddress(emulatorFTAddress), - flow.HexToAddress(emulatorFlowTokenAddress), - "FlowToken", - ), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(lockedTokensAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -174,7 +169,7 @@ func TestStakingProxy(t *testing.T) { var joshSharedAddress flow.Address var joshAddress flow.Address - tx = createTxWithTemplateAndAuthorizer(b, ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), b.ServiceKey().Address) + tx = createTxWithTemplateAndAuthorizer(b, templates.GenerateMintFlowScript(env), b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(adminAddress)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) diff --git a/lib/go/test/go.mod b/lib/go/test/go.mod index 9863cdc2c..9f083a7a8 100644 --- a/lib/go/test/go.mod +++ b/lib/go/test/go.mod @@ -8,7 +8,6 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v0.11.2-0.20230124223822-093a67baaf47 github.com/onflow/flow-core-contracts/lib/go/templates v0.11.2-0.20230124223822-093a67baaf47 github.com/onflow/flow-emulator v0.42.1-0.20230125170432-9772ea3b39f2 - github.com/onflow/flow-ft/lib/go/templates v0.2.0 github.com/onflow/flow-go v0.28.1-0.20230125144719-5b8277b35973 github.com/onflow/flow-go-sdk v0.31.3 github.com/onflow/flow-go/crypto v0.24.4 @@ -89,7 +88,7 @@ require ( github.com/multiformats/go-multihash v0.2.1 // indirect github.com/multiformats/go-varint v0.0.6 // indirect github.com/onflow/atree v0.4.0 // indirect - github.com/onflow/flow-ft/lib/go/contracts v0.5.0 // indirect + github.com/onflow/flow-ft/lib/go/contracts v0.7.0 // indirect github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20221202093946-932d1c70e288 // indirect github.com/onflow/sdks v0.4.4 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect diff --git a/lib/go/test/go.sum b/lib/go/test/go.sum index 70b1a4488..fb77e4b20 100644 --- a/lib/go/test/go.sum +++ b/lib/go/test/go.sum @@ -95,7 +95,6 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/c-bata/go-prompt v0.2.3/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -170,7 +169,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.9.9/go.mod h1:a9TqabFudpDu1nucId+k9S8R9whYaHnGBLKFouA5EAo= github.com/ethereum/go-ethereum v1.9.13 h1:rOPqjSngvs1VSYH2H+PMPiWt4VEulvNRbFgqiGqJM3E= github.com/ethereum/go-ethereum v1.9.13/go.mod h1:qwN9d1GLyDh0N7Ab8bMGd0H9knaji2jOBm2RrMGjXls= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -180,7 +178,6 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fxamacker/cbor/v2 v2.2.1-0.20201006223149-25f67fca9803/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/fxamacker/cbor/v2 v2.4.1-0.20220515183430-ad2eae63303f h1:dxTR4AaxCwuQv9LAVTAC2r1szlS+epeuPT5ClLKT6ZY= github.com/fxamacker/cbor/v2 v2.4.1-0.20220515183430-ad2eae63303f/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/fxamacker/circlehash v0.3.0 h1:XKdvTtIJV9t7DDUtsf0RIpC1OcxZtPbmgIH7ekx28WA= @@ -215,7 +212,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.5/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -416,7 +412,6 @@ github.com/libp2p/go-libp2p v0.23.3 h1:/n3i0VtJF0iZ9YMUxl/teOY3h+M8NfgaCjOSYr9D+ github.com/libp2p/go-libp2p v0.23.3/go.mod h1:s9DEa5NLR4g+LZS+md5uGU4emjMWFiqkZr6hBTY8UxI= github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo= github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/m4ksio/wal v1.0.1-0.20221209164835-154a17396e4c h1:OqVcb1Dkheracn4fgCjxlfhuSnM8jmPbrWkJbRIC4fo= @@ -427,8 +422,6 @@ github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -436,9 +429,6 @@ github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HN github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -446,10 +436,7 @@ github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= @@ -496,23 +483,18 @@ github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXW github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onflow/atree v0.4.0 h1:+TbNisavAkukAKhgQ4plWnvR9o5+SkwPIsi3jaeAqKs= github.com/onflow/atree v0.4.0/go.mod h1:7Qe1xaW0YewvouLXrugzMFUYXNoRQ8MT/UsVAWx1Ndo= -github.com/onflow/cadence v0.11.2/go.mod h1:8NwJGO535nnY/+QWEMDc2rhvOFChToWQ9Bg7fUIIc/I= github.com/onflow/cadence v0.31.3 h1:lTHTBnoFi/ahGk1cQ9JAC+tfYir4kjRVIqtTVCjbe6E= github.com/onflow/cadence v0.31.3/go.mod h1:oRgWkvau1RH15m3NuDlZCPHFQzwvC72jEstCGu8OJ98= github.com/onflow/flow-emulator v0.42.1-0.20230125170432-9772ea3b39f2 h1:Mbro0nq5bohkhMIab5DnAxPa/6PxJ8aVUH4Cv9R3c90= github.com/onflow/flow-emulator v0.42.1-0.20230125170432-9772ea3b39f2/go.mod h1:U9uxx1uxxd2ZEkeO4FD/+Q8HymZfvESJI3pzeG/peoI= -github.com/onflow/flow-ft/lib/go/contracts v0.5.0 h1:Cg4gHGVblxcejfNNG5Mfj98Wf4zbY76O0Y28QB0766A= -github.com/onflow/flow-ft/lib/go/contracts v0.5.0/go.mod h1:1zoTjp1KzNnOPkyqKmWKerUyf0gciw+e6tAEt0Ks3JE= -github.com/onflow/flow-ft/lib/go/templates v0.2.0 h1:oQQk5UthLS9KfKLkZVJg/XAVq8CXW7HAxSTu4HwBJkU= -github.com/onflow/flow-ft/lib/go/templates v0.2.0/go.mod h1:qwkTElMcI+PnSBGIWGu1K9OYBLatNimWTC8un9qUji0= +github.com/onflow/flow-ft/lib/go/contracts v0.7.0 h1:XEKE6qJUw3luhsYmIOteXP53gtxNxrwTohgxJXCYqBE= +github.com/onflow/flow-ft/lib/go/contracts v0.7.0/go.mod h1:kTMFIySzEJJeupk+7EmXs0EJ6CBWY/MV9fv9iYQk+RU= github.com/onflow/flow-go v0.28.1-0.20230125144719-5b8277b35973 h1:tOfFrZOoKMLTgkyoxikiuHsUajcbzL7Ed7YDcKI7RZE= github.com/onflow/flow-go v0.28.1-0.20230125144719-5b8277b35973/go.mod h1:InT2jGNlXvMGwvRl/iURayGfd3vCKbamF7iuQQS4LPw= -github.com/onflow/flow-go-sdk v0.13.0/go.mod h1:yqnSajzJVFfrTg68F4WXRR1Yzs1akqAjyscEDyFudPE= github.com/onflow/flow-go-sdk v0.31.3 h1:CytMRiTayXRlkRNXQ9Cw6ZcKoOIK6+QtXk4iUb8f0zQ= github.com/onflow/flow-go-sdk v0.31.3/go.mod h1:cqj2QShwC4DqxWzrg0+U7KxE2k7OJDGBxh8XZrJ4v5E= github.com/onflow/flow-go/crypto v0.24.4 h1:SwEtoVS2TidCIHYCZMgQ7U2YsqhI9upnw94fhdHTubM= github.com/onflow/flow-go/crypto v0.24.4/go.mod h1:dkVL98P6GHR48iD9zCB6XlnkJX8IQd00FKgt1reV90w= -github.com/onflow/flow/protobuf/go/flow v0.1.8/go.mod h1:kRugbzZjwQqvevJhrnnCFMJZNmoSJmxlKt6hTGXZojM= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20221202093946-932d1c70e288 h1:haWv3D5loiH+zcOoWEvDXtWQvXt5U8PLliQjwhv9sfw= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20221202093946-932d1c70e288/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= github.com/onflow/sdks v0.4.4 h1:aJPGJJLAN+mlBWAQxsyuJXeRRMFeLwU6Mp4e/YL6bdU= @@ -542,7 +524,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -562,12 +543,9 @@ github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/psiemens/sconfig v0.1.0 h1:xfWqW+TRpih7mXZIqKYTmpRhlZLQ1kbxV8EjllPv76s= github.com/psiemens/sconfig v0.1.0/go.mod h1:+MLKqdledP/8G3rOBpknbLh0IclCf4WneJUtS26JB2U= -github.com/raviqqe/hamt v0.0.0-20190615202029-864fb7caef85/go.mod h1:I9elsTaXMhu41qARmzefHy7v2KmAV2TB1yH4E+nBSf0= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.1-0.20211004051800-57c86be7915a h1:s7GrsqeorVkFR1vGmQ6WVL9nup0eyQCC+YVUeSQLH/Q= github.com/rivo/uniseg v0.2.1-0.20211004051800-57c86be7915a/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -581,7 +559,6 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/schollz/progressbar/v3 v3.8.3 h1:FnLGl3ewlDUP+YdSwveXBaXs053Mem/du+wr7XSYKl8= -github.com/segmentio/fasthash v1.0.2/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sethvargo/go-retry v0.2.3 h1:oYlgvIvsju3jNbottWABtbnoLC+GDtLdBHxKWxQm/iU= @@ -630,7 +607,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= @@ -703,7 +679,6 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -727,7 +702,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -863,16 +837,12 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -885,7 +855,6 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -955,7 +924,6 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -973,7 +941,6 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -983,7 +950,6 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200828161849-5deb26317202/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1022,7 +988,6 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.31.0/go.mod h1:CL+9IBCa2WWU6gRuBWaKqGWLFFwbEUXkfeMkHLQWYWo= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= @@ -1064,7 +1029,6 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200831141814-d751682dd103/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1127,10 +1091,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200316214253-d7b0ff38cac9/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -1140,7 +1102,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/lib/go/test/lockedtokens_helpers.go b/lib/go/test/lockedtokens_helpers.go index 2fa051a1f..78bc15edf 100644 --- a/lib/go/test/lockedtokens_helpers.go +++ b/lib/go/test/lockedtokens_helpers.go @@ -13,7 +13,6 @@ import ( "github.com/onflow/cadence" jsoncdc "github.com/onflow/cadence/encoding/json" emulator "github.com/onflow/flow-emulator" - ft_templates "github.com/onflow/flow-ft/lib/go/templates" "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flow-go-sdk/test" @@ -61,6 +60,7 @@ func (evt unlockedAccountRegisteredEvent) Address() flow.Address { func deployLockedTokensContract( t *testing.T, b *emulator.Blockchain, + env templates.Environment, IDTableAddr, proxyAddr flow.Address, lockedTokensAccountKey *flow.AccountKey, adminAddress flow.Address, @@ -123,11 +123,7 @@ func deployLockedTokensContract( require.NoError(t, err) // Mint tokens for the locked tokens admin - script := ft_templates.GenerateMintTokensScript( - flow.HexToAddress(emulatorFTAddress), - flow.HexToAddress(emulatorFlowTokenAddress), - "FlowToken", - ) + script := templates.GenerateMintFlowScript(env) tx = createTxWithTemplateAndAuthorizer(b, script, b.ServiceKey().Address) _ = tx.AddArgument(cadence.NewAddress(lockedTokensAddr)) _ = tx.AddArgument(CadenceUFix64("1000000000.0")) @@ -167,7 +163,7 @@ func createLockedAccountPairWithBalances( var newUserAddress flow.Address if adminAmount != "0.0" { - mintTokensForAccount(t, b, adminAddress, adminAmount) + mintTokensForAccount(t, b, env, adminAddress, adminAmount) } tx := createTxWithTemplateAndAuthorizer(b, templates.GenerateCreateSharedAccountScript(env), adminAddress). @@ -225,7 +221,7 @@ func createLockedAccountPairWithBalances( } if unlockedBalance != "0.0" { - mintTokensForAccount(t, b, newUserAddress, unlockedBalance) + mintTokensForAccount(t, b, env, newUserAddress, unlockedBalance) } return newUserAddress, newUserSharedAddress, newUserSigner @@ -338,7 +334,7 @@ func deployAllCollectionContracts(t *testing.T, assert.NoError(t, err) lockedTokensAccountKey, lockedTokensSigner := accountKeys.NewWithSigner() - lockedTokensAddress := deployLockedTokensContract(t, b, flow.HexToAddress(env.IDTableAddress), stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) + lockedTokensAddress := deployLockedTokensContract(t, b, *env, flow.HexToAddress(env.IDTableAddress), stakingProxyAddress, lockedTokensAccountKey, adminAddress, adminSigner) env.StakingProxyAddress = stakingProxyAddress.Hex() env.LockedTokensAddress = lockedTokensAddress.Hex() @@ -467,7 +463,7 @@ func verifyStakingCollectionInfo( expectedInfo StakingCollectionInfo, ) { // check balance of unlocked account - result := executeScriptAndCheck(t, b, ft_templates.GenerateInspectVaultScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), [][]byte{jsoncdc.MustEncode(cadence.Address(flow.HexToAddress(expectedInfo.accountAddress)))}) + result := executeScriptAndCheck(t, b, templates.GenerateGetFlowBalanceScript(env), [][]byte{jsoncdc.MustEncode(cadence.Address(flow.HexToAddress(expectedInfo.accountAddress)))}) assertEqual(t, CadenceUFix64(expectedInfo.unlockedBalance), result) // check balance of locked account if it exists diff --git a/lib/go/test/test.go b/lib/go/test/test.go index 8a9194c44..256e0c784 100644 --- a/lib/go/test/test.go +++ b/lib/go/test/test.go @@ -10,7 +10,6 @@ import ( "github.com/onflow/cadence" emulator "github.com/onflow/flow-emulator" - ft_templates "github.com/onflow/flow-ft/lib/go/templates" "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flow-go-sdk/test" @@ -269,11 +268,11 @@ func assertEqual(t *testing.T, expected, actual interface{}) bool { // Mints the specified amount of FLOW tokens for the specified account address // Using the mint tokens template from the onflow/flow-ft repo // signed by the service account -func mintTokensForAccount(t *testing.T, b *emulator.Blockchain, recipient flow.Address, amount string) { +func mintTokensForAccount(t *testing.T, b *emulator.Blockchain, env templates.Environment, recipient flow.Address, amount string) { // Create a new mint FLOW transaction template authorized by the service account tx := createTxWithTemplateAndAuthorizer(b, - ft_templates.GenerateMintTokensScript(flow.HexToAddress(emulatorFTAddress), flow.HexToAddress(emulatorFlowTokenAddress), "FlowToken"), + templates.GenerateMintFlowScript(env), b.ServiceKey().Address) // Add the recipient and amount as arguments @@ -293,6 +292,7 @@ func mintTokensForAccount(t *testing.T, b *emulator.Blockchain, recipient flow.A func registerAndMintManyAccounts( t *testing.T, b *emulator.Blockchain, + env templates.Environment, accountKeys *test.AccountKeys, numAccounts int) ([]flow.Address, []*flow.AccountKey, []crypto.Signer) { @@ -304,7 +304,7 @@ func registerAndMintManyAccounts( // Create each new account and mint 1B tokens for it for i := 0; i < numAccounts; i++ { userAddresses[i], userPublicKeys[i], userSigners[i] = newAccountWithAddress(b, accountKeys) - mintTokensForAccount(t, b, userAddresses[i], "1000000000.0") + mintTokensForAccount(t, b, env, userAddresses[i], "1000000000.0") } return userAddresses, userPublicKeys, userSigners diff --git a/transactions/flowToken/mint_tokens.cdc b/transactions/flowToken/mint_tokens.cdc index 5a3ad1a7b..b637dd4d1 100644 --- a/transactions/flowToken/mint_tokens.cdc +++ b/transactions/flowToken/mint_tokens.cdc @@ -1,11 +1,16 @@ import FungibleToken from 0xFUNGIBLETOKENADDRESS -import FlowToken from 0xTOKENADDRESS +import FlowToken from 0xFLOWTOKENADDRESS + +/// This transaction mints tokens using the account that stores the Flow Token Admin resource +/// This is the service account transaction(recipient: Address, amount: UFix64) { + let tokenAdmin: &FlowToken.Administrator let tokenReceiver: &{FungibleToken.Receiver} prepare(signer: AuthAccount) { + self.tokenAdmin = signer .borrow<&FlowToken.Administrator>(from: /storage/flowTokenAdmin) ?? panic("Signer is not the token admin")