Skip to content

Commit

Permalink
Relayer: Integrate XRP token sending from the XRPL and back (#58)
Browse files Browse the repository at this point in the history
Relayer: Integrate XRP token sending from the XRPL and back (tests
mostly, the logic of the sending was covered by the previous commits).
  • Loading branch information
dzmitryhil authored Dec 8, 2023
1 parent 612fb24 commit 5b61dc1
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 42 deletions.
2 changes: 1 addition & 1 deletion contract/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const XRPL_DENOM_PREFIX: &str = "xrpl";
pub const XRPL_TOKENS_DECIMALS: u32 = 15;

const XRP_CURRENCY: &str = "XRP";
const XRP_ISSUER: &str = "rrrrrrrrrrrrrrrrrrrrrho";
const XRP_ISSUER: &str = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";

// Initial values for the XRP token that can be modified afterwards.
const XRP_DEFAULT_SENDING_PRECISION: i32 = 6;
Expand Down
2 changes: 1 addition & 1 deletion contract/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod tests {
const XRP_SUBUNIT: &str = "drop";
const XRPL_DENOM_PREFIX: &str = "xrpl";
const XRP_CURRENCY: &str = "XRP";
const XRP_ISSUER: &str = "rrrrrrrrrrrrrrrrrrrrrho";
const XRP_ISSUER: &str = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
const TRUST_SET_LIMIT_AMOUNT: u128 = 1000000000000000000; // 1e18
const XRP_DECIMALS: u32 = 6;
const XRP_DEFAULT_SENDING_PRECISION: i32 = 6;
Expand Down
190 changes: 185 additions & 5 deletions integration-tests/coreum/contract_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
xrp = "XRP"
drop = "drop"
xrplPrecision = 15
xrpIssuer = "rrrrrrrrrrrrrrrrrrrrrho"
xrpIssuer = "rrrrrrrrrrrrrrrrrrrrrhoLvTp"
xrpCurrency = "XRP"

xrpSendingPrecision = 6
Expand Down Expand Up @@ -756,6 +756,94 @@ func TestSendFromXRPLToCoreumXRPLOriginatedTokenWithDifferentSendingPrecision(t
}
}

func TestSendFromXRPLToCoreumXRPToken(t *testing.T) {
t.Parallel()

ctx, chains := integrationtests.NewTestingContext(t)

coreumRecipient := chains.Coreum.GenAccount()
randomAddress := chains.Coreum.GenAccount()
relayers := genRelayers(ctx, t, chains, 2)

bankClient := banktypes.NewQueryClient(chains.Coreum.ClientContext)

chains.Coreum.FundAccountWithOptions(ctx, t, randomAddress, coreumintegration.BalancesOptions{
Amount: sdkmath.NewInt(1_000_000),
})

_, contractClient := integrationtests.DeployAndInstantiateContract(
ctx,
t,
chains,
relayers,
len(relayers),
3,
defaultTrustSetLimitAmount,
xrpl.GenPrivKeyTxSigner().Account().String(),
)
registeredXRPToken, err := contractClient.GetXRPLTokenByIssuerAndCurrency(ctx, xrpl.XRPTokenIssuer.String(), xrpl.XRPTokenCurrency.String())
require.NoError(t, err)

require.Equal(t, coreum.XRPLToken{
Issuer: xrpl.XRPTokenIssuer.String(),
Currency: xrpl.XRPTokenCurrency.String(),
CoreumDenom: assetfttypes.BuildDenom("drop", contractClient.GetContractAddress()),
SendingPrecision: 6,
MaxHoldingAmount: sdkmath.NewInt(10000000000000000),
State: coreum.TokenStateEnabled,
}, registeredXRPToken)

// create an evidence of transfer tokens from XRPL to Coreum
xrplToCoreumTransferEvidence := coreum.XRPLToCoreumTransferEvidence{
TxHash: genXRPLTxHash(t),
Issuer: rippledata.Account{}.String(),
Currency: rippledata.Currency{}.String(),
Amount: sdkmath.NewInt(10),
Recipient: coreumRecipient,
}

// try to call from not relayer
_, err = contractClient.SendXRPLToCoreumTransferEvidence(ctx, randomAddress, xrplToCoreumTransferEvidence)
require.True(t, coreum.IsUnauthorizedSenderError(err), err)

// call from first relayer
txRes, err := contractClient.SendXRPLToCoreumTransferEvidence(ctx, relayers[0].CoreumAddress, xrplToCoreumTransferEvidence)
require.NoError(t, err)
recipientBalanceRes, err := bankClient.Balance(ctx, &banktypes.QueryBalanceRequest{
Address: coreumRecipient.String(),
Denom: registeredXRPToken.CoreumDenom,
})
require.NoError(t, err)
require.True(t, recipientBalanceRes.Balance.IsZero())
thresholdReached, err := event.FindStringEventAttribute(txRes.Events, wasmtypes.ModuleName, eventAttributeThresholdReached)
require.NoError(t, err)
require.Equal(t, strconv.FormatBool(false), thresholdReached)

// call from first relayer one more time
_, err = contractClient.SendXRPLToCoreumTransferEvidence(ctx, relayers[0].CoreumAddress, xrplToCoreumTransferEvidence)
require.True(t, coreum.IsEvidenceAlreadyProvidedError(err), err)

// call from second relayer
txRes, err = contractClient.SendXRPLToCoreumTransferEvidence(ctx, relayers[1].CoreumAddress, xrplToCoreumTransferEvidence)
require.NoError(t, err)
recipientBalanceRes, err = bankClient.Balance(ctx, &banktypes.QueryBalanceRequest{
Address: coreumRecipient.String(),
Denom: registeredXRPToken.CoreumDenom,
})
require.NoError(t, err)
thresholdReached, err = event.FindStringEventAttribute(txRes.Events, wasmtypes.ModuleName, eventAttributeThresholdReached)
require.NoError(t, err)
require.Equal(t, strconv.FormatBool(true), thresholdReached)

require.NoError(t, err)
// expect new token on the recipient balance
require.Equal(t, xrplToCoreumTransferEvidence.Amount.String(), recipientBalanceRes.Balance.Amount.String())

// try to push the same evidence
_, err = contractClient.SendXRPLToCoreumTransferEvidence(ctx, relayers[0].CoreumAddress, xrplToCoreumTransferEvidence)
require.True(t, coreum.IsOperationAlreadyExecutedError(err), err)
}

func TestSendFromXRPLToCoreumCoreumOriginatedToken(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1634,10 +1722,10 @@ func TestSendFromCoreumToXRPLXRPLOriginatedToken(t *testing.T) {
operation := pendingOperations[0]
operationType := operation.OperationType.CoreumToXRPLTransfer
require.NotNil(t, operationType)
require.NotNil(t, operationType.Issuer, registeredXRPLOriginatedToken.Issuer)
require.NotNil(t, operationType.Currency, registeredXRPLOriginatedToken.Currency)
require.NotNil(t, operationType.Amount, amountToSend)
require.NotNil(t, operationType.Recipient, xrplRecipientAddress.String())
require.Equal(t, operationType.Issuer, registeredXRPLOriginatedToken.Issuer)
require.Equal(t, operationType.Currency, registeredXRPLOriginatedToken.Currency)
require.Equal(t, operationType.Amount, amountToSend)
require.Equal(t, operationType.Recipient, xrplRecipientAddress.String())

acceptedTxEvidence := coreum.XRPLTransactionResultCoreumToXRPLTransferEvidence{
XRPLTransactionResultEvidence: coreum.XRPLTransactionResultEvidence{
Expand Down Expand Up @@ -1830,6 +1918,98 @@ func TestSendFromCoreumToXRPLXRPLOriginatedTokenWithDifferentSendingPrecision(t
}
}

func TestSendFromCoreumToXRPLXRPToken(t *testing.T) {
t.Parallel()

ctx, chains := integrationtests.NewTestingContext(t)

relayers := genRelayers(ctx, t, chains, 2)
bankClient := banktypes.NewQueryClient(chains.Coreum.ClientContext)

coreumSenderAddress := chains.Coreum.GenAccount()
chains.Coreum.FundAccountWithOptions(ctx, t, coreumSenderAddress, coreumintegration.BalancesOptions{
Amount: sdkmath.NewInt(1_000_000),
})

xrplRecipientAddress := chains.XRPL.GenAccount(ctx, t, 0)

owner, contractClient := integrationtests.DeployAndInstantiateContract(
ctx,
t,
chains,
relayers,
len(relayers),
3,
defaultTrustSetLimitAmount,
xrpl.GenPrivKeyTxSigner().Account().String(),
)
registeredXRPToken, err := contractClient.GetXRPLTokenByIssuerAndCurrency(ctx, xrpl.XRPTokenIssuer.String(), xrpl.XRPTokenCurrency.String())
require.NoError(t, err)

// recover tickets to be able to create operations from coreum to XRPL
recoverTickets(ctx, t, contractClient, owner, relayers, 5)

amountToSendFromXRPLToCoreum := sdkmath.NewInt(1_000_100)
sendFromXRPLToCoreum(ctx, t, contractClient, relayers, registeredXRPToken.Issuer, registeredXRPToken.Currency, amountToSendFromXRPLToCoreum, coreumSenderAddress)
// validate that the amount is received
balanceRes, err := bankClient.Balance(ctx, &banktypes.QueryBalanceRequest{
Address: coreumSenderAddress.String(),
Denom: registeredXRPToken.CoreumDenom,
})
require.NoError(t, err)
require.Equal(t, amountToSendFromXRPLToCoreum.String(), balanceRes.Balance.Amount.String())

amountToSend := sdkmath.NewInt(1_000_000)

// send valid amount and validate the state
coreumSenderBalanceBeforeRes, err := bankClient.Balance(ctx, &banktypes.QueryBalanceRequest{
Address: coreumSenderAddress.String(),
Denom: registeredXRPToken.CoreumDenom,
})
require.NoError(t, err)
_, err = contractClient.SendToXRPL(ctx, coreumSenderAddress, xrplRecipientAddress.String(), sdk.NewCoin(registeredXRPToken.CoreumDenom, amountToSend))
require.NoError(t, err)
// check the remaining balance
coreumSenderBalanceAfterRes, err := bankClient.Balance(ctx, &banktypes.QueryBalanceRequest{
Address: coreumSenderAddress.String(),
Denom: registeredXRPToken.CoreumDenom,
})
require.NoError(t, err)
require.Equal(t, coreumSenderBalanceBeforeRes.Balance.Amount.Sub(amountToSend).String(), coreumSenderBalanceAfterRes.Balance.Amount.String())

pendingOperations, err := contractClient.GetPendingOperations(ctx)
require.NoError(t, err)
require.Len(t, pendingOperations, 1)
operation := pendingOperations[0]
operationType := operation.OperationType.CoreumToXRPLTransfer
require.NotNil(t, operationType)
require.Equal(t, operationType.Issuer, registeredXRPToken.Issuer)
require.Equal(t, operationType.Currency, registeredXRPToken.Currency)
require.Equal(t, operationType.Amount, amountToSend)
require.Equal(t, operationType.Recipient, xrplRecipientAddress.String())

acceptedTxEvidence := coreum.XRPLTransactionResultCoreumToXRPLTransferEvidence{
XRPLTransactionResultEvidence: coreum.XRPLTransactionResultEvidence{
TxHash: genXRPLTxHash(t),
TicketSequence: &operation.TicketSequence,
TransactionResult: coreum.TransactionResultAccepted,
},
}

// send from first relayer
_, err = contractClient.SendCoreumToXRPLTransferTransactionResultEvidence(ctx, relayers[0].CoreumAddress, acceptedTxEvidence)
require.NoError(t, err)

// send from second relayer
_, err = contractClient.SendCoreumToXRPLTransferTransactionResultEvidence(ctx, relayers[1].CoreumAddress, acceptedTxEvidence)
require.NoError(t, err)

// check pending operations
pendingOperations, err = contractClient.GetPendingOperations(ctx)
require.NoError(t, err)
require.Empty(t, pendingOperations)
}

func TestSendFromCoreumToXRPLCoreumOriginatedToken(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions integration-tests/processes/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"github.com/CoreumFoundation/coreumbridge-xrpl/relayer/xrpl"
)

const XRPLTokenDecimals = 15

// RunnerEnvConfig is runner environment config.
type RunnerEnvConfig struct {
AwaitTimeout time.Duration
Expand Down
85 changes: 74 additions & 11 deletions integration-tests/processes/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ func TestSendXRPLOriginatedTokensFromXRPLToCoreumAndBack(t *testing.T) {
require.NoError(t, err)

runnerEnv.SendXRPLPaymentTx(ctx, t, xrplIssuerAddress, runnerEnv.bridgeXRPLAddress, amountToSendFromXRPLtoCoreum, memo)
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals)))

// send the full amount in 4 transactions to XRPL
amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals).QuoRaw(4)
amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals).QuoRaw(4)

// send 2 transactions without the trust set to be reverted
// TODO(dzmitryhil) update assertion once we add the final tx revert/recovery
Expand All @@ -87,6 +87,69 @@ func TestSendXRPLOriginatedTokensFromXRPLToCoreumAndBack(t *testing.T) {
require.Equal(t, "5000000000", balance.Value.String())
}

func TestSendXRPTokenFromXRPLToCoreumAndBack(t *testing.T) {
t.Parallel()

ctx, chains := integrationtests.NewTestingContext(t)

envCfg := DefaultRunnerEnvConfig()
runnerEnv := NewRunnerEnv(ctx, t, envCfg, chains)
runnerEnv.StartAllRunnerProcesses(ctx, t)
runnerEnv.AllocateTickets(ctx, t, uint32(200))

coreumSender := chains.Coreum.GenAccount()
chains.Coreum.FundAccountWithOptions(ctx, t, coreumSender, coreumintegration.BalancesOptions{
Amount: sdkmath.NewIntFromUint64(1_000_000),
})
t.Logf("Coreum sender: %s", coreumSender.String())
xrplRecipientAddress := chains.XRPL.GenAccount(ctx, t, 0)
t.Logf("XRPL recipient: %s", xrplRecipientAddress.String())
// XRP to send the part of it and cover fees
xrplSenderAddress := chains.XRPL.GenAccount(ctx, t, 2.2)
t.Logf("XRPL sender: %s", xrplSenderAddress.String())

registeredXRPToken, err := runnerEnv.ContractClient.GetXRPLTokenByIssuerAndCurrency(ctx, xrpl.XRPTokenIssuer.String(), xrpl.XRPTokenCurrency.String())
require.NoError(t, err)

valueToSendFromXRPLtoCoreum, err := rippledata.NewValue("2.111111", true)
require.NoError(t, err)
amountToSendFromXRPLtoCoreum := rippledata.Amount{
Value: valueToSendFromXRPLtoCoreum,
Currency: xrpl.XRPTokenCurrency,
Issuer: xrpl.XRPTokenIssuer,
}
memo, err := xrpl.EncodeCoreumRecipientToMemo(coreumSender)
require.NoError(t, err)

runnerEnv.SendXRPLPaymentTx(ctx, t, xrplSenderAddress, runnerEnv.bridgeXRPLAddress, amountToSendFromXRPLtoCoreum, memo)
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPCurrencyDecimals)))

