Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement parameterizer #28

Merged
merged 15 commits into from Oct 6, 2017
Merged
15 changes: 10 additions & 5 deletions conf/config.json
@@ -1,12 +1,17 @@
{
"RegistryDefaults": {
"paramDefaults": {
"minDeposit": 50000,
"minParamDeposit": 500000,
"pMinDeposit": 500000,
"applyStageLength": 600,
"commitPeriodLength": 600,
"revealPeriodLength": 600,
"pApplyStageLength": 1200,
"commitStageLength": 600,
"pCommitStageLength": 1200,
"revealStageLength": 600,
"pRevealStageLength": 1200,
"dispensationPct": 50,
"voteQuorum": 50
"pDispensationPct": 50,
"voteQuorum": 50,
"pVoteQuorum": 50
},
"TokenAddress": "0x337cDDa6D41A327c5ad456166CCB781a9722AFf9"
}
34 changes: 17 additions & 17 deletions contracts/AttributeStore.sol
@@ -1,17 +1,17 @@
pragma solidity^0.4.11;
library AttributeStore {
struct Data {
mapping(bytes32 => uint) store;
}
function getAttribute(Data storage self, bytes32 UUID, string attrName) returns (uint) {
bytes32 key = sha3(UUID, attrName);
return self.store[key];
}
function attachAttribute(Data storage self, bytes32 UUID, string attrName, uint attrVal) {
bytes32 key = sha3(UUID, attrName);
self.store[key] = attrVal;
}
}
pragma solidity^0.4.11;

library AttributeStore {
struct Data {
mapping(bytes32 => uint) store;
}

function getAttribute(Data storage self, bytes32 UUID, string attrName) returns (uint) {
bytes32 key = sha3(UUID, attrName);
return self.store[key];
}

function attachAttribute(Data storage self, bytes32 UUID, string attrName, uint attrVal) {
bytes32 key = sha3(UUID, attrName);
self.store[key] = attrVal;
}
}
78 changes: 39 additions & 39 deletions contracts/DLL.sol
@@ -1,39 +1,39 @@
pragma solidity^0.4.11;
library DLL {
struct Node {
uint next;
uint prev;
}
struct Data {
mapping(uint => Node) dll;
}
function getNext(Data storage self, uint curr) returns (uint) {
return self.dll[curr].next;
}
function getPrev(Data storage self, uint curr) returns (uint) {
return self.dll[curr].prev;
}
function insert(Data storage self, uint prev, uint curr, uint next) {
self.dll[curr].prev = prev;
self.dll[curr].next = next;
self.dll[prev].next = curr;
self.dll[next].prev = curr;
}
function remove(Data storage self, uint curr) {
uint next = getNext(self, curr);
uint prev = getPrev(self, curr);
self.dll[next].prev = prev;
self.dll[prev].next = next;
self.dll[curr].next = curr;
self.dll[curr].prev = curr;
}
}
pragma solidity^0.4.11;

library DLL {
struct Node {
uint next;
uint prev;
}

struct Data {
mapping(uint => Node) dll;
}

function getNext(Data storage self, uint curr) returns (uint) {
return self.dll[curr].next;
}

function getPrev(Data storage self, uint curr) returns (uint) {
return self.dll[curr].prev;
}

function insert(Data storage self, uint prev, uint curr, uint next) {
self.dll[curr].prev = prev;
self.dll[curr].next = next;

self.dll[prev].next = curr;
self.dll[next].prev = curr;
}

function remove(Data storage self, uint curr) {
uint next = getNext(self, curr);
uint prev = getPrev(self, curr);

self.dll[next].prev = prev;
self.dll[prev].next = next;

self.dll[curr].next = curr;
self.dll[curr].prev = curr;
}
}