Rework offer amount calculation.

This commit is contained in:
Arthur Britto
2012-07-13 15:27:22 -07:00
parent 9d40598b2b
commit a3fb732e24
5 changed files with 65 additions and 46 deletions

View File

@@ -330,7 +330,11 @@ public:
// Someone is offering X for Y, I try to pay Z, how much do I get?
// And what's left of the offer? And how much do I actually pay?
static STAmount getClaimed(STAmount& offerOut, STAmount& offerIn, STAmount& paid);
static bool applyOffer(
const STAmount& saOfferFunds, const STAmount& saTakerFunds,
const STAmount& saOfferPays, const STAmount& saOfferGets,
const STAmount& saTakerPays, const STAmount& saTakerGets,
STAmount& saTakerPaid, STAmount& saTakerGot);
// Someone is offering X for Y, I need Z, how much do I pay
static STAmount getPay(const STAmount& offerOut, const STAmount& offerIn, const STAmount& needed);