Compare commits
358
Commits
v4.0.1
...
ipfs-defaults
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
077b6fb1c1 | ||
|
|
1c097f37a6 | ||
|
|
d3fb1010d5
|
||
|
|
f390b5dff5 | ||
|
|
1e4f7be5cf
|
||
|
|
258c1cc755
|
||
|
|
f29054bc0b
|
||
|
|
fd012d5359 | ||
|
|
5da710cc14
|
||
|
|
e99184b83f
|
||
|
|
2b3fd1241d
|
||
|
|
dc2c8130f3
|
||
|
|
796ccebd84
|
||
|
|
d72413eb66
|
||
|
|
9dd9d298cc
|
||
|
|
67add71a22
|
||
|
|
cd07313679
|
||
|
|
90172071fa
|
||
|
|
de1574155c
|
||
|
|
0fc4eed09a
|
||
|
|
55877897be
|
||
|
|
59bda71f97
|
||
|
|
1521e272f9
|
||
|
|
990e2a9649
|
||
|
|
883f9adb96
|
||
|
|
550bc2b9f4
|
||
|
|
2fca436fa8 | ||
|
|
2b05be1897 | ||
|
|
46b1bbfbf2
|
||
|
|
98348dc544
|
||
|
|
fd93993a1b
|
||
|
|
0d6702fd2b
|
||
|
|
51e50e7c46
|
||
|
|
793642c238 | ||
|
|
c55593d46f
|
||
|
|
2b314556ad
|
||
|
|
53955126ff
|
||
|
|
1d1f2bb4ed | ||
|
|
42a2945692 | ||
|
|
12326ce73f | ||
|
|
18da1306b9
|
||
|
|
f6c302dd21
|
||
|
|
e3a0f0e8d3
|
||
|
|
534f68c5a9 | ||
|
|
d0fd1a3971 | ||
|
|
a8597bba8e | ||
|
|
683ec5b2e9 | ||
|
|
d93d736370
|
||
|
|
bcee608920 | ||
|
|
643bd01a78 | ||
|
|
e21fb40661 | ||
|
|
fa4583158f | ||
|
|
d46b084e2c
|
||
|
|
687040791c | ||
|
|
936115afb9 | ||
|
|
ba52e61d50 | ||
|
|
9d87636fb0 | ||
|
|
cc6b6de827 | ||
|
|
0d6dc78a58
|
||
|
|
195cd42313
|
||
|
|
1721c33620
|
||
|
|
96940716bd
|
||
|
|
ab8f632a30
|
||
|
|
9e92fbfa8f
|
||
|
|
75bcde4f49
|
||
|
|
53fafc1c78
|
||
|
|
16d5704173
|
||
|
|
23b30b7f8e
|
||
|
|
50b10dd46c
|
||
|
|
b80273b308
|
||
|
|
0fde17a4e0
|
||
|
|
ad8daa8649
|
||
|
|
d1d92c6644
|
||
|
|
53dbc1e4ad | ||
|
|
24990de42a
|
||
|
|
d52f502fd5 | ||
|
|
04fff0934d | ||
|
|
22c3a82167
|
||
|
|
f0edfa038f
|
||
|
|
8bb3f234c7 | ||
|
|
15a08fdaec | ||
|
|
0756569dc7 | ||
|
|
8a7858a0bb | ||
|
|
5e6d066e40 | ||
|
|
c3bd2b88d4 | ||
|
|
ffd4a5aeaf | ||
|
|
623cf6d6da | ||
|
|
cc9cc53d0b | ||
|
|
9bfe131cd5 | ||
|
|
8a962aea62 | ||
|
|
b81fc98740 | ||
|
|
5d4c9ba403 | ||
|
|
f5ca44d779 | ||
|
|
dd70bf77d5 | ||
|
|
63e8ce1e3f | ||
|
|
a626409221 | ||
|
|
1425c3664a | ||
|
|
c865c154a4 | ||
|
|
a63a37c5d6 | ||
|
|
20879c4c08
|
||
|
|
7ab8e4e52d | ||
|
|
f11c4f7764
|
||
|
|
44cad2d26e
|
||
|
|
357698db02 | ||
|
|
6c80179a3d
|
||
|
|
c471060cfd | ||
|
|
7418d33e63 | ||
|
|
1cfbc09e4a | ||
|
|
8984ba3802
|
||
|
|
2238ccf40e
|
||
|
|
0df7930e06 | ||
|
|
eebc0db02b | ||
|
|
b22d16e61e | ||
|
|
6bc6bcb7f6 | ||
|
|
9df58b7f9a | ||
|
|
c83a560e3b | ||
|
|
eadca6904a | ||
|
|
89829ee81f | ||
|
|
32b212f9cf
|
||
|
|
e3c03bf4a0
|
||
|
|
7dba0e4501
|
||
|
|
e6349f0594
|
||
|
|
15b47dbc42
|
||
|
|
8f0d7e5196 | ||
|
|
4add0c7d96 | ||
|
|
7ad2515b67
|
||
|
|
fbd82a442e | ||
|
|
c39fe406d0 | ||
|
|
a609d921aa | ||
|
|
23d3dd3a80 | ||
|
|
c63fcc002b
|
||
|
|
bc38dcb136 | ||
|
|
c4e7e1259e
|
||
|
|
17cc44cb98
|
||
|
|
c2dcedfe58 | ||
|
|
2c567fa71a | ||
|
|
9b4a95f375 | ||
|
|
687f87f43b | ||
|
|
7fdeb78617 | ||
|
|
19f212f283 | ||
|
|
1f248812a7 | ||
|
|
3f8407fa02 | ||
|
|
a0b0183beb | ||
|
|
2b99593699 | ||
|
|
606350eb5e | ||
|
|
a330a8eedf | ||
|
|
3c72fa3a8b | ||
|
|
a4ef2398be | ||
|
|
31c29ab6d0 | ||
|
|
ef0c0c0a39 | ||
|
|
844bdbd681 | ||
|
|
9d96824fe9 | ||
|
|
d246531cfa | ||
|
|
6be06b2e57 | ||
|
|
c2220c3654 | ||
|
|
5044d8fe41 | ||
|
|
3c49c688d2 | ||
|
|
47f59126a7 | ||
|
|
2ce5d925d0 | ||
|
|
3db89b0fa3 | ||
|
|
190d3b77d5 | ||
|
|
b7eac4202c | ||
|
|
93aeea69c6 | ||
|
|
e7700d5ec7 | ||
|
|
c3eced5c1d | ||
|
|
4c6ed12167 | ||
|
|
9431bc22a6 | ||
|
|
78c8052629 | ||
|
|
a318fe8374 | ||
|
|
eded4a811f | ||
|
|
66a37a1e74 | ||
|
|
aba4a23104 | ||
|
|
13ed02e134 | ||
|
|
48ff304861 | ||
|
|
1c1a318ae6 | ||
|
|
580d6e8f51 | ||
|
|
a572f02b2e | ||
|
|
abd4caa336 | ||
|
|
f1941eb6b8 | ||
|
|
ddeeb5ffd7 | ||
|
|
ae71691c5b | ||
|
|
819fbc547a | ||
|
|
7236b04b4b | ||
|
|
f746470cf6 | ||
|
|
5452cf2dad | ||
|
|
3c08e3ecfc | ||
|
|
6e8c994a0a | ||
|
|
fd844a00fd | ||
|
|
eb4e06edf1 | ||
|
|
4ae17aa36f | ||
|
|
e14cb0a77d | ||
|
|
d92ad83379 | ||
|
|
fa3e99d404 | ||
|
|
4aa5f3aa89 | ||
|
|
2316e8f15a | ||
|
|
87a468bc91 | ||
|
|
0734acbcbe | ||
|
|
a45c8d14be | ||
|
|
61fe9add1b | ||
|
|
16141ed482 | ||
|
|
01ef37fd39 | ||
|
|
03b9f69d22 | ||
|
|
dd76ebdc8d | ||
|
|
e485bd90c0 | ||
|
|
1d89759c49 | ||
|
|
d653b3715f | ||
|
|
a05e2c75f3 | ||
|
|
124287b977 | ||
|
|
9906fde7ef | ||
|
|
c7e1f118a6 | ||
|
|
1702c22084 | ||
|
|
32a123a825 | ||
|
|
ac83573438 | ||
|
|
77c6c11800 | ||
|
|
ca0a6f6ef9 | ||
|
|
4614c454a5 | ||
|
|
86bbe49c0b | ||
|
|
d5322530c3 | ||
|
|
011d85447f | ||
|
|
9fd9dbc1b5 | ||
|
|
b7d87cd8f2 | ||
|
|
6c8491e67b | ||
|
|
2623e71055 | ||
|
|
ed0d420fd5 | ||
|
|
36666fd417 | ||
|
|
231d6e2477 | ||
|
|
6d6c6056f0 | ||
|
|
b09c2830c8 | ||
|
|
fc5a41123a | ||
|
|
107654ecca | ||
|
|
810a2eb5fd | ||
|
|
06a4e2173a | ||
|
|
e55a209343 | ||
|
|
17bc4e7d8f | ||
|
|
4919605664 | ||
|
|
f639e3aa19 | ||
|
|
84b4461ba6 | ||
|
|
c4f8e9278e | ||
|
|
00905eb269 | ||
|
|
6a64842415 | ||
|
|
055d8bc0ef | ||
|
|
91779ccd03 | ||
|
|
516b8b31ac | ||
|
|
ccd52f6ee5 | ||
|
|
ffff09ab23 | ||
|
|
3df0831d9b | ||
|
|
27a746261c | ||
|
|
345b6bde82 | ||
|
|
a86ea08bdf | ||
|
|
e20bda73fb | ||
|
|
4c64aa7c2a | ||
|
|
cf43bf9487 | ||
|
|
1a227ba67c | ||
|
|
df7536589d | ||
|
|
f0fe62f6d7 | ||
|
|
66fc992291 | ||
|
|
2a675c9417 | ||
|
|
a3590d7c16 | ||
|
|
07a5ca847d | ||
|
|
37ce2fddde | ||
|
|
3a43284557 | ||
|
|
572848c04a | ||
|
|
b6ce9dcfc8 | ||
|
|
e7e8744ad2 | ||
|
|
d2198dca61 | ||
|
|
f9f2ef234e | ||
|
|
a1f51428d0 | ||
|
|
555cb53c78 | ||
|
|
ad74d30aa7 | ||
|
|
3568d3c141 | ||
|
|
db566a581f | ||
|
|
c69ebd0a62 | ||
|
|
5c375f764f | ||
|
|
b04d572b9a | ||
|
|
1199b053fe | ||
|
|
f06b21dfee | ||
|
|
d643e5842c | ||
|
|
a87d5326bf | ||
|
|
c9fed46054 | ||
|
|
6f2097ed46 | ||
|
|
94d342ce63 | ||
|
|
f984dec95a | ||
|
|
145b3ea766 | ||
|
|
a80dfee5c5 | ||
|
|
4649de24c8 | ||
|
|
8539b56a48 | ||
|
|
f59c37827a | ||
|
|
58db57ee45 | ||
|
|
b64a7ca299 | ||
|
|
6f09ca8d13 | ||
|
|
6f53c8097e | ||
|
|
6b2ac15f56 | ||
|
|
359989f235 | ||
|
|
5894f6323b | ||
|
|
09b78e1e8f | ||
|
|
48c8f6b9b3 | ||
|
|
542ebaf3f3 | ||
|
|
d82ffba75e | ||
|
|
bdb2cee0c4 | ||
|
|
cd45ce260f | ||
|
|
3a97983540 | ||
|
|
9714926e11 | ||
|
|
59614201b5 | ||
|
|
e591742e40 | ||
|
|
791190f5e7 | ||
|
|
24b66daf2a | ||
|
|
ad034d7712 | ||
|
|
375d8f3275 | ||
|
|
80dc787971 | ||
|
|
7967dc26f2 | ||
|
|
c248725cc1 | ||
|
|
59135bf312 | ||
|
|
1d771c43e8 | ||
|
|
3cb94fb660 | ||
|
|
5820d71b2c | ||
|
|
4771c0c8a0 | ||
|
|
2a1ae117e8 | ||
|
|
8abc7ba77f | ||
|
|
f696721918 | ||
|
|
00b58dec66 | ||
|
|
560315cbca | ||
|
|
24933f31a7 | ||
|
|
b13bf6e8b0 | ||
|
|
8dcad88372 | ||
|
|
dc6d2716aa | ||
|
|
80ad9db630 | ||
|
|
6f97c905d6 | ||
|
|
1b5f7ff95d | ||
|
|
b5b12e22ce | ||
|
|
fe811cdb12 | ||
|
|
42df6fe310 | ||
|
|
c8805be054 | ||
|
|
764f63fc8c | ||
|
|
f73ccedf42 | ||
|
|
a9093c1c40 | ||
|
|
e405644b1d | ||
|
|
f6189bf910 | ||
|
|
b6c06c289c | ||
|
|
f405e39c04 | ||
|
|
1dbf3b5742 | ||
|
|
952b5153fd | ||
|
|
d953141f52 | ||
|
|
aa57d7c70b | ||
|
|
4c0bb879e8 | ||
|
|
9c5a517fb9 | ||
|
|
b00ddda312 | ||
|
|
130e2a7797 | ||
|
|
27e5190e29 | ||
|
|
b9c171884b | ||
|
|
4d2e0ea84b | ||
|
|
26d12ba239 | ||
|
|
1aae62e139 | ||
|
|
f21c4cf9de | ||
|
|
6778b9060f | ||
|
|
4d36f78824 | ||
|
|
98ecf28262 | ||
|
|
3d24835908 | ||
|
|
dfe38e7d21 |
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
.openzeppelin
|
||||||
|
artifacts
|
||||||
|
cache
|
||||||
|
deployments
|
||||||
|
gitno
|
||||||
|
node_modules
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: setup
|
||||||
|
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||||
|
commands:
|
||||||
|
- cp -r /app/node_modules /drone/src/node_modules
|
||||||
|
- chown -R drone:drone /drone/src
|
||||||
|
- su drone -c 'npm install'
|
||||||
|
- name: lint js
|
||||||
|
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||||
|
commands:
|
||||||
|
- su drone -c 'npm run lint:wrapper'
|
||||||
|
depends_on:
|
||||||
|
- setup
|
||||||
|
# - name: lint contracts
|
||||||
|
# image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||||
|
# commands:
|
||||||
|
# - su drone -c 'npm run lint:contracts'
|
||||||
|
# depends_on:
|
||||||
|
# - setup
|
||||||
|
- name: build contracts
|
||||||
|
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||||
|
commands:
|
||||||
|
- su drone -c 'npm run devchain -- --silent' &
|
||||||
|
- sleep 5
|
||||||
|
- su drone -c 'npm run build'
|
||||||
|
depends_on:
|
||||||
|
- setup
|
||||||
|
- name: test
|
||||||
|
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||||
|
commands:
|
||||||
|
- su drone -c 'npm run devchain -- --silent' &
|
||||||
|
- sleep 5
|
||||||
|
- su drone -c 'npm test'
|
||||||
|
depends_on:
|
||||||
|
- setup
|
||||||
|
- build contracts
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/scripts/
|
||||||
|
/test/
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
module.exports = {
|
||||||
|
'env': {
|
||||||
|
'browser': true,
|
||||||
|
'es6': true,
|
||||||
|
'node': true
|
||||||
|
},
|
||||||
|
'extends': 'eslint:recommended',
|
||||||
|
'globals': {
|
||||||
|
'Atomics': 'readonly',
|
||||||
|
'SharedArrayBuffer': 'readonly'
|
||||||
|
},
|
||||||
|
'parserOptions': {
|
||||||
|
'ecmaVersion': 2018,
|
||||||
|
'sourceType': 'module'
|
||||||
|
},
|
||||||
|
'rules': {
|
||||||
|
'comma-dangle': ['error', {
|
||||||
|
arrays: 'always-multiline',
|
||||||
|
objects: 'always-multiline',
|
||||||
|
imports: 'never',
|
||||||
|
exports: 'never',
|
||||||
|
functions: 'ignore',
|
||||||
|
}],
|
||||||
|
'eol-last': ['error', 'always'],
|
||||||
|
semi: ['error', 'always'],
|
||||||
|
'space-before-function-paren': ['error', {
|
||||||
|
anonymous: 'never',
|
||||||
|
named: 'always',
|
||||||
|
asyncArrow: 'always',
|
||||||
|
}],
|
||||||
|
'indent': ['error', 2]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
template: |
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
$CHANGES
|
||||||
+8
-2
@@ -1,6 +1,12 @@
|
|||||||
build
|
|
||||||
flattened_contracts
|
|
||||||
node_modules
|
node_modules
|
||||||
**/node_modules
|
**/node_modules
|
||||||
.ganache-db
|
.ganache-db
|
||||||
.tm_properties
|
.tm_properties
|
||||||
|
yarn-error.log
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
data
|
||||||
|
|
||||||
|
cache
|
||||||
|
artifacts
|
||||||
|
.openzeppelin
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"solhint:default",
|
||||||
|
"solhint:recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"indent": "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM node:16.16
|
||||||
|
#ENV NODE_ENV=production
|
||||||
|
|
||||||
|
RUN useradd -ms /bin/bash drone
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ["package.json", "package-lock.json*", "./"]
|
||||||
|
RUN chown -R drone:drone /app
|
||||||
|
USER drone
|
||||||
|
RUN npm install
|
||||||
|
USER root
|
||||||
@@ -2,195 +2,150 @@
|
|||||||
|
|
||||||
# Kredits Contracts
|
# Kredits Contracts
|
||||||
|
|
||||||
This repository contains the Solidity smart contracts organized as
|
This repository contains the Solidity smart contracts and the JavaScript API
|
||||||
[Aragon](https://hack.aragon.org/) apps and JavaScript API wrapper for [Kosmos
|
wrapper for [Kosmos Kredits](https://wiki.kosmos.org/Kredits).
|
||||||
Kredits](https://wiki.kosmos.org/Kredits).
|
|
||||||
|
|
||||||
It is based on [aragonOS](https://hack.aragon.org/docs/aragonos-intro.html) and
|
|
||||||
follows the aragonOS conventions. Aragon itself uses the [Truffle
|
|
||||||
framework](http://truffleframework.com/) for some things.
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
#### App dependencies
|
||||||
|
|
||||||
All requirements are defined in `package.json`.
|
All requirements are defined in `package.json`.
|
||||||
|
|
||||||
$ npm install
|
$ npm install
|
||||||
|
|
||||||
Each of the aragon apps are separate packages:
|
|
||||||
|
|
||||||
$ cd apps/[app]
|
|
||||||
$ npm install
|
|
||||||
|
|
||||||
You can use `npm run install-all` to install all app dependencies at once.
|
|
||||||
|
|
||||||
### Local development chain
|
### Local development chain
|
||||||
|
|
||||||
For local development it is recommended to use
|
We use [hardhat](https://hardhat.org/) as development environment for the
|
||||||
[ganache](http://truffleframework.com/ganache/) to run a local development
|
smart contracts.
|
||||||
chain. Using the ganache simulator no full Ethereum node is required.
|
|
||||||
|
|
||||||
We use the default aragon-cli devchain command to confgure and run a local
|
To run a local development chain run:
|
||||||
development ganache.
|
|
||||||
|
|
||||||
$ npm run devchain (or aragon devchain --port 7545)
|
$ npm run devchain # or: hardhat node --network hardhat
|
||||||
|
|
||||||
To clear/reset the chain use:
|
|
||||||
|
|
||||||
$ npm run devchain -- --reset (or aragon devchain --port 7545 --reset)
|
|
||||||
|
|
||||||
We default to port 7545 for development to not get in conflict with the default
|
|
||||||
Ethereum RPC port.
|
|
||||||
|
|
||||||
### Bootstrap
|
### Bootstrap
|
||||||
|
|
||||||
1. Run an Ethereum node and ipfs
|
1. Run an Ethereum node and ipfs
|
||||||
|
|
||||||
$ npm run devchain
|
$ npm run devchain
|
||||||
$ ipfs daemon
|
$ ipfs daemon
|
||||||
|
|
||||||
2. Deploy each app to the devchain
|
2. Compile contracts and build ABIs
|
||||||
|
|
||||||
(make sure you've run `npm install` for every app - see installation)
|
(compiled artifacts will be in `/artifacts`)
|
||||||
$ npm run deploy:apps
|
$ npm run build
|
||||||
|
|
||||||
3. Deploy a new KreditsKit and create a new DAO with the latest app versions
|
3. Deploy new upgradable contract proxies
|
||||||
|
|
||||||
$ npm run deploy:kit
|
|
||||||
$ npm run deploy:dao
|
$ npm run deploy:dao
|
||||||
|
|
||||||
4. Execute seeds to create demo contributors, contributons, etc. (optional)
|
4. Execute seeds to create demo contributors, contributions, etc. (optional)
|
||||||
|
|
||||||
$ npm run seeds
|
$ npm run seeds
|
||||||
|
|
||||||
**Step 2-4 is also summarized in `npm run bootstrap`**
|
**Step 2-4 is also summarized in `npm run bootstrap`**
|
||||||
|
|
||||||
If you want to reset your local setup:
|
5. Show contract addresses
|
||||||
|
|
||||||
$ npm run reset // deploys a new kit and a new DAO
|
$ cat lib/addresses.json
|
||||||
$ npm run reset:hard // deploys all apps and does reset
|
|
||||||
|
## Fund a local development account
|
||||||
|
|
||||||
|
If you need to fund development accounts with devchain coins:
|
||||||
|
|
||||||
|
$ npm run fund # or hardhat fund --network localhost
|
||||||
|
|
||||||
## Contract architecture
|
## Contract architecture
|
||||||
|
|
||||||
Contracts are organized in independent apps (see `/apps`) and are developed and
|
We use the [OpenZeppelin hardhat
|
||||||
deployed independently. Each app has a version and can be "installed" on the
|
proxy](https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades) for
|
||||||
Kredits DAO independently.
|
deploying and managing upgradeable contracts. (see `scripts/create-proxy.js`)
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
A DAO can be deployed using the `scripts/deploy-kit.js` script or with the `npm
|
|
||||||
run deploy:dao` command. This deploys a new Kredits DAO, installs the latest
|
|
||||||
app versions and sets the required permissions.
|
|
||||||
|
|
||||||
See each app in `/apps/*` for details.
|
|
||||||
|
|
||||||
|
Each contract is independent and is connected to its dependencies by storing
|
||||||
|
the addresses of the other contracts.
|
||||||
|
|
||||||
## Helper scripts
|
## Helper scripts
|
||||||
|
|
||||||
`scripts/` contains some helper scripts to interact with the contracts from the
|
`scripts/` contains some helper scripts to interact with the contracts from the
|
||||||
CLI. _At some point these should be moved into a real nice CLI._
|
CLI. _At some point these should be moved into a real nice CLI._
|
||||||
|
|
||||||
To run these scripts use `truffle exec`. For example: `truffle exec
|
To run these scripts use `hardhat run`. For example: `hardhat run
|
||||||
scripts/add-proposal.js`.
|
scripts/list-contributors.js --network localhost`. (NOTE: add `--network
|
||||||
|
localhost` or the network you want to use)
|
||||||
|
|
||||||
Some scripts are also defined as npm script, see package.json.
|
Some scripts are also defined as npm script, see `package.json`.
|
||||||
|
|
||||||
### cli.js
|
### repl/console
|
||||||
|
|
||||||
Call any function on any contract:
|
|
||||||
|
|
||||||
$ truffle exec scripts/cli.js
|
|
||||||
|
|
||||||
### repl.js
|
|
||||||
|
|
||||||
Similar to cli.js but only provides a REPL with an initialized `kredits`
|
Similar to cli.js but only provides a REPL with an initialized `kredits`
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
$ truffle exec scripts/repl.js
|
$ hardhat console --network localhost
|
||||||
|
|
||||||
### add-{contributor, contribution, proposal}.js
|
### add-{contributor, contribution, proposal}.js
|
||||||
|
|
||||||
Script to add a new entries to the contracts using the JS wrapper
|
Script to add a new entries to the contracts using the JS wrapper
|
||||||
|
|
||||||
$ truffle exec scripts/add-{contributor, contribution, proposal}.js
|
$ hardhat run scripts/add-{contributor, contribution, proposal}.js --network localhost
|
||||||
|
|
||||||
### list-{contributor, contribution, proposal}.js
|
### list-{contributors, contributions, proposals}.js
|
||||||
|
|
||||||
List contract entries
|
List contract entries
|
||||||
|
|
||||||
$ truffle exec scripts/list-{contributor, contribution, proposal}.js
|
$ hardhat run scripts/list-{contributors, contributions, proposals}.js --network localhost
|
||||||
|
|
||||||
### send-funds.js
|
|
||||||
|
|
||||||
Sends funds to an address. Helpful in development mode to for example fund a
|
|
||||||
metamask account.
|
|
||||||
|
|
||||||
$ truffle exec scripts/send-funds.js
|
|
||||||
|
|
||||||
### seeds.js
|
### seeds.js
|
||||||
|
|
||||||
Run seeds defined in `config/seeds.js`.
|
Run seeds defined in `config/seeds.js`.
|
||||||
|
|
||||||
$ truffle exec scripts/seeds.js
|
|
||||||
or
|
|
||||||
$ npm run seeds
|
$ npm run seeds
|
||||||
|
|
||||||
### current-address.js
|
### Get the contract addresses
|
||||||
|
|
||||||
Prints all known DAO addresses and the DAO address for the current network
|
All contract addresses are stored in `lib/addresses.json`
|
||||||
|
|
||||||
$ truffle exec scripts/current-address.js
|
$ cat lib/addresses.json
|
||||||
or
|
|
||||||
$ npm run dao:address
|
|
||||||
|
|
||||||
### deploy-kit.js
|
|
||||||
|
|
||||||
Deploys a new KreditsKit that allows to create a new DAO
|
|
||||||
|
|
||||||
$ truffle exec script/deploy-kit.js
|
|
||||||
or
|
|
||||||
$ npm run deploy:kit
|
|
||||||
|
|
||||||
`ENS` address is required as environment variable.
|
|
||||||
`DAO_FACTORY` can optionally be set as environment variable. (see aragon)
|
|
||||||
|
|
||||||
### new-dao.js
|
|
||||||
|
|
||||||
Creates and configures a new DAO instance.
|
|
||||||
|
|
||||||
$ truffle exec script/new-dao.js
|
|
||||||
or
|
|
||||||
$ npm run deploy:dao
|
|
||||||
|
|
||||||
KreditsKit address is load from `lib/addresses/KreditsKit.json` or can be
|
|
||||||
configured through the `KREDITS_KIT` environment variable.
|
|
||||||
|
|
||||||
### deploy-apps.sh
|
|
||||||
|
|
||||||
Runs `npm install` for each app and publishes a new version.
|
|
||||||
|
|
||||||
$ ./scripts/deploy-apps.sh
|
|
||||||
or
|
|
||||||
$ npm run deploy:apps
|
|
||||||
|
|
||||||
## ACL / Permissions
|
|
||||||
|
|
||||||
## Upgradeable contracts
|
## Upgradeable contracts
|
||||||
|
|
||||||
We use aragonOS for upgradeablity of the different contracts. Refer to the
|
We use OpenZeppelin for an upgradeable contracts:
|
||||||
[aragonOS upgradeablity documentation](https://hack.aragon.org/docs/upgradeability-intro)
|
[https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades](https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades)
|
||||||
for more details.
|
|
||||||
|
|
||||||
### Example
|
Refer to the OpenZeppelin README and `scripts/create-proxy.js`
|
||||||
|
|
||||||
|
[OpenZeppelin Step by Step guide](https://forum.openzeppelin.com/t/openzeppelin-upgrades-step-by-step-tutorial-for-hardhat/3580)
|
||||||
|
|
||||||
|
For an upgrade example checkout `scripts/upgrade-example.js`
|
||||||
|
|
||||||
|
|
||||||
|
## Deployment to other networks
|
||||||
|
|
||||||
|
Deployable networks are configured in the `hardhat.config.js`.
|
||||||
|
|
||||||
|
To deploy to those networks provide the `--network` argument to the hardhat
|
||||||
|
commands, e.g. `--network rsk`.
|
||||||
|
|
||||||
|
Please note that some npm scripts combine multiple hardhat commands. In those
|
||||||
|
cases the hardhat commands needs to be run manually with the `--network`
|
||||||
|
argument. (=> don't use `npm run bootstrap`)
|
||||||
|
|
||||||
|
Set a `DEPLOY_KEY` environment variable with the private key (HEX) which will
|
||||||
|
be used as a root/deploy account
|
||||||
|
|
||||||
|
Typical deployment flow:
|
||||||
|
|
||||||
|
$ npm run build
|
||||||
|
$ hardhat run scripts/create-proxy.js --network rsk
|
||||||
|
# OR with deploy key:
|
||||||
|
$ DEPLOY_KEY=0xsomething hardhat run scripts/create-proxy.js --network rsk
|
||||||
|
$ # commit the new addresses in the addresses.json file if needed
|
||||||
|
|
||||||
|
To run the console on one of the non localhost networks you can also just pass
|
||||||
|
on the --network argument.
|
||||||
|
|
||||||
|
$ hardhat console --network rsk
|
||||||
|
|
||||||
1. Setup (see #Bootstrap)
|
|
||||||
1. Deploy each contract/apps (see `/apps/*`)
|
|
||||||
2. Create a new DAO (see scripts/deploy-kit.js)
|
|
||||||
2. Update
|
|
||||||
1. Deploy a new Version of the contract/app (see `/apps/*`)
|
|
||||||
2. Use the `aragon dao upgrade` command to "install" the new version for the DAO
|
|
||||||
(`aragon dao upgrade <DAO address> <app name>`)
|
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
.cache
|
|
||||||
dist
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Git files
|
|
||||||
.gitignore
|
|
||||||
|
|
||||||
# Build files
|
|
||||||
.cache
|
|
||||||
node_modules
|
|
||||||
build
|
|
||||||
|
|
||||||
# Lock files
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
|
|
||||||
# Others
|
|
||||||
test
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Kredits Contribution
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"name": "Add contributions",
|
|
||||||
"id": "ADD_CONTRIBUTION_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Manage token contract",
|
|
||||||
"id": "MANAGE_TOKEN_CONTRACT_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Veto contributions",
|
|
||||||
"id": "VETO_CONTRIBUTION_ROLE",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environments": {
|
|
||||||
"default": {
|
|
||||||
"network": "development",
|
|
||||||
"appName": "kredits-contribution.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"rinkeby": {
|
|
||||||
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
|
|
||||||
"appName": "kredits-contribution.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
|
|
||||||
"network": "rinkeby"
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
|
|
||||||
"appName": "contribution.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
|
|
||||||
"network": "mainnet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path": "contracts/Contribution.sol"
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
contract Migrations {
|
|
||||||
address public owner;
|
|
||||||
uint public last_completed_migration;
|
|
||||||
|
|
||||||
modifier restricted() {
|
|
||||||
if (msg.sender == owner) _;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
owner = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCompleted(uint completed) public restricted {
|
|
||||||
last_completed_migration = completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function upgrade(address new_address) public restricted {
|
|
||||||
Migrations upgraded = Migrations(new_address);
|
|
||||||
upgraded.setCompleted(last_completed_migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Contribution",
|
|
||||||
"description": "Kredits contribution app"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Migrations = artifacts.require('./Migrations.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Migrations)
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Contribution = artifacts.require('Contribution.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Contribution)
|
|
||||||
}
|
|
||||||
Generated
-13977
File diff suppressed because it is too large.
Load diff
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "kredits-contribution",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"dependencies": {
|
|
||||||
"@aragon/os": "^4.1.0",
|
|
||||||
"@aragon/cli": "^5.5.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {},
|
|
||||||
"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": "npm run sync-assets && npm run build:script -- --no-minify && parcel serve app/index.html -p 8001 --out-dir dist/ --no-cache",
|
|
||||||
"test": "aragon contracts test",
|
|
||||||
"compile": "aragon contracts compile",
|
|
||||||
"sync-assets": "copy-aragon-ui-assets -n aragon-ui ./dist",
|
|
||||||
"build:app": "",
|
|
||||||
"build:script": "",
|
|
||||||
"build": "",
|
|
||||||
"publish:patch": "aragon apm publish patch",
|
|
||||||
"publish:minor": "aragon apm publish minor",
|
|
||||||
"publish:major": "aragon apm publish major",
|
|
||||||
"versions": "aragon apm versions"
|
|
||||||
},
|
|
||||||
"keywords": []
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
const CounterApp = artifacts.require('Contribution.sol')
|
|
||||||
|
|
||||||
contract('Contribution', (accounts) => {
|
|
||||||
it('should be tested')
|
|
||||||
})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = require("../../truffle.js");
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
.cache
|
|
||||||
dist
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Git files
|
|
||||||
.gitignore
|
|
||||||
|
|
||||||
# Build files
|
|
||||||
.cache
|
|
||||||
node_modules
|
|
||||||
build
|
|
||||||
|
|
||||||
# Lock files
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
|
|
||||||
# Others
|
|
||||||
test
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Kredits Contributor
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"name": "Manage contributors",
|
|
||||||
"id": "MANAGE_CONTRIBUTORS_ROLE",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environments": {
|
|
||||||
"default": {
|
|
||||||
"network": "development",
|
|
||||||
"appName": "kredits-contributor.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"rinkeby": {
|
|
||||||
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
|
|
||||||
"appName": "kredits-contributor.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
|
|
||||||
"network": "rinkeby"
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
|
|
||||||
"appName": "contributor.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
|
|
||||||
"network": "mainnet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path": "contracts/Contributor.sol"
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
|
||||||
import "@aragon/os/contracts/kernel/IKernel.sol";
|
|
||||||
|
|
||||||
interface ITokenBalance {
|
|
||||||
function balanceOf(address contributorAccount) public view returns (uint256);
|
|
||||||
}
|
|
||||||
|
|
||||||
contract Contributor is AragonApp {
|
|
||||||
bytes32 public constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
|
|
||||||
bytes32 public constant MANAGE_CONTRIBUTORS_ROLE = keccak256("MANAGE_CONTRIBUTORS_ROLE");
|
|
||||||
|
|
||||||
struct Contributor {
|
|
||||||
address account;
|
|
||||||
bytes32 hashDigest;
|
|
||||||
uint8 hashFunction;
|
|
||||||
uint8 hashSize;
|
|
||||||
bool exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
mapping (address => uint32) public contributorIds;
|
|
||||||
mapping (uint32 => Contributor) public contributors;
|
|
||||||
uint32 public contributorsCount;
|
|
||||||
|
|
||||||
// ensure alphabetic order
|
|
||||||
enum Apps { Contribution, Contributor, Proposal, Token }
|
|
||||||
bytes32[4] public appIds;
|
|
||||||
|
|
||||||
event ContributorProfileUpdated(uint32 id, bytes32 oldHashDigest, bytes32 newHashDigest); // what should be logged
|
|
||||||
event ContributorAccountUpdated(uint32 id, address oldAccount, address newAccount);
|
|
||||||
event ContributorAdded(uint32 id, address account);
|
|
||||||
|
|
||||||
function initialize(address root,bytes32[4] _appIds) public onlyInit {
|
|
||||||
appIds = _appIds;
|
|
||||||
|
|
||||||
initialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTokenContract() public view returns (address) {
|
|
||||||
IKernel k = IKernel(kernel());
|
|
||||||
|
|
||||||
return k.getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[uint8(Apps.Token)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function coreContributorsCount() view public returns (uint32) {
|
|
||||||
uint32 count = 0;
|
|
||||||
for (uint32 i = 1; i <= contributorsCount; i++) {
|
|
||||||
if (isCoreTeam(i)) {
|
|
||||||
count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateContributorAccount(uint32 id, address oldAccount, address newAccount) public auth(MANAGE_CONTRIBUTORS_ROLE) {
|
|
||||||
contributorIds[oldAccount] = 0;
|
|
||||||
contributorIds[newAccount] = id;
|
|
||||||
contributors[id].account = newAccount;
|
|
||||||
ContributorAccountUpdated(id, oldAccount, newAccount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateContributorProfileHash(uint32 id, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(MANAGE_CONTRIBUTORS_ROLE) {
|
|
||||||
Contributor storage c = contributors[id];
|
|
||||||
bytes32 oldHashDigest = c.hashDigest;
|
|
||||||
c.hashDigest = hashDigest;
|
|
||||||
c.hashFunction = hashFunction;
|
|
||||||
c.hashSize = hashSize;
|
|
||||||
|
|
||||||
ContributorProfileUpdated(id, oldHashDigest, c.hashDigest);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addContributor(address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(MANAGE_CONTRIBUTORS_ROLE) {
|
|
||||||
require(!addressExists(account));
|
|
||||||
uint32 _id = contributorsCount + 1;
|
|
||||||
assert(!contributors[_id].exists); // this can not be acually
|
|
||||||
Contributor storage c = contributors[_id];
|
|
||||||
c.exists = true;
|
|
||||||
c.hashDigest = hashDigest;
|
|
||||||
c.hashFunction = hashFunction;
|
|
||||||
c.hashSize = hashSize;
|
|
||||||
c.account = account;
|
|
||||||
contributorIds[account] = _id;
|
|
||||||
|
|
||||||
contributorsCount += 1;
|
|
||||||
emit ContributorAdded(_id, account);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCoreTeam(uint32 id) view public returns (bool) {
|
|
||||||
// TODO: for simplicity we simply define the first contributors as core
|
|
||||||
// later this needs to be changed to something more dynamic
|
|
||||||
return id < 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
function exists(uint32 id) view public returns (bool) {
|
|
||||||
return contributors[id].exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addressIsCore(address account) view public returns (bool) {
|
|
||||||
uint32 id = getContributorIdByAddress(account);
|
|
||||||
return isCoreTeam(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addressExists(address account) view public returns (bool) {
|
|
||||||
return getContributorByAddress(account).exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributorIdByAddress(address account) view public returns (uint32) {
|
|
||||||
return contributorIds[account];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributorAddressById(uint32 id) view public returns (address) {
|
|
||||||
return contributors[id].account;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributorByAddress(address account) internal view returns (Contributor) {
|
|
||||||
uint32 id = contributorIds[account];
|
|
||||||
return contributors[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributorById(uint32 _id) public view returns (uint32 id, address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, bool isCore, uint256 balance, bool exists ) {
|
|
||||||
id = _id;
|
|
||||||
Contributor storage c = contributors[_id];
|
|
||||||
account = c.account;
|
|
||||||
hashDigest = c.hashDigest;
|
|
||||||
hashFunction = c.hashFunction;
|
|
||||||
hashSize = c.hashSize;
|
|
||||||
isCore = isCoreTeam(id);
|
|
||||||
address token = getTokenContract();
|
|
||||||
balance = ITokenBalance(token).balanceOf(c.account);
|
|
||||||
exists = c.exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
function canPerform(address _who, address _where, bytes32 _what/*, uint256[] memory _how*/) public returns (bool) {
|
|
||||||
address sender = _who;
|
|
||||||
if (sender == address(-1)) {
|
|
||||||
sender = tx.origin;
|
|
||||||
}
|
|
||||||
// _what == keccak256('VOTE_PROPOSAL_ROLE')
|
|
||||||
if (_what == 0xd61216798314d2fc33e42ff2021d66707b1e38517d3f7166798a9d3a196a9c96) {
|
|
||||||
return contributorIds[sender] != uint256(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return addressIsCore(sender);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
contract Migrations {
|
|
||||||
address public owner;
|
|
||||||
uint public last_completed_migration;
|
|
||||||
|
|
||||||
modifier restricted() {
|
|
||||||
if (msg.sender == owner) _;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
owner = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCompleted(uint completed) public restricted {
|
|
||||||
last_completed_migration = completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function upgrade(address new_address) public restricted {
|
|
||||||
Migrations upgraded = Migrations(new_address);
|
|
||||||
upgraded.setCompleted(last_completed_migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Contributor",
|
|
||||||
"description": "Kredits Contributor app"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Migrations = artifacts.require('./Migrations.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Migrations)
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Contributor = artifacts.require('Contributor.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Contributor)
|
|
||||||
}
|
|
||||||
Generated
-13977
File diff suppressed because it is too large.
Load diff
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "kredits-contributor",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"dependencies": {
|
|
||||||
"@aragon/os": "^4.1.0",
|
|
||||||
"@aragon/cli": "^5.5.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {},
|
|
||||||
"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": "",
|
|
||||||
"build:script": "",
|
|
||||||
"build": "",
|
|
||||||
"publish:patch": "aragon apm publish patch",
|
|
||||||
"publish:minor": "aragon apm publish minor",
|
|
||||||
"publish:major": "aragon apm publish major",
|
|
||||||
"versions": "aragon apm versions"
|
|
||||||
},
|
|
||||||
"keywords": []
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
const CounterApp = artifacts.require('CounterApp.sol')
|
|
||||||
|
|
||||||
contract('CounterApp', (accounts) => {
|
|
||||||
it('should be tested')
|
|
||||||
})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = require("../../truffle.js");
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Kredits Proposal
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"name": "Add proposal",
|
|
||||||
"id": "ADD_PROPOSAL_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Vote proposals",
|
|
||||||
"id": "VOTE_PROPOSAL_ROLE",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environments": {
|
|
||||||
"default": {
|
|
||||||
"network": "development",
|
|
||||||
"appName": "kredits-proposal.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"rinkeby": {
|
|
||||||
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
|
|
||||||
"appName": "kredits-proposal.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
|
|
||||||
"network": "rinkeby"
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
|
|
||||||
"appName": "proposal.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
|
|
||||||
"network": "mainnet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path": "contracts/Proposal.sol"
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
|
||||||
import "@aragon/os/contracts/kernel/IKernel.sol";
|
|
||||||
|
|
||||||
interface IContributor {
|
|
||||||
function getContributorAddressById(uint32 contributorId) public view returns (address);
|
|
||||||
function getContributorIdByAddress(address contributorAccount) public view returns (uint32);
|
|
||||||
function exists(uint32 contributorId) public view returns (bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IContribution {
|
|
||||||
function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public;
|
|
||||||
}
|
|
||||||
|
|
||||||
contract Proposal is AragonApp {
|
|
||||||
|
|
||||||
bytes32 public constant ADD_PROPOSAL_ROLE = keccak256("ADD_PROPOSAL_ROLE");
|
|
||||||
bytes32 public constant VOTE_PROPOSAL_ROLE = keccak256("VOTE_PROPOSAL_ROLE");
|
|
||||||
|
|
||||||
bytes32 public constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
|
|
||||||
// ensure alphabetic order
|
|
||||||
enum Apps { Contribution, Contributor, Proposal, Token }
|
|
||||||
bytes32[4] public appIds;
|
|
||||||
|
|
||||||
struct Proposal {
|
|
||||||
address creatorAccount;
|
|
||||||
uint32 contributorId;
|
|
||||||
uint16 votesCount;
|
|
||||||
uint16 votesNeeded;
|
|
||||||
uint32 amount;
|
|
||||||
bool executed;
|
|
||||||
bytes32 hashDigest;
|
|
||||||
uint8 hashFunction;
|
|
||||||
uint8 hashSize;
|
|
||||||
uint32[] voterIds;
|
|
||||||
mapping (uint32 => bool) votes;
|
|
||||||
bool exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
mapping(uint32 => Proposal) public proposals;
|
|
||||||
uint32 public proposalsCount;
|
|
||||||
|
|
||||||
event ProposalCreated(uint32 id, address creatorAccount, uint32 contributorId, uint32 amount);
|
|
||||||
|
|
||||||
event ProposalVoted(uint32 id, uint32 voterId, uint16 totalVotes);
|
|
||||||
event ProposalExecuted(uint32 id, uint32 contributorId, uint32 amount);
|
|
||||||
|
|
||||||
function initialize(bytes32[4] _appIds) public onlyInit {
|
|
||||||
appIds = _appIds;
|
|
||||||
initialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributorContract() public view returns (address) {
|
|
||||||
return IKernel(kernel()).getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[uint8(Apps.Contributor)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContributionContract() public view returns (address) {
|
|
||||||
return IKernel(kernel()).getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[uint8(Apps.Contribution)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addProposal(uint32 contributorId, uint32 amount, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_PROPOSAL_ROLE) {
|
|
||||||
require(IContributor(getContributorContract()).exists(contributorId), 'CONTRIBUTOR_NOT_FOUND');
|
|
||||||
|
|
||||||
uint32 proposalId = proposalsCount + 1;
|
|
||||||
uint16 _votesNeeded = 1; //contributorsContract().coreContributorsCount() / 100 * 75;
|
|
||||||
|
|
||||||
Proposal storage p = proposals[proposalId];
|
|
||||||
p.creatorAccount = msg.sender;
|
|
||||||
p.contributorId = contributorId;
|
|
||||||
p.amount = amount;
|
|
||||||
p.hashDigest = hashDigest;
|
|
||||||
p.hashFunction = hashFunction;
|
|
||||||
p.hashSize = hashSize;
|
|
||||||
p.votesCount = 0;
|
|
||||||
p.votesNeeded = _votesNeeded;
|
|
||||||
p.exists = true;
|
|
||||||
|
|
||||||
proposalsCount++;
|
|
||||||
emit ProposalCreated(proposalId, msg.sender, p.contributorId, p.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getProposal(uint32 proposalId) public view returns (uint32 id, address creatorAccount, uint32 contributorId, uint16 votesCount, uint16 votesNeeded, uint32 amount, bool executed, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint32[] voterIds, bool exists) {
|
|
||||||
id = proposalId;
|
|
||||||
Proposal storage p = proposals[id];
|
|
||||||
return (
|
|
||||||
id,
|
|
||||||
p.creatorAccount,
|
|
||||||
p.contributorId,
|
|
||||||
p.votesCount,
|
|
||||||
p.votesNeeded,
|
|
||||||
p.amount,
|
|
||||||
p.executed,
|
|
||||||
p.hashDigest,
|
|
||||||
p.hashFunction,
|
|
||||||
p.hashSize,
|
|
||||||
p.voterIds,
|
|
||||||
p.exists
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function vote(uint32 proposalId) public isInitialized auth(VOTE_PROPOSAL_ROLE) {
|
|
||||||
Proposal storage p = proposals[proposalId];
|
|
||||||
require(!p.executed, 'ALREADY_EXECUTED');
|
|
||||||
uint32 voterId = IContributor(getContributorContract()).getContributorIdByAddress(msg.sender);
|
|
||||||
require(p.votes[voterId] != true, 'ALREADY_VOTED');
|
|
||||||
p.voterIds.push(voterId);
|
|
||||||
p.votes[voterId] = true;
|
|
||||||
|
|
||||||
p.votesCount++;
|
|
||||||
if (p.votesCount >= p.votesNeeded) {
|
|
||||||
executeProposal(proposalId);
|
|
||||||
}
|
|
||||||
emit ProposalVoted(proposalId, voterId, p.votesCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function batchVote(uint32[] _proposalIds) public isInitialized auth(VOTE_PROPOSAL_ROLE) {
|
|
||||||
for (uint32 i = 0; i < _proposalIds.length; i++) {
|
|
||||||
vote(_proposalIds[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function executeProposal(uint32 proposalId) private {
|
|
||||||
Proposal storage p = proposals[proposalId];
|
|
||||||
require(!p.executed, 'ALREADY_EXECUTED');
|
|
||||||
require(p.votesCount >= p.votesNeeded, 'MISSING_VOTES');
|
|
||||||
|
|
||||||
p.executed = true;
|
|
||||||
IContribution(getContributionContract()).add(p.amount, p.contributorId, p.hashDigest, p.hashFunction, p.hashSize);
|
|
||||||
emit ProposalExecuted(proposalId, p.contributorId, p.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
contract Migrations {
|
|
||||||
address public owner;
|
|
||||||
uint public last_completed_migration;
|
|
||||||
|
|
||||||
modifier restricted() {
|
|
||||||
if (msg.sender == owner) _;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
owner = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCompleted(uint completed) public restricted {
|
|
||||||
last_completed_migration = completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function upgrade(address new_address) public restricted {
|
|
||||||
Migrations upgraded = Migrations(new_address);
|
|
||||||
upgraded.setCompleted(last_completed_migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Proposal",
|
|
||||||
"description": "Kredits proposal app"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Migrations = artifacts.require('./Migrations.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Migrations)
|
|
||||||
}
|
|
||||||
Generated
-13977
File diff suppressed because it is too large.
Load diff
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "kredits-proposal",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"dependencies": {
|
|
||||||
"@aragon/os": "^4.1.0",
|
|
||||||
"@aragon/cli": "^5.5.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {},
|
|
||||||
"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": "",
|
|
||||||
"build:script": "",
|
|
||||||
"build": "",
|
|
||||||
"publish:patch": "aragon apm publish patch",
|
|
||||||
"publish:minor": "aragon apm publish minor",
|
|
||||||
"publish:major": "aragon apm publish major",
|
|
||||||
"versions": "aragon apm versions"
|
|
||||||
},
|
|
||||||
"keywords": []
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = require("../../truffle.js");
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
.cache
|
|
||||||
dist
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Git files
|
|
||||||
.gitignore
|
|
||||||
|
|
||||||
# Build files
|
|
||||||
.cache
|
|
||||||
node_modules
|
|
||||||
build
|
|
||||||
|
|
||||||
# Lock files
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
|
|
||||||
# Others
|
|
||||||
test
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Kredits Token
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"name": "Mint token",
|
|
||||||
"id": "MINT_TOKEN_ROLE",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environments": {
|
|
||||||
"default": {
|
|
||||||
"network": "development",
|
|
||||||
"appName": "kredits-token.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"rinkeby": {
|
|
||||||
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
|
|
||||||
"appName": "kredits-token.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
|
|
||||||
"network": "rinkeby"
|
|
||||||
},
|
|
||||||
"mainnet": {
|
|
||||||
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
|
|
||||||
"appName": "kredits-token.open.aragonpm.eth",
|
|
||||||
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
|
|
||||||
"network": "mainnet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path": "contracts/Token.sol"
|
|
||||||
}
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/lib/math/SafeMath.sol";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* beause ERC20.sol conflicts with the aragon ERC20.sol this is copied and modified from:
|
|
||||||
* https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20.sol
|
|
||||||
* @title Standard ERC20 token
|
|
||||||
*
|
|
||||||
* @dev Implementation of the basic standard token.
|
|
||||||
* https://eips.ethereum.org/EIPS/eip-20
|
|
||||||
* Originally based on code by FirstBlood:
|
|
||||||
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
|
|
||||||
*
|
|
||||||
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
|
|
||||||
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
|
|
||||||
* compliant implementations may not do it.
|
|
||||||
*/
|
|
||||||
contract ERC20Token {
|
|
||||||
using SafeMath for uint256;
|
|
||||||
|
|
||||||
mapping (address => uint256) public _balances;
|
|
||||||
|
|
||||||
mapping (address => mapping (address => uint256)) private _allowed;
|
|
||||||
|
|
||||||
uint256 public _totalSupply;
|
|
||||||
|
|
||||||
string public name;
|
|
||||||
string public symbol;
|
|
||||||
uint8 public decimals;
|
|
||||||
|
|
||||||
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
||||||
|
|
||||||
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Total number of tokens in existence
|
|
||||||
*/
|
|
||||||
function totalSupply() public view returns (uint256) {
|
|
||||||
return _totalSupply;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Gets the balance of the specified address.
|
|
||||||
* @param owner The address to query the balance of.
|
|
||||||
* @return A uint256 representing the amount owned by the passed address.
|
|
||||||
*/
|
|
||||||
function balanceOf(address owner) public view returns (uint256) {
|
|
||||||
return _balances[owner];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Function to check the amount of tokens that an owner allowed to a spender.
|
|
||||||
* @param owner address The address which owns the funds.
|
|
||||||
* @param spender address The address which will spend the funds.
|
|
||||||
* @return A uint256 specifying the amount of tokens still available for the spender.
|
|
||||||
*/
|
|
||||||
function allowance(address owner, address spender) public view returns (uint256) {
|
|
||||||
return _allowed[owner][spender];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Transfer token to a specified address
|
|
||||||
* @param to The address to transfer to.
|
|
||||||
* @param value The amount to be transferred.
|
|
||||||
*/
|
|
||||||
function transfer(address to, uint256 value) public returns (bool) {
|
|
||||||
_transfer(msg.sender, to, value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
|
|
||||||
* Beware that changing an allowance with this method brings the risk that someone may use both the old
|
|
||||||
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
|
|
||||||
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
|
|
||||||
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
|
|
||||||
* @param spender The address which will spend the funds.
|
|
||||||
* @param value The amount of tokens to be spent.
|
|
||||||
*/
|
|
||||||
function approve(address spender, uint256 value) public returns (bool) {
|
|
||||||
_approve(msg.sender, spender, value);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Transfer tokens from one address to another.
|
|
||||||
* Note that while this function emits an Approval event, this is not required as per the specification,
|
|
||||||
* and other compliant implementations may not emit the event.
|
|
||||||
* @param from address The address which you want to send tokens from
|
|
||||||
* @param to address The address which you want to transfer to
|
|
||||||
* @param value uint256 the amount of tokens to be transferred
|
|
||||||
*/
|
|
||||||
function transferFrom(address from, address to, uint256 value) public returns (bool) {
|
|
||||||
_transfer(from, to, value);
|
|
||||||
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Increase the amount of tokens that an owner allowed to a spender.
|
|
||||||
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
|
|
||||||
* allowed value is better to use this function to avoid 2 calls (and wait until
|
|
||||||
* the first transaction is mined)
|
|
||||||
* From MonolithDAO Token.sol
|
|
||||||
* Emits an Approval event.
|
|
||||||
* @param spender The address which will spend the funds.
|
|
||||||
* @param addedValue The amount of tokens to increase the allowance by.
|
|
||||||
*/
|
|
||||||
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
|
|
||||||
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Decrease the amount of tokens that an owner allowed to a spender.
|
|
||||||
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
|
|
||||||
* allowed value is better to use this function to avoid 2 calls (and wait until
|
|
||||||
* the first transaction is mined)
|
|
||||||
* From MonolithDAO Token.sol
|
|
||||||
* Emits an Approval event.
|
|
||||||
* @param spender The address which will spend the funds.
|
|
||||||
* @param subtractedValue The amount of tokens to decrease the allowance by.
|
|
||||||
*/
|
|
||||||
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
|
|
||||||
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Transfer token for a specified addresses
|
|
||||||
* @param from The address to transfer from.
|
|
||||||
* @param to The address to transfer to.
|
|
||||||
* @param value The amount to be transferred.
|
|
||||||
*/
|
|
||||||
function _transfer(address from, address to, uint256 value) internal {
|
|
||||||
require(to != address(0));
|
|
||||||
|
|
||||||
_balances[from] = _balances[from].sub(value);
|
|
||||||
_balances[to] = _balances[to].add(value);
|
|
||||||
emit Transfer(from, to, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Internal function that mints an amount of the token and assigns it to
|
|
||||||
* an account. This encapsulates the modification of balances such that the
|
|
||||||
* proper events are emitted.
|
|
||||||
* @param account The account that will receive the created tokens.
|
|
||||||
* @param value The amount that will be created.
|
|
||||||
*/
|
|
||||||
function _mint(address account, uint256 value) internal {
|
|
||||||
require(account != address(0), 'invalid address');
|
|
||||||
|
|
||||||
_totalSupply = _totalSupply.add(value);
|
|
||||||
_balances[account] = _balances[account].add(value);
|
|
||||||
emit Transfer(address(0), account, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Approve an address to spend another addresses' tokens.
|
|
||||||
* @param owner The address that owns the tokens.
|
|
||||||
* @param spender The address that will spend the tokens.
|
|
||||||
* @param value The number of tokens that can be spent.
|
|
||||||
*/
|
|
||||||
function _approve(address owner, address spender, uint256 value) internal {
|
|
||||||
require(spender != address(0));
|
|
||||||
require(owner != address(0));
|
|
||||||
|
|
||||||
_allowed[owner][spender] = value;
|
|
||||||
emit Approval(owner, spender, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
|
||||||
import "./ERC20Token.sol";
|
|
||||||
|
|
||||||
contract Token is ERC20Token, AragonApp {
|
|
||||||
bytes32 public constant MINT_TOKEN_ROLE = keccak256("MINT_TOKEN_ROLE");
|
|
||||||
|
|
||||||
// ensure alphabetic order
|
|
||||||
enum Apps { Contribution, Contributor, Proposal, Token }
|
|
||||||
bytes32[4] public appIds;
|
|
||||||
|
|
||||||
event LogMint(address indexed recipient, uint256 amount, uint32 contributionId);
|
|
||||||
|
|
||||||
function initialize(bytes32[4] _appIds) public onlyInit {
|
|
||||||
appIds = _appIds;
|
|
||||||
initialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
function mintFor(address contributorAccount, uint256 amount, uint32 contributionId) public isInitialized auth(MINT_TOKEN_ROLE) {
|
|
||||||
_mint(contributorAccount, amount);
|
|
||||||
emit LogMint(contributorAccount, amount, contributionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pragma solidity ^0.4.24;
|
|
||||||
|
|
||||||
contract Migrations {
|
|
||||||
address public owner;
|
|
||||||
uint public last_completed_migration;
|
|
||||||
|
|
||||||
modifier restricted() {
|
|
||||||
if (msg.sender == owner) _;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() public {
|
|
||||||
owner = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCompleted(uint completed) public restricted {
|
|
||||||
last_completed_migration = completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function upgrade(address new_address) public restricted {
|
|
||||||
Migrations upgraded = Migrations(new_address);
|
|
||||||
upgraded.setCompleted(last_completed_migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Token",
|
|
||||||
"description": "Kredits token app"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Migrations = artifacts.require('./Migrations.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Migrations)
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
var Token = artifacts.require('Token.sol')
|
|
||||||
|
|
||||||
module.exports = function (deployer) {
|
|
||||||
deployer.deploy(Token)
|
|
||||||
}
|
|
||||||
Generated
-13977
File diff suppressed because it is too large.
Load diff
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "kredits-token",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"dependencies": {
|
|
||||||
"@aragon/os": "^4.1.0",
|
|
||||||
"@aragon/cli": "^5.5.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {},
|
|
||||||
"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": "",
|
|
||||||
"build:script": "",
|
|
||||||
"build": "",
|
|
||||||
"publish:patch": "aragon apm publish patch",
|
|
||||||
"publish:minor": "aragon apm publish minor",
|
|
||||||
"publish:major": "aragon apm publish major",
|
|
||||||
"versions": "aragon apm versions"
|
|
||||||
},
|
|
||||||
"keywords": []
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
const CounterApp = artifacts.require('CounterApp.sol')
|
|
||||||
|
|
||||||
contract('CounterApp', (accounts) => {
|
|
||||||
it('should be tested')
|
|
||||||
})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
module.exports = require("../../truffle.js");
|
|
||||||
-60
@@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"name": "Add contributions",
|
|
||||||
"id": "ADD_CONTRIBUTION_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Veto contributions",
|
|
||||||
"id": "VETO_CONTRIBUTION_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Manage contributors",
|
|
||||||
"id": "MANAGE_CONTRIBUTORS_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Mint token",
|
|
||||||
"id": "MINT_TOKEN_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Add proposal",
|
|
||||||
"id": "ADD_PROPOSAL_ROLE",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Vote proposal",
|
|
||||||
"id": "VOTE_PROPOSAL_ROLE",
|
|
||||||
"params": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"environments": {
|
|
||||||
"development": {
|
|
||||||
"network": "development",
|
|
||||||
"apm": "aragonpm.eth",
|
|
||||||
"registry": "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1",
|
|
||||||
"appName": "dummy.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"rinkeby": {
|
|
||||||
"network": "rinkeby",
|
|
||||||
"registry": "0x98Df287B6C145399Aaa709692c8D308357bC085D",
|
|
||||||
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
|
|
||||||
"daoFactory": "0x2298d27a9b847c681d2b2c2828ab9d79013f5f1d",
|
|
||||||
"appName": "dummy.open.aragonpm.eth",
|
|
||||||
"apm": "open.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"kovan": {
|
|
||||||
"network": "kovan",
|
|
||||||
"appName": "dummy.aragonpm.eth"
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"network": "development",
|
|
||||||
"appName": "dummy.aragonpm.eth",
|
|
||||||
"apm": "open.aragonpm.eth"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"path": "contracts/misc/DummyApp.sol"
|
|
||||||
}
|
|
||||||
+48
-10
@@ -1,16 +1,54 @@
|
|||||||
const contractCalls = [
|
const contractCalls = [
|
||||||
['Contributor', 'add', [{ account: '0x7e8f313c56f809188313aa274fa67ee58c31515d', name: 'bumi', isCore: true, kind: 'person', url: '', github_username: 'bumi', github_uid: 318, wiki_username: 'bumi' }, { gasLimit: 200000 }]],
|
['Contributor', 'add', [{
|
||||||
['Contributor', 'add', [{ account: '0x49575f3DD9a0d60aE661BC992f72D837A77f05Bc', name: 'raucao', isCore: true, kind: 'person', url: '', github_username: 'skddc', github_uid: 842, wiki_username: 'raucau' }, { gasLimit: 200000 }]],
|
account: '0x7e8f313c56f809188313aa274fa67ee58c31515d',
|
||||||
['Proposal', 'addProposal', [{ contributorId: 1, amount: 500, kind: 'code', description: '[67P/kredits-contracts] Ran the seeds', url: '' }, { gasLimit: 350000 }]],
|
name: 'bumi',
|
||||||
['Proposal', 'addProposal', [{ contributorId: 2, amount: 500, kind: 'code', description: '[67P/kredits-contracts] Ran the seeds', url: '' }, { gasLimit: 350000 }]],
|
kind: 'person',
|
||||||
['Proposal', 'addProposal', [{ contributorId: 2, amount: 500, kind: 'code', description: '[67P/kredits-contracts] Hacked on kredits', url: '' }, { gasLimit: 350000 }]],
|
url: '',
|
||||||
['Proposal', 'vote', [1, { gasLimit: 550000 }]],
|
github_username: 'bumi',
|
||||||
['Contribution', 'addContribution', [{ contributorId: 1, amount: 5000, kind: 'dev', description: '[67P/kredits-contracts] Introduce contribution token', url: '' }, { gasLimit: 350000 }]],
|
github_uid: 318,
|
||||||
['Contribution', 'addContribution', [{ contributorId: 2, amount: 1500, kind: 'dev', description: '[67P/kredits-web] Reviewed stuff', url: '' }, { gasLimit: 350000 }]],
|
gitea_username: 'bumi',
|
||||||
['Contribution', 'claim', [1, { gasLimit: 300000 }]]
|
wiki_username: 'Bumi',
|
||||||
|
}, { gasLimit: 200000 }]],
|
||||||
|
|
||||||
|
['Contributor', 'add', [{
|
||||||
|
account: '0x49575f3DD9a0d60aE661BC992f72D837A77f05Bc',
|
||||||
|
name: 'raucao',
|
||||||
|
kind: 'person',
|
||||||
|
url: '',
|
||||||
|
github_username: 'skddc',
|
||||||
|
github_uid: 842,
|
||||||
|
gitea_username: 'raucao',
|
||||||
|
wiki_username: 'Basti',
|
||||||
|
}, { gasLimit: 200000 }]],
|
||||||
|
|
||||||
|
['Contributor', 'add', [{
|
||||||
|
account: '0xF722709ECC3B05c19d02E82a2a4A4021B8F48C62',
|
||||||
|
name: 'Manuel',
|
||||||
|
kind: 'person',
|
||||||
|
url: '',
|
||||||
|
github_username: 'fsmanuel',
|
||||||
|
github_uid: 54812,
|
||||||
|
wiki_username: 'Manuel',
|
||||||
|
}, { gasLimit: 200000 }]],
|
||||||
|
|
||||||
|
['Contribution', 'add', [{ contributorId: 1, contributorIpfsHash: 'QmWKCYGr2rSf6abUPaTYqf98urvoZxGrb7dbspFZA6oyVF', date: '2019-04-11', amount: 500, kind: 'dev', description: '[67P/kredits-contracts] Test this thing', url: '' }, { gasLimit: 350000 }]],
|
||||||
|
['Contribution', 'add', [{ contributorId: 2, contributorIpfsHash: 'QmcHzEeAM26HV2zHTf5HnZrCtCtGdEccL5kUtDakAB7ozB', date: '2019-04-11', amount: 1500, kind: 'dev', description: '[67P/kredits-web] Reviewed stuff', url: '' }, { gasLimit: 350000 }]],
|
||||||
|
['Contribution', 'add', [{ contributorId: 1, contributorIpfsHash: 'QmWKCYGr2rSf6abUPaTYqf98urvoZxGrb7dbspFZA6oyVF', date: '2019-04-11', amount: 1500, kind: 'dev', description: '[67P/kredits-contracts] Add tests', url: '' }, { gasLimit: 350000 }]],
|
||||||
|
['Contribution', 'add', [{ contributorId: 1, contributorIpfsHash: 'QmWKCYGr2rSf6abUPaTYqf98urvoZxGrb7dbspFZA6oyVF', date: '2019-04-11', amount: 1500, kind: 'dev', description: '[67P/kredits-contracts] Introduce contribution token', url: '' }, { gasLimit: 350000 }]],
|
||||||
|
['Contribution', 'add', [{ contributorId: 2, contributorIpfsHash: 'QmcHzEeAM26HV2zHTf5HnZrCtCtGdEccL5kUtDakAB7ozB', date: '2019-04-11', amount: 5000, kind: 'dev', description: '[67P/kredits-web] Expense UI, first draft', url: '' }, { gasLimit: 350000 }]],
|
||||||
|
|
||||||
|
['Reimbursement', 'add', [{amount: 1116000, recipientId: 1, token: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', expenses: [
|
||||||
|
{ title: 'Server rent', description: 'Dedicated server: andromeda.kosmos.org, April 2020', amount: 61, currency: 'EUR', date: '2020-05-28' },
|
||||||
|
{ title: 'Server rent', description: 'Dedicated server: centaurus.kosmos.org, April 2020', amount: 32, currency: 'EUR', date: '2020-05-28' }
|
||||||
|
]}, { gasLimit: 300000 }]],
|
||||||
|
['Reimbursement', 'add', [{amount: 166800, recipientId: 2, token: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', expenses: [
|
||||||
|
{ title: 'Domain kosmos.chat', description: 'Yearly registration fee for domain kosmos.chat', amount: 13.90, currency: 'EUR', date: '2020-05-30' }
|
||||||
|
]}, { gasLimit: 300000 }]],
|
||||||
];
|
];
|
||||||
|
|
||||||
const funds = [
|
const funds = [
|
||||||
'0x7e8f313c56f809188313aa274fa67ee58c31515d',
|
'0x7e8f313c56f809188313aa274fa67ee58c31515d',
|
||||||
'0xa502eb4021f3b9ab62f75b57a94e1cfbf81fd827'
|
'0xa502eb4021f3b9ab62f75b57a94e1cfbf81fd827',
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = { contractCalls, funds };
|
module.exports = { contractCalls, funds };
|
||||||
@@ -1,33 +1,21 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
||||||
import "@aragon/os/contracts/kernel/IKernel.sol";
|
|
||||||
|
|
||||||
interface IToken {
|
|
||||||
function mintFor(address contributorAccount, uint256 amount, uint32 contributionId) public;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ContributorInterface {
|
interface ContributorInterface {
|
||||||
function getContributorAddressById(uint32 contributorId) public view returns (address);
|
function getContributorAddressById(uint32 contributorId) external view returns (address);
|
||||||
function getContributorIdByAddress(address contributorAccount) public view returns (uint32);
|
function getContributorIdByAddress(address contributorAccount) external view returns (uint32);
|
||||||
|
function addressIsCore(address sender) external view returns (bool);
|
||||||
// TODO Maybe use for validation
|
// TODO Maybe use for validation
|
||||||
// function exists(uint32 contributorId) public view returns (bool);
|
// function exists(uint32 contributorId) public view returns (bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract Contribution is AragonApp {
|
contract Contribution is Initializable {
|
||||||
bytes32 public constant ADD_CONTRIBUTION_ROLE = keccak256("ADD_CONTRIBUTION_ROLE");
|
ContributorInterface public contributorContract;
|
||||||
bytes32 public constant VETO_CONTRIBUTION_ROLE = keccak256("VETO_CONTRIBUTION_ROLE");
|
|
||||||
|
|
||||||
bytes32 public constant KERNEL_APP_ADDR_NAMESPACE = 0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb;
|
|
||||||
|
|
||||||
// ensure alphabetic order
|
|
||||||
enum Apps { Contribution, Contributor, Proposal, Token }
|
|
||||||
bytes32[4] public appIds;
|
|
||||||
|
|
||||||
struct ContributionData {
|
struct ContributionData {
|
||||||
uint32 contributorId;
|
uint32 contributorId;
|
||||||
uint32 amount;
|
uint32 amount;
|
||||||
bool claimed;
|
|
||||||
bytes32 hashDigest;
|
bytes32 hashDigest;
|
||||||
uint8 hashFunction;
|
uint8 hashFunction;
|
||||||
uint8 hashSize;
|
uint8 hashSize;
|
||||||
@@ -48,47 +36,60 @@ contract Contribution is AragonApp {
|
|||||||
mapping(uint32 => ContributionData) public contributions;
|
mapping(uint32 => ContributionData) public contributions;
|
||||||
uint32 public contributionsCount;
|
uint32 public contributionsCount;
|
||||||
|
|
||||||
|
// Confirmation veto period
|
||||||
uint32 public blocksToWait;
|
uint32 public blocksToWait;
|
||||||
|
|
||||||
|
// The address that deployed the contract
|
||||||
|
address public deployer;
|
||||||
|
|
||||||
|
// Data migration flag
|
||||||
|
bool public migrationDone;
|
||||||
|
|
||||||
event ContributionAdded(uint32 id, uint32 indexed contributorId, uint32 amount);
|
event ContributionAdded(uint32 id, uint32 indexed contributorId, uint32 amount);
|
||||||
event ContributionClaimed(uint32 id, uint32 indexed contributorId, uint32 amount);
|
|
||||||
event ContributionVetoed(uint32 id, address vetoedByAccount);
|
event ContributionVetoed(uint32 id, address vetoedByAccount);
|
||||||
|
|
||||||
function initialize(bytes32[4] _appIds) public onlyInit {
|
modifier onlyCore {
|
||||||
appIds = _appIds;
|
require(contributorContract.addressIsCore(tx.origin), "Core only");
|
||||||
blocksToWait = 40320; // 7 days; 15 seconds block time
|
_;
|
||||||
initialized();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO refactor into a single function
|
modifier onlyDeployer {
|
||||||
function getTokenContract() public view returns (address) {
|
require(msg.sender == deployer, "Deployer only");
|
||||||
IKernel k = IKernel(kernel());
|
_;
|
||||||
return k.getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[uint8(Apps.Token)]);
|
|
||||||
}
|
}
|
||||||
function getContributorContract() public view returns (address) {
|
|
||||||
IKernel k = IKernel(kernel());
|
function initialize(uint32 blocksToWait_) public initializer {
|
||||||
return k.getApp(KERNEL_APP_ADDR_NAMESPACE, appIds[uint8(Apps.Contributor)]);
|
deployer = msg.sender;
|
||||||
|
migrationDone = false;
|
||||||
|
blocksToWait = blocksToWait_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishMigration() public onlyDeployer {
|
||||||
|
migrationDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContributorContract(address contributor) public {
|
||||||
|
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
|
||||||
|
contributorContract = ContributorInterface(contributor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContributorIdByAddress(address contributorAccount) public view returns (uint32) {
|
function getContributorIdByAddress(address contributorAccount) public view returns (uint32) {
|
||||||
address contributor = getContributorContract();
|
return contributorContract.getContributorIdByAddress(contributorAccount);
|
||||||
return ContributorInterface(contributor).getContributorIdByAddress(contributorAccount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContributorAddressById(uint32 contributorId) public view returns (address) {
|
function getContributorAddressById(uint32 contributorId) public view returns (address) {
|
||||||
address contributor = getContributorContract();
|
return contributorContract.getContributorAddressById(contributorId);
|
||||||
return ContributorInterface(contributor).getContributorAddressById(contributorId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Token standard functions (ERC 721)
|
// Token standard functions (ERC 721)
|
||||||
//
|
//
|
||||||
|
|
||||||
function name() external view returns (string) {
|
function name() external view returns (string memory) {
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function symbol() external view returns (string) {
|
function symbol() external view returns (string memory) {
|
||||||
return symbol_;
|
return symbol_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ contract Contribution is AragonApp {
|
|||||||
return ownedContributions[contributorId][index];
|
return ownedContributions[contributorId][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
function tokenMetadata(uint32 contributionId) public view returns (string) {
|
function tokenMetadata(uint32 contributionId) public view returns (string memory) {
|
||||||
return contributions[contributionId].tokenMetadataURL;
|
return contributions[contributionId].tokenMetadataURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,14 +119,33 @@ contract Contribution is AragonApp {
|
|||||||
// Custom functions
|
// Custom functions
|
||||||
//
|
//
|
||||||
|
|
||||||
function getContribution(uint32 contributionId) public view returns (uint32 id, uint32 contributorId, uint32 amount, bool claimed, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool exists, bool vetoed) {
|
function totalKreditsEarned(bool confirmedOnly) public view returns (uint32 amount) {
|
||||||
|
for (uint32 i = 1; i <= contributionsCount; i++) {
|
||||||
|
ContributionData memory c = contributions[i];
|
||||||
|
if (!c.vetoed && (block.number >= c.confirmedAtBlock || !confirmedOnly)) {
|
||||||
|
amount += c.amount; // should use safemath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function totalKreditsEarnedByContributor(uint32 contributorId, bool confirmedOnly) public view returns (uint32 amount) {
|
||||||
|
uint256 tokenCount = ownedContributions[contributorId].length;
|
||||||
|
for (uint256 i = 0; i < tokenCount; i++) {
|
||||||
|
uint32 cId = ownedContributions[contributorId][i];
|
||||||
|
ContributionData memory c = contributions[cId];
|
||||||
|
if (!c.vetoed && (block.number >= c.confirmedAtBlock || !confirmedOnly)) {
|
||||||
|
amount += c.amount; // should use safemath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContribution(uint32 contributionId) public view returns (uint32 id, uint32 contributorId, uint32 amount, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool exists, bool vetoed) {
|
||||||
id = contributionId;
|
id = contributionId;
|
||||||
ContributionData storage c = contributions[id];
|
ContributionData storage c = contributions[id];
|
||||||
return (
|
return (
|
||||||
id,
|
id,
|
||||||
c.contributorId,
|
c.contributorId,
|
||||||
c.amount,
|
c.amount,
|
||||||
c.claimed,
|
|
||||||
c.hashDigest,
|
c.hashDigest,
|
||||||
c.hashFunction,
|
c.hashFunction,
|
||||||
c.hashSize,
|
c.hashSize,
|
||||||
@@ -135,23 +155,29 @@ contract Contribution is AragonApp {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_CONTRIBUTION_ROLE) {
|
function add(uint32 amount, uint32 contributorId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool vetoed) public {
|
||||||
//require(canPerform(msg.sender, ADD_CONTRIBUTION_ROLE, new uint32[](0)), 'nope');
|
// require(canPerform(msg.sender, ADD_CONTRIBUTION_ROLE, new uint32[](0)), 'nope');
|
||||||
|
// TODO hubot neither has kredits nor a core account
|
||||||
|
require((confirmedAtBlock == 0 && vetoed == false) || migrationDone == false, 'extra arguments during migration only');
|
||||||
|
require(balanceOf(msg.sender) > 0 || contributorContract.addressIsCore(msg.sender), 'requires kredits or core status');
|
||||||
|
|
||||||
uint32 contributionId = contributionsCount + 1;
|
uint32 contributionId = contributionsCount + 1;
|
||||||
ContributionData storage c = contributions[contributionId];
|
ContributionData storage c = contributions[contributionId];
|
||||||
c.exists = true;
|
c.exists = true;
|
||||||
c.amount = amount;
|
c.amount = amount;
|
||||||
c.claimed = false;
|
|
||||||
c.contributorId = contributorId;
|
c.contributorId = contributorId;
|
||||||
c.hashDigest = hashDigest;
|
c.hashDigest = hashDigest;
|
||||||
c.hashFunction = hashFunction;
|
c.hashFunction = hashFunction;
|
||||||
c.hashSize = hashSize;
|
c.hashSize = hashSize;
|
||||||
if (contributionId < 10) {
|
|
||||||
c.confirmedAtBlock = block.number;
|
if (confirmedAtBlock > 0) {
|
||||||
|
c.confirmedAtBlock = confirmedAtBlock;
|
||||||
} else {
|
} else {
|
||||||
c.confirmedAtBlock = block.number + blocksToWait;
|
c.confirmedAtBlock = block.number + 1 + blocksToWait;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vetoed) { c.vetoed = true; }
|
||||||
|
|
||||||
contributionsCount++;
|
contributionsCount++;
|
||||||
|
|
||||||
contributionOwner[contributionId] = contributorId;
|
contributionOwner[contributionId] = contributorId;
|
||||||
@@ -160,32 +186,16 @@ contract Contribution is AragonApp {
|
|||||||
emit ContributionAdded(contributionId, contributorId, amount);
|
emit ContributionAdded(contributionId, contributorId, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function veto(uint32 contributionId) public isInitialized auth(VETO_CONTRIBUTION_ROLE) {
|
function veto(uint32 contributionId) public onlyCore {
|
||||||
ContributionData storage c = contributions[contributionId];
|
ContributionData storage c = contributions[contributionId];
|
||||||
require(c.exists, 'NOT_FOUND');
|
require(c.exists, 'NOT_FOUND');
|
||||||
require(!c.claimed, 'ALREADY_CLAIMED');
|
|
||||||
require(block.number < c.confirmedAtBlock, 'VETO_PERIOD_ENDED');
|
require(block.number < c.confirmedAtBlock, 'VETO_PERIOD_ENDED');
|
||||||
c.vetoed = true;
|
c.vetoed = true;
|
||||||
|
|
||||||
emit ContributionVetoed(contributionId, msg.sender);
|
emit ContributionVetoed(contributionId, msg.sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
function claim(uint32 contributionId) public isInitialized {
|
function exists(uint32 contributionId) public view returns (bool) {
|
||||||
ContributionData storage c = contributions[contributionId];
|
|
||||||
require(c.exists, 'NOT_FOUND');
|
|
||||||
require(!c.claimed, 'ALREADY_CLAIMED');
|
|
||||||
require(!c.vetoed, 'VETOED');
|
|
||||||
require(block.number >= c.confirmedAtBlock, 'NOT_CLAIMABLE');
|
|
||||||
|
|
||||||
c.claimed = true;
|
|
||||||
address token = getTokenContract();
|
|
||||||
address contributorAccount = getContributorAddressById(c.contributorId);
|
|
||||||
uint256 amount = uint256(c.amount);
|
|
||||||
IToken(token).mintFor(contributorAccount, amount, contributionId);
|
|
||||||
emit ContributionClaimed(contributionId, c.contributorId, c.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
function exists(uint32 contributionId) view public returns (bool) {
|
|
||||||
return contributions[contributionId].exists;
|
return contributions[contributionId].exists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
||||||
|
|
||||||
|
interface IToken {
|
||||||
|
function mintFor(address contributorAccount, uint256 amount) external;
|
||||||
|
function balanceOf(address contributorAccount) external view returns (uint256);
|
||||||
|
}
|
||||||
|
interface IContributionBalance {
|
||||||
|
function totalKreditsEarnedByContributor(uint32 contributorId, bool confirmedOnly) external view returns (uint32 amount);
|
||||||
|
function balanceOf(address owner) external view returns (uint256);
|
||||||
|
}
|
||||||
|
|
||||||
|
contract Contributor is Initializable {
|
||||||
|
address public deployer;
|
||||||
|
IContributionBalance public contributionContract;
|
||||||
|
IToken public tokenContract;
|
||||||
|
|
||||||
|
struct Contributor {
|
||||||
|
address account;
|
||||||
|
bytes32 hashDigest;
|
||||||
|
uint8 hashFunction;
|
||||||
|
uint8 hashSize;
|
||||||
|
bool exists;
|
||||||
|
uint32 kreditsWithdrawn;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapping (address => uint32) public contributorIds;
|
||||||
|
mapping (uint32 => Contributor) public contributors;
|
||||||
|
uint32 public contributorsCount;
|
||||||
|
|
||||||
|
event ContributorProfileUpdated(uint32 id, bytes32 oldHashDigest, bytes32 newHashDigest); // what should be logged
|
||||||
|
event ContributorAccountUpdated(uint32 id, address oldAccount, address newAccount);
|
||||||
|
event ContributorAdded(uint32 id, address account);
|
||||||
|
|
||||||
|
modifier onlyCore {
|
||||||
|
require(addressIsCore(tx.origin), "Core only");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyContributors {
|
||||||
|
require(addressExists(msg.sender) && contributionContract.balanceOf(msg.sender) > 0, "Contributors only");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialize() public initializer {
|
||||||
|
deployer = msg.sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContributionContract(address contribution) public onlyCore {
|
||||||
|
require(address(contributionContract) == address(0) || addressIsCore(msg.sender), "Core only");
|
||||||
|
contributionContract = IContributionBalance(contribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTokenContract(address token) public onlyCore {
|
||||||
|
require(address(tokenContract) == address(0) || addressIsCore(msg.sender), "Core only");
|
||||||
|
tokenContract = IToken(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
function coreContributorsCount() public view returns (uint32) {
|
||||||
|
uint32 count = 0;
|
||||||
|
for (uint32 i = 1; i <= contributorsCount; i++) {
|
||||||
|
if (isCoreTeam(i)) {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateContributorAccount(uint32 id, address oldAccount, address newAccount) public onlyCore {
|
||||||
|
require(newAccount != address(0), "invalid new account address");
|
||||||
|
require(getContributorAddressById(id) == oldAccount, "contributor does not exist");
|
||||||
|
|
||||||
|
contributorIds[oldAccount] = 0;
|
||||||
|
contributorIds[newAccount] = id;
|
||||||
|
contributors[id].account = newAccount;
|
||||||
|
emit ContributorAccountUpdated(id, oldAccount, newAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateContributorProfileHash(uint32 id, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public onlyCore {
|
||||||
|
Contributor storage c = contributors[id];
|
||||||
|
bytes32 oldHashDigest = c.hashDigest;
|
||||||
|
c.hashDigest = hashDigest;
|
||||||
|
c.hashFunction = hashFunction;
|
||||||
|
c.hashSize = hashSize;
|
||||||
|
|
||||||
|
ContributorProfileUpdated(id, oldHashDigest, c.hashDigest);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addContributor(address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public onlyCore {
|
||||||
|
require(!addressExists(account), "Address already in use");
|
||||||
|
uint32 _id = contributorsCount + 1;
|
||||||
|
assert(!contributors[_id].exists); // this can not be acually
|
||||||
|
Contributor storage c = contributors[_id];
|
||||||
|
c.exists = true;
|
||||||
|
c.hashDigest = hashDigest;
|
||||||
|
c.hashFunction = hashFunction;
|
||||||
|
c.hashSize = hashSize;
|
||||||
|
c.account = account;
|
||||||
|
c.kreditsWithdrawn = 0;
|
||||||
|
contributorIds[account] = _id;
|
||||||
|
|
||||||
|
contributorsCount += 1;
|
||||||
|
emit ContributorAdded(_id, account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCoreTeam(uint32 id) view public returns (bool) {
|
||||||
|
// TODO: for simplicity we simply define the first contributors as core
|
||||||
|
// later this needs to be changed to something more dynamic
|
||||||
|
return id > 0 && id < 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exists(uint32 id) view public returns (bool) {
|
||||||
|
return contributors[id].exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addressIsCore(address account) view public returns (bool) {
|
||||||
|
// the deployer is always core
|
||||||
|
if(account == deployer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
uint32 id = getContributorIdByAddress(account);
|
||||||
|
return isCoreTeam(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addressExists(address account) view public returns (bool) {
|
||||||
|
return getContributorByAddress(account).exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorIdByAddress(address account) view public returns (uint32) {
|
||||||
|
return contributorIds[account];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorAddressById(uint32 id) view public returns (address) {
|
||||||
|
return contributors[id].account;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorByAddress(address account) internal view returns (Contributor memory) {
|
||||||
|
uint32 id = contributorIds[account];
|
||||||
|
return contributors[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorById(uint32 _id) view public returns (uint32 id, address account, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, bool isCore, uint256 balance, uint32 totalKreditsEarned, uint256 contributionsCount, bool exists, uint256 kreditsWithdrawn) {
|
||||||
|
id = _id;
|
||||||
|
Contributor storage c = contributors[_id];
|
||||||
|
account = c.account;
|
||||||
|
hashDigest = c.hashDigest;
|
||||||
|
hashFunction = c.hashFunction;
|
||||||
|
hashSize = c.hashSize;
|
||||||
|
isCore = isCoreTeam(id);
|
||||||
|
balance = tokenContract.balanceOf(c.account);
|
||||||
|
totalKreditsEarned = contributionContract.totalKreditsEarnedByContributor(_id, true);
|
||||||
|
contributionsCount = contributionContract.balanceOf(c.account);
|
||||||
|
exists = c.exists;
|
||||||
|
kreditsWithdrawn = c.kreditsWithdrawn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function withdraw() public onlyContributors {
|
||||||
|
uint32 id = getContributorIdByAddress(msg.sender);
|
||||||
|
Contributor storage c = contributors[id];
|
||||||
|
|
||||||
|
// TODO check if we need a failsafe for unconfirmed or malicious txs
|
||||||
|
uint32 confirmedKredits = contributionContract.totalKreditsEarnedByContributor(id, true);
|
||||||
|
uint32 amountWithdrawable = confirmedKredits - c.kreditsWithdrawn;
|
||||||
|
require (amountWithdrawable > 0, "No kredits available");
|
||||||
|
|
||||||
|
c.kreditsWithdrawn += amountWithdrawable;
|
||||||
|
tokenContract.mintFor(msg.sender, amountWithdrawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
pragma solidity 0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
|
||||||
import "@aragon/os/contracts/kernel/Kernel.sol";
|
|
||||||
import "@aragon/os/contracts/acl/ACL.sol";
|
|
||||||
|
|
||||||
import "@aragon/kits-base/contracts/KitBase.sol";
|
|
||||||
|
|
||||||
import "../apps/contribution/contracts/Contribution.sol";
|
|
||||||
import "../apps/contributor/contracts/Contributor.sol";
|
|
||||||
import "../apps/token/contracts/Token.sol";
|
|
||||||
import "../apps/proposal/contracts/Proposal.sol";
|
|
||||||
|
|
||||||
contract KreditsKit is KitBase {
|
|
||||||
|
|
||||||
// ensure alphabetic order
|
|
||||||
enum Apps { Contribution, Contributor, Proposal, Token }
|
|
||||||
bytes32[4] public appIds;
|
|
||||||
|
|
||||||
event DeployInstance(address dao);
|
|
||||||
event InstalledApp(address dao, address appProxy, bytes32 appId);
|
|
||||||
|
|
||||||
constructor (DAOFactory _fac, ENS _ens, bytes32[4] _appIds) public KitBase(_fac, _ens) {
|
|
||||||
appIds = _appIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
function newInstance() public returns (Kernel dao) {
|
|
||||||
address root = msg.sender;
|
|
||||||
dao = fac.newDAO(this);
|
|
||||||
ACL acl = ACL(dao.acl());
|
|
||||||
|
|
||||||
acl.createPermission(this, dao, dao.APP_MANAGER_ROLE(), this);
|
|
||||||
|
|
||||||
Contributor contributor = Contributor(_installApp(dao, appIds[uint8(Apps.Contributor)]));
|
|
||||||
contributor.initialize(root, appIds);
|
|
||||||
acl.createPermission(root, contributor, contributor.MANAGE_CONTRIBUTORS_ROLE(), this);
|
|
||||||
|
|
||||||
Token token = Token(_installApp(dao, appIds[uint8(Apps.Token)]));
|
|
||||||
token.initialize(appIds);
|
|
||||||
|
|
||||||
Contribution contribution = Contribution(_installApp(dao, appIds[uint8(Apps.Contribution)]));
|
|
||||||
contribution.initialize(appIds);
|
|
||||||
|
|
||||||
Proposal proposal = Proposal(_installApp(dao, appIds[uint8(Apps.Proposal)]));
|
|
||||||
proposal.initialize(appIds);
|
|
||||||
|
|
||||||
acl.createPermission(root, contribution, contribution.ADD_CONTRIBUTION_ROLE(), this);
|
|
||||||
acl.createPermission(root, contribution, contribution.VETO_CONTRIBUTION_ROLE(), this);
|
|
||||||
acl.grantPermission(proposal, contribution, contribution.ADD_CONTRIBUTION_ROLE());
|
|
||||||
|
|
||||||
uint256[] memory params = new uint256[](1);
|
|
||||||
params[0] = uint256(203) << 248 | uint256(1) << 240 | uint240(contributor);
|
|
||||||
acl.grantPermissionP(acl.ANY_ENTITY(), contribution, contribution.ADD_CONTRIBUTION_ROLE(), params);
|
|
||||||
acl.grantPermissionP(acl.ANY_ENTITY(), contribution, contribution.VETO_CONTRIBUTION_ROLE(), params);
|
|
||||||
acl.grantPermissionP(acl.ANY_ENTITY(), contributor, contributor.MANAGE_CONTRIBUTORS_ROLE(), params);
|
|
||||||
|
|
||||||
//acl.setPermissionManager(this, proposal, proposal.VOTE_PROPOSAL_ROLE();
|
|
||||||
acl.createPermission(root, proposal, proposal.VOTE_PROPOSAL_ROLE(), this);
|
|
||||||
acl.grantPermissionP(acl.ANY_ENTITY(), proposal, proposal.VOTE_PROPOSAL_ROLE(), params);
|
|
||||||
|
|
||||||
acl.createPermission(root, proposal, proposal.ADD_PROPOSAL_ROLE(), this);
|
|
||||||
//acl.grantPermissionP(address(-1), proposal, proposal.ADD_PROPOSAL_ROLE(), params);
|
|
||||||
acl.grantPermission(acl.ANY_ENTITY(), proposal, proposal.ADD_PROPOSAL_ROLE());
|
|
||||||
|
|
||||||
acl.setPermissionManager(root, proposal, proposal.VOTE_PROPOSAL_ROLE());
|
|
||||||
acl.setPermissionManager(root, proposal, proposal.ADD_PROPOSAL_ROLE());
|
|
||||||
acl.setPermissionManager(root, contribution, contribution.ADD_CONTRIBUTION_ROLE());
|
|
||||||
acl.setPermissionManager(root, contribution, contribution.VETO_CONTRIBUTION_ROLE());
|
|
||||||
acl.setPermissionManager(root, contributor, contributor.MANAGE_CONTRIBUTORS_ROLE());
|
|
||||||
|
|
||||||
acl.createPermission(root, token, token.MINT_TOKEN_ROLE(), this);
|
|
||||||
acl.grantPermission(contribution, token, token.MINT_TOKEN_ROLE());
|
|
||||||
acl.setPermissionManager(root, token, token.MINT_TOKEN_ROLE());
|
|
||||||
|
|
||||||
|
|
||||||
cleanupDAOPermissions(dao, acl, root);
|
|
||||||
|
|
||||||
emit DeployInstance(dao);
|
|
||||||
return dao;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _installApp(Kernel _dao, bytes32 _appId) internal returns (AragonApp) {
|
|
||||||
address baseAppAddress = latestVersionAppBase(_appId);
|
|
||||||
require(baseAppAddress != address(0), "App should be deployed");
|
|
||||||
AragonApp appProxy = AragonApp(_dao.newAppInstance(_appId, baseAppAddress, new bytes(0), true));
|
|
||||||
|
|
||||||
emit InstalledApp(_dao, appProxy, _appId);
|
|
||||||
return appProxy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
||||||
|
|
||||||
|
interface ContributorInterface {
|
||||||
|
function getContributorAddressById(uint32 contributorId) external view returns (address);
|
||||||
|
function getContributorIdByAddress(address contributorAccount) external view returns (uint32);
|
||||||
|
function addressIsCore(address sender) external view returns (bool);
|
||||||
|
// TODO Maybe use for validation
|
||||||
|
// function exists(uint32 contributorId) public view returns (bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
contract Reimbursement is Initializable {
|
||||||
|
ContributorInterface public contributorContract;
|
||||||
|
|
||||||
|
struct ReimbursementData {
|
||||||
|
uint32 recipientId;
|
||||||
|
uint256 amount;
|
||||||
|
address token;
|
||||||
|
bytes32 hashDigest;
|
||||||
|
uint8 hashFunction;
|
||||||
|
uint8 hashSize;
|
||||||
|
uint256 confirmedAtBlock;
|
||||||
|
bool vetoed;
|
||||||
|
bool exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapping(uint32 => ReimbursementData) public reimbursements;
|
||||||
|
uint32 public reimbursementsCount;
|
||||||
|
|
||||||
|
uint32 public blocksToWait;
|
||||||
|
|
||||||
|
event ReimbursementAdded(uint32 id, address indexed addedByAccount, uint256 amount);
|
||||||
|
event ReimbursementVetoed(uint32 id, address vetoedByAccount);
|
||||||
|
|
||||||
|
function initialize() public initializer {
|
||||||
|
blocksToWait = 40320; // 7 days; 15 seconds block time
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyCore {
|
||||||
|
require(contributorContract.addressIsCore(tx.origin), "Core only");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContributorContract(address contributor) public {
|
||||||
|
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
|
||||||
|
contributorContract = ContributorInterface(contributor);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorIdByAddress(address contributorAccount) public view returns (uint32) {
|
||||||
|
return contributorContract.getContributorIdByAddress(contributorAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContributorAddressById(uint32 contributorId) public view returns (address) {
|
||||||
|
return contributorContract.getContributorAddressById(contributorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function totalAmount(bool confirmedOnly) public view returns (uint256 amount) {
|
||||||
|
for (uint32 i = 1; i <= reimbursementsCount; i++) {
|
||||||
|
ReimbursementData memory r = reimbursements[i];
|
||||||
|
if (!r.vetoed && (block.number >= r.confirmedAtBlock || !confirmedOnly)) {
|
||||||
|
amount += r.amount; // should use safemath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get(uint32 reimbursementId) public view returns (uint32 id, uint32 recipientId, uint256 amount, address token, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize, uint256 confirmedAtBlock, bool exists, bool vetoed) {
|
||||||
|
id = reimbursementId;
|
||||||
|
ReimbursementData storage r = reimbursements[id];
|
||||||
|
return (
|
||||||
|
id,
|
||||||
|
r.recipientId,
|
||||||
|
r.amount,
|
||||||
|
r.token,
|
||||||
|
r.hashDigest,
|
||||||
|
r.hashFunction,
|
||||||
|
r.hashSize,
|
||||||
|
r.confirmedAtBlock,
|
||||||
|
r.exists,
|
||||||
|
r.vetoed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(uint256 amount, address token, uint32 recipientId, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public onlyCore {
|
||||||
|
uint32 reimbursementId = reimbursementsCount + 1;
|
||||||
|
ReimbursementData storage r = reimbursements[reimbursementId];
|
||||||
|
r.exists = true;
|
||||||
|
r.amount = amount;
|
||||||
|
r.token = token;
|
||||||
|
r.recipientId = recipientId;
|
||||||
|
r.hashDigest = hashDigest;
|
||||||
|
r.hashFunction = hashFunction;
|
||||||
|
r.hashSize = hashSize;
|
||||||
|
r.confirmedAtBlock = block.number + blocksToWait;
|
||||||
|
|
||||||
|
reimbursementsCount++;
|
||||||
|
|
||||||
|
emit ReimbursementAdded(reimbursementId, msg.sender, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function veto(uint32 reimbursementId) public onlyCore {
|
||||||
|
ReimbursementData storage r = reimbursements[reimbursementId];
|
||||||
|
require(r.exists, 'NOT_FOUND');
|
||||||
|
require(block.number < r.confirmedAtBlock, 'VETO_PERIOD_ENDED');
|
||||||
|
r.vetoed = true;
|
||||||
|
|
||||||
|
emit ReimbursementVetoed(reimbursementId, msg.sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exists(uint32 reimbursementId) public view returns (bool) {
|
||||||
|
return reimbursements[reimbursementId].exists;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
pragma solidity ^0.8.0;
|
||||||
|
|
||||||
|
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
|
||||||
|
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
|
||||||
|
|
||||||
|
interface ContributorInterface {
|
||||||
|
function getContributorAddressById(uint32 contributorId) external view returns (address);
|
||||||
|
function getContributorIdByAddress(address contributorAccount) external view returns (uint32);
|
||||||
|
function addressIsCore(address sender) external view returns (bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
contract Token is Initializable, ERC20Upgradeable {
|
||||||
|
ContributorInterface public contributorContract;
|
||||||
|
using SafeMathUpgradeable for uint256;
|
||||||
|
|
||||||
|
address public contributorContractAddress;
|
||||||
|
|
||||||
|
event KreditsMinted(address indexed recipient, uint256 amount);
|
||||||
|
|
||||||
|
function initialize() public virtual initializer {
|
||||||
|
__ERC20_init("Kredits", "KS");
|
||||||
|
}
|
||||||
|
|
||||||
|
function decimals() public view virtual override returns (uint8) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContributorContract(address contributor) public {
|
||||||
|
require(address(contributorContract) == address(0) || contributorContract.addressIsCore(msg.sender), "Core only");
|
||||||
|
contributorContract = ContributorInterface(contributor);
|
||||||
|
contributorContractAddress = contributor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mintFor(address contributorAccount, uint256 amount) public {
|
||||||
|
require(contributorContractAddress == msg.sender, "Only Contributor");
|
||||||
|
require(amount > 0, "INVALID_AMOUNT");
|
||||||
|
|
||||||
|
_mint(contributorAccount, amount);
|
||||||
|
emit KreditsMinted(contributorAccount, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
pragma solidity 0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apm/APMNamehash.sol";
|
|
||||||
|
|
||||||
|
|
||||||
contract APMNamehashOpen is APMNamehash {
|
|
||||||
bytes32 public constant OPEN_TITLE = keccak256("open");
|
|
||||||
bytes32 public constant OPEN_APM_NODE = keccak256(abi.encodePacked(APM_NODE, OPEN_TITLE));
|
|
||||||
|
|
||||||
function apmNamehashOpen(string name) internal pure returns (bytes32) {
|
|
||||||
return keccak256(abi.encodePacked(OPEN_APM_NODE, keccak256(name)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
pragma solidity 0.4.24;
|
|
||||||
|
|
||||||
import "@aragon/os/contracts/apps/AragonApp.sol";
|
|
||||||
|
|
||||||
|
|
||||||
// This is a "Dummy" app which's only purpose to exist is because
|
|
||||||
// Aragon's CLI still doesn't support running a Kit inside a project
|
|
||||||
// which isn't considered to be a "valid" Aragon project.
|
|
||||||
// It requires us to have an arrap.json file pointing to the contract
|
|
||||||
// and a manifest.json file which describes the front-end structure.
|
|
||||||
contract DummyApp is AragonApp {
|
|
||||||
function initialize() public onlyInit {
|
|
||||||
initialized();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
pragma solidity ^0.4.4;
|
|
||||||
|
|
||||||
contract Migrations {
|
|
||||||
address public owner;
|
|
||||||
uint public last_completed_migration;
|
|
||||||
|
|
||||||
modifier restricted() {
|
|
||||||
if (msg.sender == owner) _;
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructor() public {
|
|
||||||
owner = msg.sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCompleted(uint completed) public restricted {
|
|
||||||
last_completed_migration = completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function upgrade(address new_address) public restricted {
|
|
||||||
Migrations upgraded = Migrations(new_address);
|
|
||||||
upgraded.setCompleted(last_completed_migration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,52 @@
|
|||||||
# Contribution deployments
|
# Contribution deployments
|
||||||
|
|
||||||
|
aragon apm publish major --environment=rinkeby"
|
||||||
|
|
||||||
|
## 20212-01-14
|
||||||
|
|
||||||
|
apps/contribution@master » aragon apm publish major --environment=rinkeby
|
||||||
|
eth-provider | Invalid provider preset/location: "local"
|
||||||
|
✔ Start IPFS
|
||||||
|
✔ Applying version bump (major)
|
||||||
|
↓ Building frontend [skipped]
|
||||||
|
→ build script not defined in package.json
|
||||||
|
✔ Deploy contract
|
||||||
|
✔ Determine contract address for version
|
||||||
|
✔ Prepare files for publishing
|
||||||
|
✔ Generate application artifact
|
||||||
|
✔ Publish intent
|
||||||
|
|
||||||
|
⚠ Publishing files from the project's root folder is not recommended. Consider using the distribution folder of your project: "--files <folder>".
|
||||||
|
|
||||||
|
The following information will be published:
|
||||||
|
Contract address: 0x914Da982ef17B56D2e868E3a67E923EbED1aE017
|
||||||
|
Content (ipfs): QmdVrY2R48NFqwLopd8ix1anAK1d6WafDGauou3ZJrB9gf
|
||||||
|
|
||||||
|
? Publish to kredits-contribution.open.aragonpm.eth repo Yes
|
||||||
|
|
||||||
|
✔ Publish kredits-contribution.open.aragonpm.eth
|
||||||
|
|
||||||
|
Successfully published kredits-contribution.open.aragonpm.eth v7.0.0 :
|
||||||
|
|
||||||
|
Transaction hash: 0xb817b2e80e90a6be60b45dd39987498e3132c9962c0501feb7549ad30186c6d5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 2019-04-24 update balances
|
||||||
|
|
||||||
|
✔ Successfully published kredits-contribution.open.aragonpm.eth v6.0.0:
|
||||||
|
ℹ Contract address: 0x2c083EEA83fd3a99C93759D97D0317A43261c758
|
||||||
|
ℹ Content (ipfs): QmULpSqz7BgTFmDu8AL7YZZEz525xkcEzf3dPKtbRdUtFs
|
||||||
|
ℹ Transaction hash: 0x8b01c4c00162e918659d267a2beaf33b578e2aaf9f427f1aa9a43029333c5cd7
|
||||||
|
|
||||||
|
## 2019-04-10 - Weltempfänger release
|
||||||
|
|
||||||
|
✔ Successfully published kredits-contribution.open.aragonpm.eth v5.0.0:
|
||||||
|
ℹ Contract address: 0xe0f7dB486321b917e3A986Bdb2F2b9d51BA98fa9
|
||||||
|
ℹ Content (ipfs): QmU3XEBb4f5jU8MFFEpwaa95C1mhc82UeYLRWLrKsvcQNw
|
||||||
|
ℹ Transaction hash: 0xd736ff5f79f8142be3fad1a50580fb40aa468838da397f8630285fd91a445af3
|
||||||
|
|
||||||
|
|
||||||
## 2019-04-04
|
## 2019-04-04
|
||||||
|
|
||||||
✔ Successfully published kredits-contribution.open.aragonpm.eth v4.0.0:
|
✔ Successfully published kredits-contribution.open.aragonpm.eth v4.0.0:
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# Contributor deployments
|
# Contributor deployments
|
||||||
|
|
||||||
|
aragon apm publish major --environment=rinkeby
|
||||||
|
|
||||||
|
## 2019-04-25 canPerform fix
|
||||||
|
|
||||||
|
✔ Successfully published kredits-contributor.open.aragonpm.eth v6.0.0:
|
||||||
|
ℹ Contract address: 0xA5379D49C718845A1BD7720c6BE3872bA69906cc
|
||||||
|
ℹ Content (ipfs): QmdennNV6s2FNpe6QNYxrUsUXPVdnQGvh1vCi22Tqs8ojq
|
||||||
|
ℹ Transaction hash: 0x51077afeff70a24e87c78bb23ea13bdb9b4445bd43ea7a74a4178fadfeeb6c35
|
||||||
|
|
||||||
|
## 2019-04-24 update balances
|
||||||
|
|
||||||
|
✔ Successfully published kredits-contributor.open.aragonpm.eth v5.0.0:
|
||||||
|
ℹ Contract address: 0xadefa3b66b68a127Fe38bEa1813b844EE69CFD86
|
||||||
|
ℹ Content (ipfs): QmeygbQgoj2McLWzo9hJayLWuBZqFaK4HTpa5qLeQdkn5K
|
||||||
|
ℹ Transaction hash: 0x4237a9636f6e4a8190e0d5bcfa85a452da097bf654a173a88e0e1de3d078f08d
|
||||||
|
|
||||||
|
|
||||||
|
## 2019-04-10 - Weltempfänger release
|
||||||
|
|
||||||
|
✔ Successfully published kredits-contributor.open.aragonpm.eth v4.0.0:
|
||||||
|
ℹ Contract address: 0x08a6D4D915FCAA5524F05F5F715a6C17cB6eeA6B
|
||||||
|
ℹ Content (ipfs): QmR62PWwe1EzommfkhJDYcTvHoZjbXuv9dTG6vCn5dWCsb
|
||||||
|
ℹ Transaction hash: 0xd5317c9e207a413485c55ec3046b09d467d978443680304737a6d7d3db0c90e1
|
||||||
|
|
||||||
|
|
||||||
## 2019-04-04
|
## 2019-04-04
|
||||||
|
|
||||||
✔ Successfully published kredits-contributor.open.aragonpm.eth v3.0.0:
|
✔ Successfully published kredits-contributor.open.aragonpm.eth v3.0.0:
|
||||||
|
|||||||
@@ -1,5 +1,41 @@
|
|||||||
# Kredits deployment
|
# Kredits deployment
|
||||||
|
|
||||||
|
|
||||||
|
## 2021-01-14
|
||||||
|
|
||||||
|
apps/contribution@master » aragon dao upgrade 0xc34edf7d11b7f8433d597f0bb0697acdff55ef14 kredits-contribution.open.aragonpm.eth --environment=rinkeby
|
||||||
|
eth-provider | Invalid provider preset/location: "local"
|
||||||
|
✔ Fetching kredits-contribution.open.aragonpm.eth@latest
|
||||||
|
✔ Fetching kredits-contribution.open.aragonpm.eth@latest
|
||||||
|
✔ Upgrading app
|
||||||
|
|
||||||
|
✔ Successfully executed: "Upgrade 'kredits-contribution.open.aragonpm.eth' app instances to v7.0.0"
|
||||||
|
|
||||||
|
## 2019-04-25 canPerfom fix
|
||||||
|
|
||||||
|
aragon dao upgrade 0xc34edf7d11b7f8433d597f0bb0697acdff55ef14 kredits-contributor.open.aragonpm.eth --environment=rinkeby
|
||||||
|
✔ Fetching kredits-contributor.open.aragonpm.eth@latest
|
||||||
|
✔ Upgrading app
|
||||||
|
✔ Successfully executed: "Set the resolving address of 'kredits-contributor.open.aragonpm.eth' in namespace 'App code' to 0xA5379D49C718845A1BD7720c6BE3872bA69906cc"
|
||||||
|
|
||||||
|
## 2019-04-24 upgrade contributor and contribution
|
||||||
|
|
||||||
|
aragon dao upgrade 0xc34edf7d11b7f8433d597f0bb0697acdff55ef14 kredits-contributor.open.aragonpm.eth --environment=rinkeby
|
||||||
|
eth-provider | Invalid provider preset/location: "local"
|
||||||
|
✔ Fetching kredits-contributor.open.aragonpm.eth@latest
|
||||||
|
✔ Upgrading app
|
||||||
|
✔ Successfully executed: "Set the resolving address of 'kredits-contributor.open.aragonpm.eth' in namespace 'App code' to 0xadefa3b66b68a127Fe38bEa1813b844EE69CFD86"
|
||||||
|
|
||||||
|
aragon dao upgrade 0xc34edf7d11b7f8433d597f0bb0697acdff55ef14 kredits-contribution.open.aragonpm.eth --environment=rinkeby
|
||||||
|
✔ Fetching kredits-contribution.open.aragonpm.eth@latest
|
||||||
|
✔ Upgrading app
|
||||||
|
✔ Successfully executed: "Set the resolving address of 'kredits-contribution.open.aragonpm.eth' in namespace 'App code' to 0x2c083EEA83fd3a99C93759D97D0317A43261c758"
|
||||||
|
|
||||||
|
## 2019-04-10 - Weltempfänger release
|
||||||
|
|
||||||
|
Using KreditsKit at: 0x76e069b47b79442657eaf0555a32c6b16fa1b8b4
|
||||||
|
Created new DAO at: 0xc34edf7d11b7f8433d597f0bb0697acdff55ef14
|
||||||
|
|
||||||
## 2019-04-04
|
## 2019-04-04
|
||||||
|
|
||||||
Using KreditsKit at: 0x76e069b47b79442657eaf0555a32c6b16fa1b8b4
|
Using KreditsKit at: 0x76e069b47b79442657eaf0555a32c6b16fa1b8b4
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Proposal deployments
|
# Proposal deployments
|
||||||
|
|
||||||
|
## 2019-04-10 - Weltempfänger release
|
||||||
|
|
||||||
|
✔ Successfully published kredits-proposal.open.aragonpm.eth v5.0.0:
|
||||||
|
ℹ Contract address: 0x4ce5b0286483c66b861e5599a199054687434552
|
||||||
|
ℹ Content (ipfs): QmNYXEcmvKTGxYiob7WUf85oZhdmFDCuGiA6TsRrDE9TYb
|
||||||
|
ℹ Transaction hash: 0x0482b58a1ba87d494c6391026399d0ac41b45384330d916f3f99ba70e501584b
|
||||||
|
|
||||||
|
|
||||||
## 2019-04-04
|
## 2019-04-04
|
||||||
|
|
||||||
✔ Successfully published kredits-proposal.open.aragonpm.eth v4.0.0:
|
✔ Successfully published kredits-proposal.open.aragonpm.eth v4.0.0:
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Token deployments
|
# Token deployments
|
||||||
|
|
||||||
|
## 2019-04-10 - Weltempfänger release
|
||||||
|
|
||||||
|
✔ Successfully published kredits-token.open.aragonpm.eth v4.0.0:
|
||||||
|
ℹ Contract address: 0x05E0C2bbdA8e5BeE22AC1E20C1457dA4de63aE26
|
||||||
|
ℹ Content (ipfs): QmUuYLRMRNZcundUk2pxVaSjMNvtB7hzdf3eyoaUNqDPow
|
||||||
|
ℹ Transaction hash: 0x98c28b5ca645904d56eb83c4783682f018c0fcee015b3a3d5fa8bd609223fb89
|
||||||
|
|
||||||
|
|
||||||
## 2019-04-04
|
## 2019-04-04
|
||||||
|
|
||||||
✔ Successfully published kredits-token.open.aragonpm.eth v3.0.0:
|
✔ Successfully published kredits-token.open.aragonpm.eth v3.0.0:
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
require("@nomiclabs/hardhat-waffle");
|
||||||
|
require("hardhat-deploy");
|
||||||
|
require("hardhat-deploy-ethers");
|
||||||
|
require("@nomicfoundation/hardhat-chai-matchers");
|
||||||
|
require("@openzeppelin/hardhat-upgrades");
|
||||||
|
const Kredits = require("./lib/kredits");
|
||||||
|
|
||||||
|
const promptly = require("promptly");
|
||||||
|
|
||||||
|
extendEnvironment(async (hre) => {
|
||||||
|
hre.kredits = new Kredits(
|
||||||
|
hre.ethers.provider,
|
||||||
|
hre.ethers.provider.getSigner()
|
||||||
|
);
|
||||||
|
await hre.kredits.init();
|
||||||
|
});
|
||||||
|
|
||||||
|
// This is a sample Hardhat task. To learn how to create your own go to
|
||||||
|
// https://hardhat.org/guides/create-task.html
|
||||||
|
task("accounts", "Prints the list of accounts", async () => {
|
||||||
|
const accounts = await ethers.getSigners();
|
||||||
|
|
||||||
|
for (const account of accounts) {
|
||||||
|
console.log(account.address);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
task("fund", "Send eth to an address", async () => {
|
||||||
|
const to = await promptly.prompt("Address:");
|
||||||
|
const value = await promptly.prompt("Value:");
|
||||||
|
|
||||||
|
const signer = await ethers.getSigners();
|
||||||
|
|
||||||
|
const fundTransaction = await signer[0].sendTransaction({
|
||||||
|
to: to,
|
||||||
|
value: ethers.utils.parseEther(value),
|
||||||
|
});
|
||||||
|
console.log(fundTransaction);
|
||||||
|
});
|
||||||
|
|
||||||
|
task("create-wallet", "Creates a new wallet json", async () => {
|
||||||
|
const wallet = ethers.Wallet.createRandom();
|
||||||
|
|
||||||
|
console.log("New wallet:");
|
||||||
|
console.log(`Address: ${wallet.address}`);
|
||||||
|
console.log(`Public key: ${wallet.publicKey}`);
|
||||||
|
console.log(`Private key: ${wallet.privateKey}`);
|
||||||
|
console.log(`Mnemonic: ${JSON.stringify(wallet.mnemonic)}`);
|
||||||
|
|
||||||
|
const password = await promptly.prompt("Encryption password: ");
|
||||||
|
const encryptedJSON = await wallet.encrypt(password);
|
||||||
|
|
||||||
|
console.log("Encrypted wallet JSON:");
|
||||||
|
console.log(encryptedJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
// You need to export an object to set up your config
|
||||||
|
// Go to https://hardhat.org/config/ to learn more
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type import('hardhat/config').HardhatUserConfig
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
solidity: "0.8.2",
|
||||||
|
defaultNetwork: "localhost",
|
||||||
|
networks: {
|
||||||
|
hardhat: {
|
||||||
|
chainId: 1337,
|
||||||
|
},
|
||||||
|
rinkeby: {
|
||||||
|
url: "https://rinkeby.infura.io/v3/2e73045db2e84711912f8d0e5968f309",
|
||||||
|
accounts: [
|
||||||
|
process.env.DEPLOY_KEY ||
|
||||||
|
"0xffb4230bdf9b1f1dd48f0bc54e4007436733f225a4f163d4f7e58e620ae329eb",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
rsk: {
|
||||||
|
url: "https://rsk-testnet.kosmos.org",
|
||||||
|
accounts: [
|
||||||
|
process.env.DEPLOY_KEY ||
|
||||||
|
"0xffb4230bdf9b1f1dd48f0bc54e4007436733f225a4f163d4f7e58e620ae329eb",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
namedAccounts: {
|
||||||
|
deployer: {
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1 +0,0 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"NO_PERMISSION","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CREATE_PERMISSIONS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ANY_ENTITY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EMPTY_PARAM_HASH","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BURN_ENTITY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"entity","type":"address"},{"indexed":true,"name":"app","type":"address"},{"indexed":true,"name":"role","type":"bytes32"},{"indexed":false,"name":"allowed","type":"bool"}],"name":"SetPermission","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"entity","type":"address"},{"indexed":true,"name":"app","type":"address"},{"indexed":true,"name":"role","type":"bytes32"},{"indexed":false,"name":"paramsHash","type":"bytes32"}],"name":"SetPermissionParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"app","type":"address"},{"indexed":true,"name":"role","type":"bytes32"},{"indexed":true,"name":"manager","type":"address"}],"name":"ChangePermissionManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"constant":false,"inputs":[{"name":"_permissionsCreator","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_manager","type":"address"}],"name":"createPermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"grantPermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"grantPermissionP","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_entity","type":"address"},{"name":"_app","type":"address"},{"name":"_role","type":"bytes32"}],"name":"Line truncated
|
|
||||||
@@ -1 +1 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ADD_CONTRIBUTION_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contributionsCount","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KERNEL_APP_ADDR_NAMESPACE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"contributionOwner","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"contributions","outputs":[{"name":"contributorId","type":"uint32"},{"name":"amount","type":"uint32"},{"name":"claimed","type":"bool"},{"name":"hashDigest","type":"bytes32"},{"name":"hashFunction","type":"uint8"},{"name":"hashSize","type":"uint8"},{"name":"tokenMetadataURL","type":"string"},{"name":"confirmedAtBlock","type":"uint256"},{"name":"vetoed","type":"bool"},{"name":"exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"},{"name":"","type":"uint256"}],"name":"ownedContributions","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"blocksToWait","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"appIds","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VETO_CONTRIBUTION_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":true,"name":"contributorId","type":"uint32"},{"indexed":false,"name":"amount","type":"uint32"}],"name":"ContributionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":true,"name":"contributorId","type":"uint32"},{"indexed":false,"name":"amount","type":"uint32"}],"name":"ContributionClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"vetoedByAccount","type":"address"}],"name":"ContributionVetoed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"constant":false,"inputs":[{"name":"_appIds","type":"bytes32[4]"}],"name":"initialize","outputs":[],"payable":falLine truncated
|
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":true,"internalType":"uint32","name":"contributorId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"amount","type":"uint32"}],"name":"ContributionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":false,"internalType":"address","name":"vetoedByAccount","type":"address"}],"name":"ContributionVetoed","type":"event"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"uint32","name":"contributorId","type":"uint32"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"uint256","name":"confirmedAtBlock","type":"uint256"},{"internalType":"bool","name":"vetoed","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blocksToWait","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"contributionOwner","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"contributions","outputs":[{"internalType":"uint32","name":"contributorId","type":"uint32"},{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"string","name":"tokenMetadataURL","type":"string"},{"internalType":"uint256","name":"confirmedAtBlock","type":"uint256"},{"internalType":"bool","name":"vetoed","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributionsCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributorContract","outputs":[{"internalType":"contract ContributorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"contributionId","type":"uint32"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finishMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"contributionId","type":"uint32"}],"name":"getContribution","outputs":[{"internalType":"uint32","name":"id","type":"uint32"},{"internalType":"uint32","name":"contributorId","type":"uint32"},{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"uint256","name":"confirmedAtBlock","type":"uint256"},{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"bool","name":"vetoed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"contributorId","type":"uint32"}],"name":"getContributorAddressById","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contributorAccount","type":"address"}],"name":"getContributorIdByAddress","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"blocksToWait_","type":"uint32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrationDone","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownedContributions","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"contributionId","type":"uint32"}],"name":"ownerOf","outputs":[{"internalLine truncated
|
||||||
@@ -1 +1 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contributorsCount","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"contributorIds","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KERNEL_APP_ADDR_NAMESPACE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MANAGE_CONTRIBUTORS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"contributors","outputs":[{"name":"account","type":"address"},{"name":"hashDigest","type":"bytes32"},{"name":"hashFunction","type":"uint8"},{"name":"hashSize","type":"uint8"},{"name":"exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"appIds","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"oldHashDigest","type":"bytes32"},{"indexed":false,"name":"newHashDigest","type":"bytes32"}],"name":"ContributorProfileUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"oldAccount","type":"address"},{"indexed":false,"name":"newAccount","type":"address"}],"name":"ContributorAccountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"account","type":"address"}],"name":"ContributorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"constant":false,"inputs":[{"name":"root","type":"address"},{"name":"_appIds","type":"bytes32[4]"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getTokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"coreContributorsCount","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint32"},{"name":"oldAccount","type":"address"},{"name":"newAccount","type":"address"}],"name":"updateContributorAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint32"},{"name":"hashDigest","type":"bytes32"},{"name":"hashFunction","type":"uint8"},{"name":"hashSize","type":"uint8"}],"name":"updateContributorProfileHash","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":falLine truncated
|
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":false,"internalType":"address","name":"oldAccount","type":"address"},{"indexed":false,"internalType":"address","name":"newAccount","type":"address"}],"name":"ContributorAccountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"ContributorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"oldHashDigest","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newHashDigest","type":"bytes32"}],"name":"ContributorProfileUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"}],"name":"addContributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addressExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addressIsCore","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributionContract","outputs":[{"internalType":"contract IContributionBalance","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contributorIds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"contributors","outputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint32","name":"kreditsWithdrawn","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributorsCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coreContributorsCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"id","type":"uint32"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"id","type":"uint32"}],"name":"getContributorAddressById","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_id","type":"uint32"}],"name":"getContributorById","outputs":[{"internalType":"uint32","name":"id","type":"uint32"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"bool","name":"isCore","type":"bool"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint32","name":"totalKreditsEarned","type":"uint32"},{"internalType":"uint256","name":"contributionsCount","type":"uint256"},{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint256","name":"kreditsWithdrawn","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getContributorIdByAddress","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"id","type":"uint32"}],"name":"isCoreTeam","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contribution","type":"address"}],"name":"setContributionContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":Line truncated
|
||||||
@@ -1 +0,0 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"apps","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"recoveryVaultAppId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"APP_MANAGER_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_kernel","type":"address"},{"name":"_appId","type":"bytes32"},{"name":"_initializePayload","type":"bytes"}],"name":"newAppProxyPinned","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_kernel","type":"address"},{"name":"_appId","type":"bytes32"}],"name":"newAppProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_kernel","type":"address"},{"name":"_appId","type":"bytes32"},{"name":"_initializePayload","type":"bytes"}],"name":"newAppProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_kernel","type":"address"},{"name":"_appId","type":"bytes32"}],"name":"newAppProxyPinned","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_shouldPetrify","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proxy","type":"address"},{"indexed":false,"name":"isUpgradeable","type":"bool"},{"indexed":false,"name":"appId","type":"bytes32"}],"name":"NewAppProxy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"namespace","type":"bytes32"},{"indexed":true,"name":"appId","type":"bytes32"},{"indexed":false,"name":"app","type":"address"}],"name":"SetApp","type":"event"},{"constant":false,"inputs":[{"name":"_baseAcl","type":"address"},{"name":"_permissionsCreator","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_appId","type":"bytes32"},{"name":"_appBase","type":"address"},{"name":"_initializePayload","type":"bytes"},{"name":"_setDefault","type":"bool"}],"name":"newAppInstance","outputs":[{"name":"appProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_appId","type":"bytes32"},{"name":"_appBase","type":"address"}],"name":"newAppInstance","outputs":[{"name":"appProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_appId","type":"bytes32"},{"name":"_appBase","type":"address"}],"name":"newPinnedAppInstance","outputs":[{"name":"appProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_appId","type":"bytes32"},{"name":"_appBase","type":"address"},{"name":"_initializePayload","type":"bytes"},{"name":"_setDefault","type":"bool"}],"name":"newPinnedAppInstance","outputs":[{"name":"appProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_namespace","type":"bytes32"},{"name":"_appId","type":"bytes32"},{"name":"_app","type":"address"}],"name":"setApp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_recoveryVaultAppId","type":"bytes32"}],"name":"setRecoveryVaultAppId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CORE_NAMESPACE","outputs":[{"name":"","type":"bytes32"}],"payable":false,Line truncated
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposalsCount","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint32"}],"name":"proposals","outputs":[{"name":"creatorAccount","type":"address"},{"name":"contributorId","type":"uint32"},{"name":"votesCount","type":"uint16"},{"name":"votesNeeded","type":"uint16"},{"name":"amount","type":"uint32"},{"name":"executed","type":"bool"},{"name":"hashDigest","type":"bytes32"},{"name":"hashFunction","type":"uint8"},{"name":"hashSize","type":"uint8"},{"name":"exists","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VOTE_PROPOSAL_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KERNEL_APP_ADDR_NAMESPACE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"appIds","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ADD_PROPOSAL_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"creatorAccount","type":"address"},{"indexed":false,"name":"contributorId","type":"uint32"},{"indexed":false,"name":"amount","type":"uint32"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"voterId","type":"uint32"},{"indexed":false,"name":"totalVotes","type":"uint16"}],"name":"ProposalVoted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint32"},{"indexed":false,"name":"contributorId","type":"uint32"},{"indexed":false,"name":"amount","type":"uint32"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"constant":false,"inputs":[{"name":"_appIds","type":"bytes32[4]"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getContributorContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getContributionContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"contributorId","type":"uint32"},{"name":"amount","tyLine truncated
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":true,"internalType":"address","name":"addedByAccount","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReimbursementAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"id","type":"uint32"},{"indexed":false,"internalType":"address","name":"vetoedByAccount","type":"address"}],"name":"ReimbursementVetoed","type":"event"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"recipientId","type":"uint32"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blocksToWait","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributorContract","outputs":[{"internalType":"contract ContributorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"reimbursementId","type":"uint32"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"reimbursementId","type":"uint32"}],"name":"get","outputs":[{"internalType":"uint32","name":"id","type":"uint32"},{"internalType":"uint32","name":"recipientId","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"uint256","name":"confirmedAtBlock","type":"uint256"},{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"bool","name":"vetoed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"contributorId","type":"uint32"}],"name":"getContributorAddressById","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contributorAccount","type":"address"}],"name":"getContributorIdByAddress","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"reimbursements","outputs":[{"internalType":"uint32","name":"recipientId","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"hashDigest","type":"bytes32"},{"internalType":"uint8","name":"hashFunction","type":"uint8"},{"internalType":"uint8","name":"hashSize","type":"uint8"},{"internalType":"uint256","name":"confirmedAtBlock","type":"uint256"},{"internalType":"bool","name":"vetoed","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reimbursementsCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contributor","type":"address"}],"name":"setContributorContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"confirmedOnly","type":"bool"}],"name":"totalAmount","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"reimbursementId","type":"uint32"}],"name":"veto","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"_balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINT_TOKEN_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"appIds","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"recipient","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"contributionId","type":"uint32"}],"name":"LogMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":faLine truncated
|
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"KreditsMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributorContract","outputs":[{"internalType":"contract ContributorInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributorContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contributorAccount","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contributor","type":"address"}],"name":"setContributorContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"1337": {
|
||||||
|
"Contributor": "0xCc66f9A3cA2670972938FAD91d0865c4a62DFB25",
|
||||||
|
"Contribution": "0x8999CaBc43E28202c5A2257f2a95A45b1F8A62BD",
|
||||||
|
"Token": "0xe082678eCF749982e33Ea6839852a8cd989aEDE2",
|
||||||
|
"Reimbursement": "0x984f797d26d3da2E9b9f8Ae4eeFEACC60fCAA90C"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"4": "0x76e069b47b79442657eaf0555a32c6b16fa1b8b4",
|
"4": "0x76e069b47b79442657eaf0555a32c6b16fa1b8b4"
|
||||||
"41787949": "0xa35aacdfccac54d3d96e0d29050c773b251c2c83"
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"4": "0xcd75458fbc4aa2231252d5b21f1391fd031e5cb2",
|
"4": "0xc34edf7d11b7f8433d597f0bb0697acdff55ef14"
|
||||||
"41787949": "0x183af3950364390a266edff2a0e7c4c2f95c0691"
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
const Base = require('./base');
|
|
||||||
const EthersUtils = require('ethers').utils;
|
|
||||||
|
|
||||||
class Acl extends Base {
|
|
||||||
|
|
||||||
hasPermission(fromAddress, contractAddress, roleID, params = null) {
|
|
||||||
let roleHash = EthersUtils.keccak256(EthersUtils.toUtf8Bytes(roleID));
|
|
||||||
console.log(roleHash)
|
|
||||||
return this.functions.hasPermission(fromAddress, contractAddress, roleHash, params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Acl;
|
|
||||||
+10
-11
@@ -1,23 +1,22 @@
|
|||||||
|
const deprecate = require('../utils/deprecate');
|
||||||
|
|
||||||
class Base {
|
class Base {
|
||||||
constructor(contract) {
|
constructor (contract) {
|
||||||
this.contract = contract;
|
this.contract = contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
get functions() {
|
get functions () {
|
||||||
return this.contract.functions;
|
deprecate('The property `functions` is deprecated. contract functions are now directly defined on the ethers contract object. https://github.com/ethers-io/ethers.js/issues/920#issuecomment-650836642');
|
||||||
|
return this.contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
get ipfs() {
|
get address () {
|
||||||
if (!this._ipfsAPI) { throw new Error('IPFS API not configured; please set an ipfs instance'); }
|
return this.contract.address;
|
||||||
return this._ipfsAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set ipfs(ipfsAPI) {
|
on (type, callback) {
|
||||||
this._ipfsAPI = ipfsAPI;
|
|
||||||
}
|
|
||||||
|
|
||||||
on(type, callback) {
|
|
||||||
return this.contract.on(type, callback);
|
return this.contract.on(type, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Base;
|
module.exports = Base;
|
||||||
@@ -1,44 +1,36 @@
|
|||||||
const ethers = require('ethers');
|
const Record = require('./record');
|
||||||
|
|
||||||
const ContributionSerializer = require('../serializers/contribution');
|
const ContributionSerializer = require('../serializers/contribution');
|
||||||
const Base = require('./base');
|
const deprecate = require('../utils/deprecate');
|
||||||
|
|
||||||
class Contribution extends Base {
|
class Contribution extends Record {
|
||||||
all() {
|
get count () {
|
||||||
return this.functions.contributionsCount()
|
return this.contract.contributionsCount();
|
||||||
.then(async (count) => {
|
|
||||||
let contributions = [];
|
|
||||||
|
|
||||||
for (let id = 1; id <= count; id++) {
|
|
||||||
const contribution = await this.getById(id)
|
|
||||||
contributions.push(contribution);
|
|
||||||
}
|
|
||||||
|
|
||||||
return contributions;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getById(id) {
|
getById (id) {
|
||||||
return this.functions.getContribution(id)
|
return this.contract.getContribution(id)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
|
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getByContributorId(contributorId) {
|
getData (id) {
|
||||||
return this.functions.getContributorAddressById(contributorId)
|
return this.contract.getContribution(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
getByContributorId (contributorId) {
|
||||||
|
return this.contract.getContributorAddressById(contributorId)
|
||||||
.then(address => this.getByContributorAddress(address));
|
.then(address => this.getByContributorAddress(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
getByContributorAddress(address) {
|
getByContributorAddress (address) {
|
||||||
return this.functions.balanceOf(address)
|
return this.contract.balanceOf(address)
|
||||||
.then(async (balance) => {
|
.then(async (balance) => {
|
||||||
const count = balance.toNumber();
|
const count = balance.toNumber();
|
||||||
const contributions = [];
|
const contributions = [];
|
||||||
|
|
||||||
for (let index = 0; index < count; index++) {
|
for (let index = 0; index < count; index++) {
|
||||||
const id = await this.functions.tokenOfOwnerByIndex(address, index);
|
const id = await this.contract.tokenOfOwnerByIndex(address, index);
|
||||||
const contribution = await this.getById(id);
|
const contribution = await this.getById(id);
|
||||||
contributions.push(contribution);
|
contributions.push(contribution);
|
||||||
}
|
}
|
||||||
@@ -47,13 +39,17 @@ class Contribution extends Base {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addContribution(contributionAttr, callOptions = {}) {
|
async add (contributionAttr, callOptions = {}) {
|
||||||
let json = ContributionSerializer.serialize(contributionAttr);
|
const contribution = new ContributionSerializer(contributionAttr);
|
||||||
// TODO: validate against schema
|
|
||||||
|
try { await contribution.validate(); }
|
||||||
|
catch (error) { return Promise.reject(error); }
|
||||||
|
|
||||||
|
const jsonStr = contribution.serialize();
|
||||||
|
|
||||||
return this.ipfs
|
return this.ipfs
|
||||||
.add(json)
|
.add(jsonStr)
|
||||||
.then((ipfsHashAttr) => {
|
.then(ipfsHashAttr => {
|
||||||
let contribution = [
|
let contribution = [
|
||||||
contributionAttr.amount,
|
contributionAttr.amount,
|
||||||
contributionAttr.contributorId,
|
contributionAttr.contributorId,
|
||||||
@@ -62,9 +58,15 @@ class Contribution extends Base {
|
|||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
];
|
];
|
||||||
|
|
||||||
return this.functions.add(...contribution, callOptions);
|
return this.contract.add(...contribution, 0, false, callOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addContribution () {
|
||||||
|
deprecate('The function `addContribution()` is deprecated and will be removed in the next major version. Use `add()` instead');
|
||||||
|
return this.add(...arguments);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contribution;
|
module.exports = Contribution;
|
||||||
@@ -1,40 +1,34 @@
|
|||||||
const ethers = require('ethers');
|
const Record = require('./record');
|
||||||
const RSVP = require('rsvp');
|
|
||||||
|
|
||||||
const ContributorSerializer = require('../serializers/contributor');
|
const ContributorSerializer = require('../serializers/contributor');
|
||||||
const Base = require('./base');
|
const formatKredits = require('../utils/format-kredits');
|
||||||
|
|
||||||
class Contributor extends Base {
|
class Contributor extends Record {
|
||||||
all() {
|
get count () {
|
||||||
return this.functions.contributorsCount()
|
return this.contract.contributorsCount();
|
||||||
.then(count => {
|
|
||||||
let contributors = [];
|
|
||||||
|
|
||||||
for (let id = 1; id <= count; id++) {
|
|
||||||
contributors.push(this.getById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return RSVP.all(contributors);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getById(id) {
|
getById (id) {
|
||||||
return this.functions.getContributorById(id)
|
return this.contract.getContributorById(id)
|
||||||
// Fetch IPFS data if available
|
.then(contractData => {
|
||||||
.then((data) => {
|
let data = {...contractData};
|
||||||
|
data.balanceInt = formatKredits(data.balance);
|
||||||
return this.ipfs.catAndMerge(data, ContributorSerializer.deserialize);
|
return this.ipfs.catAndMerge(data, ContributorSerializer.deserialize);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
filterByAccount(search) {
|
getData (id) {
|
||||||
|
return this.contract.getContributorById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
filterByAccount (search) {
|
||||||
return this._byAccount(search, 'filter');
|
return this._byAccount(search, 'filter');
|
||||||
}
|
}
|
||||||
|
|
||||||
findByAccount(search) {
|
findByAccount (search) {
|
||||||
return this._byAccount(search, 'find');
|
return this._byAccount(search, 'find');
|
||||||
}
|
}
|
||||||
|
|
||||||
_byAccount(search, method = 'filter') {
|
_byAccount (search, method = 'filter') {
|
||||||
return this.all().then((contributors) => {
|
return this.all().then((contributors) => {
|
||||||
const searchEntries = Object.entries(search);
|
const searchEntries = Object.entries(search);
|
||||||
|
|
||||||
@@ -50,12 +44,16 @@ class Contributor extends Base {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
add(contributorAttr, callOptions = {}) {
|
async add (contributorAttr, callOptions = {}) {
|
||||||
let json = ContributorSerializer.serialize(contributorAttr);
|
let contributor = new ContributorSerializer(contributorAttr);
|
||||||
// TODO: validate against schema
|
|
||||||
|
try { await contributor.validate(); }
|
||||||
|
catch (error) { return Promise.reject(error); }
|
||||||
|
|
||||||
|
const jsonStr = contributor.serialize();
|
||||||
|
|
||||||
return this.ipfs
|
return this.ipfs
|
||||||
.add(json)
|
.add(jsonStr)
|
||||||
.then((ipfsHashAttr) => {
|
.then((ipfsHashAttr) => {
|
||||||
let contributor = [
|
let contributor = [
|
||||||
contributorAttr.account,
|
contributorAttr.account,
|
||||||
@@ -64,9 +62,34 @@ class Contributor extends Base {
|
|||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
];
|
];
|
||||||
|
|
||||||
return this.functions.addContributor(...contributor, callOptions);
|
return this.contract.addContributor(...contributor, callOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateProfile (contributorId, updateAttr, callOptions = {}) {
|
||||||
|
return this.getById(contributorId).then(async (contributor) => {
|
||||||
|
let updatedContributorAttr = Object.assign(contributor, updateAttr);
|
||||||
|
let updatedContributor = new ContributorSerializer(updatedContributorAttr);
|
||||||
|
|
||||||
|
try { await updatedContributor.validate(); }
|
||||||
|
catch (error) { return Promise.reject(error); }
|
||||||
|
|
||||||
|
const jsonStr = updatedContributor.serialize();
|
||||||
|
|
||||||
|
return this.ipfs
|
||||||
|
.add(jsonStr)
|
||||||
|
.then(ipfsHashAttr => {
|
||||||
|
return this.contract.updateContributorProfileHash(
|
||||||
|
contributorId,
|
||||||
|
ipfsHashAttr.hashDigest,
|
||||||
|
ipfsHashAttr.hashFunction,
|
||||||
|
ipfsHashAttr.hashSize,
|
||||||
|
callOptions
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contributor;
|
module.exports = Contributor;
|
||||||
@@ -3,6 +3,5 @@ module.exports = {
|
|||||||
Contribution: require('./contribution'),
|
Contribution: require('./contribution'),
|
||||||
Proposal: require('./proposal'),
|
Proposal: require('./proposal'),
|
||||||
Token: require('./token'),
|
Token: require('./token'),
|
||||||
Kernel: require('./kernel'),
|
Reimbursement: require('./reimbursement'),
|
||||||
Acl: require('./acl')
|
|
||||||
};
|
};
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
const namehash = require('ethers').utils.namehash;
|
|
||||||
const Base = require('./base');
|
|
||||||
|
|
||||||
const KERNEL_APP_ADDR_NAMESPACE = '0xd6f028ca0e8edb4a8c9757ca4fdccab25fa1e0317da1188108f7d2dee14902fb';
|
|
||||||
|
|
||||||
class Kernel extends Base {
|
|
||||||
constructor(contract) {
|
|
||||||
super(contract);
|
|
||||||
this.apm = 'aragonpm.eth'; // can be overwritten if needed
|
|
||||||
}
|
|
||||||
|
|
||||||
getApp(appName) {
|
|
||||||
if (appName === 'Acl') {
|
|
||||||
return this.functions.acl();
|
|
||||||
}
|
|
||||||
return this.functions.getApp(KERNEL_APP_ADDR_NAMESPACE, this.appNamehash(appName));
|
|
||||||
}
|
|
||||||
|
|
||||||
appNamehash(appName) {
|
|
||||||
return namehash(`kredits-${appName.toLowerCase()}.${this.apm}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Kernel;
|
|
||||||
+22
-24
@@ -1,36 +1,29 @@
|
|||||||
const ethers = require('ethers');
|
const Record = require('./record');
|
||||||
const RSVP = require('rsvp');
|
|
||||||
|
|
||||||
const ContributionSerializer = require('../serializers/contribution');
|
const ContributionSerializer = require('../serializers/contribution');
|
||||||
const Base = require('./base');
|
const deprecate = require('../utils/deprecate');
|
||||||
|
|
||||||
class Proposal extends Base {
|
class Proposal extends Record {
|
||||||
all() {
|
get count () {
|
||||||
return this.functions.proposalsCount()
|
return this.contract.proposalsCount();
|
||||||
.then(count => {
|
|
||||||
let proposals = [];
|
|
||||||
|
|
||||||
for (let id = 1; id <= count; id++) {
|
|
||||||
proposals.push(this.getById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return RSVP.all(proposals);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getById(id) {
|
getById (id) {
|
||||||
return this.functions.getProposal(id)
|
return this.contract.getProposal(id)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
|
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addProposal(proposalAttr, callOptions = {}) {
|
async add (proposalAttr, callOptions = {}) {
|
||||||
let json = ContributionSerializer.serialize(proposalAttr);
|
const contribution = new ContributionSerializer(proposalAttr);
|
||||||
// TODO: validate against schema
|
|
||||||
|
try { await contribution.validate(); }
|
||||||
|
catch (error) { return Promise.reject(error); }
|
||||||
|
|
||||||
|
const jsonStr = contribution.serialize();
|
||||||
|
|
||||||
return this.ipfs
|
return this.ipfs
|
||||||
.add(json)
|
.add(jsonStr)
|
||||||
.then((ipfsHashAttr) => {
|
.then((ipfsHashAttr) => {
|
||||||
let proposal = [
|
let proposal = [
|
||||||
proposalAttr.contributorId,
|
proposalAttr.contributorId,
|
||||||
@@ -40,9 +33,14 @@ class Proposal extends Base {
|
|||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
];
|
];
|
||||||
|
|
||||||
return this.functions.addProposal(...proposal, callOptions);
|
return this.contract.addProposal(...proposal, callOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addProposal () {
|
||||||
|
deprecate('The function `addProposal()` is deprecated and will be removed in the next major version. Use `add()` instead');
|
||||||
|
return this.add(...arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Proposal
|
module.exports = Proposal;
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const Base = require('./base');
|
||||||
|
const paged = require('../utils/pagination');
|
||||||
|
|
||||||
|
class Record extends Base {
|
||||||
|
all (options = {}) {
|
||||||
|
return this.count
|
||||||
|
.then((count) => {
|
||||||
|
let records = paged(count, options).map((id) => this.getById(id));
|
||||||
|
return Promise.all(records);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Record;
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
const Record = require("./record");
|
||||||
|
const ExpenseSerializer = require("../serializers/expense");
|
||||||
|
|
||||||
|
class Reimbursement extends Record {
|
||||||
|
get count () {
|
||||||
|
return this.contract.reimbursementsCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
getById (id) {
|
||||||
|
return this.contract.get(id).then((data) => {
|
||||||
|
return this.ipfs.catAndMerge(data, (ipfsDocument) => {
|
||||||
|
const expenses = JSON.parse(ipfsDocument);
|
||||||
|
return { expenses };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getData (id) {
|
||||||
|
return this.contract.getReimbursement(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
async add (attrs, callOptions = {}) {
|
||||||
|
const amount = parseInt(attrs.amount);
|
||||||
|
const token = attrs.token;
|
||||||
|
const recipientId = attrs.recipientId;
|
||||||
|
const expenses = attrs.expenses.map((e) => new ExpenseSerializer(e));
|
||||||
|
let errorMessage;
|
||||||
|
|
||||||
|
if (typeof amount !== "number" || amount <= 0) {
|
||||||
|
errorMessage = "Invalid data: amount must be a positive number.";
|
||||||
|
}
|
||||||
|
if (!token || token === "") {
|
||||||
|
errorMessage = "Invalid data: token must be a token address.";
|
||||||
|
}
|
||||||
|
if (!recipientId || recipientId === "") {
|
||||||
|
errorMessage = "Invalid data: recipientId is required.";
|
||||||
|
}
|
||||||
|
if (expenses.length === 0) {
|
||||||
|
errorMessage = "Invalid data: at least one expense item is required.";
|
||||||
|
}
|
||||||
|
if (errorMessage) {
|
||||||
|
return Promise.reject(new Error(errorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.all(expenses.map((e) => e.validate())).then(() => {
|
||||||
|
const jsonStr = JSON.stringify(
|
||||||
|
expenses.map((e) => e.data),
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
return this.ipfs.add(jsonStr).then((ipfsHashAttr) => {
|
||||||
|
const reimbursement = [
|
||||||
|
amount,
|
||||||
|
token,
|
||||||
|
parseInt(recipientId),
|
||||||
|
ipfsHashAttr.hashDigest,
|
||||||
|
ipfsHashAttr.hashFunction,
|
||||||
|
ipfsHashAttr.hashSize,
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.contract.add(...reimbursement, callOptions);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Reimbursement;
|
||||||
@@ -4,4 +4,3 @@ class Token extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Token;
|
module.exports = Token;
|
||||||
|
|
||||||
+54
-55
@@ -1,38 +1,35 @@
|
|||||||
const ethers = require('ethers');
|
const ethers = require('ethers');
|
||||||
const RSVP = require('rsvp');
|
|
||||||
|
|
||||||
const Preflight = require('./utils/preflight');
|
const Preflight = require('./utils/preflight');
|
||||||
|
const deprecate = require('./utils/deprecate');
|
||||||
|
|
||||||
const ABIS = {
|
const ABIS = {
|
||||||
Contributor: require('./abis/Contributor.json'),
|
Contributor: require('./abis/Contributor.json'),
|
||||||
Contribution: require('./abis/Contribution.json'),
|
Contribution: require('./abis/Contribution.json'),
|
||||||
|
Reimbursement: require('./abis/Reimbursement.json'),
|
||||||
Token: require('./abis/Token.json'),
|
Token: require('./abis/Token.json'),
|
||||||
Proposal: require('./abis/Proposal.json'),
|
|
||||||
Kernel: require('./abis/Kernel.json'),
|
|
||||||
Acl: require('./abis/ACL.json')
|
|
||||||
};
|
};
|
||||||
const APP_CONTRACTS = [
|
// const APP_CONTRACTS = [
|
||||||
'Contributor',
|
// 'Contributor',
|
||||||
'Contribution',
|
// 'Contribution',
|
||||||
'Token',
|
// 'Token',
|
||||||
'Proposal',
|
// 'Reimbursement',
|
||||||
'Acl'
|
// ];
|
||||||
];
|
const Addresses = require('./addresses.json');
|
||||||
const DaoAddresses = require('./addresses/dao.json');
|
|
||||||
|
|
||||||
const Contracts = require('./contracts');
|
const Contracts = require('./contracts');
|
||||||
const IPFS = require('./utils/ipfs')
|
const IPFS = require('./utils/ipfs');
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
function capitalize(word) {
|
function capitalize (word) {
|
||||||
let [first, ...rest] = word;
|
let [first, ...rest] = word;
|
||||||
return `${first.toUpperCase()}${rest.join('')}`;
|
return `${first.toUpperCase()}${rest.join('')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Kredits {
|
class Kredits {
|
||||||
|
|
||||||
constructor(provider, signer, options = {}) {
|
constructor (provider, signer, options = {}) {
|
||||||
let { addresses, abis, ipfsConfig } = options;
|
const { addresses, abis, ipfsConfig } = options;
|
||||||
|
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.signer = signer;
|
this.signer = signer;
|
||||||
@@ -43,69 +40,71 @@ class Kredits {
|
|||||||
this.contracts = {};
|
this.contracts = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
init(names) {
|
init (/* names */) {
|
||||||
let contractsToLoad = names || APP_CONTRACTS;
|
// TODO implement
|
||||||
|
// const contractsToLoad = names || APP_CONTRACTS;
|
||||||
|
|
||||||
return this.provider.getNetwork().then(network => {
|
return this.provider.getNetwork().then(network => {
|
||||||
this.addresses['Kernel'] = this.addresses['Kernel'] || DaoAddresses[network.chainId.toString()];
|
if (Object.keys(this.addresses).length === 0) {
|
||||||
let addressPromises = contractsToLoad.map((contractName) => {
|
this.addresses = Addresses[network.chainId.toString()];
|
||||||
return this.Kernel.getApp(contractName).then((address) => {
|
}
|
||||||
this.addresses[contractName] = address;
|
return this;
|
||||||
}).catch((error) => {
|
|
||||||
console.log(error);
|
|
||||||
throw new Error(`Failed to get address for ${contractName} from DAO at ${this.Kernel.contract.address}
|
|
||||||
- ${error.message}`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return RSVP.all(addressPromises).then(() => { return this });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static setup(provider, signer, ipfsConfig = null) {
|
static setup (provider, signer, ipfsConfig = null) {
|
||||||
console.log('Kredits.setup() is deprecated use new Kredits().init() instead');
|
deprecate('Kredits.setup() is deprecated use new Kredits().init() instead');
|
||||||
return new Kredits(provider, signer, { ipfsConfig: ipfsConfig }).init();
|
return new Kredits(provider, signer, { ipfsConfig: ipfsConfig }).init();
|
||||||
}
|
}
|
||||||
|
|
||||||
get Kernel() {
|
static for (connectionOptions, kreditsOptions) {
|
||||||
let k = this.contractFor('Kernel');
|
let { network, rpcUrl, wallet } = connectionOptions;
|
||||||
// in case we want to use a special apm (e.g. development vs. production)
|
if (!rpcUrl && network === 'local') { rpcUrl = 'http://localhost:8545'; }
|
||||||
if (this.options.apm) {
|
let ethProvider, signer;
|
||||||
k.apm = this.options.apm;
|
if (rpcUrl) {
|
||||||
|
ethProvider = new ethers.providers.JsonRpcProvider(rpcUrl);
|
||||||
|
} else {
|
||||||
|
ethProvider = new ethers.getDefaultProvider(network);
|
||||||
}
|
}
|
||||||
return k;
|
if (wallet) {
|
||||||
|
signer = wallet.connect(ethProvider);
|
||||||
|
} else if (ethProvider.getSigner) {
|
||||||
|
signer = ethProvider.getSigner();
|
||||||
|
}
|
||||||
|
return new Kredits(ethProvider, signer, kreditsOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
get Contributor() {
|
static availableNetworks () {
|
||||||
|
return Object.keys(Addresses);
|
||||||
|
}
|
||||||
|
|
||||||
|
get Contributor () {
|
||||||
return this.contractFor('Contributor');
|
return this.contractFor('Contributor');
|
||||||
}
|
}
|
||||||
|
|
||||||
get Contributors() {
|
get Contributors () {
|
||||||
console.log('Contributors is deprecated use Contributor instead');
|
deprecate('Contributors is deprecated use Contributor instead');
|
||||||
return this.Contributor;
|
return this.contractFor('Contributor');
|
||||||
}
|
}
|
||||||
|
|
||||||
get Proposal() {
|
get Operator () {
|
||||||
return this.contractFor('Proposal');
|
|
||||||
}
|
|
||||||
|
|
||||||
get Operator() {
|
|
||||||
return this.Proposal;
|
return this.Proposal;
|
||||||
}
|
}
|
||||||
|
|
||||||
get Token() {
|
get Token () {
|
||||||
return this.contractFor('Token');
|
return this.contractFor('Token');
|
||||||
}
|
}
|
||||||
|
|
||||||
get Contribution() {
|
get Contribution () {
|
||||||
return this.contractFor('Contribution');
|
return this.contractFor('Contribution');
|
||||||
}
|
}
|
||||||
|
|
||||||
get Acl() {
|
get Reimbursement () {
|
||||||
return this.contractFor('Acl');
|
return this.contractFor('Reimbursement');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be private
|
// Should be private
|
||||||
contractFor(name) {
|
contractFor (name) {
|
||||||
if (this.contracts[name]) {
|
if (this.contracts[name]) {
|
||||||
return this.contracts[name];
|
return this.contracts[name];
|
||||||
}
|
}
|
||||||
@@ -117,15 +116,15 @@ class Kredits {
|
|||||||
throw new Error(`Address or ABI not found for ${contractName}`);
|
throw new Error(`Address or ABI not found for ${contractName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let signerOrProvider = this.signer || this.provider;
|
const signerOrProvider = this.signer || this.provider;
|
||||||
let contract = new ethers.Contract(address, abi, signerOrProvider);
|
const contract = new ethers.Contract(address, abi, signerOrProvider);
|
||||||
this.contracts[name] = new Contracts[contractName](contract);
|
this.contracts[name] = new Contracts[contractName](contract);
|
||||||
this.contracts[name].ipfs = this.ipfs;
|
this.contracts[name].ipfs = this.ipfs;
|
||||||
|
|
||||||
return this.contracts[name];
|
return this.contracts[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
preflightChecks() {
|
preflightChecks () {
|
||||||
return new Preflight(this).check();
|
return new Preflight(this).check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
const ethers = require('ethers');
|
||||||
|
|
||||||
|
const ABI = require('./abis/KreditsKit.json');
|
||||||
|
const Addresses = require('./addresses/KreditsKit.json');
|
||||||
|
|
||||||
|
class KreditsKit {
|
||||||
|
|
||||||
|
constructor (provider, signer, options = {}) {
|
||||||
|
let { address, abi } = options;
|
||||||
|
|
||||||
|
this.provider = provider;
|
||||||
|
this.signer = signer;
|
||||||
|
this.options = options;
|
||||||
|
this.address = address;
|
||||||
|
this.abi = abi || ABI;
|
||||||
|
}
|
||||||
|
|
||||||
|
init () {
|
||||||
|
return this.provider.getNetwork().then((network) => {
|
||||||
|
this.address = this.address || Addresses[network.chainId.toString()];
|
||||||
|
this.contract = new ethers.Contract(
|
||||||
|
this.address,
|
||||||
|
this.abi,
|
||||||
|
(this.signer || this.provider)
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
appIdFor (contractName) {
|
||||||
|
// see appIds in KreditsKit.sol for more details
|
||||||
|
const knownContracts = ['Contribution', 'Contributor', 'Proposal', 'Reimbursement', 'Token'];
|
||||||
|
return this.contract.appIds(knownContracts.indexOf(contractName));
|
||||||
|
}
|
||||||
|
|
||||||
|
newDAO (options = {}) {
|
||||||
|
return this.contract.newInstance(options).then(transaction => {
|
||||||
|
return transaction.wait().then(result => {
|
||||||
|
const deployEvent = result.events.find(e => e.event === 'DeployInstance');
|
||||||
|
return {
|
||||||
|
daoAddress: deployEvent.args.dao,
|
||||||
|
transactionHash: transaction.hash,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = KreditsKit;
|
||||||
@@ -1,19 +1,75 @@
|
|||||||
|
const schemas = require('@kosmos/schemas');
|
||||||
|
const validator = require('../utils/validator');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle serialization for JSON-LD object of the contribution, according to
|
* Serialization and validation for JSON-LD document of the contribution.
|
||||||
* https://github.com/67P/kosmos-schemas/blob/master/schemas/contribution.json
|
|
||||||
*
|
*
|
||||||
* @class
|
* @class
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
class Contribution {
|
class Contribution {
|
||||||
/**
|
|
||||||
* Deserialize JSON to object
|
constructor (attrs) {
|
||||||
*
|
Object.keys(attrs).forEach(a => this[a] = attrs[a]);
|
||||||
* @method
|
}
|
||||||
* @public
|
|
||||||
*/
|
/**
|
||||||
static deserialize(serialized) {
|
* Serialize object to JSON
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
serialize () {
|
||||||
let {
|
let {
|
||||||
|
contributorIpfsHash,
|
||||||
|
date,
|
||||||
|
time,
|
||||||
|
kind,
|
||||||
|
description,
|
||||||
|
url,
|
||||||
|
details,
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
'@context': 'https://schema.kosmos.org',
|
||||||
|
'@type': 'Contribution',
|
||||||
|
'contributor': {
|
||||||
|
'ipfs': contributorIpfsHash,
|
||||||
|
},
|
||||||
|
date,
|
||||||
|
time,
|
||||||
|
kind,
|
||||||
|
description,
|
||||||
|
'details': details || {},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
data['url'] = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write it pretty to ipfs
|
||||||
|
return JSON.stringify(data, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate serialized data against schema
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
validate () {
|
||||||
|
const serialized = JSON.parse(this.serialize());
|
||||||
|
const valid = validator.validate(serialized, schemas['contribution']);
|
||||||
|
return valid ? Promise.resolve() : Promise.reject(validator.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize JSON to object
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
static deserialize (serialized) {
|
||||||
|
let {
|
||||||
|
date,
|
||||||
|
time,
|
||||||
kind,
|
kind,
|
||||||
description,
|
description,
|
||||||
details,
|
details,
|
||||||
@@ -21,6 +77,8 @@ class Contribution {
|
|||||||
} = JSON.parse(serialized.toString('utf8'));
|
} = JSON.parse(serialized.toString('utf8'));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
date,
|
||||||
|
time,
|
||||||
kind,
|
kind,
|
||||||
description,
|
description,
|
||||||
details,
|
details,
|
||||||
@@ -29,39 +87,6 @@ class Contribution {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize object to JSON
|
|
||||||
*
|
|
||||||
* @method
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
static serialize(deserialized) {
|
|
||||||
let {
|
|
||||||
contributorIpfsHash,
|
|
||||||
kind,
|
|
||||||
description,
|
|
||||||
url,
|
|
||||||
details
|
|
||||||
} = deserialized;
|
|
||||||
|
|
||||||
let data = {
|
|
||||||
"@context": "https://schema.kosmos.org",
|
|
||||||
"@type": "Contribution",
|
|
||||||
"contributor": {
|
|
||||||
"ipfs": contributorIpfsHash
|
|
||||||
},
|
|
||||||
kind,
|
|
||||||
description,
|
|
||||||
"details": details || {}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (url) {
|
|
||||||
data["url"] = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write it pretty to ipfs
|
|
||||||
return JSON.stringify(data, null, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contribution;
|
module.exports = Contribution;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const schemas = require('@kosmos/schemas');
|
||||||
|
const validator = require('../utils/validator');
|
||||||
/**
|
/**
|
||||||
* Handle serialization for JSON-LD object of the contributor, according to
|
* Handle serialization for JSON-LD object of the contributor, according to
|
||||||
* https://github.com/67P/kosmos-schemas/blob/master/schemas/contributor.json
|
* https://github.com/67P/kosmos-schemas/blob/master/schemas/contributor.json
|
||||||
@@ -6,13 +8,95 @@
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
class Contributor {
|
class Contributor {
|
||||||
/**
|
|
||||||
|
constructor (attrs) {
|
||||||
|
Object.keys(attrs).forEach(a => this[a] = attrs[a]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize object to JSON
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
serialize () {
|
||||||
|
let {
|
||||||
|
name,
|
||||||
|
kind,
|
||||||
|
url,
|
||||||
|
github_uid,
|
||||||
|
github_username,
|
||||||
|
gitea_username,
|
||||||
|
wiki_username,
|
||||||
|
zoom_display_name,
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
'@context': 'https://schema.kosmos.org',
|
||||||
|
'@type': 'Contributor',
|
||||||
|
kind,
|
||||||
|
name,
|
||||||
|
accounts: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
data['url'] = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (github_uid) {
|
||||||
|
data.accounts.push({
|
||||||
|
'site': 'github.com',
|
||||||
|
'uid': github_uid,
|
||||||
|
'username': github_username,
|
||||||
|
'url': `https://github.com/${github_username}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gitea_username) {
|
||||||
|
data.accounts.push({
|
||||||
|
'site': 'gitea.kosmos.org',
|
||||||
|
'username': gitea_username,
|
||||||
|
'url': `https://gitea.kosmos.org/${gitea_username}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wiki_username) {
|
||||||
|
data.accounts.push({
|
||||||
|
'site': 'wiki.kosmos.org',
|
||||||
|
'username': wiki_username,
|
||||||
|
'url': `https://wiki.kosmos.org/User:${wiki_username}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate serialized data against schema
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
validate () {
|
||||||
|
const serialized = JSON.parse(this.serialize());
|
||||||
|
const valid = validator.validate(serialized, schemas['contributor']);
|
||||||
|
return valid ? Promise.resolve() : Promise.reject(validator.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Deserialize JSON to object
|
* Deserialize JSON to object
|
||||||
*
|
*
|
||||||
* @method
|
* @method
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
static deserialize(serialized) {
|
static deserialize (serialized) {
|
||||||
let {
|
let {
|
||||||
name,
|
name,
|
||||||
kind,
|
kind,
|
||||||
@@ -20,16 +104,24 @@ class Contributor {
|
|||||||
accounts,
|
accounts,
|
||||||
} = JSON.parse(serialized.toString('utf8'));
|
} = JSON.parse(serialized.toString('utf8'));
|
||||||
|
|
||||||
let github_username, github_uid, wiki_username;
|
let github_username, github_uid, gitea_username, wiki_username, zoom_display_name;
|
||||||
let github = accounts.find((a) => a.site === 'github.com');
|
let github = accounts.find(a => a.site === 'github.com');
|
||||||
let wiki = accounts.find((a) => a.site === 'wiki.kosmos.org');
|
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) {
|
if (github) {
|
||||||
(({ username: github_username, uid: github_uid} = github));
|
(({ username: github_username, uid: github_uid} = github));
|
||||||
}
|
}
|
||||||
|
if (gitea) {
|
||||||
|
(({ username: gitea_username } = gitea));
|
||||||
|
}
|
||||||
if (wiki) {
|
if (wiki) {
|
||||||
(({ username: wiki_username } = wiki));
|
(({ username: wiki_username } = wiki));
|
||||||
}
|
}
|
||||||
|
if (zoom) {
|
||||||
|
(({ username: zoom_display_name } = zoom));
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
@@ -38,59 +130,13 @@ class Contributor {
|
|||||||
accounts,
|
accounts,
|
||||||
github_uid,
|
github_uid,
|
||||||
github_username,
|
github_username,
|
||||||
|
gitea_username,
|
||||||
wiki_username,
|
wiki_username,
|
||||||
|
zoom_display_name,
|
||||||
ipfsData: serialized,
|
ipfsData: serialized,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize object to JSON
|
|
||||||
*
|
|
||||||
* @method
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
static serialize(deserialized) {
|
|
||||||
let {
|
|
||||||
name,
|
|
||||||
kind,
|
|
||||||
url,
|
|
||||||
github_uid,
|
|
||||||
github_username,
|
|
||||||
wiki_username,
|
|
||||||
} = deserialized;
|
|
||||||
|
|
||||||
let data = {
|
|
||||||
"@context": "https://schema.kosmos.org",
|
|
||||||
"@type": "Contributor",
|
|
||||||
kind,
|
|
||||||
name,
|
|
||||||
"accounts": []
|
|
||||||
};
|
|
||||||
|
|
||||||
if (url) {
|
|
||||||
data["url"] = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (github_uid) {
|
|
||||||
data.accounts.push({
|
|
||||||
"site": "github.com",
|
|
||||||
"uid": github_uid,
|
|
||||||
"username": github_username,
|
|
||||||
"url": `https://github.com/${github_username}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wiki_username) {
|
|
||||||
data.accounts.push({
|
|
||||||
"site": "wiki.kosmos.org",
|
|
||||||
"username": wiki_username,
|
|
||||||
"url": `https://wiki.kosmos.org/User:${wiki_username}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write it pretty to ipfs
|
|
||||||
return JSON.stringify(data, null, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contributor;
|
module.exports = Contributor;
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
const schemas = require('@kosmos/schemas');
|
||||||
|
const validator = require('../utils/validator');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialization and validation for JSON-LD document of the Expense
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
class ExpenseSerializer {
|
||||||
|
|
||||||
|
constructor (attrs) {
|
||||||
|
Object.keys(attrs).forEach(a => this[a] = attrs[a]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize object to JSON
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
serialize () {
|
||||||
|
// Write it pretty to ipfs
|
||||||
|
return JSON.stringify(this.data, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
get data () {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
currency,
|
||||||
|
amount,
|
||||||
|
date,
|
||||||
|
url,
|
||||||
|
tags,
|
||||||
|
details,
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
'@context': 'https://schema.kosmos.org',
|
||||||
|
'@type': 'Expense',
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
currency,
|
||||||
|
amount,
|
||||||
|
date,
|
||||||
|
'tags': tags || [],
|
||||||
|
'details': details || {},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
data['url'] = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate serialized data against schema
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
validate () {
|
||||||
|
const serialized = JSON.parse(this.serialize());
|
||||||
|
const valid = validator.validate(serialized, schemas['expense']);
|
||||||
|
return valid ? Promise.resolve() : Promise.reject(validator.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize JSON to object
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
static deserialize (serialized) {
|
||||||
|
const {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
currency,
|
||||||
|
amount,
|
||||||
|
date,
|
||||||
|
url,
|
||||||
|
tags,
|
||||||
|
details,
|
||||||
|
} = JSON.parse(serialized.toString('utf8'));
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
currency,
|
||||||
|
amount,
|
||||||
|
date,
|
||||||
|
url,
|
||||||
|
tags,
|
||||||
|
details,
|
||||||
|
ipfsData: serialized,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ExpenseSerializer;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/*eslint no-console: ["error", { allow: ["warn"] }] */
|
||||||
|
|
||||||
|
module.exports = function deprecate (msg) {
|
||||||
|
console.warn(msg);
|
||||||
|
};
|
||||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user