builderFee function

BigInt builderFee(
  1. BigInt fee,
  2. BigInt quantity,
  3. bool hasBuilderCode
)

expiry_market::builder_fee_amount — an account carrying a builder code pays the builder a multiple of its trading fee, capped as a share of quantity.

Implementation

BigInt builderFee(BigInt fee, BigInt quantity, bool hasBuilderCode) {
  _assertUint(fee, 'fee');
  _assertUint(quantity, 'quantity');
  if (!hasBuilderCode) return BigInt.zero;
  return _min(_mulDown(fee, BUILDER_FEE_MULTIPLIER),
      _mulDown(quantity, MAX_BUILDER_FEE_RATE));
}