def need.of

cswap-bend-cli@0.1.0.0 · policy/algo.bend:45

import cswap-bend-cli@0.1.0.0/policy/algo.bend as Algo
import Base
import cswap-bend-cli@0.1.0.0/policy/safe.bend as SF

45# The least headroom a target needs: drain-first and a proactive automatic
46# switch must land below the threshold; an at-limit switch or a rotation takes
47# any headroom.
48def need.of(+algo: SF.Algo, +via: Via, +a: Nat, +thr: Nat) -> Nat:
49  need.under(drain(algo) || (via.auto(via) && Nat.is_gt(a, 0n)), thr)

Uses (9)

Used by (1)