GovernancePaymasterFacet
Inherits: IFactoryCMXPaymaster
Paymaster integration facet for governance factory
Handles CMX token-based fee payments for governance creation
State Variables
CMX_PAYMASTER_STORAGE_SLOT
bytes32 private constant CMX_PAYMASTER_STORAGE_SLOT = keccak256("capsign.storage.governance_factory.cmx_paymaster");
Functions
_getCMXPaymasterStorage
function _getCMXPaymasterStorage() internal pure returns (CMXPaymasterLayout storage l);
onlyFactoryAdmin
modifier onlyFactoryAdmin();
updatePaymasterSupport
Update paymaster support
function updatePaymasterSupport(address paymaster, bool supported) external override;
Parameters
paymaster
address
Paymaster address
supported
bool
Whether to support this paymaster
isPaymasterSupported
Check if a paymaster is supported
function isPaymasterSupported(address paymaster) external view override returns (bool supported);
Parameters
paymaster
address
Paymaster address
Returns
supported
bool
Whether the paymaster is supported
getSupportedPaymasters
Get all supported paymasters
function getSupportedPaymasters() external view override returns (address[] memory paymasters);
Returns
paymasters
address[]
Array of supported paymaster addresses
updateCMXPaymasterSupport
Update CMX paymaster support
function updateCMXPaymasterSupport(address paymaster, bool supported) external onlyFactoryAdmin;
Parameters
paymaster
address
CMX paymaster address
supported
bool
Whether to support this paymaster
isCMXPaymasterSupported
Check if CMX paymaster is supported
function isCMXPaymasterSupported(address paymaster) external view returns (bool supported);
Parameters
paymaster
address
CMX paymaster address
Returns
supported
bool
Whether the paymaster is supported
getSupportedCMXPaymasters
Get all supported CMX paymasters
function getSupportedCMXPaymasters() external view returns (address[] memory paymasters);
Returns
paymasters
address[]
Array of supported paymaster addresses
getBaseFee
Get base fee for governance operation
function getBaseFee(string calldata operationType) public view returns (uint256 fee);
Parameters
operationType
string
Type of governance operation
Returns
fee
uint256
Base fee in wei
calculateTotalFee
Calculate total fee including any multipliers
function calculateTotalFee(string calldata operationType, uint256 baseFee) public view returns (uint256 totalFee);
Parameters
operationType
string
Type of governance operation
baseFee
uint256
Base fee amount
Returns
totalFee
uint256
Total fee including multipliers
validateCMXPayment
Validate CMX paymaster can handle the fee for an operation
function validateCMXPayment(address user, address paymaster, string calldata operationType)
external
view
override
returns (bool canPay, uint256 cmxRequired, uint256 ethEquivalent);
Parameters
user
address
User who will pay the fee
paymaster
address
CMX paymaster address
operationType
string
Type of operation (for fee calculation)
Returns
canPay
bool
Whether the user can pay via CMX
cmxRequired
uint256
CMX amount required
ethEquivalent
uint256
ETH equivalent amount
preValidatePayment
Pre-validate payment before operation
function preValidatePayment(address user, address paymaster, PackedUserOperation calldata userOp)
external
view
override
returns (bool validated);
Parameters
user
address
User who will pay
paymaster
address
Paymaster address
userOp
PackedUserOperation
User operation (for gas estimation)
Returns
validated
bool
Whether the payment is pre-validated
preValidateCMXPayment
Pre-validate CMX payment before operation
function preValidateCMXPayment(address user, address paymaster, PackedUserOperation calldata userOp)
external
view
override
returns (bool validated);
Parameters
user
address
User who will pay
paymaster
address
CMX paymaster address
userOp
PackedUserOperation
User operation (for gas estimation)
Returns
validated
bool
Whether the payment is pre-validated
Events
CMXPaymasterAdded
event CMXPaymasterAdded(address indexed paymaster);
CMXPaymasterRemoved
event CMXPaymasterRemoved(address indexed paymaster);
Structs
CMXPaymasterLayout
struct CMXPaymasterLayout {
mapping(address => bool) supportedCMXPaymasters;
address[] cmxPaymasterList;
}
Last updated
Was this helpful?