Skip to content

Commit

Permalink
Feat/v3.2 gateway (#595)
Browse files Browse the repository at this point in the history
* feat: new weth gateway and tests

* feat: fixed test for wrapped new interface

* feat: added renamed v3 gateway

* feat: go back to old pool weth gateway for v2
  • Loading branch information
JoaquinBattilana authored Oct 9, 2024
1 parent 446d9af commit 6b7a707
Show file tree
Hide file tree
Showing 8 changed files with 2,378 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { L2Pool, L2PoolInterface } from '../v3-pool-rollups';
import {
WETHGatewayInterface,
WETHGatewayService,
} from '../wethgateway-contract';
} from '../v3-wethgateway-contract';

export type SupplyTxBuilder = {
generateTxData: ({
Expand Down Expand Up @@ -316,7 +316,6 @@ export class PoolBundle
user,
amount,
debtTokenAddress,
interestRateMode,
referralCode: referralCodeParam,
});
} else {
Expand Down Expand Up @@ -375,7 +374,6 @@ export class PoolBundle
lendingPool: this.poolAddress,
user,
amount,
interestRateMode,
onBehalfOf: onBehalfOfParam,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,6 @@ describe('PoolBundle', () => {
debtTokenAddress: API_ETH_MOCK_ADDRESS.toLowerCase(),
});

const resultStable = instance.borrowTxBuilder.generateTxData({
user: USER,
reserve: API_ETH_MOCK_ADDRESS.toLowerCase(),
amount: '1',
onBehalfOf: USER,
interestRateMode: InterestRate.Stable,
referralCode: '0',
debtTokenAddress: API_ETH_MOCK_ADDRESS.toLowerCase(),
});

const differentParamsSameResult = instance.borrowTxBuilder.generateTxData(
{
user: USER,
Expand All @@ -495,20 +485,14 @@ describe('PoolBundle', () => {
},
);
const variableTxData =
'0x66514c970000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000';
const stableTxData =
'0x66514c970000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000';
'0xe74f7b85000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000';
expect(result.to).toEqual(WETH_GATEWAY);
expect(result.from).toEqual(USER);
expect(result.value).toEqual(undefined);
expect(result.data).toEqual(variableTxData);
expect(differentParamsSameResult.to).toEqual(WETH_GATEWAY);
expect(differentParamsSameResult.from).toEqual(USER);
expect(differentParamsSameResult.data).toEqual(variableTxData);
expect(resultStable.to).toEqual(WETH_GATEWAY);
expect(resultStable.from).toEqual(USER);
expect(resultStable.value).toEqual(undefined);
expect(resultStable.data).toEqual(stableTxData);
});

it('generates borrow tx data with generateTxData and L2POOL', () => {
Expand Down Expand Up @@ -711,12 +695,12 @@ describe('PoolBundle', () => {
expect(result.from).toEqual(USER);
expect(result.value).toEqual(BigNumber.from('1'));
expect(result.data).toEqual(
'0x02c5fcf80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003',
'0xbcc3c255000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003',
);
expect(differentParamsSameResult.to).toEqual(WETH_GATEWAY);
expect(differentParamsSameResult.from).toEqual(USER);
expect(differentParamsSameResult.data).toEqual(
'0x02c5fcf80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003',
'0xbcc3c255000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003',
);
});

Expand Down
4 changes: 1 addition & 3 deletions packages/contract-helpers/src/v3-pool-contract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { L2Pool, L2PoolInterface } from '../v3-pool-rollups';
import {
WETHGatewayInterface,
WETHGatewayService,
} from '../wethgateway-contract';
} from '../v3-wethgateway-contract';
import {
LPBorrowParamsType,
LPSupplyParamsType,
Expand Down Expand Up @@ -681,7 +681,6 @@ export class Pool extends BaseService<IPool> implements PoolInterface {
user,
amount,
debtTokenAddress,
interestRateMode,
referralCode,
});
}
Expand Down Expand Up @@ -750,7 +749,6 @@ export class Pool extends BaseService<IPool> implements PoolInterface {
lendingPool: this.poolAddress,
user,
amount,
interestRateMode,
onBehalfOf,
});
}
Expand Down
Loading

0 comments on commit 6b7a707

Please sign in to comment.