[WIP] Solidity contracts tests #106
@@ -1,26 +1,29 @@
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const Contribution = artifacts.require("Contribution.sol");
|
||||
const { Token, getTokenContract } = require("../../token/artifacts");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
// eslint-disable-next-line no-undef
|
||||
const getContract = name => artifacts.require(name);
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Contribution app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, acl, contribution, token;
|
||||
let kernelBase, aclBase, daoFactory, r, dao, acl, contribution, token;
|
||||
|
||||
const root = accounts[0];
|
||||
const member1 = accounts[1];
|
||||
|
||||
before(async() => {
|
||||
kernelBase = await getContract('Kernel').new(true) // petrify immediately
|
||||
aclBase = await getContract('ACL').new()
|
||||
// eslint-disable-next-line no-undef
|
||||
before(async () => {
|
||||
kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
aclBase = await getContract('ACL').new();
|
||||
daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
r = await daoFactory.newDAO(root)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao)
|
||||
acl = getContract('ACL').at(await dao.acl())
|
||||
r = await daoFactory.newDAO(root);
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao);
|
||||
acl = getContract('ACL').at(await dao.acl());
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
@@ -46,7 +49,7 @@ contract('Contribution app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
contribution = Contribution.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
);
|
||||
@@ -57,7 +60,7 @@ contract('Contribution app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
token = Token.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
);
|
||||
@@ -71,7 +74,7 @@ contract('Contribution app', (accounts) => {
|
||||
await contribution.ADD_CONTRIBUTION_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
|
||||
await acl.createPermission(
|
||||
root,
|
||||
@@ -96,101 +99,107 @@ contract('Contribution app', (accounts) => {
|
||||
//acl.grantPermission(contribution, token, await token.MINT_TOKEN_ROLE(), {from: root});
|
||||
|
|
||||
});
|
||||
|
||||
describe("Owner default space permissions", async() => {
|
||||
it('check owner can add contribution', async() => {
|
||||
describe("Owner default space permissions", async () => {
|
||||
it('check owner can add contribution', async () => {
|
||||
let addContributionPermission = await acl.hasPermission(root, contribution.address, await contribution.ADD_CONTRIBUTION_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(addContributionPermission, true);
|
||||
});
|
||||
|
||||
it('check owner can veto contribution', async() => {
|
||||
it('check owner can veto contribution', async () => {
|
||||
let vetoContributionPermission = await acl.hasPermission(root, contribution.address, await contribution.VETO_CONTRIBUTION_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(vetoContributionPermission, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Add contribution", async() => {
|
||||
describe("Add contribution", async () => {
|
||||
let amount = 100;
|
||||
let contributorId = 1;
|
||||
let hashDigest = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||
let hashFunction = 1;
|
||||
let hashSize = 1;
|
||||
|
||||
it("should revert when add contribution from address that does not have permission", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when add contribution from address that does not have permission", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.add(amount, contributorId, hashDigest, hashFunction, hashSize, {from: member1});
|
||||
'sender does not have permission'
|
||||
'sender does not have permission';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when add contribution with amount equal to zero", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when add contribution with amount equal to zero", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.add(0, contributorId, hashDigest, hashFunction, hashSize, {from: root});
|
||||
'amount equal to zero'
|
||||
'amount equal to zero';
|
||||
});
|
||||
});
|
||||
|
||||
it("add contribution", async() => {
|
||||
it("add contribution", async () => {
|
||||
let contributionCountBefore = await contribution.contributionsCount();
|
||||
await contribution.add(amount, contributorId, hashDigest, hashFunction, hashSize, {from: root});
|
||||
let contributionCountAfter = await contribution.contributionsCount();
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(contributionCountAfter.toNumber()-contributionCountBefore.toNumber(), 1);
|
||||
let contributionObject = await contribution.getContribution(contributionCountAfter.toNumber());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(contributionObject[1], contributorId);
|
||||
let isExist = await contribution.exists(contributionCountAfter.toNumber());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(isExist, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Veto/Claim contribution", async() => {
|
||||
describe("Veto/Claim contribution", async () => {
|
||||
|
||||
it("should revert when veto from address that does not have permission", async() => {
|
||||
it("should revert when veto from address that does not have permission", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
return assertRevert(async() => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.veto(contributionId.toNumber(), {from: member1});
|
||||
'sender does not have permission to veto'
|
||||
'sender does not have permission to veto';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when veto contribution that does not exist", async() => {
|
||||
it("should revert when veto contribution that does not exist", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
return assertRevert(async() => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.veto(contributionId.toNumber()+1, {from: root});
|
||||
'contribution not found'
|
||||
'contribution not found';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when claim contribution that does not exist", async() => {
|
||||
it("should revert when claim contribution that does not exist", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
return assertRevert(async() => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.claim(contributionId.toNumber()+1, {from: root});
|
||||
'contribution not found'
|
||||
'contribution not found';
|
||||
});
|
||||
});
|
||||
|
||||
it("claim contribution", async() => {
|
||||
it("claim contribution", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
await contribution.claim(contributionId);
|
||||
let contributionObject = await contribution.getContribution(contributionId.toNumber());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert(contributionObject[3], true);
|
||||
});
|
||||
|
||||
it("should revert when claim already claimed contribution", async() => {
|
||||
it("should revert when claim already claimed contribution", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
return assertRevert(async() => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.claim(contributionId.toNumber(), {from: root});
|
||||
'contribution already claimed'
|
||||
'contribution already claimed';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when veto already claimed contribution", async() => {
|
||||
it("should revert when veto already claimed contribution", async () => {
|
||||
let contributionId = await contribution.contributionsCount();
|
||||
return assertRevert(async() => {
|
||||
return assertRevert(async () => {
|
||||
await contribution.veto(contributionId.toNumber(), {from: root});
|
||||
'contribution already claimed'
|
||||
'contribution already claimed';
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
const Contributor = artifacts.require("Contributor.sol");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
const getContract = name => artifacts.require(name);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Contributor app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, acl, contributor;
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let kernelBase, aclBase, daoFactory, r, dao, acl, contributor;
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
|
||||
const root = accounts[0];
|
||||
const member1 = accounts[1];
|
||||
|
||||
before(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
kernelBase = await getContract('Kernel').new(true) // petrify immediately
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
aclBase = await getContract('ACL').new()
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
before(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
aclBase = await getContract('ACL').new();
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
r = await daoFactory.newDAO(root)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
acl = getContract('ACL').at(await dao.acl())
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
r = await daoFactory.newDAO(root);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
acl = getContract('ACL').at(await dao.acl());
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
@@ -37,10 +40,10 @@ contract('Contributor app', (accounts) => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
contributor = Contributor.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
|
||||
//apps id
|
||||
let appsId = [];
|
||||
@@ -59,47 +62,50 @@ contract('Contributor app', (accounts) => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.MANAGE_CONTRIBUTORS_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
|
||||
});
|
||||
|
||||
describe("Owner default space permissions", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it('check owner is token issuer', async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
describe("Owner default space permissions", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it('check owner is token issuer', async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let manageContributorPermission = await acl.hasPermission(root, contributor.address, await contributor.MANAGE_CONTRIBUTORS_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(manageContributorPermission, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Add contributor", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
describe("Add contributor", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let account = root;
|
||||
let hashDigest = '0x0';
|
||||
let hashFunction = 0;
|
||||
let hashSize = 0;
|
||||
|
||||
it("should revert when add contributor from an address that does not have permission", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1})
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'sender does not have permission'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when add contributor from an address that does not have permission", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1});
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'sender does not have permission';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
|
||||
it('add contributor', async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it('add contributor', async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let contributorCount = await contributor.coreContributorsCount();
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize);
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(await contributor.addressExists(account), true);
|
||||
let contributorCountAfter = await contributor.coreContributorsCount();
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(await contributorCountAfter.toNumber(), parseInt(contributorCount)+1);
|
||||
});
|
||||
|
||||
it("should revert when add contributor with an address that already exist", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1})
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'address already exist'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when add contributor with an address that already exist", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1});
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'address already exist';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Update contributor", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
describe("Update contributor", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let id;
|
||||
let oldAccount;
|
||||
let newAccount;
|
||||
@@ -107,7 +113,8 @@ contract('Contributor app', (accounts) => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
let hashFunction;
|
||||
let hashSize;
|
||||
|
||||
before(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
before(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
id = await contributor.coreContributorsCount();
|
||||
oldAccount = root;
|
||||
newAccount = member1;
|
||||
@@ -116,47 +123,48 @@ contract('Contributor app', (accounts) => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
hashSize = 1;
|
||||
});
|
||||
|
||||
it('update contributor account', async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it('update contributor account', async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, newAccount);
|
||||
let contributorId = await contributor.getContributorIdByAddress(oldAccount);
|
||||
// eslint-disable-next-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(contributorId.toNumber(), 0);
|
||||
});
|
||||
|
||||
it("should revert when update contributor account from address that does not have permission", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when update contributor account from address that does not have permission", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, newAccount, {from: member1});
|
||||
'sender does not have permission'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'sender does not have permission';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when update contributor account that does not exist", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when update contributor account that does not exist", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorAccount(id.toNumber(), accounts[3], newAccount);
|
||||
'contributor does not exist'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'contributor does not exist';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when update contributor account with address(0)", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when update contributor account with address(0)", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, ZERO_ADDR);
|
||||
'contributor does not exist'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'contributor does not exist';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
|
||||
it('update contributor profile hash', async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it('update contributor profile hash', async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorProfileHash(id.toNumber(), hashDigest, hashFunction, hashSize);
|
||||
let contributorProfile = await contributor.contributors(id.toNumber());
|
||||
assert.equal(hashDigest, contributorProfile[1]);
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(hashFunction, contributorProfile[2].toNumber());
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(hashSize, contributorProfile[3].toNumber());
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(hashDigest, contributorProfile[1]); // eslint-disable-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(hashFunction, contributorProfile[2].toNumber()); // eslint-disable-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
assert.equal(hashSize, contributorProfile[3].toNumber()); // eslint-disable-line no-undef
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
|
||||
it("should revert when update contributor profile hash from address that does not have permission", async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async() => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
it("should revert when update contributor profile hash from address that does not have permission", async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
return assertRevert(async () => {
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
await contributor.updateContributorProfileHash(id.toNumber(), hashDigest, hashFunction, hashSize, {from: member1});
|
||||
'sender does not have permission'
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
'sender does not have permission';
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
});
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
|
||||
|
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
This doesn't actually check for an updated hash afaics. This doesn't actually check for an updated hash afaics.
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
yup...solved in this commit yup...solved in this [commit](https://github.com/67P/kredits-contracts/pull/106/commits/ab6d6a40251a9589d99886b0e53bb86b74f50080)
|
||||
@@ -1,27 +1,30 @@
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const Proposal = artifacts.require("Proposal.sol");
|
||||
const { Contributor, getContributorContract } = require("../../contributor/artifacts");
|
||||
|
idk why I have an error here importing other apps contracts? idk why I have an error here importing other apps contracts?
looks to me like from where is truffle loading the contracts? looks to me like `artifacts` might not defined in the contributor/artifacts.js file.
`artifacts.require('Contributor')` does not work here? because the proposal app does not know about the Contributor.sol?
from where is truffle loading the contracts?
I did the same with the Contribution app to access to the Token app contracts, and it worked... I did the same with the Contribution app to access to the Token app contracts, and it worked...
If I understand correctly `artifacts.require('Contributor.sol')` in Contributor app should b able to access that contract inside that app contracts folder... or no ?
|
||||
const { Contribution, getContributionContract } = require("../../contribution/artifacts");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
// eslint-disable-next-line no-undef
|
||||
const getContract = name => artifacts.require(name);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Proposal app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, acl, proposal, contribution, contributor;
|
||||
let kernelBase, aclBase, daoFactory, dao, r, acl, proposal, contribution, contributor;
|
||||
|
||||
const root = accounts[0];
|
||||
const member1 = accounts[1];
|
||||
|
||||
before(async() => {
|
||||
kernelBase = await getContract('Kernel').new(true) // petrify immediately
|
||||
aclBase = await getContract('ACL').new()
|
||||
// eslint-disable-next-line no-undef
|
||||
before(async () => {
|
||||
kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
aclBase = await getContract('ACL').new();
|
||||
daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
r = await daoFactory.newDAO(root)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao)
|
||||
acl = getContract('ACL').at(await dao.acl())
|
||||
r = await daoFactory.newDAO(root);
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao);
|
||||
acl = getContract('ACL').at(await dao.acl());
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
@@ -47,7 +50,7 @@ contract('Proposal app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
proposal = Proposal.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
);
|
||||
@@ -58,7 +61,7 @@ contract('Proposal app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
contributor = Contributor.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
);
|
||||
@@ -69,7 +72,7 @@ contract('Proposal app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
contribution = Contribution.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
);
|
||||
@@ -83,7 +86,7 @@ contract('Proposal app', (accounts) => {
|
||||
await proposal.ADD_PROPOSAL_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
|
||||
await acl.createPermission(
|
||||
root,
|
||||
@@ -102,7 +105,7 @@ contract('Proposal app', (accounts) => {
|
||||
await contribution.ADD_CONTRIBUTION_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
|
||||
await acl.createPermission(
|
||||
root,
|
||||
@@ -123,34 +126,39 @@ contract('Proposal app', (accounts) => {
|
||||
await contributor.MANAGE_CONTRIBUTORS_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
describe("Owner default permissions", async() => {
|
||||
it('check owner can add proposal', async() => {
|
||||
describe("Owner default permissions", async () => {
|
||||
it('check owner can add proposal', async () => {
|
||||
let addProposalPermission = await acl.hasPermission(root, proposal.address, await proposal.ADD_PROPOSAL_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(addProposalPermission, true);
|
||||
});
|
||||
|
||||
it('check owner can veto contribution', async() => {
|
||||
it('check owner can veto contribution', async () => {
|
||||
let vetoProposalPermission = await acl.hasPermission(root, proposal.address, await proposal.VOTE_PROPOSAL_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(vetoProposalPermission, true);
|
||||
});
|
||||
|
||||
it('check owner can add contribution', async() => {
|
||||
it('check owner can add contribution', async () => {
|
||||
let addContributionPermission = await acl.hasPermission(root, contribution.address, await contribution.ADD_CONTRIBUTION_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(addContributionPermission, true);
|
||||
});
|
||||
|
||||
it('check owner can veto contribution', async() => {
|
||||
it('check owner can veto contribution', async () => {
|
||||
let vetoContributionPermission = await acl.hasPermission(root, contribution.address, await contribution.VETO_CONTRIBUTION_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(vetoContributionPermission, true);
|
||||
});
|
||||
|
||||
it('check owner can manage contributors', async() => {
|
||||
it('check owner can manage contributors', async () => {
|
||||
let manageContributorsPermission = await acl.hasPermission(root, contributor.address, await contribution.MANAGE_CONTRIBUTORS_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(manageContributorsPermission, true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const Token = artifacts.require("Token.sol");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
// eslint-disable-next-line no-undef
|
||||
const getContract = name => artifacts.require(name);
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Token app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, acl, token;
|
||||
let kernelBase, aclBase, daoFactory, dao, r, acl, token;
|
||||
|
||||
const root = accounts[0];
|
||||
const member1 = accounts[1];
|
||||
|
||||
before(async() => {
|
||||
kernelBase = await getContract('Kernel').new(true) // petrify immediately
|
||||
aclBase = await getContract('ACL').new()
|
||||
// eslint-disable-next-line no-undef
|
||||
before(async () => {
|
||||
kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
aclBase = await getContract('ACL').new();
|
||||
daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
r = await daoFactory.newDAO(root)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao)
|
||||
acl = getContract('ACL').at(await dao.acl())
|
||||
r = await daoFactory.newDAO(root);
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao);
|
||||
acl = getContract('ACL').at(await dao.acl());
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
@@ -37,10 +40,10 @@ contract('Token app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
token = Token.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
)
|
||||
);
|
||||
|
||||
//apps id
|
||||
let appsId = [];
|
||||
@@ -59,13 +62,14 @@ contract('Token app', (accounts) => {
|
||||
await token.MINT_TOKEN_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe("Owner default space permissions", async() => {
|
||||
it('check owner is token issuer', async() => {
|
||||
describe("Owner default space permissions", async () => {
|
||||
it('check owner is token issuer', async () => {
|
||||
let tokenIssuerPermission = await acl.hasPermission(root, token.address, await token.MINT_TOKEN_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(tokenIssuerPermission, true);
|
||||
});
|
||||
});
|
||||
@@ -75,45 +79,45 @@ contract('Token app', (accounts) => {
|
||||
let symbol = "₭S";
|
||||
let decimals = 18;
|
||||
|
||||
it("check token properties", async() => {
|
||||
assert.equal(await token.name(), name);
|
||||
assert.equal(await token.symbol(), symbol);
|
||||
assert.equal(await token.decimals(), decimals);
|
||||
it("check token properties", async () => {
|
||||
assert.equal(await token.name(), name); // eslint-disable-line no-undef
|
||||
assert.equal(await token.symbol(), symbol); // eslint-disable-line no-undef
|
||||
assert.equal(await token.decimals(), decimals); // eslint-disable-line no-undef
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Token minting", async() => {
|
||||
describe("Token minting", async () => {
|
||||
let tokenToMint = 250;
|
||||
let ether = 1000000000000000000;
|
||||
|
||||
it("should revert when mint tokens from an address that does not have minting permission", async() => {
|
||||
return assertRevert(async() => {
|
||||
await token.mintFor(root, tokenToMint, 1, { from: member1})
|
||||
'address does not have permission to mint tokens'
|
||||
it("should revert when mint tokens from an address that does not have minting permission", async () => {
|
||||
return assertRevert(async () => {
|
||||
await token.mintFor(root, tokenToMint, 1, { from: member1});
|
||||
'address does not have permission to mint tokens';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when mint tokens to address(0)", async() => {
|
||||
return assertRevert(async() => {
|
||||
await token.mintFor(ZERO_ADDR, tokenToMint, 1, { from: root})
|
||||
'invalid contributor address'
|
||||
it("should revert when mint tokens to address(0)", async () => {
|
||||
return assertRevert(async () => {
|
||||
await token.mintFor(ZERO_ADDR, tokenToMint, 1, { from: root});
|
||||
'invalid contributor address';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when mint amount of tokens equal to 0", async() => {
|
||||
return assertRevert(async() => {
|
||||
await token.mintFor(root, 0, 1, { from: root})
|
||||
'amount to mint should be greater than zero'
|
||||
it("should revert when mint amount of tokens equal to 0", async () => {
|
||||
return assertRevert(async () => {
|
||||
await token.mintFor(root, 0, 1, { from: root});
|
||||
'amount to mint should be greater than zero';
|
||||
});
|
||||
});
|
||||
|
||||
it("mint tokens", async() => {
|
||||
it("mint tokens", async () => {
|
||||
await token.mintFor(root, tokenToMint, 1, { from: root });
|
||||
let ownerBalance = await token.balanceOf(root);
|
||||
let totalSupply = await token.totalSupply();
|
||||
assert.equal(ownerBalance.toNumber(), tokenToMint*ether);
|
||||
assert.equal(totalSupply.toNumber(), tokenToMint*ether);
|
||||
assert.equal(ownerBalance.toNumber(), tokenToMint*ether); // eslint-disable-line no-undef
|
||||
assert.equal(totalSupply.toNumber(), tokenToMint*ether); // eslint-disable-line no-undef
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -64,4 +64,4 @@ class Contribution extends Record {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Contribution;
|
||||
module.exports = Contribution;
|
||||
|
||||
@@ -86,4 +86,4 @@ class Contributor extends Record {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Contributor;
|
||||
module.exports = Contributor;
|
||||
|
||||
@@ -43,4 +43,4 @@ class Proposal extends Record {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Proposal;
|
||||
module.exports = Proposal;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const ethers = require('ethers');
|
||||
const RSVP = require('rsvp');
|
||||
|
||||
const Preflight = require('./utils/preflight');
|
||||
const deprecate = require('./utils/deprecate');
|
||||
|
||||
I have a problem here granting the mint token permission to the contribution app...
what do you mean? what's the error?
a revert...