OfferingFactory
This factory dynamically registers offering implementations and deploys minimal proxy clones.
State Variables
offeringImplementations
mapping(bytes32 => OfferingImplementation) public offeringImplementations;
allOfferings
address[] public allOfferings;
Functions
constructor
Registers initial offering implementations.
constructor(OfferingImplementation[] memory _implementations);
Parameters
_implementations
OfferingImplementation[]
Array of offering implementations to register.
addOfferingImplementation
Adds a new offering implementation dynamically.
function addOfferingImplementation(OfferingImplementation memory _implementation) external;
Parameters
_implementation
OfferingImplementation
The offering implementation details.
createOffering
Deploys a new offering clone using a minimal proxy and initializes it.
function createOffering(bytes32 offeringImplId, bytes calldata initCallData) external returns (address offering);
Parameters
offeringImplId
bytes32
The identifier of the offering implementation.
initCallData
bytes
The initialization call data to configure the offering clone.
Returns
offering
address
The address of the newly deployed offering clone.
getAllOfferings
Returns an array of all deployed offering clone addresses.
function getAllOfferings() external view returns (address[] memory);
_getRevertMsg
Decodes revert messages from failed external calls.
function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory);
Parameters
_returnData
bytes
The return data from the call.
Returns
<none>
string
The revert message string.
Events
OfferingImplementationAdded
event OfferingImplementationAdded(
bytes32 indexed offeringImplId, string offeringType, address implementation, bytes4 requiredSelector, bool active
);
OfferingFactoryCreated
event OfferingFactoryCreated(address indexed factory);
OfferingCreated
event OfferingCreated(address indexed offering, address indexed issuer, bytes32 indexed offeringImplId);
Structs
OfferingImplementation
Struct for storing offering implementation details.
struct OfferingImplementation {
string offeringType;
address implementation;
bytes4 requiredSelector;
bool active;
}
Properties
offeringType
string
A human-readable name or type identifier.
implementation
address
The address of the deployed implementation contract.
requiredSelector
bytes4
The function selector expected in the first 4 bytes of the initialization call.
active
bool
Flag to indicate if the offering is active.
Last updated
Was this helpful?