Fee Calculator

Git Source

Inherits: IFeeCalculator

Author: Sperax Foundation

A contract that calculates fees for minting and redeeming USDs.

State Variables

LOWER_THRESHOLD

uint16 private constant LOWER_THRESHOLD = 5000;

UPPER_THRESHOLD

uint16 private constant UPPER_THRESHOLD = 15000;

DISCOUNT_FACTOR

uint16 private constant DISCOUNT_FACTOR = 2;

PENALTY_MULTIPLIER

uint16 private constant PENALTY_MULTIPLIER = 2;

CALIBRATION_GAP

uint32 private constant CALIBRATION_GAP = 1 days;

COLLATERAL_MANAGER

ICollateralManager public immutable COLLATERAL_MANAGER;

collateralFee

mapping(address => FeeData) public collateralFee;

Functions

constructor

constructor(address _collateralManager);

calibrateFee

Calibrates fee for a particular collateral

function calibrateFee(address _collateral) external;

Parameters

NameTypeDescription

_collateral

address

Address of the desired collateral

getMintFee

Calculates fee to be collected for minting

function getMintFee(address _collateral) external view returns (uint256);

Parameters

NameTypeDescription

_collateral

address

Returns

NameTypeDescription

uint256

(uint256) baseFeeIn

getRedeemFee

Calculates fee to be collected for redeeming

function getRedeemFee(address _collateral) external view returns (uint256);

Parameters

NameTypeDescription

_collateral

address

Returns

NameTypeDescription

uint256

(uint256) baseFeeOut

calibrateFeeForAll

Calibrates fee for all the collaterals registered

function calibrateFeeForAll() public;

_calibrateFee

Helper function for calibrating fee for a collateral

function _calibrateFee(address _collateral) private;

Parameters

NameTypeDescription

_collateral

address

Address of the desired collateral

Events

FeeCalibrated

event FeeCalibrated(address indexed collateral, uint16 mintFee, uint16 redeemFee);

Errors

InvalidCalibration

error InvalidCalibration();

Structs

FeeData

struct FeeData {
    uint32 nextUpdate;
    uint16 mintFee;
    uint16 redeemFee;
}

Last updated