Compare commits

..

5 Commits

Author SHA1 Message Date
a7c497da6a Return IPFS hash in addContribution() response
Needed in kredits-web. Useful for clients to identify contributions
before knowing their assigned ID.
2019-09-10 12:18:35 +02:00
1c1a318ae6 Merge pull request #165 from 67P/docs/blocktime
Document how to configure block time for Ganache
2019-08-09 22:10:06 +00:00
a572f02b2e Merge pull request #164 from 67P/chore/remove-cached-artifacts
Remove cached artifacts
2019-08-09 19:00:21 +02:00
abd4caa336 Document how to configure block time for Ganache 2019-08-09 18:58:20 +02:00
f1941eb6b8 Remove cached artifacts
Thos should be generated on every contract app deployment and thus don't need to
be in the repo.
We also don't have those for the other contract apps.
2019-08-09 18:46:36 +02:00
5 changed files with 9 additions and 2168 deletions

View File

@@ -22,13 +22,11 @@ install:
before_script:
- npm run devchain &
- ipfs daemon --offline &
script:
- npm run lint:wrapper
- npm run lint:contract-tests
- npm run test
- npm run bootstrap
branches:
only:

View File

@@ -38,7 +38,7 @@ Aragon CLI and Truffle need to be installed on your sytem as well:
For local development it is recommended to use
[ganache](http://truffleframework.com/ganache/) to run a local development
chain. Using the ganache simulator no full Ethereum node is required.
chain. When using the ganache simulator, no full Ethereum node is required.
We use the default aragon-cli devchain command to configure and run a local
development ganache.
@@ -52,6 +52,10 @@ To clear/reset the chain use (e.g. if you run out of funds on your devchain)
We default to port 7545 for development to not get in conflict with the default
Ethereum RPC port.
You can also set certain ganache options to configure the devchain, for example
if you want to increase the block time to 10 seconds you can add
`--block-time=10`.
### Bootstrap
1. Run an Ethereum node and ipfs

View File

@@ -1,912 +0,0 @@
{
"roles": [
{
"name": "Add contributions",
"id": "ADD_CONTRIBUTION_ROLE",
"params": [],
"bytes": "0x493d28cd0d82bcb20db66e4f6390a00122ef772717e282b436ba3240af18bfb1"
},
{
"name": "Manage token contract",
"id": "MANAGE_TOKEN_CONTRACT_ROLE",
"params": [],
"bytes": "0xdd275187bc43df45ce7b34f6716e572716c69ad44e5e496175008950f032854b"
},
{
"name": "Veto contributions",
"id": "VETO_CONTRIBUTION_ROLE",
"params": [],
"bytes": "0x495a36de1ed34d5c1b9f8704e7d8bc8badb027221b09c79691d430bc54c4c88f"
}
],
"environments": {
"default": {
"network": "development",
"appName": "kredits-contribution.open.aragonpm.eth"
}
},
"path": "contracts/Contribution.sol",
"appName": "kredits-contribution.open.aragonpm.eth",
"appId": "0x09f5274cba299b46c5be722ef672d10eef7a2ef980b612aef529d74fb9da7643",
"abi": [
{
"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": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getTokenContract",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getContributorContract",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributorAccount",
"type": "address"
}
],
"name": "getContributorIdByAddress",
"outputs": [
{
"name": "",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributorId",
"type": "uint32"
}
],
"name": "getContributorAddressById",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"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": "contributionId",
"type": "uint32"
}
],
"name": "ownerOf",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "index",
"type": "uint32"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"name": "",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributionId",
"type": "uint32"
}
],
"name": "tokenMetadata",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "confirmedOnly",
"type": "bool"
}
],
"name": "totalKreditsEarned",
"outputs": [
{
"name": "amount",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributorId",
"type": "uint32"
},
{
"name": "confirmedOnly",
"type": "bool"
}
],
"name": "totalKreditsEarnedByContributor",
"outputs": [
{
"name": "amount",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributionId",
"type": "uint32"
}
],
"name": "getContribution",
"outputs": [
{
"name": "id",
"type": "uint32"
},
{
"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": "confirmedAtBlock",
"type": "uint256"
},
{
"name": "exists",
"type": "bool"
},
{
"name": "vetoed",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "amount",
"type": "uint32"
},
{
"name": "contributorId",
"type": "uint32"
},
{
"name": "hashDigest",
"type": "bytes32"
},
{
"name": "hashFunction",
"type": "uint8"
},
{
"name": "hashSize",
"type": "uint8"
}
],
"name": "add",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "contributionId",
"type": "uint32"
}
],
"name": "veto",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "contributionId",
"type": "uint32"
}
],
"name": "claim",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "contributionId",
"type": "uint32"
}
],
"name": "exists",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"deployment": {
"contractName": "Contribution",
"compiledAt": "2019-06-13T12:39:07.659Z",
"compiler": {
"name": "solc",
"version": "0.4.24+commit.e67f0147.Emscripten.clang",
"optimizer": {
"enabled": false
}
},
"flattenedCode": "./code.sol",
"transactionHash": "0x073057bb616243e415823fa9a8c8cc096b573fbd0bbf11c2f59bb75a84291689"
},
"functions": [
{
"sig": "mintFor(address,uint256,uint32)",
"roles": [],
"notice": null
},
{
"sig": "initialize(bytes32[4])",
"roles": [],
"notice": null
},
{
"sig": "add(uint32,uint32,bytes32,uint8,uint8)",
"roles": [
"ADD_CONTRIBUTION_ROLE"
],
"notice": null
},
{
"sig": "veto(uint32)",
"roles": [
"VETO_CONTRIBUTION_ROLE"
],
"notice": null
},
{
"sig": "claim(uint32)",
"roles": [],
"notice": null
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -58,7 +58,10 @@ class Contribution extends Record {
ipfsHashAttr.hashSize,
];
return this.functions.add(...contribution, callOptions);
return this.functions.add(...contribution, callOptions).then(res => {
res.ipfsHash = this.ipfs.encodeHash(ipfsHashAttr);
return res;
});
});
}