xrplRecipientBalanceBefore := runnerEnv.Chains.XRPL.GetAccountBalance(ctx, t, xrplRecipientAddress, xrpl.XRPTokenIssuer, xrpl.XRPTokenCurrency)

for _, v := range []string{"1.1", "0.5", "0.51111", "0.000001"} {
_, err = runnerEnv.ContractClient.SendToXRPL(
ctx,
coreumSender,
xrplRecipientAddress.String(),
sdk.NewCoin(
registeredXRPToken.CoreumDenom,
integrationtests.ConvertStringWithDecimalsToSDKInt(
t,
v,
xrpl.XRPCurrencyDecimals,
)),
)
require.NoError(t, err)
}

runnerEnv.AwaitNoPendingOperations(ctx, t)

xrplRecipientBalanceAfter := runnerEnv.Chains.XRPL.GetAccountBalance(ctx, t, xrplRecipientAddress, xrpl.XRPTokenIssuer, xrpl.XRPTokenCurrency)
received, err := xrplRecipientBalanceAfter.Value.Subtract(*xrplRecipientBalanceBefore.Value)
require.NoError(t, err)
require.Equal(t, valueToSendFromXRPLtoCoreum.String(), received.String())
}

func TestSendXRPLOriginatedTokenFromXRPLToCoreumWithMaliciousRelayer(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -126,12 +189,12 @@ func TestSendXRPLOriginatedTokenFromXRPLToCoreumWithMaliciousRelayer(t *testing.
require.NoError(t, err)

runnerEnv.SendXRPLPaymentTx(ctx, t, xrplIssuerAddress, runnerEnv.bridgeXRPLAddress, amountToSendFromXRPLtoCoreum, memo)
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals)))

