Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
nmushegian committed Jan 16, 2016
1 parent 19fae5f commit 66c4fab
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 39 deletions.
8 changes: 8 additions & 0 deletions src/sol/factory/auth_factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contract DSAuthFactory {
function buildDSBasicAuthorityFactory() returns (DSBasicAuthority) {
var c = new DSBasicAuthority();
c.updateAuthority(msg.sender, false);
return c;

}
}
21 changes: 21 additions & 0 deletions src/sol/factory/data_factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'data/balance_db.sol';
import 'data/approval_db.sol';
import 'data/map.sol';

contract DSDataFactory {
function buildDSBalanceDB() returns (DSBalanceDB) {
var c = new DSBalanceDB();
c.updateAuthority(msg.sender, false);
return c;
}
function buildDSApprovalDB() returns (DSApprovalDB) {
var c = new DSApprovalDB();
c.updateAuthority(msg.sender, false);
return c;
}
function buildDSMap() returns (DSMap) {
var c = new DSMap();
c.updateAuthority(msg.sender, false);
return c;
}
}
58 changes: 56 additions & 2 deletions src/sol/factory/factory.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import 'data/balance_db.sol';
import 'data/approval_db.sol';
import 'gov/easy_multisig.sol';
import 'token/controller.sol';
import 'token/frontend.sol';

import 'factory/data_factory.sol';
import 'factory/token_factory.sol';
import 'factory/multisig_factory.sol';


// One singleton factory per dappsys version.
// Tries to minimize runtime gas cost at the expense of deploy time gas cost.
// Limited by block gas limit.
// Motivated by and limited by block gas limit.

contract DSFactory {
function buildDSBalanceDB() returns (DSBalanceDB);
Expand All @@ -9,3 +19,47 @@ contract DSFactory {
returns (DSTokenController);
function buildDSTokenFrontend( DSTokenController cont ) returns (DSTokenFrontend);
}
contract DSFactory1 is DSFactory {
DSDataFactory _data;
DSTokenFactory _token;
DSMultisigFactory _ms;
function DSFactory1( DSDataFactory data
, DSTokenFactory token
, DSMultisigFactory ms )
{
_data = data;
_token = token;
_ms = ms;
}

function buildDSBalanceDB() returns (DSBalanceDB) {
return _data.buildDSBalanceDB();
}
function buildDSApprovalDB() returns (DSApprovalDB) {
return _data.buildDSApprovalDB();
}
function buildDSTokenController( DSBalanceDB bal_db, DSApprovalDB appr_db )
returns (DSTokenController)
{
return _token.buildDSTokenController( bal_db, appr_db );
}
function buildDSTokenFrontend( DSTokenController cont ) returns (DSTokenFrontend)
{
return _token.buildDSTokenFrontend( cont );
}
}


// If you need the latest factory in assembled form for a private
// chain or VM tests.
contract DSFactoryTestFactory {
function buildFactory() returns (DSFactory) {
var data = new DSDataFactory();
var token = new DSTokenFactory();
var ms = new DSMultisigFactory();
var f = new DSFactory1(data, token, ms);
return f;
}
}


33 changes: 0 additions & 33 deletions src/sol/factory/factory1.sol

This file was deleted.

5 changes: 2 additions & 3 deletions src/sol/factory/factory_test.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'factory/factory.sol';
import 'dapple/test.sol';

contract Factory1Test is Test {
contract FactoryTest is Test {
DSFactory f;
function setUp() {
f = new DSFactory1();
}
function testCreateCostMain() logs_gas() {
f = new DSFactory1();
f = (new DSFactoryTestFactory()).buildFactory();
}
}
10 changes: 10 additions & 0 deletions src/sol/factory/multisig_factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'gov/easy_multisig.sol';

contract DSMultisigFactory {
function buildDSEasyMultisig( uint n, uint m, uint expiration ) returns (DSEasyMultisig)
{
var c = new DSEasyMultisig( n, m, expiration );
c.updateAuthority(msg.sender, false);
return c;
}
}
14 changes: 14 additions & 0 deletions src/sol/factory/token_factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
contract DSTokenFactory {
function buildDSTokenController( DSBalanceDB bal_db, DSApprovalDB appr_db )
returns (DSTokenController)
{
var c = new DSTokenController( bal_db, appr_db );
c.updateAuthority(msg.sender, false);
return c;
}
function buildDSTokenFrontend( DSTokenController cont ) returns (DSTokenFrontend) {
var c = new DSTokenFrontend( cont );
c.updateAuthority(msg.sender, false);
return c;
}
}
2 changes: 1 addition & 1 deletion src/sol/token/deployer_test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract TokenSetupTest is Test {
DSTokenDeployer deployer;
DSToken t;
function setUp() {
f = new DSFactory1();
f = (new DSFactoryTestFactory()).buildFactory();
deployer = new DSTokenDeployer(f);
tester = new TokenTester();
deployer.deploy(address(tester), 100);
Expand Down

0 comments on commit 66c4fab

Please sign in to comment.