Skip to content

Commit

Permalink
chore: add checks and increase timeout (#3928)
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-llimos committed Aug 31, 2023
1 parent 168135f commit c44279b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bouncer/shared/contract_swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export async function performSwapViaContract(
const receipt = await executeContractSwap(sourceAsset, destAsset, destAddress, messageMetadata);
await observeEvent('swapping:SwapScheduled', api, (event) => {
if ('Vault' in event.data.origin) {
return event.data.origin.Vault.txHash === receipt.transactionHash;
const sourceAssetMatches = sourceAsset === (event.data.sourceAsset.toUpperCase() as Asset);
const destAssetMatches = destAsset === (event.data.destinationAsset.toUpperCase() as Asset);
const txHashMatches = event.data.origin.Vault.txHash === receipt.transactionHash;
return sourceAssetMatches && destAssetMatches && txHashMatches;
}
// Otherwise it was a swap scheduled by requesting a deposit address
return false;
Expand Down
4 changes: 2 additions & 2 deletions bouncer/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export async function observeBalanceIncrease(
address: string,
oldBalance: string,
): Promise<number> {
for (let i = 0; i < 120; i++) {
for (let i = 0; i < 1200; i++) {
const newBalance = Number(await getBalance(dstCcy as Asset, address));
if (newBalance > Number(oldBalance)) {
return newBalance;
Expand Down Expand Up @@ -338,7 +338,7 @@ export async function observeEVMEvent(
// Get the parameter names of the event
const parameterNames = eventAbi.inputs.map((input) => input.name);

for (let i = 0; i < 120; i++) {
for (let i = 0; i < 1200; i++) {
if (stopObserve()) return undefined;
const currentBlockNumber = await web3.eth.getBlockNumber();
if (currentBlockNumber >= initBlockNumber) {
Expand Down

0 comments on commit c44279b

Please sign in to comment.