// send TrustSet to be able to receive coins
runnerEnv.SendXRPLMaxTrustSetTx(ctx, t, xrplRecipientAddress, xrplIssuerAddress, registeredXRPLCurrency)

amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals).QuoRaw(4)
amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals).QuoRaw(4)
_, err = runnerEnv.ContractClient.SendToXRPL(ctx, coreumSender, xrplRecipientAddress.String(), sdk.NewCoin(registeredXRPLToken.CoreumDenom, amountToSend))
require.NoError(t, err)
runnerEnv.AwaitNoPendingOperations(ctx, t)
Expand Down Expand Up @@ -180,13 +243,13 @@ func TestSendXRPLOriginatedTokenFromXRPLToCoreumWithTicketsReallocation(t *testi
require.NoError(t, err)

runnerEnv.SendXRPLPaymentTx(ctx, t, xrplIssuerAddress, runnerEnv.bridgeXRPLAddress, amountToSendFromXRPLtoCoreum, memo)
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals)))

// send TrustSet to be able to receive coins
runnerEnv.SendXRPLMaxTrustSetTx(ctx, t, xrplRecipientAddress, xrplIssuerAddress, registeredXRPLCurrency)

totalSent := sdkmath.ZeroInt()
amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, "10", XRPLTokenDecimals)
amountToSend := integrationtests.ConvertStringWithDecimalsToSDKInt(t, "10", xrpl.XRPLIssuedTokenDecimals)
for i := 0; i < sendingCount; i++ {
retryCtx, retryCtxCancel := context.WithTimeout(ctx, 15*time.Second)
require.NoError(t, retry.Do(retryCtx, 500*time.Millisecond, func() error {
Expand All @@ -207,7 +270,7 @@ func TestSendXRPLOriginatedTokenFromXRPLToCoreumWithTicketsReallocation(t *testi
runnerEnv.AwaitNoPendingOperations(ctx, t)

balance := runnerEnv.Chains.XRPL.GetAccountBalance(ctx, t, xrplRecipientAddress, xrplIssuerAddress, registeredXRPLCurrency)
require.Equal(t, totalSent.Quo(sdkmath.NewIntWithDecimal(1, XRPLTokenDecimals)).String(), balance.Value.String())
require.Equal(t, totalSent.Quo(sdkmath.NewIntWithDecimal(1, xrpl.XRPLIssuedTokenDecimals)).String(), balance.Value.String())
}

func TestSendXRPLOriginatedTokensFromXRPLToCoreumWithDifferentAmountAndPartialAmount(t *testing.T) {
Expand Down Expand Up @@ -303,8 +366,8 @@ func TestSendXRPLOriginatedTokensFromXRPLToCoreumWithDifferentAmountAndPartialAm
// send tx with hex currency
runnerEnv.SendXRPLPaymentTx(ctx, t, xrplIssuerAddress, runnerEnv.bridgeXRPLAddress, registeredHexCurrencyAmount, memo)

runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumRecipient, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, "100001.000001", XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumRecipient, sdk.NewCoin(registeredXRPLHexCurrencyToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, "9.9", XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumRecipient, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, "100001.000001", xrpl.XRPLIssuedTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumRecipient, sdk.NewCoin(registeredXRPLHexCurrencyToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, "9.9", xrpl.XRPLIssuedTokenDecimals)))
}

func TestRecoverXRPLOriginatedTokenRegistrationAndSendFromXRPLToCoreumAndBack(t *testing.T) {
Expand Down Expand Up @@ -368,12 +431,12 @@ func TestRecoverXRPLOriginatedTokenRegistrationAndSendFromXRPLToCoreumAndBack(t
require.NoError(t, err)

runnerEnv.SendXRPLPaymentTx(ctx, t, xrplIssuerAddress, runnerEnv.bridgeXRPLAddress, amountToSendFromXRPLtoCoreum, memo)
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals)))
runnerEnv.AwaitCoreumBalance(ctx, t, chains.Coreum, coreumSender, sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals)))

// send TrustSet to be able to receive coins
runnerEnv.SendXRPLMaxTrustSetTx(ctx, t, xrplRecipientAddress, xrplIssuerAddress, registeredXRPLCurrency)

_, err = runnerEnv.ContractClient.SendToXRPL(ctx, coreumSender, xrplRecipientAddress.String(), sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), XRPLTokenDecimals)))
_, err = runnerEnv.ContractClient.SendToXRPL(ctx, coreumSender, xrplRecipientAddress.String(), sdk.NewCoin(registeredXRPLToken.CoreumDenom, integrationtests.ConvertStringWithDecimalsToSDKInt(t, valueToSendFromXRPLtoCoreum.String(), xrpl.XRPLIssuedTokenDecimals)))
require.NoError(t, err)
runnerEnv.AwaitNoPendingOperations(ctx, t)

Expand Down
Loading

0 comments on commit 5b61dc1

Please sign in to comment.