Compare commits

..

1 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
9 changed files with 41423 additions and 33 deletions

View File

@@ -1,4 +0,0 @@
template: |
## Changes
$CHANGES

8145
apps/contribution/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -21,19 +21,6 @@ contract Contributor is AragonApp {
uint8 hashFunction;
uint8 hashSize;
bool exists;
// TODO
uint256 claimedBalance;
}
// TODO
function withdraw() {
// look up contributorId for msg.sender address
// require msg.sender is contributor
uint256 confirmedKredits = Contribution.totalKreditsEarnedByContributor(contributorId, confirmedOnly=true);
uint256 claimableAmount = confirmedKredits - contributor.claimedBalance;
// require claimableAmount > 0
contributor.claimedBalance += claimableAmount;
IToken(token).mintFor(msg.sender, amount);
}
mapping (address => uint32) public contributorIds;

8145
apps/contributor/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

8145
apps/proposal/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

8145
apps/token/yarn.lock Normal file

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;
});
});
}

View File

@@ -28,7 +28,7 @@ class Contributor {
github_username,
gitea_username,
wiki_username,
zoom_display_name,
accounts,
} = this;
let data = {
@@ -36,7 +36,7 @@ class Contributor {
'@type': 'Contributor',
kind,
name,
accounts: [],
accounts: accounts || [],
};
if (url) {
@@ -68,13 +68,6 @@ class Contributor {
});
}
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);
}
@@ -104,11 +97,10 @@ class Contributor {
accounts,
} = JSON.parse(serialized.toString('utf8'));
let github_username, github_uid, gitea_username, wiki_username, zoom_display_name;
let github_username, github_uid, gitea_username, wiki_username;
let github = accounts.find(a => a.site === 'github.com');
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) {
(({ username: github_username, uid: github_uid} = github));
@@ -119,9 +111,6 @@ class Contributor {
if (wiki) {
(({ username: wiki_username } = wiki));
}
if (zoom) {
(({ username: zoom_display_name } = zoom));
}
return {
name,
@@ -132,7 +121,6 @@ class Contributor {
github_username,
gitea_username,
wiki_username,
zoom_display_name,
ipfsData: serialized,
};
}

8836
yarn.lock Normal file

File diff suppressed because it is too large Load Diff