Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e7f00b088 | |||
| a318fe8374 | |||
| eded4a811f | |||
| 66a37a1e74 | |||
| aba4a23104 | |||
| 13ed02e134 | |||
| 48ff304861 | |||
| 580d6e8f51 |
@@ -0,0 +1,4 @@
|
||||
template: |
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@aragon/os/contracts/acl/ACL.sol";
|
||||
import "@aragon/os/contracts/kernel/Kernel.sol";
|
||||
import "@aragon/os/contracts/factory/DAOFactory.sol";
|
||||
|
||||
// You might think this file is a bit odd, but let me explain.
|
||||
// We only use for now those imported contracts in our tests, which
|
||||
// means Truffle will not compile them for us, because they are from
|
||||
// an external dependency.
|
||||
|
||||
|
||||
// solium-disable-next-line no-empty-blocks
|
||||
contract Spoof {
|
||||
// ...
|
||||
}
|
||||
@@ -58,10 +58,7 @@ class Contribution extends Record {
|
||||
ipfsHashAttr.hashSize,
|
||||
];
|
||||
|
||||
return this.functions.add(...contribution, callOptions).then(res => {
|
||||
res.ipfsHash = this.ipfs.encodeHash(ipfsHashAttr);
|
||||
return res;
|
||||
});
|
||||
return this.functions.add(...contribution, callOptions);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Contributor {
|
||||
github_username,
|
||||
gitea_username,
|
||||
wiki_username,
|
||||
accounts,
|
||||
zoom_display_name,
|
||||
} = this;
|
||||
|
||||
let data = {
|
||||
@@ -36,7 +36,7 @@ class Contributor {
|
||||
'@type': 'Contributor',
|
||||
kind,
|
||||
name,
|
||||
accounts: accounts || [],
|
||||
accounts: [],
|
||||
};
|
||||
|
||||
if (url) {
|
||||
@@ -68,6 +68,13 @@ class Contributor {
|
||||
});
|
||||
}
|
||||
|
||||
if (zoom_display_name) {
|
||||
data.accounts.push({
|
||||
'site': 'zoom.us',
|
||||
'username': zoom_display_name,
|
||||
});
|
||||
}
|
||||
|
||||
// Write it pretty to ipfs
|
||||
return JSON.stringify(data, null, 2);
|
||||
}
|
||||
@@ -97,10 +104,11 @@ class Contributor {
|
||||
accounts,
|
||||
} = JSON.parse(serialized.toString('utf8'));
|
||||
|
||||
let github_username, github_uid, gitea_username, wiki_username;
|
||||
let github_username, github_uid, gitea_username, wiki_username, zoom_display_name;
|
||||
let github = accounts.find(a => a.site === 'github.com');
|
||||
let gitea = accounts.find(a => a.site === 'gitea.kosmos.org');
|
||||
let wiki = accounts.find(a => a.site === 'wiki.kosmos.org');
|
||||
let zoom = accounts.find(a => a.site === 'zoom.us');
|
||||
|
||||
if (github) {
|
||||
(({ username: github_username, uid: github_uid} = github));
|
||||
@@ -111,6 +119,9 @@ class Contributor {
|
||||
if (wiki) {
|
||||
(({ username: wiki_username } = wiki));
|
||||
}
|
||||
if (zoom) {
|
||||
(({ username: zoom_display_name } = zoom));
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
@@ -121,6 +132,7 @@ class Contributor {
|
||||
github_username,
|
||||
gitea_username,
|
||||
wiki_username,
|
||||
zoom_display_name,
|
||||
ipfsData: serialized,
|
||||
};
|
||||
}
|
||||
|
||||
+2
-1
@@ -24,11 +24,12 @@
|
||||
"lint:contracts": "solhint \"contracts/**/*.sol\" \"apps/*/contracts/**/*.sol\"",
|
||||
"lint:contract-tests": "eslint apps/*/test",
|
||||
"lint:wrapper": "eslint lib/",
|
||||
"test": "npm run test:token && npm run test:contributor && npm run test:contribution && npm run test:proposal",
|
||||
"test": "npm run test:token && npm run test:contributor && npm run test:contribution && npm run test:proposal && npm run test:kit",
|
||||
"test:token": "cd apps/token && npm run test",
|
||||
"test:contributor": "cd apps/contributor && npm run test",
|
||||
"test:contribution": "cd apps/contribution && npm run test",
|
||||
"test:proposal": "cd apps/proposal && npm run test",
|
||||
"test:kit": "aragon contracts test",
|
||||
"setup-git-hooks": "sh scripts/git-hooks/install"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/* eslint-disable no-undef */
|
||||
const namehash = require('ethers').utils.namehash;
|
||||
const KreditsKit = artifacts.require("KreditsKit.sol");
|
||||
const getContract = name => artifacts.require(name);
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
const arapp = require('../arapp.json');
|
||||
const ENS_ADDRESS = arapp.environments.development.registry;
|
||||
|
||||
contract('DAO bare kit', (accounts) => {
|
||||
let kreditsKit;
|
||||
let address;
|
||||
let apps;
|
||||
let kernel;
|
||||
let contribution;
|
||||
let contributor;
|
||||
let proposal;
|
||||
let token;
|
||||
|
||||
before(async () => {
|
||||
//apps id
|
||||
const appsId = [];
|
||||
appsId[0] = namehash("kredits-contribution");
|
||||
appsId[1] = namehash("kredits-contributor");
|
||||
appsId[2] = namehash("kredits-proposal");
|
||||
appsId[3] = namehash("kredits-token");
|
||||
|
||||
const kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
const aclBase = await getContract('ACL').new();
|
||||
const daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
|
||||
kreditsKit = await KreditsKit.new(daoFactory.address, ENS_ADDRESS, appsId, { from: accounts[0] });
|
||||
});
|
||||
|
||||
describe("New DAO instance", () => {
|
||||
it("kit should be defined", async () => {
|
||||
assert.notEqual(kreditsKit, undefined);
|
||||
});
|
||||
|
||||
it('it should deploy DAO', async () => {
|
||||
const receipt = await kreditsKit.newInstance({ from: accounts[0] });
|
||||
|
||||
address = receipt.logs.filter(l => l.event === 'DeployInstance')[0].args.dao;
|
||||
apps = receipt.logs
|
||||
.filter(l => l.event === 'InstalledApp')
|
||||
.map(event => {
|
||||
return { id: event.args.appId, proxy: event.args.appProxy };
|
||||
});
|
||||
|
||||
address.should.not.equal(ZERO_ADDR);
|
||||
});
|
||||
|
||||
it('it should install apps', async () => {
|
||||
apps[0].id.should.equal(namehash('kredits-contribution'));
|
||||
apps[1].id.should.equal(namehash('kredits-contributor'));
|
||||
apps[2].id.should.equal(namehash('kredits-proposal'));
|
||||
apps[3].id.should.equal(namehash('kredits-token'));
|
||||
});
|
||||
|
||||
it('it should initialize apps', async () => {
|
||||
contribution = await getContract('Contribution').at(apps[0].proxy);
|
||||
contributor = await getContract('Contributor').at(apps[1].proxy);
|
||||
proposal = await getContract('Proposal').at(apps[2].proxy);
|
||||
token = await getContract('Token').at(apps[3].proxy);
|
||||
(await Promise.all([
|
||||
contribution.hasInitialized(),
|
||||
contributor.hasInitialized(),
|
||||
proposal.hasInitialized(),
|
||||
token.hasInitialized(),
|
||||
])).should.deep.equal([true, true, true, true]);
|
||||
});
|
||||
|
||||
it('it should set permissions', async () => {
|
||||
kernel = await getContract('Kernel').at(address);
|
||||
(await Promise.all([
|
||||
//check contribution app roles
|
||||
kernel.hasPermission(accounts[0], contribution.address, await space.ADD_CONTRIBUTION_ROLE(), '0x0'),
|
||||
kernel.hasPermission(accounts[0], contribution.address, await space.VETO_CONTRIBUTION_ROLE(), '0x0'),
|
||||
kernel.hasPermission(proposal.address, contribution.address, await space.ADD_CONTRIBUTION_ROLE(), '0x0'),
|
||||
//proposal app roles
|
||||
kernel.hasPermission(accounts[0], proposal.address, await proposal.VOTE_PROPOSAL_ROLE(), '0x0'),
|
||||
//token app roles
|
||||
kernel.hasPermission(accounts[0], token.address, await token.MINT_TOKEN_ROLE(), '0x0'),
|
||||
kernel.hasPermission(contribution.address, token.address, await token.MINT_TOKEN_ROLE(), '0x0'),
|
||||
])).should.deep.equal([true, true, true, true, true, true]);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user