Skip to content

Commit

Permalink
Fix taker_gets_funded exceeding offer.TakerGets
Browse files Browse the repository at this point in the history
  • Loading branch information
wltsmrz committed Feb 3, 2015
1 parent ba9af55 commit b19ecb4
Show file tree
Hide file tree
Showing 3 changed files with 684 additions and 676 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
9 changes: 8 additions & 1 deletion src/js/ripple/orderbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,14 @@ OrderBook.prototype.setFundedAmount = function(offer, fundedAmount) {
return offer;
}

offer.taker_gets_funded = fundedAmount;
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
Expand Down
Loading

0 comments on commit b19ecb4

Please sign in to comment.