Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
3esmit committed May 22, 2018
1 parent f021b36 commit aa93e03
Show file tree
Hide file tree
Showing 15 changed files with 280 additions and 355 deletions.
43 changes: 42 additions & 1 deletion config/contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,48 @@
},
"UpdatableInstance": {
"deploy": false
}
},
"SNT": {
"instanceOf": "MiniMeToken",
"deploy": true,
"args": [
"$MiniMeTokenFactory",
0,
0,
"TestMiniMeToken",
18,
"TST",
true
]
},
"DelegationProxyFactory": {
"deploy": true
},
"DelegationProxy": {
"deploy": false
},
"DelegationProxyView": {
"deploy": false
},
"DelegationProxyKernel": {
"deploy": false
},
"TrustNetwork": {
"deploy" : false
},
"ProposalCuration": {
"deploy": false
},
"ProposalManager": {
"deploy": false
},
"Democracy": {
"deploy": true,
"args": [
"$SNT",
"$DelegationProxyFactory"
]
}
}
}
}
4 changes: 2 additions & 2 deletions contracts/democracy/DelegationProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract DelegationProxy is DelegationProxyInterface {
/**
* @notice Calls Constructor
*/
function DelegationProxy(address _parentProxy) public {
constructor(address _parentProxy) public {
parentProxy = _parentProxy;
}

Expand Down Expand Up @@ -258,7 +258,7 @@ contract DelegationProxy is DelegationProxyInterface {
*/
function _updateDelegate(address _from, address _to) internal {
require(delegationOfAt(_to, block.number) != msg.sender); //block impossible circular delegation
Delegate(_from, _to);
emit Delegate(_from, _to);
Delegation memory _newFrom; //allocate memory
Delegation[] storage fromHistory = delegations[_from];
if (fromHistory.length > 0) { //have old config?
Expand Down
2 changes: 1 addition & 1 deletion contracts/democracy/DelegationProxyFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "../deploy/Instance.sol";
*/
contract DelegationProxyFactory is Factory {

function DelegationProxyFactory()
constructor()
Factory(new DelegationProxyKernel())
public
{ }
Expand Down
2 changes: 1 addition & 1 deletion contracts/democracy/DelegationProxyKernel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract DelegationProxyKernel is InstanceStorage, DelegationProxyView {
/**
* @notice Constructor of the model - only knows about watchdog that can trigger upgrade
*/
function DelegationProxyKernel() DelegationProxy(0x0) public {
constructor() DelegationProxyView(0x0) public {
ready = true;
}

Expand Down
6 changes: 5 additions & 1 deletion contracts/democracy/DelegationProxyView.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ contract DelegationProxyView is DelegationProxy {

//storage of preprocessed view of FinalDelegate
mapping(bytes32 => FinalDelegate) public delegationView;

struct FinalDelegate {
address delegate;
bool found;
}

constructor(address _parentTopic) DelegationProxy(0x0) public {

}

/**
* @notice Reads the final delegate of `_who` at block number `_block`.
* @param _who Address to lookup.
Expand Down
19 changes: 12 additions & 7 deletions contracts/democracy/Democracy.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
pragma solidity ^0.4.21;

import "./DemocracyInterface.sol";
import "../token/MiniMeTokenInterface.sol";
import "./DelegationProxyFactory.sol";
import "./TrustNetwork.sol";
import "./ProposalCuration.sol";
import "./ProposalManager.sol";
import "./FeeRecycler.sol";


contract Democracy is DemocracyInterface {
contract Democracy {

MiniMeTokenInterface public token;
TrustNetwork public trustNet;
ProposalManager public proposalManager;

mapping (bytes32 => Allowance) topicAllowance;
mapping (uint256 => bool) executedProposals;

Expand All @@ -15,11 +21,10 @@ contract Democracy is DemocracyInterface {
mapping(bytes32 => bool) calls;
}

function Democracy(MiniMeTokenInterface _token, TrustNetworkInterface _trustNetwork) public {
constructor(MiniMeTokenInterface _token, DelegationProxyFactory _delegationProxyFactory) public {
token = _token;
trustNet = _trustNetwork;
feeCollector = new FeeRecycler(_token);
proposalManager = new ProposalManager(_token, _trustNetwork, feeCollector);
trustNet = new TrustNetwork(_delegationProxyFactory);
proposalManager = new ProposalCuration(_token, trustNet).proposalManager();
}

function allowTopicSpecific(bytes32 _topic, address _destination, bytes4 _allowedCall, bool allowance)
Expand Down
21 changes: 0 additions & 21 deletions contracts/democracy/DemocracyInterface.sol

This file was deleted.

23 changes: 0 additions & 23 deletions contracts/democracy/DemocracyStorage.sol

This file was deleted.

26 changes: 0 additions & 26 deletions contracts/democracy/FeeCollector.sol

This file was deleted.

110 changes: 0 additions & 110 deletions contracts/democracy/FeeRecycler.sol

This file was deleted.

Loading

0 comments on commit aa93e03

Please sign in to comment.