Merge branch 'master' into feature/111-unconfirmed_balances
This commit is contained in:
+5
-1
@@ -1,5 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: 'recommended'
|
extends: 'recommended',
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'simple-unless': false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import Component from '@ember/component';
|
|||||||
import { and, notEmpty } from '@ember/object/computed';
|
import { and, notEmpty } from '@ember/object/computed';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
kredits: service(),
|
kredits: service(),
|
||||||
|
|
||||||
@@ -14,6 +13,7 @@ export default Component.extend({
|
|||||||
isValidURL: notEmpty('url'),
|
isValidURL: notEmpty('url'),
|
||||||
isValidGithubUID: notEmpty('github_uid'),
|
isValidGithubUID: notEmpty('github_uid'),
|
||||||
isValidGithubUsername: notEmpty('github_username'),
|
isValidGithubUsername: notEmpty('github_username'),
|
||||||
|
isValidGiteaUsername: notEmpty('gitea_username'),
|
||||||
isValidWikiUsername: notEmpty('wiki_username'),
|
isValidWikiUsername: notEmpty('wiki_username'),
|
||||||
isValid: and(
|
isValid: and(
|
||||||
'isValidAccount',
|
'isValidAccount',
|
||||||
@@ -21,10 +21,11 @@ export default Component.extend({
|
|||||||
'isValidGithubUID'
|
'isValidGithubUID'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
inProgress: false,
|
||||||
|
|
||||||
init () {
|
init () {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
// Default attributes used by reset
|
|
||||||
this.set('attributes', {
|
this.set('attributes', {
|
||||||
account: null,
|
account: null,
|
||||||
name: null,
|
name: null,
|
||||||
@@ -32,8 +33,8 @@ export default Component.extend({
|
|||||||
url: null,
|
url: null,
|
||||||
github_username: null,
|
github_username: null,
|
||||||
github_uid: null,
|
github_uid: null,
|
||||||
wiki_username: null,
|
gitea_username: null,
|
||||||
isCore: false
|
wiki_username: null
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -53,17 +54,19 @@ export default Component.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributes = Object.keys(this.attributes);
|
const attributes = Object.keys(this.attributes);
|
||||||
let contributor = this.getProperties(attributes);
|
const contributor = this.getProperties(attributes);
|
||||||
let saved = this.save(contributor);
|
|
||||||
|
|
||||||
// The promise handles inProgress
|
this.set('inProgress', true);
|
||||||
this.set('inProgress', saved);
|
|
||||||
|
|
||||||
saved.then(() => {
|
this.save(contributor).then(() => {
|
||||||
this.reset();
|
this.reset();
|
||||||
window.scroll(0,0);
|
window.scroll(0,0);
|
||||||
window.alert('Contributor added.');
|
}).catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
window.alert('Something went wrong. Please check the browser console.');
|
||||||
|
}).finally(() => {
|
||||||
|
this.set('inProgress', false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,4 @@
|
|||||||
<form {{action "submit" on="submit"}}>
|
<form {{action "submit" on="submit"}}>
|
||||||
<p>
|
|
||||||
{{input name="is-core"
|
|
||||||
type="checkbox"
|
|
||||||
id="is-core"
|
|
||||||
checked=isCore}}
|
|
||||||
<label for="is-core" class="checkbox">
|
|
||||||
Core team member (can add contributors)
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
{{input name="account"
|
{{input name="account"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -49,6 +40,13 @@
|
|||||||
value=github_username
|
value=github_username
|
||||||
class=(if isValidGithubUsername "valid" "")}}
|
class=(if isValidGithubUsername "valid" "")}}
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
{{input name="gitea_username"
|
||||||
|
type="text"
|
||||||
|
placeholder="Gitea username"
|
||||||
|
value=gitea_username
|
||||||
|
class=(if isValidGiteaUsername "valid" "")}}
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{input name="wiki_username"
|
{{input name="wiki_username"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -58,7 +56,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
{{input type="submit"
|
{{input type="submit"
|
||||||
disabled=(is-pending inProgress)
|
disabled=inProgress
|
||||||
value=(if (is-pending inProgress) "Processing" "Save")}}
|
value=(if inProgress "Processing" "Save")}}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ export default Component.extend({
|
|||||||
tagName: 'ul',
|
tagName: 'ul',
|
||||||
classNames: ['contribution-list'],
|
classNames: ['contribution-list'],
|
||||||
|
|
||||||
// actions: {
|
actions: {
|
||||||
//
|
|
||||||
// veto (contributionId) {
|
veto (contributionId) {
|
||||||
// if (this.contractInteractionEnabled) {
|
if (this.contractInteractionEnabled) {
|
||||||
// this.vetoContribution(contributionId);
|
this.vetoContribution(contributionId);
|
||||||
// } else {
|
} else {
|
||||||
// window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{{#each contributions as |contribution|}}
|
{{#each contributions as |contribution|}}
|
||||||
<li data-contribution-id={{contribution.id}} class={{if contribution.confirmed "confirmed" "unconfirmed"}}>
|
<li data-contribution-id={{contribution.id}} class="{{contribution-status contribution}} {{if contribution.vetoed "vetoed"}}">
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
||||||
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
||||||
@@ -14,5 +14,12 @@
|
|||||||
<p class="kredits-amount">
|
<p class="kredits-amount">
|
||||||
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
||||||
</p>
|
</p>
|
||||||
|
{{#unless contribution.vetoed}}
|
||||||
|
{{#unless (is-confirmed-contribution contribution)}}
|
||||||
|
<p class="voting">
|
||||||
|
<button {{action "veto" contribution.id}} class="small danger">veto</button>
|
||||||
|
</p>
|
||||||
|
{{/unless}}
|
||||||
|
{{/unless}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://testnet.etherscan.io/address/{{c.contributor.account}}" target="_blank" rel="noopener">Inspect Ethereum transactions</a>
|
<a href="https://rinkeby.etherscan.io/address/{{c.contributor.account}}" target="_blank" rel="noopener">Inspect Ethereum transactions</a>
|
||||||
</li>
|
</li>
|
||||||
{{#if c.contributor.ipfsHash}}
|
{{#if c.contributor.ipfsHash}}
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -27,21 +27,21 @@ export default Controller.extend({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
vetoContribution (/* contributionId */) {
|
vetoContribution (contributionId) {
|
||||||
// this.kredits.vote(proposalId).then(transaction => {
|
this.kredits.veto(contributionId).then(transaction => {
|
||||||
// window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
console.debug('[controllers:index] Veto submitted to Ethereum blockhain: '+transaction.hash);
|
||||||
// });
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmProposal (proposalId) {
|
confirmProposal (proposalId) {
|
||||||
this.kredits.vote(proposalId).then(transaction => {
|
this.kredits.vote(proposalId).then(transaction => {
|
||||||
window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
console.debug('[controllers:index] Vote submitted to Ethereum blockhain: '+transaction.hash);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
save (contributor) {
|
save (contributor) {
|
||||||
return this.kredits.addContributor(contributor)
|
return this.kredits.addContributor(contributor)
|
||||||
.then((contributor) => {
|
.then(contributor => {
|
||||||
this.contributors.pushObject(contributor);
|
this.contributors.pushObject(contributor);
|
||||||
return contributor;
|
return contributor;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import Helper from '@ember/component/helper';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
|
||||||
|
export default Helper.extend({
|
||||||
|
|
||||||
|
kredits: service(),
|
||||||
|
currentBlock: alias('kredits.currentBlock'),
|
||||||
|
|
||||||
|
compute([contribution]) {
|
||||||
|
if (contribution.vetoed) {
|
||||||
|
return 'vetoed';
|
||||||
|
} else if (contribution.confirmedAt > this.currentBlock) {
|
||||||
|
return 'unconfirmed';
|
||||||
|
} else {
|
||||||
|
return 'confirmed'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import Helper from '@ember/component/helper';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
|
||||||
|
export default Helper.extend({
|
||||||
|
|
||||||
|
kredits: service(),
|
||||||
|
currentBlock: alias('kredits.currentBlock'),
|
||||||
|
|
||||||
|
compute([contribution]) {
|
||||||
|
return !contribution.vetoed &&
|
||||||
|
(contribution.confirmedAt <= this.currentBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
+33
-10
@@ -84,9 +84,10 @@ export default Service.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function instantiateWithAccount (web3Provider, context) {
|
async function instantiateWithAccount (web3Provider, context) {
|
||||||
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
||||||
ethProvider = new ethers.providers.Web3Provider(web3Provider);
|
ethProvider = new ethers.providers.Web3Provider(web3Provider);
|
||||||
|
// const network = await ethProvider.getNetwork();
|
||||||
ethProvider.listAccounts().then(accounts => {
|
ethProvider.listAccounts().then(accounts => {
|
||||||
context.set('currentUserAccounts', accounts);
|
context.set('currentUserAccounts', accounts);
|
||||||
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
|
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
|
||||||
@@ -162,10 +163,15 @@ export default Service.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addContributor(attributes) {
|
addContributor(attributes) {
|
||||||
|
if (attributes.github_uid) {
|
||||||
|
const uidInt = parseInt(attributes.github_uid);
|
||||||
|
attributes.github_uid = uidInt;
|
||||||
|
}
|
||||||
|
|
||||||
console.debug('[kredits] add contributor', attributes);
|
console.debug('[kredits] add contributor', attributes);
|
||||||
|
|
||||||
return this.kredits.Contributor.add(attributes)
|
return this.kredits.Contributor.add(attributes, { gasLimit: 350000 })
|
||||||
.then((data) => {
|
.then(data => {
|
||||||
console.debug('[kredits] add contributor response', data);
|
console.debug('[kredits] add contributor response', data);
|
||||||
return Contributor.create(attributes);
|
return Contributor.create(attributes);
|
||||||
});
|
});
|
||||||
@@ -215,12 +221,22 @@ export default Service.extend({
|
|||||||
console.debug('[kredits] vote for', proposalId);
|
console.debug('[kredits] vote for', proposalId);
|
||||||
|
|
||||||
return this.kredits.Proposal.functions.vote(proposalId)
|
return this.kredits.Proposal.functions.vote(proposalId)
|
||||||
.then((data) => {
|
.then(data => {
|
||||||
console.debug('[kredits] vote response', data);
|
console.debug('[kredits] vote response', data);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
veto(contributionId) {
|
||||||
|
console.debug('[kredits] veto against', contributionId);
|
||||||
|
|
||||||
|
return this.kredits.Contribution.functions.veto(contributionId, { gasLimit: 300000 })
|
||||||
|
.then(data => {
|
||||||
|
console.debug('[kredits] veto response', data);
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getCurrentUser: computed('kredits.provider', function() {
|
getCurrentUser: computed('kredits.provider', function() {
|
||||||
if (isEmpty(this.currentUserAccounts)) {
|
if (isEmpty(this.currentUserAccounts)) {
|
||||||
return RSVP.resolve();
|
return RSVP.resolve();
|
||||||
@@ -241,23 +257,30 @@ export default Service.extend({
|
|||||||
return this.proposals.findBy('id', proposalId.toString());
|
return this.proposals.findBy('id', proposalId.toString());
|
||||||
},
|
},
|
||||||
|
|
||||||
findContributionById(contributionId) {
|
|
||||||
return this.contributions.findBy('id', contributionId.toString());
|
|
||||||
},
|
|
||||||
|
|
||||||
// Contract events
|
// Contract events
|
||||||
addContractEventHandlers() {
|
addContractEventHandlers() {
|
||||||
// Proposal events
|
this.kredits.Contribution
|
||||||
|
.on('ContributionVetoed', this.handleContributionVetoed.bind(this))
|
||||||
|
|
||||||
this.kredits.Proposal
|
this.kredits.Proposal
|
||||||
.on('ProposalCreated', this.handleProposalCreated.bind(this))
|
.on('ProposalCreated', this.handleProposalCreated.bind(this))
|
||||||
.on('ProposalVoted', this.handleProposalVoted.bind(this))
|
.on('ProposalVoted', this.handleProposalVoted.bind(this))
|
||||||
.on('ProposalExecuted', this.handleProposalExecuted.bind(this));
|
.on('ProposalExecuted', this.handleProposalExecuted.bind(this));
|
||||||
|
|
||||||
// Token events
|
|
||||||
this.kredits.Token
|
this.kredits.Token
|
||||||
.on('Transfer', this.handleTransfer.bind(this));
|
.on('Transfer', this.handleTransfer.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleContributionVetoed(contributionId) {
|
||||||
|
console.debug('[kredits] ContributionVetoed event received for ', contributionId);
|
||||||
|
const contribution = this.contributions.findBy('id', contributionId);
|
||||||
|
console.debug('[kredits] contribution', contribution);
|
||||||
|
|
||||||
|
if (contribution) {
|
||||||
|
contribution.set('vetoed', true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
handleProposalCreated(proposalId) {
|
handleProposalCreated(proposalId) {
|
||||||
let proposal = this.findProposalById(proposalId);
|
let proposal = this.findProposalById(proposalId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
button, input[type=submit] {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.6rem 2rem;
|
||||||
|
background-color: rgba(22, 21, 40, 0.6);
|
||||||
|
border: 1px solid rgba(22, 21, 40, 1);
|
||||||
|
border-radius: 3px;
|
||||||
|
color: $primary-color;
|
||||||
|
font-weight: 500;
|
||||||
|
text-transform: uppercase;
|
||||||
|
cursor: pointer;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(22, 21, 40, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
padding: 0.2rem 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.danger {
|
||||||
|
color: $red;
|
||||||
|
background-color: rgba(40, 21, 21, 0.6);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(40, 21, 21, 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-16
@@ -87,22 +87,6 @@ section {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button, input[type=submit] {
|
|
||||||
display: inline-block;
|
|
||||||
border: 1px solid rgba(22, 21, 40, 1);
|
|
||||||
background-color: rgba(22, 21, 40, 0.6);
|
|
||||||
color: $primary-color;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-weight: 500;
|
|
||||||
text-transform: uppercase;
|
|
||||||
cursor: pointer;
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba(22, 21, 40, 0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 550px) {
|
@media (min-width: 550px) {
|
||||||
section {
|
section {
|
||||||
h2 {
|
h2 {
|
||||||
@@ -111,6 +95,7 @@ button, input[type=submit] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@import "buttons";
|
||||||
@import "components/topbar";
|
@import "components/topbar";
|
||||||
@import "components/loading-spinner";
|
@import "components/loading-spinner";
|
||||||
@import "components/contributor-list";
|
@import "components/contributor-list";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ul.contribution-list {
|
|||||||
|
|
||||||
li {
|
li {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 5rem;
|
grid-template-columns: auto 5rem 5rem;
|
||||||
grid-row-gap: 0.5rem;
|
grid-row-gap: 0.5rem;
|
||||||
padding: 1rem 1.2rem;
|
padding: 1rem 1.2rem;
|
||||||
background-color: rgba(255,255,255,0.1);
|
background-color: rgba(255,255,255,0.1);
|
||||||
@@ -24,6 +24,16 @@ ul.contribution-list {
|
|||||||
border-top: 1px solid rgba(255,255,255,0.2);
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.confirmed {
|
||||||
|
grid-template-columns: auto 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.vetoed {
|
||||||
|
grid-template-columns: auto 5rem;
|
||||||
|
text-decoration: line-through;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -33,14 +43,6 @@ ul.contribution-list {
|
|||||||
&.kredits-amount, &.voting {
|
&.kredits-amount, &.voting {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.description {
|
|
||||||
grid-column-start: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.voting {
|
|
||||||
grid-column-start: span 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
@@ -92,12 +94,6 @@ ul.contribution-list {
|
|||||||
color: $primary-color;
|
color: $primary-color;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
height: 2rem;
|
|
||||||
line-height: 2rem;
|
|
||||||
padding: 0 0.6rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,12 +73,6 @@ ul.proposal-list {
|
|||||||
color: $primary-color;
|
color: $primary-color;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
height: 2rem;
|
|
||||||
line-height: 2rem;
|
|
||||||
padding: 0 0.6rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+6
-6
@@ -10911,9 +10911,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"kredits-contracts": {
|
"kredits-contracts": {
|
||||||
"version": "5.2.0",
|
"version": "5.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.3.0.tgz",
|
||||||
"integrity": "sha512-XS8PN01SEiSNDKUhH28KVmGJ7hS3HlhT+CsaAMgqvU9ACcE1Wizqd0AxoRutUmJkILic6W6bQQ5gRqSHcBpPBA==",
|
"integrity": "sha512-Wz4zuA6yo0Q4WbVEO61fvFin+6VTNjkBqHPhHCqq6dIoGdFSjUZ3BCKan1ei0axIAda7ZDP+eebe2vCr+eqcHg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ethers": "^4.0.27",
|
"ethers": "^4.0.27",
|
||||||
@@ -17139,9 +17139,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"pull-to-stream": {
|
"pull-to-stream": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pull-to-stream/-/pull-to-stream-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pull-to-stream/-/pull-to-stream-0.1.1.tgz",
|
||||||
"integrity": "sha512-LMvdE0JwT7XQZMFjc7JDl/G9gmoZ8Zo8e86SG4ZZUcjuwvod803KxpAK8WrmdxzHsMRK9DETlIzuA0tbEVv6jg==",
|
"integrity": "sha512-thZkMv6F9PILt9zdvpI2gxs19mkDrlixYKX6cOBxAW16i1NZH+yLAmF4r8QfJ69zuQh27e01JZP9y27tsH021w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"readable-stream": "^3.1.1"
|
"readable-stream": "^3.1.1"
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@
|
|||||||
"eslint-plugin-ember": "^5.2.0",
|
"eslint-plugin-ember": "^5.2.0",
|
||||||
"ethers": "^4.0.27",
|
"ethers": "^4.0.27",
|
||||||
"kosmos-schemas": "^2.0.0",
|
"kosmos-schemas": "^2.0.0",
|
||||||
"kredits-contracts": "^5.2.0",
|
"kredits-contracts": "^5.3.0",
|
||||||
"loader.js": "^4.7.0",
|
"loader.js": "^4.7.0",
|
||||||
"qunit-dom": "^0.8.0",
|
"qunit-dom": "^0.8.0",
|
||||||
"tv4": "^1.3.0"
|
"tv4": "^1.3.0"
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupTest } from 'ember-qunit';
|
||||||
|
|
||||||
|
module('Unit | Helper | contribution-status', function (hooks) {
|
||||||
|
setupTest(hooks);
|
||||||
|
|
||||||
|
test('returns the appropriate status', function (assert) {
|
||||||
|
const contributionStatus = this.owner.factoryFor('helper:contribution-status').create();
|
||||||
|
const kredits = this.owner.lookup('service:kredits');
|
||||||
|
|
||||||
|
kredits.set('currentBlock', 23000);
|
||||||
|
|
||||||
|
const contributionUnconfirmed = { confirmedAt: 23001, vetoed: false };
|
||||||
|
const contributionConfirmed = { confirmedAt: 21000, vetoed: false };
|
||||||
|
const contributionVetoed = { confirmedAt: 23001, vetoed: true };
|
||||||
|
|
||||||
|
assert.eq(contributionStatus.compute([contributionUnconfirmed]), 'unconfirmed');
|
||||||
|
assert.eq(contributionStatus.compute([contributionConfirmed]), 'confirmed');
|
||||||
|
assert.eq(contributionStatus.compute([contributionVetoed]), 'vetoed');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupTest } from 'ember-qunit';
|
||||||
|
|
||||||
|
module('Unit | Helper | contribution-status', function (hooks) {
|
||||||
|
setupTest(hooks);
|
||||||
|
|
||||||
|
test('returns the appropriate status', function (assert) {
|
||||||
|
const contributionStatus = this.owner.factoryFor('helper:contribution-status').create();
|
||||||
|
const kredits = this.owner.lookup('service:kredits');
|
||||||
|
|
||||||
|
kredits.set('currentBlock', 23000);
|
||||||
|
|
||||||
|
const contributionUnconfirmed = { confirmedAt: 23001, vetoed: false };
|
||||||
|
const contributionConfirmed = { confirmedAt: 21000, vetoed: false };
|
||||||
|
const contributionVetoed = { confirmedAt: 23001, vetoed: true };
|
||||||
|
|
||||||
|
assert.notOk(contributionStatus.compute([contributionUnconfirmed]), 'unconfirmed');
|
||||||
|
assert.notOk(contributionStatus.compute([contributionVetoed]), 'vetoed');
|
||||||
|
assert.ok(contributionStatus.compute([contributionConfirmed]), 'confirmed');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user