Skip to content

Commit

Permalink
Merge branch 'master' into npai/inventory-client-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai authored Aug 21, 2024
2 parents 67480c3 + c67af30 commit 6286950
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 940 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@across-protocol/constants": "^3.1.14",
"@across-protocol/contracts": "^3.0.10",
"@across-protocol/sdk": "^3.1.26",
"@across-protocol/sdk": "^3.1.27",
"@arbitrum/sdk": "^3.1.3",
"@consensys/linea-sdk": "^0.2.1",
"@defi-wonderland/smock": "^2.3.5",
Expand Down
6 changes: 5 additions & 1 deletion src/adapter/bridges/ZKSyncBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ export class ZKSyncBridge extends BaseBridgeAdapter {
this.getL1Bridge().filters.DepositInitiated(undefined, fromAddress, toAddress),
eventConfig
);

const filteredEvents = events.filter(({ args }) => args.l1Token === l1Token);
return {
[this.resolveL2TokenAddress(l1Token)]: events.map((event) => processEvent(event, "_amount", "_to", "from")),
[this.resolveL2TokenAddress(l1Token)]: filteredEvents.map((event) =>
processEvent(event, "_amount", "_to", "from")
),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/bridges/ZKSyncWethBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class ZKSyncWethBridge extends BaseBridgeAdapter {
);
}
return {
[this.resolveL2TokenAddress(l1Token)]: events.map((event) => processEvent(event, "amount", "_to", "_from")),
[this.resolveL2TokenAddress(l1Token)]: events.map((event) => processEvent(event, "_amount", "_to", "from")),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/clients/BalanceAllocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class BalanceAllocator {
async getBalance(chainId: number, token: string, holder: string): Promise<BigNumber> {
if (!this.balances?.[chainId]?.[token]?.[holder]) {
const balance = await this._queryBalance(chainId, token, holder);
// To avoid inconsitencies, we recheck the balances value after the query.
// To avoid inconsistencies, we recheck the balances value after the query.
// If it exists, skip the assignment so the value doesn't change after being set.
if (!this.balances?.[chainId]?.[token]?.[holder]) {
// Note: cannot use assign because it breaks the BigNumber object.
Expand Down
2 changes: 1 addition & 1 deletion src/clients/InventoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class InventoryClient {
}

/**
* Returns true if the depositor-specified output token is supported by the this inventory client.
* Returns true if the depositor-specified output token is supported by this inventory client.
* @param deposit V3 Deposit to consider
* @returns boolean True if output and input tokens are equivalent or if input token is USDC and output token
* is Bridged USDC.
Expand Down
Loading

0 comments on commit 6286950

Please sign in to comment.