Set Documentation
Search…
Adding a Module

What are Modules?

Set V2 employs a modular architecture consisting of a collection of modular smart contracts where additional components (e.g. modules, factories) can be seamlessly integrated or removed. This architecture is extensible, allowing new features and integrations to be easily added. Detailed system diagram here. Modules are smart contracts appendable to SetTokens that enable functionality such as trading, margining, and issuance functionality.
Module Initialization
    1.
    Module Addition: A module can be added via SetToken creation through the Factory or can be added by the manager after-the-fact.
    2.
    Initialized: To initialize the module, the manager needs to call initialize on the module, providing values required by the module. Once the transaction has successfully mined

Adding a Module to a Set:

The first method of adding a Module is directly inputting the desired module addresses on creation. See guide on Creating a Set for details.
1
function create(
2
address[] memory _components,
3
int256[] memory _units,
4
address[] memory _modules,
5
address _manager,
6
string memory _name,
7
string memory _symbol
8
)
9
external
10
returns (address)
Copied!
Post creation, managers can add or remove module functionality by calling the addModule function on the SetToken contract directly, providing the module's address.
1
function addModule(address _module) external
Copied!
Adding the module to the SetToken will put the module in pending state. To enable the functionality of the module, managers must also initialize the SetToken in the Module by calling initialize on the module contract itself.

Initializing the SetToken on the Module:

To complete the process of adding a module, the manager must call initialize on the Module. The parameters required will vary depending on the module. For example, to complete initialization of the StreamingFeeModule, the manager must provide information such as the feeRecipient, and streamingFeePercentage.
This will put the SetToken in initialized state, and will allow managers to call functions on the module.
1
function initialize(...) external
Copied!

Module Hooks:

In addition to required initialization parameters, modules can be initialized with custom hooks in the form of stand alone smart contracts. These hooks allow the user to input customized logic when the module interaction is called. Some sample hooks include:
    A hook that only allows a white listed address to issue your Set and would revert otherwise
    A hook that adds a supply or market cap ceiling to your Set and would revert otherwise
Last modified 8mo ago