Skip to content

Commit e6fc4f8

Browse files
authored
JB/Removes optional chaining on yearn bridge (#213)
* Remove optional chaining * Formatter * Formatter
1 parent 94ea0e5 commit e6fc4f8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aztec/bridge-clients",
3-
"version": "0.1.52",
3+
"version": "0.1.53",
44
"description": "This repo contains the solidity files and typescript helper class for all of the Aztec Connect Bridge Contracts",
55
"repository": "[email protected]:AztecProtocol/aztec-connect-bridges.git",
66
"license": "Apache-2.0",

src/client/yearn/yearn-bridge-data.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,19 @@ export class YearnBridgeData implements BridgeDataFieldGetters {
7878
}
7979
}
8080

81+
const hasInputAsset = allVaultsForTokens[inputAssetA.erc20Address.toString()] || [];
82+
const hasOutputAsset = allVaultsForTokens[outputAssetA.erc20Address.toString()] || [];
83+
8184
// standard deposit
8285
const matchDepositSituation =
83-
(allVaultsForTokens[inputAssetA.erc20Address.toString()] || [])?.findIndex(
84-
token => token.toString() === outputAssetA.erc20Address.toString(),
85-
) > -1;
86+
hasInputAsset && hasInputAsset.findIndex(token => token.toString() === outputAssetA.erc20Address.toString()) > -1;
8687
if (matchDepositSituation) {
8788
return [0];
8889
}
89-
9090
// standard withdraw
9191
const matchWithdrawSituation =
92-
(allVaultsForTokens[outputAssetA.erc20Address.toString()] || [])?.findIndex(
93-
token => token.toString() === inputAssetA.erc20Address.toString(),
94-
) > -1;
92+
hasOutputAsset &&
93+
hasOutputAsset.findIndex(token => token.toString() === inputAssetA.erc20Address.toString()) > -1;
9594
if (matchWithdrawSituation) {
9695
return [1];
9796
}

0 commit comments

Comments
 (0)