Switch from ETH/WBTC to RBTC/BTC
This commit is contained in:
@@ -115,14 +115,14 @@ export default class AddReimbursementComponent extends Component {
|
|||||||
@action
|
@action
|
||||||
submit (e) {
|
submit (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!this.kredits.currentUser) { window.alert('You need to connect your Ethereum account first.'); return false }
|
if (!this.kredits.currentUser) { window.alert('You need to connect your RSK account first.'); return false }
|
||||||
if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false }
|
if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false }
|
||||||
|
|
||||||
const contributor = this.contributors.findBy('id', parseInt(this.recipientId));
|
const contributor = this.contributors.findBy('id', parseInt(this.recipientId));
|
||||||
|
|
||||||
const attributes = {
|
const attributes = {
|
||||||
amount: parseInt(parseFloat(this.total) * 100000000), // convert to sats
|
amount: parseInt(parseFloat(this.total) * 100000000), // convert to sats
|
||||||
token: config.tokens['WBTC'],
|
token: config.tokens['BTC'],
|
||||||
recipientId: parseInt(this.recipientId),
|
recipientId: parseInt(this.recipientId),
|
||||||
title: `Expenses covered by ${contributor.name}`,
|
title: `Expenses covered by ${contributor.name}`,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<fieldset class="horizontal thirds total-amounts">
|
<fieldset class="horizontal thirds total-amounts">
|
||||||
<label>
|
<label>
|
||||||
<p class="label">Total amount (WBTC):</p>
|
<p class="label">Total amount (BTC):</p>
|
||||||
<p>
|
<p>
|
||||||
<Input @type="text"
|
<Input @type="text"
|
||||||
@placeholder="0.0015"
|
@placeholder="0.0015"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="token-amount">
|
<p class="token-amount">
|
||||||
<span class="amount">
|
<span class="amount">
|
||||||
{{sats-to-btc reimbursement.amount}}</span> <span class="symbol">WBTC</span>
|
{{sats-to-btc reimbursement.amount}}</span> <span class="symbol">BTC</span>
|
||||||
</p>
|
</p>
|
||||||
<ul class="expense-list">
|
<ul class="expense-list">
|
||||||
{{#each reimbursement.expenses as |expense|}}
|
{{#each reimbursement.expenses as |expense|}}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ export default helper(function fmtCryptoCurrency(params/*, hash*/) {
|
|||||||
const code = params[1];
|
const code = params[1];
|
||||||
|
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case 'ETH':
|
case 'RBTC':
|
||||||
fmtAmount = amount / 1000000000000000000;
|
fmtAmount = amount / 1000000000000000000;
|
||||||
break;
|
break;
|
||||||
case 'WBTC':
|
case 'BTC':
|
||||||
fmtAmount = amount / 100000000;
|
fmtAmount = amount / 100000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ export default class CommunityFundsService extends Service {
|
|||||||
// ERC20 token, has all meta data
|
// ERC20 token, has all meta data
|
||||||
this.balances.pushObject(balance);
|
this.balances.pushObject(balance);
|
||||||
} else {
|
} else {
|
||||||
// ETH, missing meta data
|
// RBTC, missing meta data
|
||||||
this.balances.pushObject({
|
this.balances.pushObject({
|
||||||
...balance,
|
...balance,
|
||||||
...{ token: { name: 'Ether', symbol: 'ETH'} }
|
...{ token: { name: 'RBTC', symbol: 'RBTC'} }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ module.exports = function(environment) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
tokens: {
|
tokens: {
|
||||||
'WBTC': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'
|
// TODO this is still the WBTC address, since contracts currently
|
||||||
|
// requires a token address for reimbursements
|
||||||
|
'BTC': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'
|
||||||
},
|
},
|
||||||
|
|
||||||
gnosisSafe: {
|
gnosisSafe: {
|
||||||
@@ -67,8 +69,6 @@ module.exports = function(environment) {
|
|||||||
protocol: 'http',
|
protocol: 'http',
|
||||||
gatewayUrl: 'http://localhost:8080/ipfs'
|
gatewayUrl: 'http://localhost:8080/ipfs'
|
||||||
};
|
};
|
||||||
|
|
||||||
ENV.corsProxy = 'https://cors-anywhere.herokuapp.com/';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'test') {
|
if (environment === 'test') {
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { hbs } from 'ember-cli-htmlbars';
|
|||||||
module('Integration | Helper | fmt-crypto-currency', function(hooks) {
|
module('Integration | Helper | fmt-crypto-currency', function(hooks) {
|
||||||
setupRenderingTest(hooks);
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
test('it converts Wei to ETH', async function(assert) {
|
test('it converts Wei to RBTC', async function(assert) {
|
||||||
this.set('balanceETH', '500000000000000000');
|
this.set('balanceRBTC', '500000000000000000');
|
||||||
await render(hbs`{{fmt-crypto-currency balanceETH "ETH"}}`);
|
await render(hbs`{{fmt-crypto-currency balanceRBTC "RBTC"}}`);
|
||||||
assert.equal(this.element.textContent.trim(), '0.5');
|
assert.equal(this.element.textContent.trim(), '0.5');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it converts Satoshis to (W)BTC', async function(assert) {
|
test('it converts Satoshis to BTC', async function(assert) {
|
||||||
this.set('balanceWBTC', '117214976');
|
this.set('balanceBTC', '117214976');
|
||||||
await render(hbs`{{fmt-crypto-currency balanceWBTC "WBTC"}}`);
|
await render(hbs`{{fmt-crypto-currency balanceBTC "BTC"}}`);
|
||||||
assert.equal(this.element.textContent.trim(), '1.17214976');
|
assert.equal(this.element.textContent.trim(), '1.17214976');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user