Skip to content

Commit

Permalink
refactor: simplify delegate calling (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
EndymionJkb authored Dec 5, 2024
1 parent e2ee5d0 commit b149dbc
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions v3/tasks/20241205-v3-buffer-router/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { BufferRouterDeployment } from '../input';

describeForkTest('BufferRouter-V3', 'mainnet', 21336200, function () {
let task: Task;
let bufferRouter: Contract, vault: Contract, permit2: Contract, usdc: Contract;
let bufferRouter: Contract, vault: Contract, vaultExtension: Contract, permit2: Contract, usdc: Contract;
let wethSigner: SignerWithAddress, alice: SignerWithAddress, usdcWhale: SignerWithAddress;

const WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
Expand Down Expand Up @@ -39,6 +39,8 @@ describeForkTest('BufferRouter-V3', 'mainnet', 21336200, function () {
const vaultTask = new Task('20241204-v3-vault', TaskMode.READ_ONLY, getForkedNetwork(hre));
vault = await vaultTask.deployedInstance('Vault');
usdc = await testBALTokenTask.instanceAt('TestBalancerToken', USDC_ADDRESS);

vaultExtension = await vaultTask.deployedInstance('VaultExtension');
});

it('checks buffer router version', async () => {
Expand Down Expand Up @@ -67,15 +69,10 @@ describeForkTest('BufferRouter-V3', 'mainnet', 21336200, function () {
await usdc.connect(usdcWhale).approve(permit2.address, initBalance);
await permit2.connect(usdcWhale).approve(USDC_ADDRESS, bufferRouter.address, initBalance, MAX_UINT48);

// We need to call methods that don't exist in the vault.
const abi = [
'function isERC4626BufferInitialized(address) external view returns (bool)',
'function getERC4626BufferAsset(address) external view returns (address)',
];
const vaultAsExtension = new ethers.Contract(vault.address, abi, usdcWhale);

await bufferRouter.connect(usdcWhale).initializeBuffer(waUSDC_ADDRESS, 1000000e6, 0, 0);
expect(await vaultAsExtension.isERC4626BufferInitialized(waUSDC_ADDRESS)).to.be.true;
expect(await vaultAsExtension.getERC4626BufferAsset(waUSDC_ADDRESS)).to.be.eq(USDC_ADDRESS);

const extensionEntrypoint = vaultExtension.attach(vault.address);
expect(await extensionEntrypoint.isERC4626BufferInitialized(waUSDC_ADDRESS)).to.be.true;
expect(await extensionEntrypoint.getERC4626BufferAsset(waUSDC_ADDRESS)).to.be.eq(USDC_ADDRESS);
});
});

0 comments on commit b149dbc

Please sign in to comment.