Skip to main content

Helpers

Git Source

Library with helper functions in SablierFlow contract.

Functions

calculateAmountsFromFee

Calculate the fee amount and the net amount after subtracting the fee, based on the fee percentage.

function calculateAmountsFromFee(
uint128 totalAmount,
UD60x18 fee
)
internal
pure
returns (uint128 feeAmount, uint128 netAmount);

checkAndCalculateBrokerFee

Checks the Broker parameter, and then calculates the broker fee amount and the deposit amount from the total amount.

function checkAndCalculateBrokerFee(
uint128 totalAmount,
Broker memory broker,
UD60x18 maxFee
)
internal
pure
returns (uint128 brokerFeeAmount, uint128 depositAmount);

descaleAmount

Descales the provided amount from 18 decimals fixed-point number to token's decimals number.

function descaleAmount(uint256 amount, uint8 decimals) internal pure returns (uint256);

scaleAmount

Scales the provided amount from token's decimals number to 18 decimals fixed-point number.

function scaleAmount(uint256 amount, uint8 decimals) internal pure returns (uint256);