Registering Super Apps
Overview
To activate a Super App, you need to register it in the Superfluid Host contract. This registration is crucial for enabling the Super App's business logic to be invoked via agreement hooks.
Registration Process
Basic Registration
You can
- Use the
registerApp
method of the host contract. - Two ways to register:
- Self-registration:
registerApp(configWord)
- Registration by another account:
registerApp(app, configWord)
- Self-registration:
Permissioned vs. Non-Permissioned Networks
Some networks require additional steps for Super App registration. Here's how to check:
- Query
host.APP_WHITE_LISTING_ENABLED()
on your target network. - You can do this via the Superfluid Console:
- Go to the "protocol" section (e.g., Polygon Mainnet Console)
- Click the Explorer link for "Host"
- Navigate to Contract -> Read as Proxy
- Expand "WHITE_LISTING_ENABLED"
- If
false
: Standard registration process applies - If
true
: Follow the permissioned registration process below
Permissioned App Registration
If your target network requires permissioned registration:
-
Get a "deployer" account whitelisted (can be an EOA or a contract)
-
Choose your deployment strategy:
a) For a single Super App:
- Register in the constructor or initialize method
- Use
host.registerApp(configWord)
- Whitelist the EOA making this transaction
b) For multiple Super App instances (e.g., factory pattern):
- Whitelist a contract as the deployer
- Use
host.registerApp(app, configWord)
from this contract
Important Notes
- Using
registerApp(configWord)
:tx.origin
must be whitelisted - Using
registerApp(app, configWord)
:msg.sender
must be whitelisted
Need Help?
If you need assistance or have questions about the process:
- Join our Discord
- Contact the Superfluid dev team in the #development channel
Code Examples
Here are some basic examples to illustrate the registration process:
// Self-registration in constructor
constructor(ISuperfluid host, uint256 configWord) {
host.registerApp(configWord);
}
// Registration by another account
function registerSuperApp(ISuperfluid host, ISuperApp app, uint256 configWord) external {
host.registerApp(app, configWord);
}
Remember to adjust these examples based on your specific Super App implementation and network requirements.