Skip to main content

ISablierComptroller

Git Source

Inherits: IERC165, IERC1822Proxiable, IRoleAdminable

Title: ISablierComptroller

Manage fees across all Sablier protocols. State-changing functions are only accessible to the admin and the fee manager.

Functions

MAX_FEE_USD

Retrieves the maximum USD fee that can be set for claiming an airdrop or withdrawing from a stream.

This is a constant state variable and is 100e8, which is equivalent to $100.

function MAX_FEE_USD() external view returns (uint256);

MINIMAL_INTERFACE_ID

The minimal interface ID of the comptroller.

Any new comptroller must support the minimal interface ID made up of the following functions:

  1. calculateMinFeeWeiFor - used by protocols inherited from IComptrollerable.
  2. convertUSDFeeToWei - used by protocols inherited from IComptrollerable.
  3. execute - used by comptroller admin to perform necessary operations.
  4. getMinFeeUSDFor - used by protocols inherited from IComptrollerable.
function MINIMAL_INTERFACE_ID() external view returns (bytes4);

VERSION

The version of the comptroller contract.

This follows the format "v{Major}.{Minor}" (e.g., "v1.1").

function VERSION() external view returns (string memory);

attestor

Retrieves the attestor address used for verifying attestation signatures in merkle campaigns.

A zero address indicates that the attestor is not set.

function attestor() external view returns (address);

calculateMinFeeWei

Calculates the minimum fee in wei for the given protocol.

See the documentation for convertUSDFeeToWei for more details.

function calculateMinFeeWei(Protocol protocol) external view returns (uint256);

Parameters

NameTypeDescription
protocolProtocolThe protocol as defined in {Protocol} enum.

calculateMinFeeWeiFor

Calculates the minimum fee in wei for the provided user for the given protocol.

If the custom fee is enabled, it returns the custom fee, otherwise it returns the default minimum fee. See the documentation for convertUSDFeeToWei for more details.

function calculateMinFeeWeiFor(Protocol protocol, address user) external view returns (uint256);

Parameters

NameTypeDescription
protocolProtocolThe protocol as defined in {Protocol} enum.
useraddressThe user address.

convertUSDFeeToWei

Converts the fee amount from USD to Wei.

The price is considered to be 0 if:

  1. The oracle is not set.
  2. The min USD fee is 0.
  3. The oracle price is ≤ 0.
  4. The oracle's update timestamp is in the future.
  5. The oracle price hasn't been updated in the last 24 hours.
function convertUSDFeeToWei(uint256 feeUSD) external view returns (uint256);

Parameters

NameTypeDescription
feeUSDuint256The fee in USD, denominated in Chainlink's 8-decimal format for USD prices, where 1e8 is $1.

Returns

NameTypeDescription
<none>uint256The fee in wei, denominated in 18 decimals (1e18 = 1 native token).

getMinFeeUSD

Get the minimum fee in USD for the given protocol, paid in the native token of the chain, e.g., ETH for Ethereum Mainnet. Use calculateMinFeeWei to retrieve the fee in wei.

The fee is denominated in Chainlink's 8-decimal format for USD prices, where 1e8 is $1.

function getMinFeeUSD(Protocol protocol) external view returns (uint256);

getMinFeeUSDFor

Get the minimum fee in USD for the provided user for the given protocol, paid in the native token of the chain, e.g., ETH for Ethereum Mainnet. Use calculateMinFeeWeiFor to retrieve the fee in wei.

The fee is denominated in Chainlink's 8-decimal format for USD prices, where 1e8 is $1.

function getMinFeeUSDFor(Protocol protocol, address user) external view returns (uint256);

oracle

Retrieves the oracle contract address, which provides price data for the native token.

A zero address indicates that the oracle is not set.

function oracle() external view returns (address);

disableCustomFeeUSDFor

Disables the custom USD fee for the provided user for the given protocol, defaulting to the minimum fee.

