Skip to content

Commit

Permalink
Deployments: Add stable pool factory deployment (balancer#650)
Browse files Browse the repository at this point in the history
* deployments: add stable pool factory task

* deployments: update stable pool deployment

* deployments: update stable pool factory testnets

* deployments: update stable pool factory mainnet

* deployments: add polygon stable pool factory
  • Loading branch information
facuspagnuolo authored Jun 25, 2021
1 parent e29c13a commit ad14421
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/deployments/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Contract, BigNumber } from 'ethers';

import Task from './task';

export const NETWORKS = ['goerli', 'kovan', 'mainnet', 'rinkeby', 'ropsten'];
export const NETWORKS = ['goerli', 'kovan', 'mainnet', 'rinkeby', 'ropsten', 'polygon'];

export type Network = typeof NETWORKS[number];

Expand Down
4 changes: 4 additions & 0 deletions pkg/deployments/tasks/20210418-vault/output/polygon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"balancerHelpers": "0x5aDDCCa35b7A0D07C74063c48700C8590E87864E"
}
123 changes: 123 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/abi/StablePoolFactory.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Task from '../../src/task';

import { StablePoolDeployment } from './input';

export default async (task: Task, force = false): Promise<void> => {
const output = task.output({ ensure: false });

if (force || !output.factory) {
const input = task.input() as StablePoolDeployment;
const factory = await task.deploy('StablePoolFactory', [input.vault]);
task.save({ factory });
}
};
11 changes: 11 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Task from '../../src/task';

export type StablePoolDeployment = {
vault: string;
};

const vault = new Task('20210418-vault');

export default {
vault: vault,
};
4 changes: 4 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/output/kovan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"factory": "0x751dfDAcE1AD995fF13c927f6f761C6604532c79",
"timestamp": 1624565674900
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"factory": "0xc66Ba2B6595D3613CCab350C886aCE23866EDe24",
"timestamp": 1624622142780
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"factory": "0xc66Ba2B6595D3613CCab350C886aCE23866EDe24",
"timestamp": 1624636796833
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"factory": "0xc66Ba2B6595D3613CCab350C886aCE23866EDe24",
"timestamp": 1624573659396
}
3 changes: 3 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 20210624 - Stable Pool


73 changes: 73 additions & 0 deletions pkg/deployments/tasks/20210624-stable-pool/test/deploy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { expect } from 'chai';

import Task from '../../../src/task';
import { Output } from '../../../src/types';

describe('StablePool', function () {
const task = new Task('20210624-stable-pool', 'mainnet', 'test');

afterEach('delete deployment', async () => {
await task.delete();
});

context('with no previous deploy', () => {
const itDeploysFactory = (force: boolean) => {
it('deploys a stable pool factory', async () => {
await task.run(force);

const output = task.output();
expect(output.factory).not.to.be.null;
expect(output.timestamp).not.to.be.null;

const input = task.input();
const factory = await task.instanceAt('StablePoolFactory', output.factory);
expect(await factory.getVault()).to.be.equal(input.vault);
});
};

context('when forced', () => {
const force = true;

itDeploysFactory(force);
});

context('when not forced', () => {
const force = false;

itDeploysFactory(force);
});
});

context('with a previous deploy', () => {
let previousDeploy: Output;

beforeEach('deploy', async () => {
await task.run();
previousDeploy = task.output();
});

context('when forced', () => {
const force = true;

it('re-deploys the stable pool factory', async () => {
await task.run(force);

const output = task.output();
expect(output.factory).not.to.be.equal(previousDeploy.factory);
expect(output.timestamp).to.be.gt(previousDeploy.timestamp);
});
});

context('when not forced', () => {
const force = false;

it('does not re-deploys the stable pool factory', async () => {
await task.run(force);

const output = task.output();
expect(output.factory).to.be.equal(previousDeploy.factory);
expect(output.timestamp).to.be.equal(previousDeploy.timestamp);
});
});
});
});

0 comments on commit ad14421

Please sign in to comment.