Dynamically get app ids from the namehash

This dynamically hashes the app id which makes it easier to manually set
contract addresses. This is useful in development environments with no
default network ids.
The used apm (which is part of the app id hash) is configurable.

usage:

new Kredits(provider, signer, { addresses: { Kernel: '0x...' }, apm: 'aragonpm.eth' })
This commit is contained in:
2019-04-01 22:41:00 +02:00
parent a24f80d44f
commit fedb10c5da
3 changed files with 14 additions and 19 deletions

View File

@@ -36,6 +36,7 @@ class Kredits {
this.provider = provider;
this.signer = signer;
this.options = options;
this.addresses = addresses || {};
this.abis = abis || ABIS;
this.ipfs = new IPFS(ipfsConfig);
@@ -66,7 +67,12 @@ class Kredits {
}
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() {