Skip to content

Commit

Permalink
Use new OptimisticRootGaugeFactory.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Ignacio Ubeira committed May 31, 2024
1 parent f7e844b commit dce9661
Show file tree
Hide file tree
Showing 12 changed files with 530 additions and 344,473 deletions.

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

172,004 changes: 0 additions & 172,004 deletions tasks/20240522-fraxtal-root-gauge-factory/build-info/OptimismRootGauge.json

This file was deleted.

172,004 changes: 0 additions & 172,004 deletions tasks/20240522-fraxtal-root-gauge-factory/build-info/OptimismRootGaugeFactory.json

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions tasks/20240522-fraxtal-root-gauge-factory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import { FraxtalRootGaugeFactoryDeployment } from './input';
export default async (task: Task, { force, from }: TaskRunOptions = {}): Promise<void> => {
const input = task.input() as FraxtalRootGaugeFactoryDeployment;

const args = [input.Vault, input.BalancerMinter, input.L1StandardBridge, input.FraxtalBAL, input.GasLimit];
const args = [
input.Vault,
input.BalancerMinter,
input.L1StandardBridge,
input.FraxtalBAL,
input.GasLimit,
input.Network,
];

const factory = await task.deployAndVerify('OptimismRootGaugeFactory', args, from, force);
const factory = await task.deployAndVerify('OptimisticRootGaugeFactory', args, from, force);

const implementation = await factory.getGaugeImplementation();
await task.verify('OptimismRootGauge', implementation, [
await task.verify('OptimisticRootGauge', implementation, [
input.BalancerMinter,
input.L1StandardBridge,
input.FraxtalBAL,
Expand Down
2 changes: 2 additions & 0 deletions tasks/20240522-fraxtal-root-gauge-factory/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type FraxtalRootGaugeFactoryDeployment = {
FraxtalBAL: string;
L1StandardBridge: string;
GasLimit: number;
Network: string;
};

const Tokens = new Task('00000000-tokens', TaskMode.READ_ONLY);
Expand All @@ -21,5 +22,6 @@ export default {
L1StandardBridge: '0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2',
// Value taken from TX sample directly.
GasLimit: 200000,
Network: 'Fraxtal',
},
};
8 changes: 4 additions & 4 deletions tasks/20240522-fraxtal-root-gauge-factory/readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 2022-08-23 - Fraxtal Root Gauge Factory

Deployment of the `OptimismRootGaugeFactory`, for stakeless gauges that bridge funds to their Fraxtal counterparts.
Uses the exact same code as [`OptimismRootGaugeFactory` V2](../20220823-optimism-root-gauge-factory-v2/), but points to the [Fraxtal OP Stack Bridge](https://docs.frax.com/fraxtal/tools/bridges#fraxtal-op-stack-bridge).
Deployment of the `OptimisticRootGaugeFactory`, for stakeless gauges that bridge funds to their Fraxtal counterparts.
The code that manages the bridge is the same as in [`OptimismRootGaugeFactory` V2](../20220823-optimism-root-gauge-factory-v2/), but this deployment points to the [Fraxtal OP Stack Bridge](https://docs.frax.com/fraxtal/tools/bridges#fraxtal-op-stack-bridge).

## Useful Files

- [`OptimismRootGauge` artifact](./artifact/OptimismRootGauge.json)
- [`OptimismRootGaugeFactory` artifact](./artifact/OptimismRootGaugeFactory.json)
- [`OptimisticRootGauge` artifact](./artifact/OptimisticRootGauge.json)
- [`OptimisticRootGaugeFactory` artifact](./artifact/OptimisticRootGaugeFactory.json)
17 changes: 11 additions & 6 deletions tasks/20240522-fraxtal-root-gauge-factory/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describeForkTest('FraxtalRootGaugeFactory', 'mainnet', 19928000, function () {
task = new Task('20240522-fraxtal-root-gauge-factory', TaskMode.TEST, getForkedNetwork(hre));
({ FraxtalBAL: fraxtalBAL, L1StandardBridge: fraxtalL1Bridge, GasLimit: gasLimit } = task.input());
await task.run({ force: true });
factory = await task.deployedInstance('OptimismRootGaugeFactory');
factory = await task.deployedInstance('OptimisticRootGaugeFactory');
});

before('advance time', async () => {
Expand Down Expand Up @@ -134,7 +134,7 @@ describeForkTest('FraxtalRootGaugeFactory', 'mainnet', 19928000, function () {
const tx = await factory.create(recipient.address, weightCap);
const event = expectEvent.inReceipt(await tx.wait(), 'GaugeCreated');

gauge = await task.instanceAt('OptimismRootGauge', event.args.gauge);
gauge = await task.instanceAt('OptimisticRootGauge', event.args.gauge);

expect(await factory.isGaugeFromFactory(gauge.address)).to.be.true;

Expand Down Expand Up @@ -180,6 +180,10 @@ describeForkTest('FraxtalRootGaugeFactory', 'mainnet', 19928000, function () {
expect(await gauge.getOptimismBal()).to.eq(fraxtalBAL);
});

it('returns the correct network tag', async () => {
expect(await gauge.NETWORK()).to.eq('Fraxtal');
});

it('vote for gauge', async () => {
expect(await gaugeController.get_gauge_weight(gauge.address)).to.equal(0);
expect(await gauge.getCappedRelativeWeight(await currentTimestamp())).to.equal(0);
Expand Down Expand Up @@ -215,10 +219,11 @@ describeForkTest('FraxtalRootGaugeFactory', 'mainnet', 19928000, function () {

await advanceTime(WEEK);

const bridgeCost = await gauge.getTotalBridgeCost();

// The gauge should now mint and send all minted tokens to the Fraxtal bridge
// Optimism gauges are costless, and this version does not have a `getBridgeCost` function.
const mintReceipt = await (
await adaptorEntrypoint.connect(admin).performAction(gauge.address, calldata, { value: 0 })
await adaptorEntrypoint.connect(admin).performAction(gauge.address, calldata, { value: bridgeCost })
).wait();

const event = expectEvent.inIndirectReceipt(mintReceipt, gauge.interface, 'Checkpoint', {
Expand Down Expand Up @@ -290,9 +295,9 @@ describeForkTest('FraxtalRootGaugeFactory', 'mainnet', 19928000, function () {
// Note that instead of the weight, we use the cap (since we expect for the weight to be larger than the cap)
const expectedEmissions = weightCap.mul(numberOfWeeks).mul(weeklyRate).div(FP_ONE);

const bridgeCost = await gauge.getTotalBridgeCost();
const calldata = gauge.interface.encodeFunctionData('checkpoint');
// Optimism gauges are costless, and this version does not have a `getBridgeCost` function.
const tx = await adaptorEntrypoint.connect(admin).performAction(gauge.address, calldata, { value: 0 });
const tx = await adaptorEntrypoint.connect(admin).performAction(gauge.address, calldata, { value: bridgeCost });
const receipt = await tx.wait();

await Promise.all(
Expand Down

0 comments on commit dce9661

Please sign in to comment.