Contract Details
The SyncSwap fee management system is an integral part of the SyncSwap ecosystem, responsible for managing and distributing fees across different pools.
The SyncSwap fee management system is an integral part of the SyncSwap ecosystem, responsible for managing and distributing fees across different pools. It ensures the fair distribution of rewards to liquidity providers and supports the protocol's operational costs. This document provides detailed instructions on using the SyncSwap Fee Manager, Fee Registry, and Fee Recipient contracts to query and manage various fees and rates.
Fee Manager
getSwapFeeData
getSwapFeeDataReturns the swap fee data for a given pool, sender, and token pair.
Example Usage:
feeManager.getSwapFeeData(poolAddress, senderAddress, tokenInAddress, tokenOutAddress, data);
// Returns the fee data for the given parameters.
>>> FeeData {gamma: 0, minFee: 290, maxFee: 290}getSwapFee
getSwapFeeReturns the swap fee for a given pool, sender, and token pair.
Example Usage:
feeManager.getSwapFee(poolAddress, senderAddress, tokenInAddress, tokenOutAddress, data);
// Returns the swap fee for the given parameters.
>>> 290getProtocolFee
getProtocolFeeReturns the protocol fee for a given pool.
Example Usage:
rotocolFee = feeManager.getProtocolFee(poolAddress);
// Returns the protocol fee for the given pool.
>>> 30000getFeeRecipient
getFeeRecipient Returns the current fee recipient address.
Example Usage:
address recipient = feeManager.getFeeRecipient();
// Returns the current fee recipient address.
>>> 0x1234567890abcdef1234567890abcdef12345678getSwapFeeHook
getSwapFeeHookReturns the current swap fee hook address.
Example Usage:
saddress hook = feeManager.getSwapFeeHook();
// Returns the current swap fee hook address.
>>> 0xabcdef1234567890abcdef1234567890abcdef12Fee Registry V2
registerFee
registerFee Registers a new fee for a pool with additional data.
Example Usage:
feeRegistryV2.registerFee(poolAddress, 1000, additionalData);
// Registers a new fee of 1000 for the given pool with additional data.getFee
getFeeReturns the fee amount for a given pool.
Example Usage:
feeAmount = feeRegistryV2.getFee(poolAddress);
// Returns the fee amount for the given pool.
>>> 1000updateFee
updateFeeUpdates the fee amount for a pool.
Example Usage:
feeRegistryV2.updateFee(poolAddress, 2000, additionalData);
// Updates the fee amount to 2000 for the given pool with additional data.getFeesByPool
getFeesByPoolReturns all fees associated with a given pool.
Example Usage:
uint256[] memory fees = feeRegistryV2.getFeesByPool(poolAddress);
// Returns all fees associated with the given pool.
>>> [1000, 2000]Fee Recipient
notifyFees
notifyFeesNotifies the contract about a fee that needs to be recorded. Example Usage:
feeRecipient.notifyFees(senderAddress, tokenAddress, 1000, 3000, "");
// Notifies the contract about a fee of 1000 tokens with a fee rate of 3000.getEpochStart
getEpochStartReturns the start time of a given timestamp based on the epoch duration. Example Usage:
epochStart = feeRecipient.getEpochStart(block.timestamp);
// Returns the start time of the epoch for the given timestamp.
>>> 1625097600fees
feesReturns the total fees recorded for a specific token within a specific epoch. Example Usage:
feeRecipient.fees(epoch, tokenAddress);
// Returns the total fees recorded for the given token in the specified epoch.
>>> 5000