Skip to content

Commit

Permalink
save remaining funds
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomPhreak committed Jul 17, 2014
1 parent 4b6505d commit 0229f63
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ def parse (db, tx, message):
delta = (initial_value - value) * leverage * config.UNIT
if tx['block_index'] >= 311500 or config.TESTNET: # Protocol change.
bear_credit = bear_escrow + (delta * Fraction(bear_escrow, bear_wager_quantity))
bull_credit = (escrow_less_fee - bear_escrow) - (delta * Fraction(bull_escrow, bull_wager_quantity))
bull_credit = bull_escrow - (delta * Fraction(bull_escrow, bull_wager_quantity))
else:
bear_credit = bear_escrow + delta
bull_credit = escrow_less_fee - bear_escrow - delta
bull_credit = bull_escrow - delta
bear_credit = round(bear_credit)
bull_credit = round(bull_credit)

Expand Down Expand Up @@ -229,6 +229,11 @@ def parse (db, tx, message):
elif timestamp >= bet_match['deadline']:
bet_match_status = 'settled'

if tx['block_index'] >= 311500 or config.TESTNET: # Protocol change.
remaining = escrow_less_fee - (bull_credit + bear_credit)
bull_credit += round(remaining * Fraction(bull_escrow, bear_escrow))
bear_credit += remaining - bull_credit

util.credit(db, tx['block_index'], bull_address, config.XCP, bull_credit)
util.credit(db, tx['block_index'], bear_address, config.XCP, bear_credit)

Expand Down

0 comments on commit 0229f63

Please sign in to comment.