STPV2Factory
Git Source (opens in a new tab)
Inherits: AccessControlled, Multicallable
Author: Fabric Inc.
A factory which leverages Clones to deploy Fabric Subscription Token Contracts
State Variables
IMPLEMENTATION
The STP contract implementation address
address private immutable IMPLEMENTATION;
_protocolFeeRecipient
The protocol fee recipient
address private _protocolFeeRecipient;
_deployFee
The deploy fee (how much to charge for deployment)
uint256 private _deployFee;
Functions
constructor
Construct a new Factory contract
constructor(address stpImplementation, address protocolFeeRecipient);
Parameters
Name | Type | Description |
---|---|---|
stpImplementation | address | the STPV2 implementation address |
protocolFeeRecipient | address |
deploySubscription
Deploy a new Clone of a STPV2 contract
function deploySubscription(DeployParams memory params) public payable returns (address);
Parameters
Name | Type | Description |
---|---|---|
params | DeployParams | the initialization parameters for the contract (@see DeloyParams) |
_transferDeployFee
Transfer the deploy fee to the collector (if configured)
function _transferDeployFee() internal;
setProtocolFeeRecipient
Set the protocol recipient for deployed contracts
function setProtocolFeeRecipient(address recipient) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | the new recipient |
setDeployFee
Set the deploy fee (wei)
function setDeployFee(uint256 deployFeeWei) external;
Parameters
Name | Type | Description |
---|---|---|
deployFeeWei | uint256 | the new deploy fee |
feeSchedule
Get the current fee schedule
function feeSchedule() external view returns (FeeScheduleView memory schedule);
Returns
Name | Type | Description |
---|---|---|
schedule | FeeScheduleView | the fee schedule |
updateClientFeeRecipient
Update the client fee recipient for a list of deployments
requires the sender to be the current recipient
function updateClientFeeRecipient(address payable deployment, address recipient) external;
Parameters
Name | Type | Description |
---|---|---|
deployment | address payable | the deployment to update |
recipient | address | the new recipient |
updateProtocolFeeRecipient
Update the protocol fee recipient for a list of deployments
requires the sender to be the current recipient
function updateProtocolFeeRecipient(address payable deployment, address recipient) external;
Parameters
Name | Type | Description |
---|---|---|
deployment | address payable | the deployment to update |
recipient | address | the new recipient |
Events
Deployment
Emitted upon a successful subscription contract deployment
event Deployment(address indexed deployment, bytes deployKey);
DeployFeeTransfer
Emitted when the deploy fees are collected by the owner
event DeployFeeTransfer(address indexed recipient, uint256 amount);
DeployFeeChange
Emitted when a deploy fee is set
event DeployFeeChange(uint256 amount);
ProtocolFeeRecipientChange
Emitted when the protocol fee recipient is set
event ProtocolFeeRecipientChange(address account);
Errors
InvalidImplementation
Error when the implementation address is invalid
error InvalidImplementation();
InvalidFeeRecipient
Error when a fee collector is invalid (0 address)
error InvalidFeeRecipient();
FeeInvalid
Error when the fee paid for deployment is insufficient
error FeeInvalid();