Build on aragonOS #62

Merged
bumi merged 51 commits from aragonos into master 2019-04-02 19:36:36 +00:00
3 changed files with 14 additions and 19 deletions
Showing only changes of commit fedb10c5da - Show all commits

View File

@ -1,14 +0,0 @@
{
"4": {
"Contribution": "0x09f5274cba299b46c5be722ef672d10eef7a2ef980b612aef529d74fb9da7643",
"Contributor": "0x8e50972b062e83b48dbb2a68d8a058f2a07227ca183c144dc974e6da3186d7e9",
"Proposal": "0xb48bc8b4e539823f3be98d67f4130c07b5d29cc998993debcdea15c6faf4cf8a",
"Token": "0x82c0e483537d703bb6f0fc799d2cc60d8f62edcb0f6d26d5571a92be8485b112"
},
"41787949": {
"Contribution": "0xe401b988b8af39119004de5c7691a60391d69d873b3120682a8c61306a4883ce",
"Contributor": "0x7829d33291d6e118d115ce321de9341894a2da120bd35505fc03b98f715c606d",
"Proposal": "0x15d03d435b24a74317868c24fda4646302076b59272241a122a3868eb5c745da",
"Token": "0x85b0f626cecde6188d11940904fedeb16a4d49b0e8c878b9d109b23d38062ca7"
}
}

View File

@ -1,8 +1,13 @@
const AppIds = require('../app_ids.json'); const namehash = require('eth-ens-namehash').hash;
const Base = require('./base'); const Base = require('./base');
const KERNEL_APP_ADDR_NAMESPACE = '0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb'; const KERNEL_APP_ADDR_NAMESPACE = '0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb';
class Kernel extends Base { class Kernel extends Base {
constructor(contract) {
super(contract);
this.apm = 'aragonpm.eth'; // can be overwritten if needed
}
getApp(appName) { getApp(appName) {
if (appName === 'Acl') { if (appName === 'Acl') {
@ -12,9 +17,7 @@ class Kernel extends Base {
} }
appNamehash(appName) { appNamehash(appName) {
// actually provider.network is an asynchronous property. return namehash(`kredits-${appName.toLowerCase()}.${this.apm}`);
// but when we call this function kredits is already initialized and the network is already loaded
return AppIds[this.contract.provider.network.chainId.toString()][appName];
} }
} }

View File

@ -36,6 +36,7 @@ class Kredits {
this.provider = provider; this.provider = provider;
this.signer = signer; this.signer = signer;
this.options = options;
this.addresses = addresses || {}; this.addresses = addresses || {};
this.abis = abis || ABIS; this.abis = abis || ABIS;
this.ipfs = new IPFS(ipfsConfig); this.ipfs = new IPFS(ipfsConfig);
@ -66,7 +67,12 @@ class Kredits {
} }
get Kernel() { get Kernel() {
return this.contractFor('Kernel'); let k = this.contractFor('Kernel');
// in case we want to use a special apm (e.g. development vs. production)
if (this.options.apm) {
k.apm = this.options.apm;
}
return k;
} }
get Contributor() { get Contributor() {