Implementation
Initializing a Token Manager is simple. We have an approved, audited collection of managers available to deploy. This example will run through the deployment and initialization of a RevenueManager, and subsequent deposit of flaunched tokens.
1. Initialize Manager
// Contract addresses are valid for Base Sepolia
TreasuryManagerFactory factory = TreasuryManagerFactory(0xd2f3c6185e06925dcbe794c6574315b2202e9ccd);
address manager = factory.deployAndInitializeManager({
_managerImplementation: 0x1216c723853dac0449c01d01d6e529d751d9c0c8, // RevenueManager
_owner: address(this),
_data: abi.encode(
RevenueManager.InitializeParams({
protocolRecipient: payable(address(this)),
protocolFee: 1000 // 10%
})
)
});
Fields
2. Deposit Token(s)
Once your Token Manager is initialized, you can deposit Flaunch tokens into it.
revenueManager.deposit({
_flaunchToken: ITreasuryManager.FlaunchToken({
flaunch: flaunch,
tokenId: tokenId
}),
_creator: creator,
_data: abi.encode('')
});
Fields
3. Flaunch Tokens Directly to Manager
Rather than depositing an existing Flaunch ERC721, it's possible to transfer it directly to the manager when flaunching. When flaunching via the Flaunch Zap, the caller can specify TreasuryManagerParams
in the call.
/**
* If the manager is an approved implementation, then it's instance will be deployed.
* Otherwise the flaunch token will be transferred directly to the manager.
*
* @param manager The manager implementation to use
* @param initializeData The data to initialize the manager with
* @param depositData The data to deposit to the manager with
*/
struct TreasuryManagerParams {
address manager;
bytes initializeData;
bytes depositData;
}
This will result in the flaunched token being sent directly to the manager; for a simplified example:
(address memecoin_,, address deployedManager_) = flaunchZap.flaunch({
_flaunchParams: PositionManager.FlaunchParams({
// ..
creator: YOUR_END_CREATOR,
}),
// ..
_treasuryManagerParams: FlaunchZap.TreasuryManagerParams({
manager: 0x1216c723853dac0449c01d01d6e529d751d9c0c8, // RevenueManager
initializeData: abi.encode(
RevenueManager.InitializeParams({
protocolRecipient: payable(address(this)),
protocolFee: 1000 // 10%
})
),
depositData: abi.encode('')
})
});
4. ???
5. Profit!
Last updated
Was this helpful?