Skip to content

Commit

Permalink
Merge pull request #6409 from multiversx/save-DynamicNFT-metaData-on-…
Browse files Browse the repository at this point in the history
…user

update go mod and tests
  • Loading branch information
BeniaminDrasovean authored Aug 28, 2024
2 parents 196aed5 + 667579e commit 2cd2d55
Show file tree
Hide file tree
Showing 23 changed files with 113 additions and 87 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ require (
github.com/klauspost/cpuid/v2 v2.2.5
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-communication-go v1.1.0
github.com/multiversx/mx-chain-core-go v1.2.21
github.com/multiversx/mx-chain-core-go v1.2.22-0.20240823091930-22b700471ada
github.com/multiversx/mx-chain-crypto-go v1.2.12
github.com/multiversx/mx-chain-es-indexer-go v1.7.5-0.20240807095116-4f2f595e52d9
github.com/multiversx/mx-chain-logger-go v1.0.15
github.com/multiversx/mx-chain-scenario-go v1.4.4
github.com/multiversx/mx-chain-storage-go v1.0.16
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240812082318-afa839968da3
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240821104654-483a1cfdfc69
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240827070828-a7bb8c51a98e
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240827072959-38b7c6f69191
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.69
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.98
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUY
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
github.com/multiversx/mx-chain-communication-go v1.1.0 h1:J7bX6HoN3HiHY7cUeEjG8AJWgQDDPcY+OPDOsSUOkRE=
github.com/multiversx/mx-chain-communication-go v1.1.0/go.mod h1:WK6bP4pGEHGDDna/AYRIMtl6G9OA0NByI1Lw8PmOnRM=
github.com/multiversx/mx-chain-core-go v1.2.21 h1:+XVKznPTlUU5EFS1A8chtS8fStW60upRIyF4Pgml19I=
github.com/multiversx/mx-chain-core-go v1.2.21/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-core-go v1.2.22-0.20240823091930-22b700471ada h1:Yi4gpXr/LzpLR2Soca5SNC/NRGnPCrD5FyGKShGLFpE=
github.com/multiversx/mx-chain-core-go v1.2.22-0.20240823091930-22b700471ada/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-crypto-go v1.2.12 h1:zWip7rpUS4CGthJxfKn5MZfMfYPjVjIiCID6uX5BSOk=
github.com/multiversx/mx-chain-crypto-go v1.2.12/go.mod h1:HzcPpCm1zanNct/6h2rIh+MFrlXbjA5C8+uMyXj3LI4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.5-0.20240807095116-4f2f595e52d9 h1:VJOigTM9JbjFdy9ICVhsDfM9YQkFqMigAaQCHaM0iwY=
Expand All @@ -399,10 +399,10 @@ github.com/multiversx/mx-chain-scenario-go v1.4.4 h1:DVE2V+FPeyD/yWoC+KEfPK3jsFz
github.com/multiversx/mx-chain-scenario-go v1.4.4/go.mod h1:kI+TWR3oIEgUkbwkHCPo2CQ3VjIge+ezGTibiSGwMxo=
github.com/multiversx/mx-chain-storage-go v1.0.16 h1:l2lJq+EAN3YwLbjJrnoKfFd1/1Xmo9DcAUECND2obLs=
github.com/multiversx/mx-chain-storage-go v1.0.16/go.mod h1:uM/z7YyqTOD3wgyH8TfapyEl5sb+7x/Jaxne4cfG4HI=
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240812082318-afa839968da3 h1:RlHKl5enbGrleB0Aea9TinZLLymS4WvG0/xAt/iRb6E=
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240812082318-afa839968da3/go.mod h1:OSvFbzdWThfRbLZbUsEr7bikBSaLrPJQ2iUm9jw9nXQ=
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240821104654-483a1cfdfc69 h1:HoyZbjYuQLVHJ8UMOkoIyKLA/jq80kbb3Gbqe2AfuPM=
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240821104654-483a1cfdfc69/go.mod h1:j9FBeftA/BKfn0BbndKV7bNFJAzwCnYZuebsM/sufK0=
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240827070828-a7bb8c51a98e h1:bM3ftf0/bgyeNs7vEWwXJU/4pIzJ39144jT3v9sDnNQ=
github.com/multiversx/mx-chain-vm-common-go v1.5.14-0.20240827070828-a7bb8c51a98e/go.mod h1:sN471lwUKZMIfhNEDgHnSUR5SOv+BCoxF2kv2AnOCj8=
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240827072959-38b7c6f69191 h1:yTooD6GHLgOlBK74X4u7okJ2qeGAnCo5TrAoyH+PiVY=
github.com/multiversx/mx-chain-vm-go v1.5.32-0.20240827072959-38b7c6f69191/go.mod h1:v14k+Xd4Rj+wjfU4b6F25SzwqLsU7DiRN/BfQV4qwVU=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68 h1:L3GoAVFtLLzr9ya0rVv1YdTUzS3MyM7kQNBSAjCNO2g=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68/go.mod h1:ixxwib+1pXwSDHG5Wa34v0SRScF+BwFzH4wFWY31saI=
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.69 h1:G/PLsyfQV4bMLs2amGRvaLKZoW1DC7M+7ecVaLuaCNc=
Expand Down
58 changes: 25 additions & 33 deletions integrationTests/chainSimulator/vm/esdtImprovements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,12 @@ func TestChainSimulator_ESDTModifyCreator(t *testing.T) {

require.Equal(t, "success", txResult.Status.String())

retrievedMetaData := getMetaDataFromAcc(t, cs, core.SystemAccountAddress, tokenIDs[i], shardID)
retrievedMetaData := &esdt.MetaData{}
if bytes.Equal(tokenIDs[i], nftTokenID) {
retrievedMetaData = getMetaDataFromAcc(t, cs, newCreatorAddress.Bytes, tokenIDs[i], shardID)
} else {
retrievedMetaData = getMetaDataFromAcc(t, cs, core.SystemAccountAddress, tokenIDs[i], shardID)
}

require.Equal(t, newCreatorAddress.Bytes, retrievedMetaData.Creator)
}
Expand Down Expand Up @@ -1695,8 +1700,13 @@ func TestChainSimulator_ESDTModifyCreator_CrossShard(t *testing.T) {

require.Equal(t, "success", txResult.Status.String())

retrievedMetaData := &esdt.MetaData{}
shardID := cs.GetNodeHandler(0).GetProcessComponents().ShardCoordinator().ComputeId(newCreatorAddress.Bytes)
retrievedMetaData := getMetaDataFromAcc(t, cs, core.SystemAccountAddress, tokenIDs[i], shardID)
if bytes.Equal(tokenIDs[i], nftTokenID) {
retrievedMetaData = getMetaDataFromAcc(t, cs, newCreatorAddress.Bytes, tokenIDs[i], shardID)
} else {
retrievedMetaData = getMetaDataFromAcc(t, cs, core.SystemAccountAddress, tokenIDs[i], shardID)
}

require.Equal(t, newCreatorAddress.Bytes, retrievedMetaData.Creator)

Expand Down Expand Up @@ -2504,7 +2514,8 @@ func TestChainSimulator_NFT_RegisterDynamic(t *testing.T) {

shardID := cs.GetNodeHandler(0).GetProcessComponents().ShardCoordinator().ComputeId(addrs[0].Bytes)

checkMetaData(t, cs, core.SystemAccountAddress, nftTokenID, shardID, nftMetaData)
checkMetaData(t, cs, addrs[0].Bytes, nftTokenID, shardID, nftMetaData)
checkMetaDataNotInAcc(t, cs, core.SystemAccountAddress, nftTokenID, shardID)

log.Info("Check that token type is Dynamic")

Expand Down Expand Up @@ -2747,7 +2758,8 @@ func TestChainSimulator_NFT_RegisterAndSetAllRolesDynamic(t *testing.T) {

shardID := cs.GetNodeHandler(0).GetProcessComponents().ShardCoordinator().ComputeId(addrs[0].Bytes)

checkMetaData(t, cs, core.SystemAccountAddress, nftTokenID, shardID, nftMetaData)
checkMetaData(t, cs, addrs[0].Bytes, nftTokenID, shardID, nftMetaData)
checkMetaDataNotInAcc(t, cs, core.SystemAccountAddress, nftTokenID, shardID)

log.Info("Check that token type is Dynamic")

Expand Down Expand Up @@ -3789,11 +3801,12 @@ func TestChainSimulator_CreateAndPauseTokens_DynamicNFT(t *testing.T) {
err = cs.GenerateBlocks(10)
require.Nil(t, err)

log.Info("Step 1. check that the metadata for all tokens is saved on the system account")
log.Info("Step 1. check that the metadata for the Dynamic NFT is saved on the user account")

shardID := cs.GetNodeHandler(0).GetProcessComponents().ShardCoordinator().ComputeId(addrs[0].Bytes)

checkMetaData(t, cs, core.SystemAccountAddress, nftTokenID, shardID, nftMetaData)
checkMetaData(t, cs, addrs[0].Bytes, nftTokenID, shardID, nftMetaData)
checkMetaDataNotInAcc(t, cs, core.SystemAccountAddress, nftTokenID, shardID)

log.Info("Step 1b. Pause all tokens")

Expand All @@ -3809,34 +3822,13 @@ func TestChainSimulator_CreateAndPauseTokens_DynamicNFT(t *testing.T) {
require.Equal(t, "", result.ReturnMessage)
require.Equal(t, testsChainSimulator.OkReturnCode, result.ReturnCode)

tx = updateTokenIDTx(nonce, addrs[0].Bytes, nftTokenID)
nonce++

log.Info("updating token id", "tokenID", nftTokenID)

txResult, err = cs.SendTxAndGenerateBlockTilTxIsExecuted(tx, maxNumOfBlockToGenerateWhenExecutingTx)
require.Nil(t, err)
require.NotNil(t, txResult)
require.Equal(t, "success", txResult.Status.String())

log.Info("change to dynamic token")

tx = changeToDynamicTx(nonce, addrs[0].Bytes, nftTokenID)
nonce++

log.Info("updating token id", "tokenID", nftTokenID)

txResult, err = cs.SendTxAndGenerateBlockTilTxIsExecuted(tx, maxNumOfBlockToGenerateWhenExecutingTx)
require.Nil(t, err)
require.NotNil(t, txResult)
require.Equal(t, "success", txResult.Status.String())

log.Info("check that the metadata for all tokens is saved on the system account")
log.Info("check that the metadata for the Dynamic NFT is saved on the user account")

err = cs.GenerateBlocks(10)
require.Nil(t, err)

checkMetaData(t, cs, core.SystemAccountAddress, nftTokenID, shardID, nftMetaData)
checkMetaData(t, cs, addrs[0].Bytes, nftTokenID, shardID, nftMetaData)
checkMetaDataNotInAcc(t, cs, core.SystemAccountAddress, nftTokenID, shardID)

log.Info("transfering token id", "tokenID", nftTokenID)

Expand All @@ -3846,16 +3838,16 @@ func TestChainSimulator_CreateAndPauseTokens_DynamicNFT(t *testing.T) {
require.NotNil(t, txResult)
require.Equal(t, "success", txResult.Status.String())

log.Info("check that the metaData for the NFT is still on the system account")
log.Info("check that the metaData for the NFT is on the new user account")

err = cs.GenerateBlocks(10)
require.Nil(t, err)

shardID = cs.GetNodeHandler(0).GetProcessComponents().ShardCoordinator().ComputeId(addrs[2].Bytes)

checkMetaData(t, cs, core.SystemAccountAddress, nftTokenID, shardID, nftMetaData)
checkMetaData(t, cs, addrs[1].Bytes, nftTokenID, shardID, nftMetaData)
checkMetaDataNotInAcc(t, cs, addrs[0].Bytes, nftTokenID, shardID)
checkMetaDataNotInAcc(t, cs, addrs[1].Bytes, nftTokenID, shardID)
checkMetaDataNotInAcc(t, cs, core.SystemAccountAddress, nftTokenID, shardID)
}

func TestChainSimulator_CheckRolesWhichHasToBeSingular(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions integrationTests/vm/txsFee/apiTransactionEvaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestESDTTransfer(t *testing.T) {
egldBalance := big.NewInt(100000000)
esdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance, uint32(core.Fungible))

tx := utils.CreateESDTTransferTx(0, sndAddr, rcvAddr, token, big.NewInt(100), 0, 0)
res, err := testContext.TxCostHandler.ComputeTransactionGasLimit(tx)
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestAsyncESDTTransfer(t *testing.T) {

esdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance, uint32(core.Fungible))

// deploy 2 contracts
ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down
5 changes: 3 additions & 2 deletions integrationTests/vm/txsFee/asyncCall_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math/big"
"testing"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/data/scheduled"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/integrationTests/vm"
Expand Down Expand Up @@ -276,7 +277,7 @@ func deployForwarderAndTestContract(

forwarderSCAddress := utils.DoDeploySecond(t, testContext, pathToForwarder, ownerAccount, gasPrice, deployGasLimit, nil, big.NewInt(0))

utils.CreateAccountWithESDTBalance(t, testContext.Accounts, forwarderSCAddress, egldBalance, esdtToken, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, forwarderSCAddress, egldBalance, esdtToken, 0, esdtBalance, uint32(core.Fungible))

utils.CleanAccumulatedIntermediateTransactions(t, testContext)

Expand Down Expand Up @@ -514,7 +515,7 @@ func transferESDTAndExecuteCrossShard(t *testing.T, numberOfCallsFromParent int,
pathToContract = "testdata/forwarderQueue/forwarder-queue-promises.wasm"
forwarderSCAddress := utils.DoDeploySecond(t, forwarderShard, pathToContract, forwarderOwnerAccount, gasPrice, gasLimit, nil, big.NewInt(0))

utils.CreateAccountWithESDTBalance(t, forwarderShard.Accounts, forwarderSCAddress, egldBalance, esdtToken, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, forwarderShard.Accounts, forwarderSCAddress, egldBalance, esdtToken, 0, esdtBalance, uint32(core.Fungible))

utils.CheckESDTNFTBalance(t, forwarderShard, forwarderSCAddress, esdtToken, 0, esdtBalance)

Expand Down
16 changes: 8 additions & 8 deletions integrationTests/vm/txsFee/asyncESDT_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestAsyncESDTCallShouldWork(t *testing.T) {

localEsdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance, uint32(core.Fungible))

// deploy 2 contracts
ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestAsyncESDTCallSecondScRefusesPayment(t *testing.T) {

localEsdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance, uint32(core.Fungible))

// deploy 2 contracts
ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -153,7 +153,7 @@ func TestAsyncESDTCallsOutOfGas(t *testing.T) {

localEsdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance, uint32(core.Fungible))

// deploy 2 contracts
ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestAsyncMultiTransferOnCallback(t *testing.T) {
sftBalance := big.NewInt(1000)
halfBalance := big.NewInt(500)

utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance, uint32(core.SemiFungible))
utils.CheckESDTNFTBalance(t, testContext, ownerAddr, sftTokenID, sftNonce, sftBalance)

ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -305,7 +305,7 @@ func TestAsyncMultiTransferOnCallAndOnCallback(t *testing.T) {
sftBalance := big.NewInt(1000)
halfBalance := big.NewInt(500)

utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance, uint32(core.SemiFungible))
utils.CheckESDTNFTBalance(t, testContext, ownerAddr, sftTokenID, sftNonce, sftBalance)

ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -408,7 +408,7 @@ func TestSendNFTToContractWith0Function(t *testing.T) {
sftNonce := uint64(1)
sftBalance := big.NewInt(1000)

utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance, uint32(core.SemiFungible))
utils.CheckESDTNFTBalance(t, testContext, ownerAddr, sftTokenID, sftNonce, sftBalance)

ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -461,7 +461,7 @@ func TestSendNFTToContractWith0FunctionNonPayable(t *testing.T) {
sftNonce := uint64(1)
sftBalance := big.NewInt(1000)

utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, ownerAddr, big.NewInt(1000000000), sftTokenID, sftNonce, sftBalance, uint32(core.SemiFungible))
utils.CheckESDTNFTBalance(t, testContext, ownerAddr, sftTokenID, sftNonce, sftBalance)

ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down Expand Up @@ -523,7 +523,7 @@ func TestAsyncESDTCallForThirdContractShouldWork(t *testing.T) {
localEsdtBalance := big.NewInt(100000000)
esdtTransferValue := big.NewInt(5000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, localEgldBalance, token, 0, localEsdtBalance, uint32(core.Fungible))

// deploy contract
ownerAccount, _ := testContext.Accounts.LoadAccount(ownerAddr)
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/vm/txsFee/esdtLocalBurn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestESDTLocalBurnNotAllowedShouldErr(t *testing.T) {
egldBalance := big.NewInt(100000000)
esdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance, uint32(core.Fungible))

gasLimit := uint64(40)
tx := utils.CreateESDTLocalBurnTx(0, sndAddr, sndAddr, token, big.NewInt(100), gasPrice, gasLimit)
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/vm/txsFee/esdtLocalMint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestESDTLocalMintNotAllowedShouldErr(t *testing.T) {
egldBalance := big.NewInt(100000000)
esdtBalance := big.NewInt(100000000)
token := []byte("miiutoken")
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance)
utils.CreateAccountWithESDTBalance(t, testContext.Accounts, sndAddr, egldBalance, token, 0, esdtBalance, uint32(core.Fungible))

gasLimit := uint64(40)
tx := utils.CreateESDTLocalMintTx(0, sndAddr, sndAddr, token, big.NewInt(100), gasPrice, gasLimit)
Expand Down
6 changes: 5 additions & 1 deletion integrationTests/vm/txsFee/esdtMetaDataRecreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func runEsdtMetaDataRecreateTest(t *testing.T, tokenType string) {
_, err = testContext.Accounts.Commit()
require.Nil(t, err)

checkMetaData(t, testContext, core.SystemAccountAddress, key, defaultMetaData)
if tokenType == core.DynamicNFTESDT {
checkMetaData(t, testContext, sndAddr, key, defaultMetaData)
} else {
checkMetaData(t, testContext, core.SystemAccountAddress, key, defaultMetaData)
}
}

func esdtMetaDataRecreateTx(
Expand Down
6 changes: 5 additions & 1 deletion integrationTests/vm/txsFee/esdtMetaDataUpdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ func runEsdtMetaDataUpdateTest(t *testing.T, tokenType string) {
_, err = testContext.Accounts.Commit()
require.Nil(t, err)

checkMetaData(t, testContext, core.SystemAccountAddress, key, defaultMetaData)
if tokenType == core.DynamicNFTESDT {
checkMetaData(t, testContext, sndAddr, key, defaultMetaData)
} else {
checkMetaData(t, testContext, core.SystemAccountAddress, key, defaultMetaData)
}
}

func esdtMetaDataUpdateTx(
Expand Down
8 changes: 7 additions & 1 deletion integrationTests/vm/txsFee/esdtModifyCreator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/multiversx/mx-chain-core-go/core"
dataBlock "github.com/multiversx/mx-chain-core-go/data/block"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/integrationTests/vm"
Expand Down Expand Up @@ -69,7 +70,12 @@ func runEsdtModifyCreatorTest(t *testing.T, tokenType string) {
_, err = testContext.Accounts.Commit()
require.Nil(t, err)

retrievedMetaData := getMetaDataFromAcc(t, testContext, core.SystemAccountAddress, key)
retrievedMetaData := &esdt.MetaData{}
if tokenType == core.DynamicNFTESDT {
retrievedMetaData = getMetaDataFromAcc(t, testContext, newCreator, key)
} else {
retrievedMetaData = getMetaDataFromAcc(t, testContext, core.SystemAccountAddress, key)
}
require.Equal(t, newCreator, retrievedMetaData.Creator)
}

Expand Down
8 changes: 7 additions & 1 deletion integrationTests/vm/txsFee/esdtModifyRoyalties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/multiversx/mx-chain-core-go/core"
dataBlock "github.com/multiversx/mx-chain-core-go/data/block"
"github.com/multiversx/mx-chain-core-go/data/esdt"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/integrationTests/vm"
Expand Down Expand Up @@ -63,7 +64,12 @@ func runEsdtModifyRoyaltiesTest(t *testing.T, tokenType string) {
_, err = testContext.Accounts.Commit()
require.Nil(t, err)

retrievedMetaData := getMetaDataFromAcc(t, testContext, core.SystemAccountAddress, key)
retrievedMetaData := &esdt.MetaData{}
if tokenType == core.DynamicNFTESDT {
retrievedMetaData = getMetaDataFromAcc(t, testContext, creatorAddr, key)
} else {
retrievedMetaData = getMetaDataFromAcc(t, testContext, core.SystemAccountAddress, key)
}
require.Equal(t, uint32(big.NewInt(20).Uint64()), retrievedMetaData.Royalties)
}

Expand Down
Loading

0 comments on commit 2cd2d55

Please sign in to comment.