Emits an UpdateCustomFeeUSD event. Notes:

  • In case of airdrops, the new fee applies only to the future campaigns created by the user. Past campaigns are not affected.
  • In case of streams, the new fee applies immediately to all the streams created by user. Requirements:
  • msg.sender must be either the admin or have the IRoleAdminable.FEE_MANAGEMENT_ROLE role.
function disableCustomFeeUSDFor(Protocol protocol, address user) external;

Parameters

NameTypeDescription
protocolProtocolThe protocol as defined in {Protocol} enum.
useraddressThe user address.

execute

Executes an external call to any contract and function.

Emits an Execute event. Requirements:

  • msg.sender must be the admin.
  • target must be a contract.
function execute(address target, bytes calldata targetCallData) external returns (bytes memory result);

Parameters

NameTypeDescription
targetaddressThe address of the target contract on which the data is executed.
targetCallDatabytesFunction selector plus ABI encoded data.

Returns

NameTypeDescription
resultbytesThe result from the call.

lowerMinFeeUSDForCampaign

Calls lowerMinFeeUSD function on an existing campaign.

Notes:

  • This function is a pass-through to the campaign's ISablierMerkleBase.lowerMinFeeUSD function.
  • All validations are expected to be performed in the campaign's lowerMinFeeUSD function. Requirements:
  • msg.sender must be either the admin or have the IRoleAdminable.FEE_MANAGEMENT_ROLE role.
function lowerMinFeeUSDForCampaign(address campaign, uint256 newMinFeeUSD) external;

Parameters

NameTypeDescription
campaignaddressThe address of an existing campaign.
newMinFeeUSDuint256The new min USD fee to set, denominated in 8 decimals.

setAttestor

Sets the attestor address used for verifying attestation signatures in airdrop campaigns.

Emits a SetAttestor event. Notes:

  • The default attestor to be used in merkle campaigns. It can be overridden by setting a different attestor in the campaign contract.
  • Setting it to zero address would disable attestation-based claims for campaigns that have not set their own local attestor. Requirements:
  • msg.sender must be either the admin or have the IRoleAdminable.ATTESTOR_MANAGER_ROLE role.
function setAttestor(address newAttestor) external;

Parameters

NameTypeDescription
newAttestoraddressThe new attestor address. It can be the zero address.

setAttestorForCampaign

Calls setAttestor function on an existing campaign contract.

Notes:

  • This function is a pass-through to the campaign's setAttestor function.
  • All validations are expected to be performed in the campaign's setAttestor function.
  • Setting it to zero address would not allow the campaign to use the default attestor. Requirements:
  • msg.sender must be either the admin or have the IRoleAdminable.ATTESTOR_MANAGER_ROLE role.
function setAttestorForCampaign(address campaign, address newAttestor) external;

Parameters

NameTypeDescription
campaignaddressThe address of an existing campaign contract.
newAttestoraddressThe new attestor address.

setCustomFeeUSDFor

Sets the custom USD fee for the provided user for the given protocol.

Emits an UpdateCustomFeeUSD event. Notes:

function setCustomFeeUSDFor(Protocol protocol, address user, uint256 customFeeUSD) external;

Parameters

NameTypeDescription
protocolProtocolThe protocol as defined in {Protocol} enum.
useraddressThe user address.
customFeeUSDuint256The custom USD fee to set, denominated in 8 decimals.

setMinFeeUSD

Sets a new min USD fee for the given protocol.

Emits a SetMinFeeUSD event. Notes:

function setMinFeeUSD(Protocol protocol, uint256 newMinFeeUSD) external;

Parameters

NameTypeDescription
protocolProtocolThe protocol as defined in {Protocol} enum.
newMinFeeUSDuint256The custom USD fee to set, denominated in 8 decimals.

setOracle

Sets the oracle contract address. The zero address can be used to disable the oracle.

