Skip to main content

JBFees

Git Source

Fee calculations.

Functions

feeAmountIn

Returns the amount of tokens to pay as a fee out of the specified amount.

The resulting fee will be feePercent of the REMAINING amount after subtracting the fee, not the full amount.

function feeAmountIn(uint256 amount, uint256 feePercent) internal pure returns (uint256);

Parameters

NameTypeDescription
amountuint256The amount that the fee is based on, as a fixed point number.
feePercentuint256The fee percent, out of JBConstants.MAX_FEE.

Returns

NameTypeDescription
<none>uint256The amount of tokens to pay as a fee, as a fixed point number with the same number of decimals as the provided amount.

feeAmountFrom

Returns the fee that would have been paid based on an amount which has already had the fee subtracted from it.

The resulting fee will be feePercent of the full amount.

function feeAmountFrom(uint256 amount, uint256 feePercent) internal pure returns (uint256);

Parameters

NameTypeDescription
amountuint256The amount that the fee is based on, as a fixed point number with the same amount of decimals as this terminal.
feePercentuint256The fee percent, out of JBConstants.MAX_FEE.

Returns

NameTypeDescription
<none>uint256The amount of the fee, as a fixed point number with the same amount of decimals as this terminal.