Skip to content

Fee Collector

ITTFeeCollector

Calculates TokenTable service fees.

The implementation is TTFeeCollector, which TokenTable Airdrop also uses and which has its own version number: the Unlocker 2.7.7 release uses fee collector 2.7.3-TTFeeCollector (plus the EVM suffix). In npm package 2.7.0 the interface is called ITTUFeeCollector and also inherits IOwnable and IVersionable. In 2.7.7, ITTFeeCollector declares only the members below. TTFeeCollector still uses Solady's Ownable (see Ownership) and implements version().

On each claim, the Unlocker gets the fee from the deployer's fee collector with getFee(address(this), claimedAmount) and transfers that amount of the project token from its own balance to the fee collector's owner(). The Unlocker does not use getFeeToken.

DefaultFeeSetBips

event DefaultFeeSetBips(uint256 bips)

Declared but not emitted by TTFeeCollector.

DefaultFeeSet

event DefaultFeeSet(uint256 fee)

CustomFeeSetBips

event CustomFeeSetBips(address unlockerAddress, uint256 bips)

CustomFeeSetFixed

event CustomFeeSetFixed(address unlockerAddress, uint256 fixedFee)

FeesTooHigh

error FeesTooHigh()

0xc9034e18

getFee

function getFee(address unlockerAddress, uint256 tokenTransferred) external view returns (uint256 tokensCollected)

Returns the fee to collect. A fixed fee always overrides a dynamic fee.

TTFeeCollector resolves the fee in this order:

  1. 0 if tokenTransferred is 0.
  2. The fixed custom fee of unlockerAddress, if set.
  3. The custom basis-point fee of unlockerAddress, if set. The maximum is 1000 bips, and setting exactly 1000 means no fee.
  4. Otherwise the default fee, a fixed amount.

Parameters

Name Type Description
unlockerAddress address The address of the Unlocker (or any contract that uses the fee collector). Used to fetch pricing.
tokenTransferred uint256 The number of tokens transferred.

Return Values

Name Type Description
tokensCollected uint256 The number of tokens to collect as fees.

getFeeToken

function getFeeToken(address unlockerAddress) external view returns (address tokenAddress)

Returns the fee token address.

TTFeeCollector returns the custom fee token of unlockerAddress if one is set, and the default fee token otherwise.

Parameters

Name Type Description
unlockerAddress address The address of the Unlocker (or any contract that uses the fee collector). Used to fetch pricing.

Return Values

Name Type Description
tokenAddress address The fee token address.