Sperax
  • USDs (Sperax USD)
    • Minting and Redeeming
    • Auto Yield
      • Smart Contracts can opt in for the rebase feature (Auto-yield).
    • Stability Mechanism
    • Key parameters and functions
    • Technical documents
      • Sequence diagrams
      • Smart contracts
        • Vault
        • USDs
        • CollateralManager
        • SPA Buyback
        • MasterPriceOracle
        • Yield Reserve
        • Fee Calculator
        • RebaseManager
        • Dripper
        • BaseStrategy
      • Deployed contracts
  • Buyback Contract
  • Staking Protocol
    • Locking SPA
    • Withdrawing SPA
    • Staking Rewards
  • Demeter Protocol
    • How does Demeter Work?
    • Technical documents
      • Smart contracts
        • E721 Farms
          • E721Farm
          • Camelot V3
            • CamelotV3FarmDeployer
            • CamelotV3Farm
        • Base contracts
          • Farm
          • FarmStorage
          • FarmRegistry
          • FarmDeployer
        • Features
          • ClaimableFee
          • ExpirableFarm
          • OperableDeposit
        • Rewarder
          • Rewarder
          • RewarderFactory
      • Deployed contracts
  • Getting Started on Our DApp
    • Minting & Redeeming USDs
    • Stake SPA
  • Governance
  • Bug Bounty Program
  • FAQ
    • SPA Tokenomics
    • xSPA token
    • Smart Contract Addresses
    • How to Transfer SPA from Ethereum to Arbitrum
  • Quick Links
    • Audit Reports
    • Sperax Dapp
    • Demeter Dapp
    • Discord
    • Forum
    • Snapshot
Powered by GitBook
On this page
  • State Variables
  • LOWER_THRESHOLD
  • UPPER_THRESHOLD
  • DISCOUNT_FACTOR
  • PENALTY_MULTIPLIER
  • CALIBRATION_GAP
  • COLLATERAL_MANAGER
  • collateralFee
  • Functions
  • constructor
  • calibrateFee
  • getMintFee
  • getRedeemFee
  • calibrateFeeForAll
  • _calibrateFee
  • Events
  • FeeCalibrated
  • Errors
  • InvalidCalibration
  • Structs
  • FeeData

Was this helpful?

Export as PDF
  1. USDs (Sperax USD)
  2. Technical documents
  3. Smart contracts

Fee Calculator

PreviousYield ReserveNextRebaseManager

Last updated 1 year ago

Was this helpful?

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

Name
Type
Description

_collateral

address

Address of the desired collateral

getMintFee

Calculates fee to be collected for minting

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

Parameters

Name
Type
Description

_collateral

address

Returns

Name
Type
Description

uint256

(uint256) baseFeeIn

getRedeemFee

Calculates fee to be collected for redeeming

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

Parameters

Name
Type
Description

_collateral

address

Returns

Name
Type
Description

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

Name
Type
Description

_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;
}
Git Source