CompensationFactory
A factory contract that registers different compensation contract implementations (e.g., ESO, RSA) and deploys clones of these implementations.
State Variables
compensationImplementations
mapping(bytes32 => CompensationImplementation) public compensationImplementations;
allCompensations
address[] public allCompensations;
rule701Exemptions
mapping(address => address) public rule701Exemptions;
Functions
constructor
Registers initial compensation implementations.
constructor(CompensationImplementation[] memory _implementations);
Parameters
_implementations
CompensationImplementation[]
Array of compensation implementations to register.
addCompensationImplementation
Adds (or updates) a compensation implementation dynamically.
function addCompensationImplementation(CompensationImplementation memory _implementation) external;
Parameters
_implementation
CompensationImplementation
The compensation implementation details.
createRule701Exemption
Creates (and tracks) a Rule701Exemption for msg.sender
with an initialCap
. Reverts if one already exists for the given msg.sender
.
function createRule701Exemption(uint256 initialCap) external returns (address);
createCompensation
Deploys a new compensation contract using a minimal proxy clone of the registered implementation.
function createCompensation(bytes32 compImplId, bytes calldata initCallData) external returns (address newComp);
Parameters
compImplId
bytes32
The identifier of the compensation implementation to clone.
initCallData
bytes
The call data used to initialize the newly cloned contract. Must start with the requiredSelector for this implementation.
Returns
newComp
address
The address of the newly deployed compensation contract.
getAllCompensations
Returns an array of all deployed compensation contracts.
function getAllCompensations() external view returns (address[] memory);
_getRevertMsg
Extracts a revert message 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
CompensationFactoryCreated
event CompensationFactoryCreated(address indexed factory);
CompensationImplementationAdded
event CompensationImplementationAdded(
bytes32 indexed compImplId, string compType, address implementation, bytes4 requiredSelector, bool active
);
CompensationCreated
event CompensationCreated(address indexed compensation, address indexed creator, bytes32 indexed compImplId);
Rule701ExemptionCreated
event Rule701ExemptionCreated(address indexed issuer, address rule701Exemption);
Structs
CompensationImplementation
Struct for storing compensation implementation details.
struct CompensationImplementation {
string compType;
address implementation;
bytes4 requiredSelector;
bool active;
}
Properties
compType
string
A human-readable name or identifier for the compensation (e.g., "ESO", "RSA").
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
Whether this implementation is active and can be cloned.
Last updated
Was this helpful?