Skip to content

Commit b19ecb4

Browse files
committedFeb 3, 2015
Fix taker_gets_funded exceeding offer.TakerGets
1 parent ba9af55 commit b19ecb4

File tree

3 files changed

+684
-676
lines changed

3 files changed

+684
-676
lines changed
 

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
"superagent": "^0.18.0"
2626
},
2727
"devDependencies": {
28+
"assert-diff": "0.0.4",
2829
"coveralls": "~2.10.0",
2930
"gulp": "~3.6.2",
3031
"gulp-bump": "~0.1.10",
3132
"gulp-clean-dest": "^0.1.0",
3233
"gulp-concat": "~2.2.0",
34+
"gulp-eslint": "^0.2.0",
3335
"gulp-filelog": "^0.4.1",
3436
"gulp-flowtype": "^0.4.1",
3537
"gulp-plumber": "^0.6.6",
@@ -38,7 +40,6 @@
3840
"gulp-uglify": "~0.3.0",
3941
"gulp-util": "^3.0.2",
4042
"gulp-watch": "^3.0.0",
41-
"gulp-eslint": "^0.2.0",
4243
"istanbul": "~0.2.10",
4344
"map-stream": "~0.1.0",
4445
"mocha": "~1.14.0",

‎src/js/ripple/orderbook.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,14 @@ OrderBook.prototype.setFundedAmount = function(offer, fundedAmount) {
439439
return offer;
440440
}
441441

442-
offer.taker_gets_funded = fundedAmount;
442+
var isOfferGetsExceeded = Amount.from_json(fundedAmount)
443+
.compareTo(offer.TakerGets) > 0;
444+
445+
if (isOfferGetsExceeded) {
446+
offer.taker_gets_funded = offer.TakerGets;
447+
} else {
448+
offer.taker_gets_funded = fundedAmount;
449+
}
443450

444451
var takerPaysValue = (typeof offer.TakerPays === 'object')
445452
? offer.TakerPays.value

0 commit comments

Comments
 (0)