Skip to content

Commit

Permalink
Fix address comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoguerios committed Oct 9, 2023
1 parent b64e29a commit 61ae94f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/entities/nestedJoin/doQueryNestedJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export async function doQueryNestedJoin(
data: data as Hex,
});

// TODO: extend logic for multiple peek calls in the context of non-leaf joins
const peekedValue = decodeAbiParameters(
[{ type: 'uint256' }],
result[result.length - 1],
Expand Down
8 changes: 4 additions & 4 deletions src/entities/nestedJoin/parseNestedJoinCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function parseNestedJoinCall({
let value = 0n;
if (chainId && useNativeAssetAsWrappedAmountIn) {
tokensIn = replaceWrapped([...sortedTokens], chainId);
const nativeAssetIndex = tokensIn.findIndex(
(t) => t.address === ZERO_ADDRESS,
const nativeAssetIndex = tokensIn.findIndex((t) =>
t.isSameAddress(ZERO_ADDRESS),
);
if (nativeAssetIndex > -1) {
value = maxAmountsIn[nativeAssetIndex].amount;
Expand All @@ -37,8 +37,8 @@ export function parseNestedJoinCall({
const _maxAmountsIn = maxAmountsIn.map((a) =>
a.isRef ? Relayer.toChainedReference(a.amount) : a.amount,
);
const amountsInWithoutBpt = _maxAmountsIn.filter(
(_, i) => sortedTokens[i].address !== poolAddress, // TODO: lowercase?
const amountsInWithoutBpt = _maxAmountsIn.filter((_, i) =>
sortedTokens[i].isSameAddress(poolAddress),
);
let userData: Hex;
switch (poolType) {
Expand Down
4 changes: 2 additions & 2 deletions test/nestedJoin.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('nested join test', () => {
}
});

test('leaf join - single token', async () => {
test('single asset join', async () => {
const amountIn = {
address: '0x6b175474e89094c44da98b954eedeac495271d0f' as Address, // DAI
rawAmount: parseUnits('1', 18),
Expand All @@ -153,7 +153,7 @@ describe('nested join test', () => {
});
});

test('leaf join - all tokens', async () => {
test('all assets join', async () => {
const amountsIn = [
{
address:
Expand Down

0 comments on commit 61ae94f

Please sign in to comment.