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

Returns the swap fee data for a given pool, sender, and token pair.

Example Usage:

Copy

feeManager.getSwapFeeData(poolAddress, senderAddress, tokenInAddress, tokenOutAddress, data);
// Returns the fee data for the given parameters.
>>> FeeData {gamma: 0, minFee: 290, maxFee: 290}

getSwapFee

Returns the swap fee for a given pool, sender, and token pair.

Example Usage:

Copy

feeManager.getSwapFee(poolAddress, senderAddress, tokenInAddress, tokenOutAddress, data);
// Returns the swap fee for the given parameters.
>>> 290

getProtocolFee

Returns the protocol fee for a given pool.

Example Usage:

Copy

rotocolFee = feeManager.getProtocolFee(poolAddress);
// Returns the protocol fee for the given pool.
>>> 30000

getFeeRecipient

Returns the current fee recipient address.

Example Usage:

Copy

address recipient = feeManager.getFeeRecipient();
// Returns the current fee recipient address.
>>> 0x1234567890abcdef1234567890abcdef12345678

getSwapFeeHook

Returns the current swap fee hook address.

Example Usage:

Copy

saddress hook = feeManager.getSwapFeeHook();
// Returns the current swap fee hook address.
>>> 0xabcdef1234567890abcdef1234567890abcdef12

Fee Registry V2

registerFee

Registers a new fee for a pool with additional data.

Example Usage:

Copy

feeRegistryV2.registerFee(poolAddress, 1000, additionalData);
// Registers a new fee of 1000 for the given pool with additional data.

getFee

Returns the fee amount for a given pool.

Example Usage:

Copy

feeAmount = feeRegistryV2.getFee(poolAddress);
// Returns the fee amount for the given pool.
>>> 1000

updateFee

Updates the fee amount for a pool.

Example Usage:

Copy

feeRegistryV2.updateFee(poolAddress, 2000, additionalData);
// Updates the fee amount to 2000 for the given pool with additional data.

getFeesByPool

Returns all fees associated with a given pool.

Example Usage:

Copy

uint256[] memory fees = feeRegistryV2.getFeesByPool(poolAddress);
// Returns all fees associated with the given pool.
>>> [1000, 2000]

Fee Recipient

notifyFees

Notifies the contract about a fee that needs to be recorded. Example Usage:

Copy

feeRecipient.notifyFees(senderAddress, tokenAddress, 1000, 3000, "");
// Notifies the contract about a fee of 1000 tokens with a fee rate of 3000.

getEpochStart

Returns the start time of a given timestamp based on the epoch duration. Example Usage:

Copy

epochStart = feeRecipient.getEpochStart(block.timestamp);
// Returns the start time of the epoch for the given timestamp.
>>> 1625097600

fees

Returns the total fees recorded for a specific token within a specific epoch. Example Usage:

Copy

feeRecipient.fees(epoch, tokenAddress);
// Returns the total fees recorded for the given token in the specified epoch.
>>> 5000

Last updated