Pick.need.of: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/policy/pick.bend as Pick Lines 44-52 of cswap-bend-cli@0.1.0.0/policy/pick.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/policy/pick.bend&start_line=44&end_line=52 import Base import cswap-bend-cli@0.1.0.0/policy/types.bend as T # The least headroom a target needs: at-limit and failover take any # headroom; proactive must land below the threshold and beat the active # account by the hysteresis margin. def need.of(+t: T.Trigger, +ah: Nat, +hy: Nat, +thr: Nat) -> Nat: match t: case T.Proactive{}: Nat.max(Nat.add(ah, hy), Nat.add(Nat.sub(T.full(), thr), 1n)) case o: 1n Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.max https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/policy/types.bend&name=Trigger https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/policy/types.bend&name=full