mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-30 09:05:50 +00:00
Fix taker_gets_funded exceeding offer.TakerGets
This commit is contained in:
@@ -25,11 +25,13 @@
|
||||
"superagent": "^0.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"assert-diff": "0.0.4",
|
||||
"coveralls": "~2.10.0",
|
||||
"gulp": "~3.6.2",
|
||||
"gulp-bump": "~0.1.10",
|
||||
"gulp-clean-dest": "^0.1.0",
|
||||
"gulp-concat": "~2.2.0",
|
||||
"gulp-eslint": "^0.2.0",
|
||||
"gulp-filelog": "^0.4.1",
|
||||
"gulp-flowtype": "^0.4.1",
|
||||
"gulp-plumber": "^0.6.6",
|
||||
@@ -38,7 +40,6 @@
|
||||
"gulp-uglify": "~0.3.0",
|
||||
"gulp-util": "^3.0.2",
|
||||
"gulp-watch": "^3.0.0",
|
||||
"gulp-eslint": "^0.2.0",
|
||||
"istanbul": "~0.2.10",
|
||||
"map-stream": "~0.1.0",
|
||||
"mocha": "~1.14.0",
|
||||
|
||||
@@ -439,7 +439,14 @@ OrderBook.prototype.setFundedAmount = function(offer, fundedAmount) {
|
||||
return offer;
|
||||
}
|
||||
|
||||
var isOfferGetsExceeded = Amount.from_json(fundedAmount)
|
||||
.compareTo(offer.TakerGets) > 0;
|
||||
|
||||
if (isOfferGetsExceeded) {
|
||||
offer.taker_gets_funded = offer.TakerGets;
|
||||
} else {
|
||||
offer.taker_gets_funded = fundedAmount;
|
||||
}
|
||||
|
||||
var takerPaysValue = (typeof offer.TakerPays === 'object')
|
||||
? offer.TakerPays.value
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var assert = require('assert');
|
||||
var assert = require('assert-diff');
|
||||
var Remote = require('ripple-lib').Remote;
|
||||
var Currency = require('ripple-lib').Currency;
|
||||
var Amount = require('ripple-lib').Amount;
|
||||
@@ -1791,7 +1791,7 @@ describe('OrderBook', function() {
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '3900',
|
||||
is_fully_funded: false,
|
||||
taker_gets_funded: '3900',
|
||||
taker_gets_funded: '2000',
|
||||
taker_pays_funded: '97.22927678564545'
|
||||
},
|
||||
{
|
||||
@@ -1811,7 +1811,7 @@ describe('OrderBook', function() {
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
is_fully_funded: false,
|
||||
taker_gets_funded: '3900',
|
||||
taker_gets_funded: '2000',
|
||||
taker_pays_funded: '97.22927678564545'
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user