def nr.release

cswap-bend-cli@0.1.0.0 · policy/bar.bend:100

import cswap-bend-cli@0.1.0.0/policy/bar.bend as Bar
import Base
import cswap-bend-cli@0.1.0.0/policy/types.bend as T

100# The bar lifts when the account we left beats us outright.
101def nr.release(+hb: Maybe<&2, Nat>, +ah: Maybe<&2, Nat>, +thr: Nat) -> Bool:
102  match hb ah:
103    case None{} _:
104      False{}
105    case Some{l} Some{a}:
106      Nat.is_ge(l, Nat.mul(2n, a))
107    case Some{l} None{}:
108      Nat.is_gt(l, Nat.sub(T.full(), thr))

Uses (8)

Used by (1)