So far we always had to initialze a provider and signer and pass those
to the kredits constructor.
This helper makes it easier to initialize a default ethers provider and
a default signer.
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 mainly allows us to check if an account has a certain role and thus
if the account can call specific contract functions.
At some point we might want to extend that to support the check if an
account can call the function. For that we would need to have a mapping
between function names and roles, which we have not right now.
This moves the whole checks if everything is running into its own class
and is no longer inside the different functions.
Makes the functions smaller and the healthcheck can be used from the
client only if wanted/needed.
This moves the Kredits initialization to the instance which allows us to
be more flexible with handling contract addresses.
Example:
var k = new Kredits(provider, signer, {Registry: '0xabc'});
k.init().then((kredits) { ...});
var k = new Kredits(provider, signer, {Contributors: '0xabc'})
k.Contributor.add(...);