FeeManager_v1.sol

FeeManager_v1

Git Source

Inherits: ERC165Upgradeable, IFeeManager_v1, Ownable2StepUpgradeable

Author: Inverter Network

This contract manages the different fees possible on a protocol level. The different fees can be fetched publicly and be set by the owner of the contract.

Inherits from {ERC165Upgradeable} for interface detection, {Ownable2StepUpgradeable} for owner-based access control, and implements the {IFeeManager_v1} interface.

State Variables

BPS

Base Points used for percentage calculation. This value represents 100%.

uint public constant BPS = 10_000;

maxFee

The maximum fee percentage amount that can be set. Based on the BPS.

uint public maxFee;

defaultProtocolTreasury

The default protocol treasury address.

workflowTreasuries

The workflow treasury address. Orchestrator => treasury

defaultIssuanceFee

The default issuance fee percentage amount that apply unless workflow specific fees are set.

defaultCollateralFee

The default collateral fee percentage amount that apply unless workflow specific fees are set.

workflowIssuanceFees

The workflow issuance fee. Orchestrator => hash(functionSelector + module address) => feeStruct.

workflowCollateralFees

The workflow collateral fee. Orchestrator => hash(functionSelector + module address) => feeStruct.

__gap

Storage gap for future upgrades.

Functions

supportsInterface

See {IERC165-supportsInterface}.

validAddress

Modifier to check if the given address is valid.

validFee

Modifier to check if the given fee is valid.

validMaxFee

Modifier to check if the given max fee is valid.

constructor

init

getDefaultProtocolTreasury

Returns the default treasury for all workflows.

Returns

Name
Type
Description

<none>

address

The address of the treasury.

getWorkflowTreasuries

Returns the treasury assigned to the given workflow.

Parameters

Name
Type
Description

workflow

address

The address of the workflow.

Returns

Name
Type
Description

<none>

address

The address of the treasury.

getDefaultCollateralFee

Returns the default collateral fee for all workflows.

Returns

Name
Type
Description

<none>

uint256

The collateral fee amount in relation to the BPS.

getDefaultIssuanceFee

Returns the default issuance fee for all workflows.

Returns

Name
Type
Description

<none>

uint256

The issuance fee amount in relation to the BPS.

getCollateralWorkflowFee

Returns the collateral fee for a specific workflow module function.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

Returns

Name
Type
Description

fee

uint256

The collateral fee amount in relation to the BPS.

getIssuanceWorkflowFee

Returns the issuance fee for a specific workflow module function.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

Returns

Name
Type
Description

fee

uint256

The issuance fee amount in relation to the BPS.

getCollateralWorkflowFeeAndTreasury

Returns the collateral fee for a specific workflow module function and the according treasury address of the workflow.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

Returns

Name
Type
Description

fee

uint256

The collateral fee amount in relation to the BPS.

treasury

address

The address of the treasury.

getIssuanceWorkflowFeeAndTreasury

Returns the issuance fee for a specific workflow module function and the according treasury address of the workflow.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

Returns

Name
Type
Description

fee

uint256

The issuance fee amount in relation to the BPS.

treasury

address

The address of the treasury.

setMaxFee

Sets the maximum fee percentage that can be assigned.

This function can only be called by the owner.

Parameters

Name
Type
Description

_maxFee

uint256

The max Fee in relation to the BPS.

setDefaultProtocolTreasury

Sets the default protocol treasury address.

This function can only be called by the owner.

Parameters

Name
Type
Description

_defaultProtocolTreasury

address

The address of the default protocol treasury.

setWorkflowTreasury

Sets the protocol treasury address for a specific workflow.

This function can only be called by the owner.

Parameters

Name
Type
Description

workflow

address

The address of the workflow.

treasury

address

The address of the protocol treasury for that specific workflow.

setDefaultCollateralFee

Sets the default collateral fee of the protocol.

This function can only be called by the owner.

Parameters

Name
Type
Description

_defaultCollateralFee

uint256

The default collateral fee of the protocol in relation to the BPS.

setDefaultIssuanceFee

Sets the default issuance fee of the protocol.

This function can only be called by the owner.

Parameters

Name
Type
Description

_defaultIssuanceFee

uint256

The default issuance fee of the protocol in relation to the BPS.

setCollateralWorkflowFee

Sets the collateral fee for a specific workflow module function.

This function can only be called by the owner.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

set

bool

Boolean that determines if the fee is actually used or not.

fee

uint256

The collateral fee in relation to the BPS.

setIssuanceWorkflowFee

Sets the issuance fee for a specific workflow module function.

This function can only be called by the owner.

Parameters

Name
Type
Description

workflow

address

The address of the workflow that contains the module function.

module

address

The address of the module that contains the function.

functionSelector

bytes4

The function selector of the target function.

set

bool

Boolean that determines if the fee is actually used or not.

fee

uint256

The issuance fee in relation to the BPS.

_getModuleFunctionHash

_setDefaultProtocolTreasury

_setWorkflowTreasury

_setDefaultCollateralFee

_setDefaultIssuanceFee

_setIssuanceWorkflowFee

_setMaxFee

Last updated