Dynamically set AppIds

AppIds are used to lookup the actual contract addresses of each app.
Because of different registry names (open.aragonpm.eth vs. aragonpm.eth)
we have to use different ids in the local dev chain and in the
testnet/mainnet. To allow this we need to set the appids dynamically.

There is an open aragon issue to solve this and also allow to use
open.aragonpm.eth in the devchain by default.
https://github.com/aragon/aragen/issues/10
This commit is contained in:
2019-03-27 00:21:06 +01:00
parent 9cc237fbf4
commit f5973756c8
17 changed files with 78 additions and 48 deletions

View File

@@ -9,7 +9,7 @@
"environments": {
"default": {
"network": "development",
"appName": "kredits-contributor.open.aragonpm.eth"
"appName": "kredits-contributor.aragonpm.eth"
},
"rinkeby": {
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",

View File

@@ -18,11 +18,15 @@ contract Contributor is AragonApp {
mapping (uint => Contributor) public contributors;
uint256 public contributorsCount;
// ensure alphabetic order
enum Apps { Contribution, Contributor, Proposal, Token }
bytes32[4] public appIds;
event ContributorProfileUpdated(uint id, bytes32 oldIpfsHash, bytes32 newIpfsHash);
event ContributorAccountUpdated(uint id, address oldAccount, address newAccount);
event ContributorAdded(uint id, address account);
function initialize(address root) public onlyInit {
function initialize(address root,bytes32[4] _appIds) public onlyInit {
uint _id = contributorsCount + 1;
Contributor storage c = contributors[_id];
c.exists = true;
@@ -31,6 +35,8 @@ contract Contributor is AragonApp {
contributorIds[root] = _id;
contributorsCount += 1;
appIds = _appIds;
initialized();
}