DynamicFee ​
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
Name | Type | Description |
---|---|---|
deviation | uint256 | Deviation from the target price in SCALE (1e27) |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | Fee in basis points (1e4 = 1%) |
_scaleMul ​
solidity
function _scaleMul(uint256 a, uint256 b) internal pure returns (uint256);