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