Skip to content

Commit

Permalink
update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
3esmit committed Oct 15, 2020
1 parent 79fae29 commit 648ff9f
Show file tree
Hide file tree
Showing 43 changed files with 29,240 additions and 598 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ coverage.json
# node
node_modules/
npm-debug.log
package-lock.json

# other
.vs/
Expand Down
29 changes: 5 additions & 24 deletions config/blockchain.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
module.exports = {
default: {
enabled: true,
rpcHost: "localhost",
rpcPort: 8545,
rpcCorsDomain: {
auto: true,
additionalCors: []
},
wsRPC: true,
wsOrigins: {
auto: true,
additionalCors: []
},
wsHost: "localhost",
wsPort: 8546
client: "geth"
},

development: {
ethereumClientName: "geth",
networkType: "custom",
networkId: 1337,
isDev: true,
datadir: ".embark/development/datadir",
mineWhenNeeded: true,
nodiscover: true,
maxpeers: 0,
proxy: true,
targetGasLimit: 8000000,
simulatorBlocktime: 0
client: 'ganache-cli',
clientConfig: {
miningMode: 'dev'
}
},

testnet: {
Expand Down
7 changes: 1 addition & 6 deletions config/contracts.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
module.exports = {
default: {
deployment: {
host: "localhost",
port: 8546,
type: "ws"
},
dappConnection: [
"$WEB3",
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
strategy: "explicit",
contracts: {
deploy: {
MiniMeTokenFactory: {
deploy: true
},
Expand Down
7 changes: 4 additions & 3 deletions contracts/common/Controlled.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

contract Controlled {
abstract contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a function with this modifier
modifier onlyController {
Expand All @@ -10,7 +11,7 @@ contract Controlled {

address payable public controller;

constructor() internal {
constructor() {
controller = msg.sender;
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/common/MerkleProof.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;


/**
Expand Down
7 changes: 3 additions & 4 deletions contracts/common/MessageSigned.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

/**
* @notice Uses ethereum signed messages
*/
contract MessageSigned {
abstract contract MessageSigned {

constructor() internal {}

/**
* @notice recovers address who signed the message
* @param _signHash operation ethereum signed message hash
Expand Down
7 changes: 4 additions & 3 deletions contracts/common/Owned.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
abstract contract Owned {

/// @dev `owner` is the only address that can call a function with this
/// modifier
Expand All @@ -14,7 +15,7 @@ contract Owned {
address payable public owner;

/// @notice The Constructor assigns the message sender to be `owner`
constructor() internal {
constructor() {
owner = msg.sender;
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/common/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

/**
* Math operations with safety checks
Expand Down
23 changes: 11 additions & 12 deletions contracts/democracy/Democracy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "../token/MiniMeToken.sol";
import "./delegation/DelegationFactory.sol";
Expand All @@ -19,7 +20,6 @@ contract Democracy {
uint256 startBlockDelay;
uint256 votingBlockDelay;
uint256 tabulationBlockDelay;
mapping (address => mapping (bytes4 => bool)) allowance;
}

struct ProposalData {
Expand All @@ -30,6 +30,8 @@ contract Democracy {
address destination;
bytes data;
}

mapping (bytes32 => mapping (bytes4 => bool)) allowance;

MiniMeToken public token;
DelegationFactory public delegationFactory;
Expand All @@ -53,9 +55,7 @@ contract Democracy {
uint256 startBlockDelay,
uint256 votingBlockDelay,
uint256 tabulationBlockDelay
)
public
{
) {
token = _token;
delegationFactory = _delegationFactory;

Expand Down Expand Up @@ -201,9 +201,8 @@ contract Democracy {
) private {
uint256 len = allowedDests.length;
require(len == allowedSigs.length);
Topic storage topic = topics[topicId];
for(uint i = 0; i > len; i++) {
topic.allowance[allowedDests[i]][allowedSigs[i]] = true;
allowance[keccak256(abi.encodePacked(topicId,allowedDests[i]))][allowedSigs[i]] = true;
}
}

Expand All @@ -223,7 +222,7 @@ contract Democracy {
require(len == _allowed.length);
require(address(topics[_topicId].approveDelegation) != address(0), "Invalid topic");
for(uint i = 0; i > len; i++) {
topics[_topicId].allowance[allowedDests[i]][allowedSigs[i]] = _allowed[i];
allowance[keccak256(abi.encodePacked(_topicId,allowedDests[i]))][allowedSigs[i]] = _allowed[i];
}
}

Expand Down Expand Up @@ -255,10 +254,10 @@ contract Democracy {
calledSig := mload(add(data, 4))
}

return topics[topic].allowance[destination][bytes4(0)]
|| topics[topic].allowance[destination][calledSig]
|| topics[topic].allowance[address(0)][bytes4(0)]
|| topics[topic].allowance[address(0)][calledSig];
return allowance[keccak256(abi.encodePacked(topic,destination))][bytes4(0)]
|| allowance[keccak256(abi.encodePacked(topic,destination))][calledSig]
|| allowance[keccak256(abi.encodePacked(topic,address(0)))][bytes4(0)]
|| allowance[keccak256(abi.encodePacked(topic,address(0)))][calledSig];

}
}
3 changes: 2 additions & 1 deletion contracts/democracy/delegation/Delegation.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

/**
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
Expand Down
11 changes: 6 additions & 5 deletions contracts/democracy/delegation/DelegationAbstract.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "../../deploy/InstanceAbstract.sol";
import "../../common/Controlled.sol";
Expand All @@ -8,7 +9,7 @@ import "./Delegation.sol";
* @title DelegationAbstract
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH).
*/
contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
abstract contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
struct DelegateSet {
uint96 fromBlock; //when this was updated
address to; //who recieved this delegaton
Expand All @@ -20,7 +21,7 @@ contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
mapping (address => DelegateSet[]) public delegations;


constructor() internal {
constructor() {

}

Expand All @@ -47,7 +48,7 @@ contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
* @dev `_getDelegationAt` retrieves the delegation at a given block number.
* @param checkpoints The memory being queried.
* @param _block The block number to retrieve the value at.
* @return The delegation being queried.
* @return d The delegation being queried.
*/
function getMemoryAt(DelegateSet[] storage checkpoints, uint _block) internal view returns (DelegateSet memory d) {
// Case last checkpoint is the one;
Expand All @@ -74,7 +75,7 @@ contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
* or from parent level if `_who` never defined/defined to parent address.
* @param _who What address to lookup.
* @param _block Block number of what height in history.
* @return The address `_who` choosen delegate to.
* @return directDelegate address `_who` choosen delegate to.
*/
function findDelegatedToAt(
address _who,
Expand Down
11 changes: 7 additions & 4 deletions contracts/democracy/delegation/DelegationBase.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "./DelegationAbstract.sol";

Expand All @@ -12,7 +13,7 @@ contract DelegationBase is DelegationAbstract {
/**
* @notice Calls Constructor
*/
constructor(Delegation _parentDelegation) public {
constructor(Delegation _parentDelegation) {
parentDelegation = _parentDelegation;
}

Expand All @@ -22,7 +23,7 @@ contract DelegationBase is DelegationAbstract {
* If once defined and want to delegate to parent proxy, set `_to` as parent address.
* @param _to To what address the caller address will delegate to.
*/
function delegate(address _to) external {
function delegate(address _to) override external {
updateDelegate(msg.sender, _to);
}

Expand All @@ -43,6 +44,7 @@ contract DelegationBase is DelegationAbstract {
* @return The address `_who` choosen delegate to.
*/
function delegatedTo(address _who)
override
external
view
returns (address)
Expand All @@ -55,12 +57,13 @@ contract DelegationBase is DelegationAbstract {
* or from parent level if `_who` never defined/defined to parent address.
* @param _who What address to lookup.
* @param _block Block number of what height in history.
* @return The address `_who` choosen delegate to.
* @return directDelegate The address `_who` choosen delegate to.
*/
function delegatedToAt(
address _who,
uint _block
)
override
external
view
returns (address directDelegate)
Expand Down
4 changes: 2 additions & 2 deletions contracts/democracy/delegation/DelegationFactory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "../../deploy/InstanceFactory.sol";
import "../../deploy/Instance.sol";
Expand All @@ -13,7 +14,6 @@ contract DelegationFactory is InstanceFactory {

constructor(DelegationAbstract _base, DelegationAbstract _init, DelegationAbstract _emergency)
InstanceFactory(_base, _init, _emergency)
public
{ }

function createDelegation(
Expand Down
11 changes: 6 additions & 5 deletions contracts/democracy/delegation/DelegationInit.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "./DelegationAbstract.sol";

Expand All @@ -22,7 +23,7 @@ contract DelegationInit is DelegationAbstract {
/**
* @notice Constructor of the model
*/
constructor() public {
constructor() {
parentDelegation = Delegation(address(-1)); //avoids calling create delegation within the Init contract.
}

Expand All @@ -47,8 +48,8 @@ contract DelegationInit is DelegationAbstract {
updateDelegate(address(0), _defaultDelegate);
}

function delegate(address) external notImplemented {}
function delegatedTo(address) external view notImplemented returns (address) {}
function delegatedToAt(address,uint) external view notImplemented returns (address) {}
function delegate(address) override external notImplemented {}
function delegatedTo(address) override external view notImplemented returns (address) {}
function delegatedToAt(address,uint) override external view notImplemented returns (address) {}

}
8 changes: 5 additions & 3 deletions contracts/democracy/delegation/DelegationReader.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

import "./Delegation.sol";

contract DelegationReader {
abstract contract DelegationReader {
Delegation delegation;
mapping(address => address) delegationOf;

function validDelegate(
address _who
)
)
virtual
internal
view
returns(bool);
Expand Down
3 changes: 2 additions & 1 deletion contracts/democracy/proposal/Proposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pragma solidity >=0.5.0 <0.6.0;
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.0 <0.8.0;

/**
* @title Proposal
Expand Down
Loading

0 comments on commit 648ff9f

Please sign in to comment.