Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

answerbond.gno

0.63 Kb · 22 lines
 1package kourt
 2func settleAnswerBond(c *Court, cs *claimState) {
 3	c.coin.Transfer(c.escrow, cs.answerer, cs.answerBond)
 4	cs.answerBond = 0
 5}
 6func (cs *claimState) sideConv(side int) (hi, lo uint64) {
 7	if side == sideYES {
 8		return cs.yesConvHi, cs.yesConvLo
 9	}
10	return cs.noConvHi, cs.noConvLo
11}
12func bondFloorAt(xbar int64, convHi, convLo uint64) int64 {
13	flat := xbar * bondFloorFlatBps / 10000
14	if draw := mulDiv128(convToCC(convHi, convLo), bondFloorConvBps, 10000); draw > flat {
15		return draw
16	}
17	return flat
18}
19func bondFloorFor(cs *claimState) int64 {
20	hi, lo := cs.sideConv(int(cs.answer))
21	return bondFloorAt(cs.xBarFrozen, hi, lo)
22}