Skip to content

[DRAFT] Deployment preparation: WeightedLPOracleFactory #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions v3/tasks/20250605-v3-weighted-lp-oracle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { WeightedLPOracleDeployment } from './input';
import { Task, TaskRunOptions } from '@src';

/* eslint-disable @typescript-eslint/no-non-null-assertion */
export default async (task: Task, { force, from }: TaskRunOptions = {}): Promise<void> => {
const input = task.input() as WeightedLPOracleDeployment;

const args = [input.Vault, input.Version];
await task.deployAndVerify('WeightedLPOracleFactory', args, from, force);
};
14 changes: 14 additions & 0 deletions v3/tasks/20250605-v3-weighted-lp-oracle/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Task, TaskMode } from '@src';

export type WeightedLPOracleDeployment = {
Vault: string;
Version: string;
};

const Vault = new Task('20241204-v3-vault', TaskMode.READ_ONLY);
const Version = 1;

export default {
Vault,
Version,
};
9 changes: 9 additions & 0 deletions v3/tasks/20250605-v3-weighted-lp-oracle/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 2025-06-05 - V3 Weighted LP Oracle

Contains `WeightedLPOracleFactory` //TODO


## Useful Files

- [Code](https://github.com/balancer/balancer-v3-monorepo/commit/TBD).

Check failure on line 8 in v3/tasks/20250605-v3-weighted-lp-oracle/readme.md

View workflow job for this annotation

GitHub Actions / Linkspector

[linkspector] v3/tasks/20250605-v3-weighted-lp-oracle/readme.md#L8

Raw output
message:"Cannot reach https://github.com/balancer/balancer-v3-monorepo/commit/TBD Status: 404" location:{path:"v3/tasks/20250605-v3-weighted-lp-oracle/readme.md" range:{start:{line:8 column:3} end:{line:8 column:70}}} severity:ERROR source:{name:"linkspector" url:"https://github.com/UmbrellaDocs/linkspector"}
- [`WeightedLPOracleFactory` artifact](./artifact/WeightedLPOracle.json)

Check failure on line 9 in v3/tasks/20250605-v3-weighted-lp-oracle/readme.md

View workflow job for this annotation

GitHub Actions / Linkspector

[linkspector] v3/tasks/20250605-v3-weighted-lp-oracle/readme.md#L9

Cannot reach ./artifact/WeightedLPOracle.json Status: 404 Cannot find: ./artifact/WeightedLPOracle.json
Raw output
message:"Cannot reach ./artifact/WeightedLPOracle.json Status: 404 Cannot find: ./artifact/WeightedLPOracle.json" location:{path:"v3/tasks/20250605-v3-weighted-lp-oracle/readme.md" range:{start:{line:9 column:3} end:{line:9 column:73}}} severity:ERROR source:{name:"linkspector" url:"https://github.com/UmbrellaDocs/linkspector"}
59 changes: 59 additions & 0 deletions v3/tasks/20250605-v3-weighted-lp-oracle/test/task.fork.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import hre from 'hardhat';
import { Contract } from 'ethers';
import * as expectEvent from '@helpers/expectEvent';
import { describeForkTest, getForkedNetwork, getSigner, impersonate, Task, TaskMode } from '@src';
import { fp } from '@helpers/numbers';
import { WeightedLPOracleDeployment } from '../input';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { expect } from 'chai';

describeForkTest('WeightedLPOracle', 'mainnet', 22647247, function () {
let task: Task;
let input: WeightedLPOracleDeployment;

Check failure on line 12 in v3/tasks/20250605-v3-weighted-lp-oracle/test/task.fork.ts

View workflow job for this annotation

GitHub Actions / lint

'input' is assigned a value but never used
let weightedLPOracleFactory: Contract;
let authorizer: Contract;

const POOL = '0xecD2978447367eC0c944Af58C3B8a7b52Acfd7a4'; // 1ROR / WETH
const PRICE_FEED = [
// AAVE/USD price feed (we use AAVE because there is no 1ROR/USD price feed)
'0x547a514d5e3769680Ce22B2361c10Ea13619e8a9',
// ETH/USD price feed
'0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
];
let admin: SignerWithAddress;

const GOV_MULTISIG = '0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f';

before('run task', async () => {
task = new Task('20250605-v3-weighted-lp-oracle', TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
});

before('setup contracts and signers', async () => {
admin = await getSigner();

weightedLPOracleFactory = await task.deployedInstance('WeightedLPOracleFactory');

const authorizerTask = new Task('20210418-authorizer', TaskMode.READ_ONLY, getForkedNetwork(hre));
authorizer = await authorizerTask.deployedInstance('Authorizer');

const govMultisig = await impersonate(GOV_MULTISIG, fp(100));
await authorizer
.connect(govMultisig)
.grantRole(
await weightedLPOracleFactory.getActionId(weightedLPOracleFactory.interface.getSighash('create')),
admin.address
);

input = task.input() as WeightedLPOracleDeployment;
});

it('should deploy WeightedLPOracleFactory', async () => {
const receipt = await (await weightedLPOracleFactory.connect(admin).create(POOL, PRICE_FEED)).wait();
const event = expectEvent.inReceipt(receipt, 'WeightedLPOracleCreated');
const oracleAddress = event.args.oracle;

const oracle = await task.instanceAt('WeightedLPOracle', oracleAddress);
expect((await oracle.latestRoundData()).answer > BigInt(0)).to.be.true;
});
});
Loading