token app unit tests
This commit is contained in:
parent
e7bdcc2025
commit
0156b10067
10
apps/token/.solcover.js
Normal file
10
apps/token/.solcover.js
Normal file
@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
norpc: true,
|
||||
copyPackages: ['@aragon/os'],
|
||||
buildDirPath: '/build/contracts',
|
||||
testCommand: '../node_modules/.bin/aragon contracts test --network coverage',
|
||||
skipFiles: [
|
||||
'misc/Migrations.sol',
|
||||
'test/Spoof.sol',
|
||||
]
|
||||
}
|
@ -21,6 +21,8 @@ contract Token is ERC20Token, AragonApp {
|
||||
}
|
||||
|
||||
function mintFor(address contributorAccount, uint256 amount, uint32 contributionId) public isInitialized auth(MINT_TOKEN_ROLE) {
|
||||
require(amount > 0, "amount should be greater than zero");
|
||||
|
||||
uint256 amountInWei = amount.mul(1 ether);
|
||||
_mint(contributorAccount, amountInWei);
|
||||
emit LogMint(contributorAccount, amount, contributionId);
|
||||
|
16
apps/token/contracts/test/Spoof.sol
Normal file
16
apps/token/contracts/test/Spoof.sol
Normal file
@ -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 {
|
||||
// ...
|
||||
}
|
139
apps/token/package-lock.json
generated
139
apps/token/package-lock.json
generated
@ -171,9 +171,9 @@
|
||||
}
|
||||
},
|
||||
"@aragon/os": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@aragon/os/-/os-4.1.0.tgz",
|
||||
"integrity": "sha512-PPb8n9aUiBFHZDEFj4Kry7hrgBPYHPD+gwnZlMUvo3ocad4TCljiJYPC5SlOmmySrUkqTIHNksUzWTbuzy9n4g==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@aragon/os/-/os-4.2.0.tgz",
|
||||
"integrity": "sha512-p0CGev++Ku0oxv+6vvViaPxHYwCVSJxleqJNzf06b9L8VaiWAs0zTwVspebD3mMQqtGJgO7A63Y0LhvsHFw5IA==",
|
||||
"requires": {
|
||||
"homedir": "^0.6.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
@ -216,6 +216,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@aragon/test-helpers": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@aragon/test-helpers/-/test-helpers-1.2.0.tgz",
|
||||
"integrity": "sha512-PrNgax9B5LwQB1kQufJbPXylWN500cdnz1ohcnn09dnP1D/xWLoSSMVLduOZM4Mo2QUD14HMGc2T4cs01ce/tg==",
|
||||
"dev": true
|
||||
},
|
||||
"@aragon/wrapper": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@aragon/wrapper/-/wrapper-3.0.0.tgz",
|
||||
@ -306,9 +312,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/polyfill": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.0.tgz",
|
||||
"integrity": "sha512-bVsjsrtsDflIHp5I6caaAa2V25Kzn50HKPL6g3X0P0ni1ks+58cPB8Mz6AOKVuRPgaVdq/OwEUc/1vKqX+Mo4A==",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.3.tgz",
|
||||
"integrity": "sha512-rkv8WIvJshA5Ev8iNMGgz5WZkRtgtiPexiT7w5qevGTuT7ZBfM3de9ox1y9JR5/OXb/sWGBbWlHNa7vQKqku3Q==",
|
||||
"requires": {
|
||||
"core-js": "^2.6.5",
|
||||
"regenerator-runtime": "^0.13.2"
|
||||
@ -322,9 +328,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/runtime": {
|
||||
"version": "7.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.2.tgz",
|
||||
"integrity": "sha512-7Bl2rALb7HpvXFL7TETNzKSAeBVCPHELzc0C//9FCxN8nsiueWSJBqaF+2oIJScyILStASR/Cx5WMkXGYTiJFA==",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.3.tgz",
|
||||
"integrity": "sha512-9lsJwJLxDh/T3Q3SZszfWOTkk3pHbkmH+3KY+zwIDmsNlxsumuhS2TH3NIpktU4kNvfzy+k3eLT7aTJSPTo0OA==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.2"
|
||||
},
|
||||
@ -1266,9 +1272,9 @@
|
||||
}
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz",
|
||||
"integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw=="
|
||||
"version": "3.5.4",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.4.tgz",
|
||||
"integrity": "sha512-FG+nFEZChJrbQ9tIccIfZJBz3J7mLrAhxakAbnrJWn8d7aKOC+LWifa0G+p4ZqKp4y13T7juYvdhq9NzKdsrjw=="
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "4.11.8",
|
||||
@ -1320,9 +1326,9 @@
|
||||
"integrity": "sha512-QD46ppGintwPGuL1KqmwhR0O+N2cZUg8JG/VzwI2e28sM9TqHjQB10lI4QAaMHVbLzwVLLAwEglpKPViWX+5NQ=="
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
|
||||
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg=="
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1539,9 +1545,9 @@
|
||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30000955",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000955.tgz",
|
||||
"integrity": "sha512-6AwmIKgqCYfDWWadRkAuZSHMQP4Mmy96xAXEdRBlN/luQhlRYOKgwOlZ9plpCOsVbBuqbTmGqDK3JUM/nlr8CA=="
|
||||
"version": "1.0.30000960",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000960.tgz",
|
||||
"integrity": "sha512-7nK5qs17icQaX6V3/RYrJkOsZyRNnroA4+ZwxaKJzIKy+crIy0Mz5CBlLySd2SNV+4nbUZeqeNfiaEieUBu3aA=="
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
@ -2018,9 +2024,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"object-keys": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz",
|
||||
"integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg=="
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2145,9 +2151,9 @@
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.122",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.122.tgz",
|
||||
"integrity": "sha512-3RKoIyCN4DhP2dsmleuFvpJAIDOseWH88wFYBzb22CSwoFDSWRc4UAMfrtc9h8nBdJjTNIN3rogChgOy6eFInw=="
|
||||
"version": "1.3.124",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.124.tgz",
|
||||
"integrity": "sha512-glecGr/kFdfeXUHOHAWvGcXrxNU+1wSO/t5B23tT1dtlvYB26GY8aHzZSWD7HqhqC800Lr+w/hQul6C5AF542w=="
|
||||
},
|
||||
"elegant-spinner": {
|
||||
"version": "1.0.1",
|
||||
@ -2224,9 +2230,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"object-keys": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz",
|
||||
"integrity": "sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg=="
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2342,7 +2348,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
|
||||
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
|
||||
"requires": {
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#572d4bafe08a8a231137e1f9daeb0f8a23f197d2",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -4902,7 +4908,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-2.3.1.tgz",
|
||||
"integrity": "sha512-NamWuMBIl8kmkJFVj8WzGatySTzQPQag4Xr677yFxdVtIxACFbL/dQowk0MzEqIKk93U1TwY3MjVU6mOcwZnKA==",
|
||||
"requires": {
|
||||
"async-eventemitter": "async-eventemitter@github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c",
|
||||
"async-eventemitter": "github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c",
|
||||
"eth-query": "^2.1.0",
|
||||
"ethereumjs-tx": "^1.3.3",
|
||||
"ethereumjs-util": "^5.1.3",
|
||||
@ -4917,7 +4923,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
|
||||
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
|
||||
"requires": {
|
||||
"ethereumjs-abi": "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
}
|
||||
},
|
||||
@ -8151,7 +8157,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
|
||||
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
|
||||
"requires": {
|
||||
"ethereumjs-abi": "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
}
|
||||
},
|
||||
@ -8199,7 +8205,7 @@
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.34",
|
||||
"websocket": "websocket@git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
|
||||
},
|
||||
"dependencies": {
|
||||
"websocket": {
|
||||
@ -8910,9 +8916,9 @@
|
||||
"integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
|
||||
"integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
|
||||
"integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
|
||||
},
|
||||
"ipfs-api": {
|
||||
"version": "21.0.0",
|
||||
@ -9033,7 +9039,7 @@
|
||||
"protons": "^1.0.1",
|
||||
"rsa-pem-to-jwk": "^1.1.3",
|
||||
"tweetnacl": "^1.0.0",
|
||||
"webcrypto-shim": "github:dignifiedquire/webcrypto-shim#master"
|
||||
"webcrypto-shim": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-sha3": {
|
||||
@ -9144,16 +9150,17 @@
|
||||
}
|
||||
},
|
||||
"ipfs-http-client": {
|
||||
"version": "30.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-30.1.1.tgz",
|
||||
"integrity": "sha512-tMqSwEhW57VnjHDBLjKKlgtAvlhkqVSR3oIFC0IiGnaM1nzcw7pbFBoHaFzl0PKIuXm40a5bJt85Rm2trYx+Ag==",
|
||||
"version": "30.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-30.1.3.tgz",
|
||||
"integrity": "sha512-NQ7WTLKUZeoKaKXrTSLAtjASRYCR0bPdsolZf16Y7Gt7o3RfiPpFF+AqvP0xbekOV3/zhFj2Qyf6ShEV4CCtsQ==",
|
||||
"requires": {
|
||||
"async": "^2.6.1",
|
||||
"bignumber.js": "^8.0.2",
|
||||
"bl": "^3.0.0",
|
||||
"bs58": "^4.0.1",
|
||||
"buffer": "^5.2.1",
|
||||
"cids": "~0.5.5",
|
||||
"concat-stream": "github:hugomrdias/concat-stream#feat/smaller",
|
||||
"concat-stream": "github:hugomrdias/concat-stream#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034",
|
||||
"debug": "^4.1.0",
|
||||
"detect-node": "^2.0.4",
|
||||
"end-of-stream": "^1.4.1",
|
||||
@ -9166,7 +9173,7 @@
|
||||
"is-ipfs": "~0.6.0",
|
||||
"is-pull-stream": "0.0.0",
|
||||
"is-stream": "^1.1.0",
|
||||
"iso-stream-http": "~0.1.1",
|
||||
"iso-stream-http": "~0.1.2",
|
||||
"iso-url": "~0.4.6",
|
||||
"just-kebab-case": "^1.1.0",
|
||||
"just-map-keys": "^1.1.0",
|
||||
@ -9175,7 +9182,7 @@
|
||||
"multibase": "~0.6.0",
|
||||
"multicodec": "~0.5.0",
|
||||
"multihashes": "~0.4.14",
|
||||
"ndjson": "github:hugomrdias/ndjson#feat/readable-stream3",
|
||||
"ndjson": "github:hugomrdias/ndjson#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11",
|
||||
"once": "^1.4.0",
|
||||
"peer-id": "~0.12.2",
|
||||
"peer-info": "~0.15.1",
|
||||
@ -10050,7 +10057,7 @@
|
||||
"protons": "^1.0.1",
|
||||
"rsa-pem-to-jwk": "^1.1.3",
|
||||
"tweetnacl": "^1.0.0",
|
||||
"webcrypto-shim": "github:dignifiedquire/webcrypto-shim#master"
|
||||
"webcrypto-shim": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8"
|
||||
},
|
||||
"dependencies": {
|
||||
"tweetnacl": {
|
||||
@ -11069,9 +11076,9 @@
|
||||
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
|
||||
},
|
||||
"p-is-promise": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.0.0.tgz",
|
||||
"integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg=="
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
|
||||
"integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg=="
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "1.3.0",
|
||||
@ -11160,9 +11167,9 @@
|
||||
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY="
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
|
||||
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "2.1.0",
|
||||
@ -11358,12 +11365,12 @@
|
||||
}
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
|
||||
"integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
|
||||
"integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
|
||||
"requires": {
|
||||
"forwarded": "~0.1.2",
|
||||
"ipaddr.js": "1.8.0"
|
||||
"ipaddr.js": "1.9.0"
|
||||
}
|
||||
},
|
||||
"prr": {
|
||||
@ -12155,9 +12162,9 @@
|
||||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.11",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.11.tgz",
|
||||
"integrity": "sha512-//sajEx/fGL3iw6fltKMdPvy8kL3kJ2O3iuYlRoT3k9Kb4BjOoZ+BZzaNHeuaruSt+Kf3Zk9tnfAQg9/AJqUVQ==",
|
||||
"version": "0.5.12",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz",
|
||||
"integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==",
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
@ -12194,9 +12201,9 @@
|
||||
}
|
||||
},
|
||||
"spdx-license-ids": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz",
|
||||
"integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g=="
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz",
|
||||
"integrity": "sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA=="
|
||||
},
|
||||
"split2": {
|
||||
"version": "2.2.0",
|
||||
@ -12706,7 +12713,7 @@
|
||||
"resolved": "https://registry.npmjs.org/web3/-/web3-0.20.7.tgz",
|
||||
"integrity": "sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==",
|
||||
"requires": {
|
||||
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git",
|
||||
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
||||
"crypto-js": "^3.1.4",
|
||||
"utf8": "^2.1.1",
|
||||
"xhr2-cookies": "^1.1.0",
|
||||
@ -13206,7 +13213,7 @@
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.34",
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible"
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
|
||||
}
|
||||
},
|
||||
"web3-shh": {
|
||||
@ -13551,7 +13558,7 @@
|
||||
"resolved": "https://registry.npmjs.org/web3/-/web3-0.16.0.tgz",
|
||||
"integrity": "sha1-pFVBdc1GKUMDWx8dOUMvdBxrYBk=",
|
||||
"requires": {
|
||||
"bignumber.js": "git+https://github.com/debris/bignumber.js.git#master",
|
||||
"bignumber.js": "git+https://github.com/debris/bignumber.js.git#c7a38de919ed75e6fb6ba38051986e294b328df9",
|
||||
"crypto-js": "^3.1.4",
|
||||
"utf8": "^2.1.1",
|
||||
"xmlhttprequest": "*"
|
||||
@ -13592,7 +13599,7 @@
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.33",
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible"
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
|
||||
},
|
||||
"dependencies": {
|
||||
"underscore": {
|
||||
@ -13806,9 +13813,9 @@
|
||||
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.0.tgz",
|
||||
"integrity": "sha512-Y05ICatFYPAfykDIB7VdwSJ0LUl1yq/BwO2OpyGGLjiRe1fgzTwVypPiWnzkGFOVFHXrCXUNBl86bpjBhZWSJg=="
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
||||
},
|
||||
"cliui": {
|
||||
"version": "4.1.0",
|
||||
|
@ -6,13 +6,14 @@
|
||||
"@aragon/os": "^4.1.0",
|
||||
"@aragon/cli": "^5.5.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"@aragon/test-helpers": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run start:aragon:ipfs",
|
||||
"start:aragon:ipfs": "aragon run",
|
||||
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
|
||||
"start:app": "",
|
||||
"test": "aragon contracts test",
|
||||
"compile": "aragon contracts compile",
|
||||
"sync-assets": "",
|
||||
"build:app": "",
|
||||
@ -21,7 +22,10 @@
|
||||
"publish:patch": "aragon apm publish patch",
|
||||
"publish:minor": "aragon apm publish minor",
|
||||
"publish:major": "aragon apm publish major",
|
||||
"versions": "aragon apm versions"
|
||||
"versions": "aragon apm versions",
|
||||
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh",
|
||||
"test": "aragon contracts test",
|
||||
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test"
|
||||
},
|
||||
"keywords": []
|
||||
}
|
||||
|
119
apps/token/test/token.js
Normal file
119
apps/token/test/token.js
Normal file
@ -0,0 +1,119 @@
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
const Token = artifacts.require("Token.sol");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Coin app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, 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()
|
||||
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())
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
root,
|
||||
dao.address,
|
||||
await dao.APP_MANAGER_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
);
|
||||
|
||||
//get new app instance from DAO
|
||||
const receipt = await dao.newAppInstance(
|
||||
'0x1234',
|
||||
(await Token.new()).address,
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
token = Token.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
)
|
||||
|
||||
//apps id
|
||||
let appsId = [];
|
||||
appsId[0] = namehash("kredits-contribution");
|
||||
appsId[1] = namehash("kredits-contributor");
|
||||
appsId[2] = namehash("kredits-proposal");
|
||||
appsId[3] = namehash("kredits-token");
|
||||
|
||||
//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 }
|
||||
)
|
||||
|
||||
});
|
||||
|
||||
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());
|
||||
assert.equal(tokenIssuerPermission, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Token issuing", async () => {
|
||||
let name = "Kredits";
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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 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("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);
|
||||
});
|
||||
});
|
||||
})
|
3183
package-lock.json
generated
3183
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,8 @@
|
||||
"deploy:apps": "./scripts/every-app.sh \"aragon apm publish major\"",
|
||||
"devchain": "aragon devchain --port 7545",
|
||||
"dao:address": "truffle exec scripts/current-address.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test:kit": "aragon contracts test --environment default"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -40,12 +41,16 @@
|
||||
"eth-provider": "^0.2.2",
|
||||
"openzeppelin-solidity": "^2.2.0",
|
||||
"promptly": "^3.0.3",
|
||||
"solc": "^0.4.25"
|
||||
"solc": "^0.4.25",
|
||||
"chai": "^4.2.0",
|
||||
"solidity-coverage": "0.5.11",
|
||||
"eth-ens-namehash": "^2.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethers": "^4.0.27",
|
||||
"ipfs-http-client": "^30.1.1",
|
||||
"kosmos-schemas": "^2.0.0",
|
||||
"rsvp": "^4.8.2",
|
||||
"tv4": "^1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -54,6 +54,13 @@ module.exports = {
|
||||
goerli: {
|
||||
network_id: 5,
|
||||
provider: providerForNetwork('goerli')
|
||||
},
|
||||
coverage: {
|
||||
host: "localhost",
|
||||
network_id: "*",
|
||||
port: 8555,
|
||||
gas: 0xffffffffff,
|
||||
gasPrice: 0x01
|
||||
}
|
||||
},
|
||||
compilers: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user