Skip to content

DynamicFee ​

Git Source

Inherits:DexHelpers

Functions ​

constructor ​

solidity
constructor(uint256 _minFee, uint256 _maxFee, uint256 _minDeviation, uint256 _maxDeviation);

getDeviationFromPrice ​

Calculates the deviation from the given price.

solidity
function getDeviationFromPrice(uint256 price_) public view returns (uint256);

dynamicFeeFromPrice ​

Calculates the dynamic fee based on the given price.

solidity
function dynamicFeeFromPrice(uint256 price) external view returns (uint256);

dynamicFeeFromDeviation ​

Calculates the dynamic fee based on the given deviation.

solidity
function dynamicFeeFromDeviation(uint256 deviation) external view returns (uint256);

_computeDynamicFee ​

Internal helper that implements a smooth-step curve for fee calculation

solidity
function _computeDynamicFee(uint256 deviation) internal view returns (uint256);

Parameters

NameTypeDescription
deviationuint256Deviation from the target price in SCALE (1e27)

Returns

NameTypeDescription
<none>uint256Fee in basis points (1e4 = 1%)

_scaleMul ​

solidity
function _scaleMul(uint256 a, uint256 b) internal pure returns (uint256);