IdentityAccessManagerSubscriptionFacet
Subscription management facet for IdentityAccessManager diamond
Functions
setSubscriptionManager
Set the subscription manager contract
function setSubscriptionManager(address _subscriptionManager) external;
Parameters
_subscriptionManager
address
Address of the subscription manager
setSubscriptionRequirement
Update subscription requirements
function setSubscriptionRequirement(uint8 _requiredTier, bool _enforced) external;
Parameters
_requiredTier
uint8
Minimum subscription tier required
_enforced
bool
Whether to enforce subscription requirements
getSubscriptionStatus
Check subscription status for the entity
function getSubscriptionStatus() external view returns (bool hasSubscription, uint8 currentTier);
Returns
hasSubscription
bool
True if entity has required subscription
currentTier
uint8
The entity's current subscription tier (if available)
getSubscriptionConfig
Get subscription configuration
function getSubscriptionConfig() external view returns (address manager, uint8 requiredTier, bool enforced);
Returns
manager
address
Current subscription manager address
requiredTier
uint8
Required subscription tier
enforced
bool
Whether subscriptions are enforced
isRoleAvailableWithSubscription
Check if a role is available considering subscription requirements
function isRoleAvailableWithSubscription(uint64, address account) external view returns (bool available);
Parameters
<none>
uint64
account
address
The account to check
Returns
available
bool
True if the role is available for the account
subscribe
Subscribe to a tier using CMX tokens
function subscribe(uint8 tier) external payable;
Parameters
tier
uint8
The subscription tier to subscribe to
cancelSubscription
Cancel current subscription
function cancelSubscription() external;
renewSubscription
Renew current subscription
function renewSubscription(uint8 tier) external payable;
Parameters
tier
uint8
The tier to renew (can upgrade/downgrade)
getPaymentAmount
Get payment amount for a subscription tier
function getPaymentAmount(uint8 tier, address paymentToken) external view returns (uint256 amount);
Parameters
tier
uint8
The subscription tier
paymentToken
address
The token to pay with (address(0) for CMX)
Returns
amount
uint256
The payment amount required
_canManageSubscriptions
Check if caller can manage subscription settings
function _canManageSubscriptions() internal view returns (bool);
Returns
<none>
bool
bool True if caller is entity admin or global protocol admin
Events
SubscriptionManagerUpdated
event SubscriptionManagerUpdated(address indexed oldManager, address indexed newManager);
SubscriptionRequirementUpdated
event SubscriptionRequirementUpdated(uint8 oldTier, uint8 newTier, bool enforced);
SubscriptionPurchased
event SubscriptionPurchased(address indexed entity, uint8 tier, uint256 amount);
SubscriptionCancelled
event SubscriptionCancelled(address indexed entity);
SubscriptionRenewed
event SubscriptionRenewed(address indexed entity, uint8 tier, uint256 amount);
Last updated
Was this helpful?