Cleanup
This commit is contained in:
parent
ffff09ab23
commit
ccd52f6ee5
@ -5,17 +5,17 @@ const Addresses = require('./addresses/KreditsKit.json');
|
||||
|
||||
class KreditsKit {
|
||||
|
||||
constructor(provider, signer, options = {}) {
|
||||
let { address, abi, ipfsConfig } = options;
|
||||
constructor (provider, signer, options = {}) {
|
||||
let { address, abi } = options;
|
||||
|
||||
this.provider = provider;
|
||||
this.signer = signer;
|
||||
this.options = options;
|
||||
this.address = address
|
||||
this.address = address;
|
||||
this.abi = abi || ABI;
|
||||
}
|
||||
|
||||
init() {
|
||||
init () {
|
||||
return this.provider.getNetwork().then((network) => {
|
||||
this.address = this.address || Addresses[network.chainId.toString()];
|
||||
this.contract = new ethers.Contract(
|
||||
@ -27,20 +27,20 @@ class KreditsKit {
|
||||
});
|
||||
}
|
||||
|
||||
appIdFor(contractName) {
|
||||
appIdFor (contractName) {
|
||||
// see appIds in KreditsKit.sol for more details
|
||||
const knownContracts = ['Contribution', 'Contributor', 'Proposal', 'Token'];
|
||||
return this.contract.functions.appIds(knownContracts.indexOf(contractName));
|
||||
}
|
||||
|
||||
newDAO(options = {}) {
|
||||
newDAO (options = {}) {
|
||||
return this.contract.functions.newInstance(options).then(transaction => {
|
||||
return transaction.wait().then(result => {
|
||||
const deployEvent = result.events.find(e => e.event === 'DeployInstance');
|
||||
return {
|
||||
daoAddress: deployEvent.args.dao,
|
||||
transactionHash: transaction.hash
|
||||
}
|
||||
transactionHash: transaction.hash,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user