Move contracts to root level for hardhart usage
byebye aragon apps
This commit is contained in:
8
lib/addresses.json
Normal file
8
lib/addresses.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"1337": {
|
||||
"Contributor": "0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07",
|
||||
"Contribution": "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe",
|
||||
"Token": "0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f",
|
||||
"Reimbursement": "0x1fA02b2d6A771842690194Cf62D91bdd92BfE28d"
|
||||
}
|
||||
}
|
||||
@@ -7,20 +7,15 @@ const ABIS = {
|
||||
Contributor: require('./abis/Contributor.json'),
|
||||
Contribution: require('./abis/Contribution.json'),
|
||||
Reimbursement: require('./abis/Reimbursement.json'),
|
||||
Token: require('./abis/Token.json'),
|
||||
Proposal: require('./abis/Proposal.json'),
|
||||
Kernel: require('./abis/Kernel.json'),
|
||||
Acl: require('./abis/ACL.json'),
|
||||
Token: require('./abis/Token.json')
|
||||
};
|
||||
const APP_CONTRACTS = [
|
||||
'Contributor',
|
||||
'Contribution',
|
||||
'Token',
|
||||
'Proposal',
|
||||
'Reimbursement',
|
||||
'Acl',
|
||||
'Reimbursement'
|
||||
];
|
||||
const DaoAddresses = require('./addresses/dao.json');
|
||||
const Addresses = require('./addresses.json');
|
||||
|
||||
const Contracts = require('./contracts');
|
||||
const IPFS = require('./utils/ipfs');
|
||||
@@ -48,18 +43,9 @@ class Kredits {
|
||||
init (names) {
|
||||
let contractsToLoad = names || APP_CONTRACTS;
|
||||
return this.provider.getNetwork().then(network => {
|
||||
this.addresses['Kernel'] = this.addresses['Kernel'] || DaoAddresses[network.chainId.toString()];
|
||||
let addressPromises = contractsToLoad.map((contractName) => {
|
||||
return this.Kernel.getApp(contractName).then((address) => {
|
||||
this.addresses[contractName] = address;
|
||||
}).catch((error) => {
|
||||
throw new Error(`Failed to get address for ${contractName} from DAO at ${this.Kernel.contract.address}
|
||||
- ${error.message}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(addressPromises).then(() => { return this; });
|
||||
if (Object.keys(this.addresses).length === 0) {
|
||||
this.addresses = Addresses[network.chainId.toString()];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,16 +72,7 @@ class Kredits {
|
||||
}
|
||||
|
||||
static availableNetworks () {
|
||||
return Object.keys(DaoAddresses);
|
||||
}
|
||||
|
||||
get 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;
|
||||
return Object.keys(Addresses);
|
||||
}
|
||||
|
||||
get Contributor () {
|
||||
@@ -107,10 +84,6 @@ class Kredits {
|
||||
return this.Contributor;
|
||||
}
|
||||
|
||||
get Proposal () {
|
||||
return this.contractFor('Proposal');
|
||||
}
|
||||
|
||||
get Operator () {
|
||||
return this.Proposal;
|
||||
}
|
||||
@@ -127,10 +100,6 @@ class Kredits {
|
||||
return this.contractFor('Reimbursement');
|
||||
}
|
||||
|
||||
get Acl () {
|
||||
return this.contractFor('Acl');
|
||||
}
|
||||
|
||||
// Should be private
|
||||
contractFor (name) {
|
||||
if (this.contracts[name]) {
|
||||
|
||||
Reference in New Issue
Block a user