fix contribution tests: get access to token app contracts
This commit is contained in:
parent
5a78a50990
commit
2cfc572cc6
@ -1,6 +1,7 @@
|
|||||||
const namehash = require('eth-ens-namehash').hash;
|
const namehash = require('eth-ens-namehash').hash;
|
||||||
|
|
||||||
const Contribution = artifacts.require("Contribution.sol");
|
const Contribution = artifacts.require("Contribution.sol");
|
||||||
|
const { Token, getTokenContract } = require("../../token/artifacts");
|
||||||
|
|
||||||
const getContract = name => artifacts.require(name)
|
const getContract = name => artifacts.require(name)
|
||||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||||
@ -8,7 +9,7 @@ const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
|||||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||||
|
|
||||||
contract('Token app', (accounts) => {
|
contract('Token app', (accounts) => {
|
||||||
let kernelBase, aclBase, daoFactory, dao, acl, contribution;
|
let kernelBase, aclBase, daoFactory, dao, acl, contribution, token;
|
||||||
|
|
||||||
const root = accounts[0];
|
const root = accounts[0];
|
||||||
const member1 = accounts[1];
|
const member1 = accounts[1];
|
||||||
@ -30,9 +31,17 @@ contract('Token app', (accounts) => {
|
|||||||
{ from: root }
|
{ from: root }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//apps id
|
||||||
|
let appsId = [];
|
||||||
|
appsId[0] = namehash("kredits-contribution");
|
||||||
|
appsId[1] = namehash("kredits-contributor");
|
||||||
|
appsId[2] = namehash("kredits-proposal");
|
||||||
|
appsId[3] = namehash("kredits-token");
|
||||||
|
|
||||||
|
|
||||||
//get new app instance from DAO
|
//get new app instance from DAO
|
||||||
const receipt = await dao.newAppInstance(
|
let receipt = await dao.newAppInstance(
|
||||||
'0x1234',
|
appsId[0],
|
||||||
(await Contribution.new()).address,
|
(await Contribution.new()).address,
|
||||||
0x0,
|
0x0,
|
||||||
false,
|
false,
|
||||||
@ -40,14 +49,18 @@ contract('Token app', (accounts) => {
|
|||||||
)
|
)
|
||||||
contribution = Contribution.at(
|
contribution = Contribution.at(
|
||||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||||
)
|
);
|
||||||
|
|
||||||
//apps id
|
receipt = await dao.newAppInstance(
|
||||||
let appsId = [];
|
appsId[3],
|
||||||
appsId[0] = namehash("kredits-contribution");
|
(await getTokenContract('Token').new()).address,
|
||||||
appsId[1] = namehash("kredits-contributor");
|
0x0,
|
||||||
appsId[2] = namehash("kredits-proposal");
|
false,
|
||||||
appsId[3] = namehash("kredits-token");
|
{ from: root }
|
||||||
|
)
|
||||||
|
token = Token.at(
|
||||||
|
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||||
|
);
|
||||||
|
|
||||||
//init app
|
//init app
|
||||||
await contribution.initialize(appsId);
|
await contribution.initialize(appsId);
|
||||||
@ -66,8 +79,21 @@ contract('Token app', (accounts) => {
|
|||||||
await contribution.VETO_CONTRIBUTION_ROLE(),
|
await contribution.VETO_CONTRIBUTION_ROLE(),
|
||||||
root,
|
root,
|
||||||
{ from: root }
|
{ from: root }
|
||||||
)
|
);
|
||||||
|
|
||||||
|
//init token (app)
|
||||||
|
await token.initialize(appsId);
|
||||||
|
|
||||||
|
//create token mint permission for coin owner
|
||||||
|
await acl.createPermission(
|
||||||
|
root,
|
||||||
|
token.address,
|
||||||
|
await token.MINT_TOKEN_ROLE(),
|
||||||
|
root,
|
||||||
|
{ from: root }
|
||||||
|
);
|
||||||
|
|
||||||
|
//acl.grantPermission(contribution, token, await token.MINT_TOKEN_ROLE(), {from: root});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Owner default space permissions", async() => {
|
describe("Owner default space permissions", async() => {
|
||||||
|
5
apps/token/artifacts.js
Normal file
5
apps/token/artifacts.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
Token: artifacts.require('Token.sol'),
|
||||||
|
getTokenContract: name => artifacts.require(name)
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user