From 07cfbaa1ed011ee818cfa572cf2b5882017945af Mon Sep 17 00:00:00 2001 From: Christophe Le Bars Date: Tue, 28 Aug 2018 16:10:34 +0700 Subject: [PATCH] v 0.17 --- contracts/RougeFactory.sol | 2 +- contracts/SimpleRougeCampaign.sol | 38 ++++++++++++++++--------------- truffle.js | 6 +++++ 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/contracts/RougeFactory.sol b/contracts/RougeFactory.sol index 769692b..824e760 100644 --- a/contracts/RougeFactory.sol +++ b/contracts/RougeFactory.sol @@ -14,7 +14,7 @@ import "./RougeRegistry.sol"; contract RougeFactory is RougeRegistry { - string public version = '0.16.0'; + string public version = '0.17.0'; // The Rouge Token contract address RGETokenInterface public rge; diff --git a/contracts/SimpleRougeCampaign.sol b/contracts/SimpleRougeCampaign.sol index f087bdf..d6d2e57 100644 --- a/contracts/SimpleRougeCampaign.sol +++ b/contracts/SimpleRougeCampaign.sol @@ -33,7 +33,7 @@ library RougeCampaign { contract SimpleRougeCampaign { - string public version = '0.16.0'; + string public version = '0.17.0'; // The Rouge Token contract address RGETokenInterface public rge; @@ -55,16 +55,20 @@ contract SimpleRougeCampaign { event AttestorAddition(address indexed attestor, Authorization auth); - function addAttestor(address _attestor, Authorization _auth) isAttestor(Authorization.Role) public { - isAuthorized[_attestor][uint(_auth)] = true; - emit AttestorAddition(_attestor, _auth); + function addAttestor(address _attestor, Authorization[] _auths) isAttestor(Authorization.Role) public { + for (uint i = 0; i < _auths.length; i++) { + isAuthorized[_attestor][uint(_auths[i])] = true; + emit AttestorAddition(_attestor, _auths[i]); + } } event AttestorRemoval(address indexed attestor, Authorization auth); - function removeAttestor(address _attestor, Authorization _auth) isAttestor(Authorization.Role) public { - isAuthorized[_attestor][uint(_auth)] = false; - emit AttestorRemoval(_attestor, _auth); + function removeAttestor(address _attestor, Authorization[] _auths) isAttestor(Authorization.Role) public { + for (uint i = 0; i < _auths.length; i++) { + isAuthorized[_attestor][uint(_auths[i])] = false; + emit AttestorRemoval(_attestor, _auths[i]); + } } uint32 public issuance; @@ -183,12 +187,10 @@ contract SimpleRougeCampaign { emit Issuance(_scheme, _name, _campaignExpiration); } - // Authorization is handled bu issue() + // Authorization is handled by issue() function issueWithAttestor(bytes4 _scheme, string _name, uint _campaignExpiration, address _attestor, Authorization[] _auths) public { issue(_scheme, _name, _campaignExpiration); - for (uint i = 0; i < _auths.length; i++) { - addAttestor(_attestor, _auths[i]); - } + addAttestor(_attestor, _auths); } function getInfo() public view returns (bytes) { @@ -245,16 +247,16 @@ contract SimpleRougeCampaign { return acquisition(_bearer); } - /* mapping (address => bool) public transferRegister;*/ + mapping (address => bool) public transferRegister; - /* low level transfer of a note between bearers + /* low level transfer of a note between bearers */ function transfer(address _from, address _to) CampaignOpen private { - require(_to != issuer); /* RULE issuer and bearer need to be diffrent + require(_to != issuer); /* RULE issuer and bearer need to be different */ require(hasNote(_from)); acquisitionRegister[_from] = false; - transferRegister[_from] = true; /* RULE transfer is not reversible + transferRegister[_from] = true; /* RULE transfer is not reversible */ acquisitionRegister[_to] = true; - } */ + } mapping (address => bool) public redemptionRegister; @@ -308,9 +310,9 @@ contract SimpleRougeCampaign { return redemption(_bearer); } - /*function getWorkflow(address _bearer) public view returns (bytes) { + function getWorkflow(address _bearer) public view returns (bytes) { return abi.encodePacked(hasNote(_bearer), hasRedeemed(_bearer)); - } */ + } function kill() isAttestor(Authorization.Kill) public { diff --git a/truffle.js b/truffle.js index fc11ed1..40663e5 100644 --- a/truffle.js +++ b/truffle.js @@ -1,4 +1,10 @@ module.exports = { + solc: { + optimizer: { + enabled: true, + runs: 2000 + } + }, networks: { // local: { // host: "localhost",