Emits a SetOracle event. Requirements:

  • msg.sender must be the admin.
  • If newOracle is not the zero address, the call to it must not fail.
function setOracle(address newOracle) external;

Parameters

NameTypeDescription
newOracleaddressThe new oracle contract address. It can be the zero address.

transferFees

Transfers fees from the given protocol addresses to this contract, and then transfer the entire balance of this contract to the fee recipient.

Emits a TransferFees event. Notes:

  • If feeRecipient is a contract, it must be able to receive native tokens, e.g., ETH for Ethereum Mainnet.
  • protocolAddresses can be empty. Requirements: feeRecipient must not be the zero address.
  • If msg.sender has neither the IRoleAdminable.FEE_COLLECTOR_ROLE role nor is the contract admin, then feeRecipient must be the admin address.
  • protocolAddresses must implement the IComptrollerable interface.
function transferFees(address[] calldata protocolAddresses, address feeRecipient) external;

Parameters

NameTypeDescription
protocolAddressesaddress[]An array of addresses of the Sablier protocols from which fees is transferred from.
feeRecipientaddressThe address to which the entire fee from this contract is transferred.

withdrawERC20Token

Withdraws the entire ERC-20 token balance from the comptroller to a specified recipient.

Emits a WithdrawERC20Token event. Requirements:

  • msg.sender must be the admin.
  • to must not be the zero address.
  • The token balance of this contract must not be zero.
function withdrawERC20Token(IERC20 token, address to) external;

Parameters

NameTypeDescription
tokenIERC20The ERC-20 token to withdraw.
toaddressThe address to send the tokens to.

Events

Execute

Emitted when a target contract is called.

event Execute(address indexed target, bytes targetCallData, bytes result);

SetAttestor

Emitted when the attestor is set.

event SetAttestor(address indexed caller, address indexed previousAttestor, address indexed newAttestor);

SetMinFeeUSD

Emitted when the admin or the fee manager sets a new minimum USD fee.

event SetMinFeeUSD(Protocol indexed protocol, address caller, uint256 previousMinFeeUSD, uint256 newMinFeeUSD);

SetOracle

Emitted when the oracle contract address is set by the admin.

event SetOracle(address indexed admin, address previousOracle, address newOracle);

TransferFees

Emitted when the admin or the fee collector transfers the accrued fees to the fee recipient.

event TransferFees(address indexed feeRecipient, uint256 feeAmount);

UpdateCustomFeeUSD

Emitted when the admin or the fee manager sets/disables the custom USD fee for the provided user.

event UpdateCustomFeeUSD(
Protocol indexed protocol,
address caller,
address indexed user,
uint256 previousMinFeeUSD,
uint256 newMinFeeUSD
);

WithdrawERC20Token

Emitted when the admin withdraws ERC-20 tokens from the comptroller.

event WithdrawERC20Token(address indexed admin, IERC20 indexed token, address indexed to, uint256 amount);

Structs

CustomFeeUSD

Struct encapsulating the parameters of a custom USD fee.

struct CustomFeeUSD {
bool enabled;
uint256 fee;
}

Properties

NameTypeDescription
enabledboolWhether the fee is enabled. If false, the min USD fee will apply instead.
feeuint256The fee amount in USD, denominated in Chainlink's 8-decimal format for USD prices, where 1e8 is $1.

ProtocolFees

Struct encapsulating the fees for a protocol.

struct ProtocolFees {
uint256 minFeeUSD;
mapping(address user => CustomFeeUSD) customFeesUSD;
}

Properties

NameTypeDescription
minFeeUSDuint256The minimum fee in USD, denominated in Chainlink's 8-decimal format for USD prices, where 1e8 is $1.
customFeesUSDmapping(address user => CustomFeeUSD)

Enums

Protocol

Enum representing the different protocols supported by the comptroller.

enum Protocol {
Airdrops,
Flow,
Lockup,
Staking,
Bob
}