@pwngh/economy-lab
    Preparing search index...

    Function convertCeil

    • Converts an amount to another currency at rate, rounding up: ceil(minor * rate / 10^scale), a true ceiling for either sign. Use it where rounding down would under-cover, such as the USD a top-up must hold in trust: the trust side rounds against the platform, never against the users it backs. Throws AMOUNT_OVERFLOW when the result leaves the 64-bit range.

      Parameters

      Returns Amount

      const rate = { rate: 5n, scale: 3, rateId: 'cashout-example' };
      convertCeil(toAmount('CREDIT', 2_000_100n), rate, 'USD');
      // 10_001n minor: the same $100.005 that convertFloor takes to $100.00 rounds up here