Skip to content

Commit 7dc9ae3

Browse files
authored
Merge pull request #18 from fei-protocol/POZ-Fix-Core-Deploy-Gas
fix deploy gas coreOrchestrator
2 parents 5dfca37 + 3cc78d7 commit 7dc9ae3

File tree

13 files changed

+40
-6
lines changed

13 files changed

+40
-6
lines changed

contracts/core/Core.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ contract Core is ICore, Permissions {
2020

2121
constructor() public {
2222
_setupGovernor(msg.sender);
23+
}
24+
25+
function init() external onlyGovernor {
2326
Fei _fei = new Fei(address(this));
2427
fei = IFei(address(_fei));
2528

contracts/orchestration/CoreOrchestrator.sol

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ contract CoreOrchestrator is Ownable {
214214
address _admin
215215
) public {
216216
core = new Core();
217-
tribe = address(core.tribe());
218-
fei = address(core.fei());
219217

220218
core.grantRevoker(_admin);
221219

@@ -229,12 +227,20 @@ contract CoreOrchestrator is Ownable {
229227
routerOrchestrator = IRouterOrchestrator(_routerOrchestrator);
230228

231229
admin = _admin;
232-
tribeSupply = IERC20(tribe).totalSupply();
233230
if (TEST_MODE) {
234231
core.grantGovernor(_admin);
235232
}
236233
}
237234

235+
function initCore() public onlyOwner {
236+
core.init();
237+
238+
tribe = address(core.tribe());
239+
fei = address(core.fei());
240+
tribeSupply = IERC20(tribe).totalSupply();
241+
}
242+
243+
238244
function initPairs() public onlyOwner {
239245
ethFeiPair = UNISWAP_FACTORY.createPair(fei, WETH);
240246
tribeFeiPair = UNISWAP_FACTORY.createPair(tribe, fei);

migrations/2_deploy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ module.exports = function(deployer, network, accounts) {
4646
genesis.address,
4747
gov.address,
4848
routerOrchestrator.address,
49-
accounts[0]
49+
accounts[0],
50+
{gas: 8000000}
5051
);
5152
}).then(function(instance) {
5253
core = instance;
@@ -65,6 +66,8 @@ module.exports = function(deployer, network, accounts) {
6566
return pcvo.transferOwnership(core.address);
6667
}).then(function(instance) {
6768
return routerOrchestrator.transferOwnership(core.address);
69+
}).then(function(instance) {
70+
return core.initCore();
6871
}).then(function(instance) {
6972
return core.initPairs();
7073
}).then(function(instance) {

test/bondingcurve/EthBondingCurve.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const {
2121
describe('EthBondingCurve', function () {
2222

2323
beforeEach(async function () {
24+
2425
this.core = await getCore(true);
26+
await this.core.init({from: governorAddress});
27+
2528
this.fei = await Fei.at(await this.core.fei());
2629

2730
this.oracle = await MockOracle.new(500); // 500 USD per ETH exchange rate

test/core/Core.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ describe('Core', function () {
2020

2121
beforeEach(async function () {
2222
this.core = await getCore(false);
23+
await this.core.init({from: governorAddress});
24+
2325
this.tribe = await Tribe.at(await this.core.tribe());
2426
this.coreRef = await MockCoreRef.new(this.core.address);
2527

test/genesis/GenesisGroup.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ describe('GenesisGroup', function () {
2424

2525
beforeEach(async function () {
2626
this.core = await getCore(false);
27+
await this.core.init({from: governorAddress});
28+
2729
this.fei = await Fei.at(await this.core.fei());
2830
this.tribe = await Tribe.at(await this.core.tribe());
2931
this.bc = await MockBondingCurve.new(false, 10);

test/genesis/IDO.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ describe('IDO', function () {
2424
const LIQUIDITY_INCREMENT = 10000; // amount of liquidity created by mock for each deposit
2525

2626
beforeEach(async function () {
27-
this.core = await getCore();
28-
await this.core.setGenesisGroup(genesisGroup, {from: governorAddress});
27+
28+
this.core = await getCore(true);
29+
await this.core.init({from: governorAddress});
30+
31+
2932
this.fei = await Fei.at(await this.core.fei());
3033
this.tribe = await Tribe.at(await this.core.tribe());
3134

test/pcv/EthUniswapPCVController.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ describe('EthUniswapPCVController', function () {
2020

2121
beforeEach(async function () {
2222
this.core = await Core.new({from: governorAddress});
23+
await this.core.init({from: governorAddress});
24+
2325
await this.core.setGenesisGroup(genesisGroup, {from: governorAddress});
2426
await this.core.completeGenesisGroup({from: genesisGroup});
2527

test/pcv/EthUniswapPCVDeposit.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ describe('EthUniswapPCVDeposit', function () {
1818

1919
beforeEach(async function () {
2020
this.core = await Core.new({from: governorAddress});
21+
await this.core.init({from: governorAddress});
22+
2123
await this.core.setGenesisGroup(genesisGroup, {from: governorAddress});
2224
await this.core.completeGenesisGroup({from: genesisGroup});
2325

test/pool/FeiPool.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ describe('Pool', function () {
1313

1414
beforeEach(async function () {
1515
this.core = await Core.new({from: governorAddress});
16+
await this.core.init({from: governorAddress});
17+
1618
this.window = new BN(2 * 365 * 24 * 60 * 60);
1719
this.tribe = await Tribe.at(await this.core.tribe());
1820
this.fei = await Fei.at(await this.core.fei());

0 commit comments

Comments
 (0)