Skip to content

Commit

Permalink
fixes after review 1
Browse files Browse the repository at this point in the history
  • Loading branch information
axenteoctavian committed Oct 21, 2024
1 parent 77d925c commit 4901ca0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestChainSimulator_ExecuteMintBurnBridgeOpForESDTTokensWithPrefixAndTransfe
paymentTokenAmount, _ := big.NewInt(0).SetString("1000000000000000000", 10)
chainSim.SetEsdtInWallet(t, cs, wallet, argsEsdtSafe.IssuePaymentToken, 0, esdt.ESDigitalToken{Value: paymentTokenAmount})

// TODO uncomment after rust framework and contract framework will be updated with all esdt types
// TODO MX-15942 uncomment after rust framework and contract framework will be updated with all esdt types
bridgedInTokens := make([]chainSim.ArgsDepositToken, 0)
bridgedInTokens = append(bridgedInTokens, chainSim.ArgsDepositToken{
Identifier: argsEsdtSafe.ChainPrefix + "-TKN-123456",
Expand Down
12 changes: 7 additions & 5 deletions integrationTests/chainSimulator/bridge/esdtSafe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
// 2. transfer from main chain to sovereign chain
// 3. transfer again the same tokens from sovereign chain to main chain
// tokens are originated from sovereign chain
// esdt-safe contract in main chain will issue its own tokens ar registerToken step
// esdt-safe contract in main chain will issue its own tokens at registerToken step
// and will work with a mapper between sov_id <-> main_id
func TestChainSimulator_ExecuteAndDepositTokensWithPrefix(t *testing.T) {
if testing.Short() {
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestChainSimulator_ExecuteAndDepositTokensWithPrefix(t *testing.T) {

receiverShardId := uint32(0)

// TODO uncomment dynamic tokens, currently there is no issue function in SC framework for dynamic esdts
// TODO MX-15942 uncomment dynamic tokens, currently there is no issue function in SC framework for dynamic esdts
tokens := make([]chainSim.ArgsDepositToken, 0)
tokens = append(tokens, chainSim.ArgsDepositToken{
Identifier: "ab1-TKN-fasd35",
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestChainSimulator_ExecuteAndDepositTokensWithPrefix(t *testing.T) {
// generate hello contracts in each shard
// hello contract has one endpoint "hello" which receives a number as argument
// if number is 0 then will throw error, otherwise will do nothing
receiverContracts := generateHelloInAllShards(t, cs)
receiverContracts := deployReceiverContractInAllShards(t, cs)

// transfer sovereign chain -> main chain with transfer data
// execute 2nd time the same operations
Expand All @@ -204,7 +204,7 @@ func TestChainSimulator_ExecuteAndDepositTokensWithPrefix(t *testing.T) {
receiver := receiverContracts[receiverShardId]

// execute operations received from sovereign chain
// expecting the token to be minted in esdt-safe contract with the same properties and transferred to receiver address
// expecting the token to be minted in esdt-safe contract with the same properties and transferred to receiver contract address
trnsData := &transferData{
GasLimit: uint64(10000000),
Function: []byte("hello"),
Expand All @@ -226,6 +226,8 @@ func TestChainSimulator_ExecuteAndDepositTokensWithPrefix(t *testing.T) {
chainSim.RequireAccountHasToken(t, cs, getTokenIdentifier(receivedToken), receiver.Bech32, receivedToken.Amount)
if isSftOrMeta(receivedToken.Type) { // expect the contract to have 1 token
chainSim.RequireAccountHasToken(t, cs, getTokenIdentifier(receivedToken), esdtSafeAddr, big.NewInt(1))
} else {
chainSim.RequireAccountHasToken(t, cs, getTokenIdentifier(receivedToken), esdtSafeAddr, big.NewInt(0))
}

nextShardId(&receiverShardId)
Expand Down Expand Up @@ -488,7 +490,7 @@ func getTokenTicker(tokenIdentifier string) string {
return strings.Split(tokenIdentifier, "-")[1]
}

func generateHelloInAllShards(t *testing.T, cs chainSim.ChainSimulator) map[uint32]dtos.WalletAddress {
func deployReceiverContractInAllShards(t *testing.T, cs chainSim.ChainSimulator) map[uint32]dtos.WalletAddress {
nodeHandler := cs.GetNodeHandler(0)
systemContractDeploy := chainSim.GetSysContactDeployAddressBytes(t, nodeHandler)

Expand Down
2 changes: 2 additions & 0 deletions integrationTests/chainSimulator/bridge/executeAndBurn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func TestChainSimulator_ExecuteWithMintMultipleEsdtsAndBurnNftWithDeposit(t *tes
nftV2Nonce := uint64(10)
token := sovChainPrefix + "-TKN-1q2w3e"

// TODO MX-15942 add dynamic NFT type for bridge transfer
bridgedInTokens := make([]chainSim.ArgsDepositToken, 0)
bridgedInTokens = append(bridgedInTokens, chainSim.ArgsDepositToken{
Identifier: nftV2,
Expand Down Expand Up @@ -107,6 +108,7 @@ func TestChainSimulator_ExecuteWithMintAndBurnSftWithDeposit(t *testing.T) {
sft := sovChainPrefix + "-SOVSFT-654321"
sftNonce := uint64(123)

// TODO MX-15942 add dynamic SFT type for bridge transfer
bridgedInTokens := make([]chainSim.ArgsDepositToken, 0)
bridgedInTokens = append(bridgedInTokens, chainSim.ArgsDepositToken{
Identifier: sft,
Expand Down

0 comments on commit 4901ca0

Please sign in to comment.