Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(async (resolve, reject) => {
const aragon = new Aragon(this.kernel.address, {
accounts:
{ providedAccounts: [this.pando.options.ethereum.account] },
provider: this.pando.options.ethereum.provider,
apm: { ensRegistryAddress: this.pando.options.apm.ens }
})
console.log(aragon)
await aragon.init({
accounts:
{ providedAccounts: [this.pando.options.ethereum.account] }
// provider: this.pando.options.ethereum.provider,
// apm: { ensRegistryAddress: this.pando.options.apm.ens }
})
// await aragon.initApps()
return new Promise(async (resolve, reject) => {
try {
// Look up registry address based on current network connection
const domain = name.indexOf('.') > -1 ? name : `${name}.aragonid.eth`
const options = {
provider: require('../../provider'),
apm: {
ipfs: {
gateway: 'https://ipfs.eth.aragon.network/ipfs'
},
ensRegistryAddress: registryAddress()
}
}
const address = await resolveAragon(domain, options.apm.ensRegistryAddress)
const wrap = new Wrapper(address, options)
await wrap.init()
const subscription = wrap.apps.subscribe(apps => {
subscription.unsubscribe()
const appsSummary = {}
apps.forEach(app => {
const { appId, proxyAddress } = app
const name = appNames[appId]
if (name) appsSummary[name] = { proxyAddress }
})
if (!appsSummary['kernel']) return reject(new Error('Unable to locate DAO kernel'))
if (!appsSummary['agent']) return reject(new Error('Unable to locate DAO agent, make sure it is installed'))
resolve({ name: domain.split('.')[0], domain, apps: appsSummary, ens: address, network: store('main.connection.network') })
})
} catch (e) {
reject(e)
}
const handler = async argv => {
try {
let txHash
let spinner
const pando = await Pando.create(defaultsDeep(options(), { ethereum: { network: argv.network } }))
const appId = pando.options.ethereum.network === 'devchain' ? namehash.hash('pando-colony.aragonpm.eth') : namehash.hash('pando-colony.open.aragonpm.eth')
const wrapper = new Aragon(argv.organization, {
apm: {
ensRegistryAddress: pando.options.apm.ens,
ipfs: pando.options.ipfs.gateway,
},
defaultGasPriceFn: () => String(5e9), // gwei
provider: pando.options.ethereum.provider,
})
await wrapper.init({ accounts: { providedAccounts: [pando.options.ethereum.account] } })
const apps = await _apps(wrapper)
const colonyAddress = apps.filter(app => app.appId === appId)[0].proxyAddress
const colony = await pando.artifacts.PandoColony.at(colonyAddress)
try {
spinner = ora(`Deploying repository '${argv.name}' on ${pando.options.ethereum.network}`).start()
colony
public async deploy(organization: string, name: string, description: string): Promise {
// TODO: assert that organization address is the one of an Aragon DAO
// TODO: if we are in a git directory also try to resolve the organization by the name of the remote
// TODO: handle transaction pathing
const wrapper = new Aragon(organization, {
provider: this.pando.options.ethereum.provider,
defaultGasPriceFn: () => String(5e9), // gwei
apm: {
ipfs: {},
ensRegistryAddress: this.pando.options.apm.ens,
},
})
await wrapper.init({ accounts: { providedAccounts: [this.pando.options.ethereum.account] } })
const apps = await this._apps(wrapper)
const address = apps.filter(app => app.appId === COLONY_APP_ID)[0].proxyAddress
const colony = await this.pando.artifacts.PandoColony.at(address)
const receipt = await colony.createRepository(name, '')
return this._getRepositoryAddressFromReceipt(receipt)
}
module.exports = async function (to, web3) {
const proxy = new web3.eth.Contract(require('./AppProxyBase.json').abi, to)
const kernel = await proxy.methods.kernel().call()
const options = {
provider: require('../../../provider'),
apm: {
ipfs: {
gateway: 'https://ipfs.eth.aragon.network/ipfs'
},
ensRegistryAddress: registryAddress()
}
}
const wrap = new Wrapper(kernel, options)
await wrap.init()
const apps = await wrap.apps.pipe(first()).toPromise()
const app = apps.find((app) => addressesEqual(app.proxyAddress, to))
var detailed = {
abi: app.abi,
userdoc: {
methods: {}
}
}
app.functions.forEach(func => { detailed.userdoc.methods[func.sig] = { notice: func.notice } })
return detailed
}
setup () {
const connection = store('main.connection')
const status = [connection.local.status, connection.secondary.status]
if (status.indexOf('connected') > -1 && this.network === connection.network && !this.wrap && !this.inSetup) {
log.info('\n ** Setting Up Aragon DAO:', this.dao)
this.inSetup = true
this.provider = require('../../provider')
const options = {
provider: this.provider,
apm: { ipfs: { gateway: 'https://ipfs.eth.aragon.network/ipfs' }, ensRegistryAddress: registryAddress() }
}
const wrap = new Wrapper(this.dao, options)
wrap.init().then(() => {
this.wrap = wrap
this.inSetup = false
}).catch(err => {
log.error(err)
this.inSetup = false
})
}
}
return new Promise(async (resolve, reject) => {
try {
let address = await ensResolve(domain, { provider: require('../../provider'), registryAddress })
if (address.replace('0x', '')) return resolve(address)
throw new Error('Invalid address')
} catch (e) {
reject(new Error(`Unable to resolve DAO ${domain} on current network`))
}
})
}
import Web3 from '@aragon/wrapper/node_modules/web3'
import { addDays } from 'date-fns'
const PrivateKeyProvider = require('truffle-privatekey-provider')
const ProviderEngine = require('truffle-privatekey-provider/node_modules/web3-provider-engine')
const CacheSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/cache.js')
const FixtureSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/fixture.js')
const FilterSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/filters.js')
const VmSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/vm.js')
const NonceSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/nonce-tracker.js')
const RpcSubprovider = require('truffle-privatekey-provider/node_modules/web3-provider-engine/subproviders/rpc.js')
var engine = new ProviderEngine()
var web3 = new Web3(engine)
engine.addProvider(
new FixtureSubprovider({
web3_clientVersion: 'ProviderEngine/v0.0.0/javascript',
net_listening: true,
eth_hashrate: '0x00',
eth_mining: false,
eth_syncing: true,
})
)
engine.addProvider(new CacheSubprovider())
engine.addProvider(new FilterSubprovider())
engine.addProvider(new NonceSubprovider())
engine.addProvider(new VmSubprovider())