Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated the new contracts #370

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions integrationTests/relayers/slowTests/framework/multiversxHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const (
multiTransferEsdtSetMaxBridgedAmountForTokenFunction = "multiTransferEsdtSetMaxBridgedAmountForToken"
submitBatchFunction = "submitBatch"
unwrapTokenCreateTransactionFunction = "unwrapTokenCreateTransaction"
createTransactionFunction = "createTransaction"
setBridgedTokensWrapperAddressFunction = "setBridgedTokensWrapperAddress"
setMultiTransferAddressFunction = "setMultiTransferAddress"
withdrawRefundFeesForEthereumFunction = "withdrawRefundFeesForEthereum"
Expand Down Expand Up @@ -942,7 +943,38 @@ func (handler *MultiversxHandler) submitAggregatorBatchForKey(ctx context.Contex
}

// SendDepositTransactionFromMultiversx will send the deposit transaction from MultiversX
func (handler *MultiversxHandler) SendDepositTransactionFromMultiversx(ctx context.Context, token *TokenData, value *big.Int) {
func (handler *MultiversxHandler) SendDepositTransactionFromMultiversx(ctx context.Context, token *TokenData, params TestTokenParams, value *big.Int) {
if params.HasChainSpecificToken {
handler.unwrapCreateTransaction(ctx, token, value)
return
}

handler.createTransactionWithoutUnwrap(ctx, token, value)
}

func (handler *MultiversxHandler) createTransactionWithoutUnwrap(ctx context.Context, token *TokenData, value *big.Int) {
// create transaction params
params := []string{
hex.EncodeToString([]byte(token.MvxUniversalToken)),
hex.EncodeToString(value.Bytes()),
hex.EncodeToString([]byte(createTransactionFunction)),
hex.EncodeToString(handler.TestKeys.EthAddress.Bytes()),
}
dataField := strings.Join(params, "@")

hash, txResult := handler.ChainSimulator.ScCall(
ctx,
handler.TestKeys.MvxSk,
handler.SafeAddress,
zeroStringValue,
createDepositGasLimit+gasLimitPerDataByte*uint64(len(dataField)),
esdtTransferFunction,
params,
)
log.Info("MultiversX->Ethereum createTransaction sent", "hash", hash, "token", token.MvxUniversalToken, "status", txResult.Status)
}

func (handler *MultiversxHandler) unwrapCreateTransaction(ctx context.Context, token *TokenData, value *big.Int) {
// create transaction params
params := []string{
hex.EncodeToString([]byte(token.MvxUniversalToken)),
Expand All @@ -962,7 +994,7 @@ func (handler *MultiversxHandler) SendDepositTransactionFromMultiversx(ctx conte
esdtTransferFunction,
params,
)
log.Info("MultiversX->Ethereum transaction sent", "hash", hash, "token", token.MvxUniversalToken, "status", txResult.Status)
log.Info("MultiversX->Ethereum unwrapCreateTransaction sent", "hash", hash, "token", token.MvxUniversalToken, "status", txResult.Status)
}

// TestWithdrawFees will try to withdraw the fees for the provided token from the safe contract to the owner
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/relayers/slowTests/framework/testSetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (setup *TestSetup) sendFromMultiversxToEthereumForToken(params TestTokenPar
}

depositValue.Add(depositValue, operation.ValueToSendFromMvX)
setup.MultiversxHandler.SendDepositTransactionFromMultiversx(setup.Ctx, token, operation.ValueToSendFromMvX)
setup.MultiversxHandler.SendDepositTransactionFromMultiversx(setup.Ctx, token, params, operation.ValueToSendFromMvX)
}

return depositValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@
],
"outputs": []
},
{
"name": "updateLowestTxId",
"mutability": "mutable",
"inputs": [],
"outputs": []
},
{
"name": "getPendingTransactionById",
"mutability": "readonly",
Expand Down Expand Up @@ -163,7 +157,7 @@
]
},
{
"name": "lowestTxId",
"name": "highestTxId",
"mutability": "readonly",
"inputs": [],
"outputs": [
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading