Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f221e53

Browse files
author
Curtis
committed
Merge pull request #230 from maddenpj/Unit-Price-Fix
Fix sell form to use fixed BTC/MSC rate
2 parents b54eb6f + b9c73e8 commit f221e53

4 files changed

Lines changed: 19 additions & 11 deletions

File tree

api/sell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def sell_form_response(response_dict):
2828
amount=response_dict['amount'][0]
2929
if float(amount)<0 or float( from_satoshi( amount ))>max_currency_value:
3030
return (None, 'Invalid amount')
31-
price=response_dict['price'][0]
32-
if float(price)<0 or float( from_satoshi( price ))>max_currency_value:
31+
price=float(response_dict['price'][0])
32+
if price < 0:
3333
return (None, 'Invalid price')
3434
min_buyer_fee=response_dict['min_buyer_fee'][0]
3535
if float(min_buyer_fee)<0 or float( from_satoshi( min_buyer_fee ))>max_currency_value:
@@ -49,8 +49,8 @@ def sell_form_response(response_dict):
4949
else:
5050
return (None, 'Invalid currency')
5151

52-
satoshi_price=int( price )
53-
bitcoin_amount_desired=int( satoshi_price * int(amount) )
52+
#satoshi_price=int( price )
53+
bitcoin_amount_desired=int( price * int(amount) )
5454

5555
#DEBUG info(['early days', seller, amount, satoshi_price, bitcoin_amount_desired, min_buyer_fee, fee, blocks, currency])
5656
if pubkey != None:

www/js/WalletTradeAssetsController.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function WalletTradeAssetsController($modal, $scope, $http, $q, userService) {
3333

3434
// [ Retrieve Balances ]
3535
$scope.currencyUnit = 'stom' // satoshi to millibitt
36+
$scope.amountUnit = 'mtow'
3637
$scope.balanceData = [ 0 ];
3738
var addrListBal = [];
3839

@@ -445,12 +446,13 @@ function WalletTradeAssetsController($modal, $scope, $http, $q, userService) {
445446
var minerMinimum = 10000;
446447
var nonZeroValue = 1;
447448

448-
var salePricePerCoin = Math.ceil( formatCurrencyInFundamentalUnit( +$scope.salePricePerCoin , currencyUnit[3]+'tos' ) );
449+
// var salePricePerCoin = Math.ceil( formatCurrencyInFundamentalUnit( +$scope.salePricePerCoin , currencyUnit[3]+'tos' ) );
450+
var salePricePerCoin = +$scope.salePricePerCoin
449451
var buyersFee = Math.ceil( formatCurrencyInFundamentalUnit( +$scope.buyersFee , currencyUnit[3] +'tos' ) );
450452
var minerFees = Math.ceil( formatCurrencyInFundamentalUnit( +$scope.minerFees , currencyUnit[3] +'tos' ) );
451453
var saleAmount = Math.ceil( formatCurrencyInFundamentalUnit( +$scope.saleAmount , currencyUnit[3]+'tos' ) );
452454

453-
var salePricePerCoinMillis = formatCurrencyInFundamentalUnit( salePricePerCoin , 'stom' ) ;
455+
// var salePricePerCoinMillis = formatCurrencyInFundamentalUnit( salePricePerCoin , 'stom' ) ;
454456
var buyersFeeMillis = formatCurrencyInFundamentalUnit( buyersFee , 'stom' ) ;
455457
var minerFeesMillis = formatCurrencyInFundamentalUnit( minerFees , 'stom' ) ;
456458
var saleAmountMillis = formatCurrencyInFundamentalUnit( saleAmount , 'stom' ) ;
@@ -495,7 +497,7 @@ function WalletTradeAssetsController($modal, $scope, $http, $q, userService) {
495497
<div class="modal-body">\
496498
<h3 class="text-center"> Confirm sale order </h3>\
497499
<h3>You\'re about to put ' + saleAmountMillis + 'm' + $scope.selectedCoin +
498-
' on sale at a price of ' + salePricePerCoinMillis + 'mBTC per coin' +
500+
' on sale at a price of ' + salePricePerCoin + ' BTC per ' + $scope.selectedCoin +
499501
', plus charge ' + buyersFeeMillis + ' in fees over ' +
500502
$scope.saleBlocks + ' blocks.</h3>\
501503
<p><br>\

www/js/filter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ var conversionFactor = {
1717
//These are original values and are not consistent
1818
'BTC': 100000,
1919
'MSC': 100000000,
20-
'TMSC': 100000000
20+
'TMSC': 100000000,
21+
22+
'mtow': 1000,
23+
'wtow': 1
2124
};
2225
function getConversionFactor( symbol ) {
2326
return conversionFactor[ symbol ];

www/partials/wallet_sale.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ <h6 class="text-justify"> Please make sure this is the address you are sending f
3030
<div class="col-xs-6">
3131
<br><br><br><br><br><br><br><br><br>
3232
<button class="btn btn-primary btn-md"
33-
ng-click="currencyUnit = 'stom'" type="button">Convert to mBTC </button>
33+
ng-click="currencyUnit = 'stom'; amountUnit = 'mtow'" type="button">Convert to mBTC </button>
3434
<button class="btn btn-primary btn-md"
35-
ng-click="currencyUnit = 'stow'" type="button">Convert to whole BTC </button>
35+
ng-click="currencyUnit = 'stow'; amountUnit = 'wtow'" type="button">Convert to whole BTC </button>
3636
</div>
3737
</div>
3838
<div class="row">
@@ -48,9 +48,12 @@ <h6 class="text-justify"> Please make sure this is the address you are sending f
4848
</div>
4949
<br>
5050
<div class="input-group">
51-
<span class="input-group-addon"> Price per coin (in {{currencyUnit[currencyUnit.length-1]}}BTC): </span>
51+
<span class="input-group-addon"> Price per coin (in BTC/{{ selectedCoin }}): </span>
5252
<input name="ppc" type="number" ng-model="salePricePerCoin" class="form-control"
5353
placeholder="{{{ balance: 1000000, symbol: currencyUnit} | cryptocurrency}}" required>
54+
<span class="input-group-addon" >
55+
Total Sale Amount: {{ ({ balance: (saleAmount || 0), symbol: amountUnit } | cryptocurrency)*(salePricePerCoin || 0)}}
56+
BTC</span>
5457
</div>
5558
<br>
5659
<div id="time-blocks" class="input-group">

0 commit comments

Comments
 (0)