Skip to main content

CouponFacet

Asset Tokenization Studio Team

CouponFacet

Diamond facet exposing the standard (non-rate-variant) coupon writer surface (setCoupon, cancelCoupon) alongside the per-record reads under RESOLVER_KEY_COUPON.

Inherits the writer logic from Coupon and satisfies IStaticFunctionSelectors for Diamond proxy selector registration. Read-only sibling facets CouponSecurityHoldersFacet and CouponListingFacet register under their own resolver keys and operate on the same underlying storage.

Methods​

cancelCoupon​

function cancelCoupon(uint256 _couponID) external nonpayable returns (bool success_)

Cancels a previously scheduled coupon before its execution date is reached.

Restricted to ROLE_CORPORATE_ACTION; gated by onlyUnpaused and onlyMatchingActionType(CORPORATE_ACTION_TYPE_COUPON, _couponID - 1).

Parameters​

NameTypeDescription
_couponIDuint256One-indexed identifier of the coupon to cancel.

Returns​

NameTypeDescription
success_boolTrue if the cancellation was recorded.

forceCancelCoupon​

function forceCancelCoupon(uint256 _couponID) external nonpayable returns (bool success_)

Force-cancels a coupon regardless of its execution date.

Restricted to ROLE_CORPORATE_ACTION_FORCE_CANCEL; gated by onlyUnpaused and onlyMatchingActionType(CORPORATE_ACTION_TYPE_COUPON, _couponID - 1).

Parameters​

NameTypeDescription
_couponIDuint256One-indexed identifier of the coupon to force-cancel.

Returns​

NameTypeDescription
success_boolTrue if the force-cancellation was recorded.

getCoupon​

function getCoupon(uint256 _couponID) external view returns (struct ICouponTypes.RegisteredCoupon registeredCoupon_, bool isDisabled_)

Returns the persisted coupon record together with its cancelled flag.

Reverts via onlyMatchingActionType if _couponID does not match the coupon corporate-action type at index _couponID - 1.

Parameters​

NameTypeDescription
_couponIDuint256One-indexed coupon identifier.

Returns​

NameTypeDescription
registeredCoupon_ICouponTypes.RegisteredCouponStored coupon parameters bound to their snapshot id.
isDisabled_boolTrue if the coupon has been cancelled.

getCouponAmountFor​

function getCouponAmountFor(uint256 _couponID, address _account) external view returns (struct ICouponTypes.CouponAmountFor couponAmountFor_)

Returns the fractional coupon amount payable to a specific holder.

Reverts via onlyMatchingActionType if _couponID does not match the coupon corporate-action type at index _couponID - 1.

Parameters​

NameTypeDescription
_couponIDuint256One-indexed coupon identifier.
_accountaddressHolder address to query.

Returns​

NameTypeDescription
couponAmountFor_ICouponTypes.CouponAmountForFractional payable amount for the holder.

getCouponCount​

function getCouponCount() external view returns (uint256 couponCount_)

Returns the total number of coupons scheduled under the coupon corporate-action type — cancelled coupons remain in the count.

Returns​

NameTypeDescription
couponCount_uint256Current coupon count.

getCouponFor​

function getCouponFor(uint256 _couponID, address _account) external view returns (struct ICouponTypes.CouponFor couponFor_)

Returns the per-account view of a coupon, including the holder balance at the record date and the metadata required to compute the payable amount.

Reverts via onlyMatchingActionType if _couponID does not match the coupon corporate-action type at index _couponID - 1.

Parameters​

NameTypeDescription
_couponIDuint256One-indexed coupon identifier.
_accountaddressHolder address to query.

Returns​

NameTypeDescription
couponFor_ICouponTypes.CouponForHolder-scoped coupon view.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[])

Gets all function selectors of a facet

Selectors are written in reverse via --selectorIndex inside an unchecked block; the resulting array reads in declaration order (setCoupon, cancelCoupon, getCoupon, getCouponFor, getCouponAmountFor, getCouponCount).

Returns​

NameTypeDescription
_0bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[])

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
_0bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

initializeCoupon​

function initializeCoupon() external nonpayable

Initialises the coupon capability on the token.

Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.

setCoupon​

function setCoupon(ICouponTypes.Coupon _newCoupon) external nonpayable returns (uint256 couponID_)

Parameters​

NameTypeDescription
_newCouponICouponTypes.Couponundefined

Returns​

NameTypeDescription
couponID_uint256undefined

Events​

CouponCancelled​

event CouponCancelled(uint256 indexed couponId, address indexed operator)

Emitted when an operator cancels a previously scheduled coupon.

Cancellation is rejected once the execution date has passed; see CouponAlreadyExecuted.

Parameters​

NameTypeDescription
couponId indexeduint256One-indexed identifier of the cancelled coupon.
operator indexedaddressAddress that performed the cancellation.

CouponForceCancelled​

event CouponForceCancelled(uint256 indexed couponId, address indexed operator)

Emitted when an admin force-cancels a coupon, bypassing date guards.

Parameters​

NameTypeDescription
couponId indexeduint256One-indexed identifier of the force-cancelled coupon.
operator indexedaddressAddress that performed the force-cancellation.

CouponInitialized​

event CouponInitialized()

Emitted once when the coupon capability is initialised on a token.

Fires exclusively from initializeCoupon.

CouponSet​

event CouponSet(bytes32 indexed corporateActionId, uint256 indexed couponId, address indexed operator, ICouponTypes.Coupon coupon)

Emitted when an operator schedules a new coupon corporate action.

Parameters​

NameTypeDescription
corporateActionId indexedbytes32Identifier of the underlying corporate action.
couponId indexeduint256One-indexed coupon identifier within the coupon corporate action type.
operator indexedaddressAddress that scheduled the coupon.
couponICouponTypes.CouponThe coupon parameters captured at scheduling time.

Errors​

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The role that is not held.

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

CouponAlreadyExecuted​

error CouponAlreadyExecuted(bytes32 corporateActionId, uint256 couponId)

Reverts when an operator attempts to cancel a coupon whose execution date has already passed.

Parameters​

NameTypeDescription
corporateActionIdbytes32Identifier of the underlying corporate action.
couponIduint256One-indexed identifier of the coupon that cannot be cancelled.

CouponCreationFailed​

error CouponCreationFailed()

Reverts when the underlying corporate-action creation step returns the zero id, indicating the coupon could not be persisted.

CouponNotFound​

error CouponNotFound(uint256 couponID)

Reverts when a coupon identifier does not resolve to an existing corporate action.

Parameters​

NameTypeDescription
couponIDuint256The coupon identifier that was not found.

CouponRatePending​

error CouponRatePending(uint256 couponID)

Reverts when at least one coupon is still awaiting rate resolution.

Raised by CouponStorageWrapper.checkPendingCoupons, used to guard InterestRate::setCouponRateType so a KPI-linked coupon cannot be left permanently unresolved by switching the rate type away before its scheduled listing has persisted a resolved rate.

Parameters​

NameTypeDescription
couponIDuint256One-indexed identifier of the first pending coupon found.

Deactivated​

error Deactivated()

Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.

DecimalsTooLarge​

error DecimalsTooLarge(uint8 currentDecimals, uint8 newDecimals)

Reverts when the difference between current decimals and new decimals exceeds the maximum value.

Protects decimals amount difference between current and new not te be greater than maximum.

Parameters​

NameTypeDescription
currentDecimalsuint8the current decimals amount.
newDecimalsuint8the new decimals amount.

ExponentOverflow​

error ExponentOverflow(uint256 exponent)

Reverts when an exponent would cause 10 ** exponent to overflow uint256.

Thrown by DecimalsLib.checkExponentOverflow when exponent >= 78.

Parameters​

NameTypeDescription
exponentuint256The exponent that would produce an overflow.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

GreaterThanMaxUint256​

error GreaterThanMaxUint256(uint256 amount, uint8 decimals)

Reverts when multiplying amount by 10 ** decimals would exceed uint256 max.

Thrown by DecimalsLib.calculateDecimalsAdjustment when amount > MAX_UINT256 / 10 ** decimals.

Parameters​

NameTypeDescription
amountuint256The token amount that cannot be scaled up.
decimalsuint8The exponent that causes the overflow.

InterestRateIsFixed​

error InterestRateIsFixed()

Thrown when setRate is called on a token whose rate has been locked.

InterestRateIsKpiLinked​

error InterestRateIsKpiLinked()

Reverts when a KPI-linked rate variant is supplied with non-pending or non-zero rate parameters, which the variant requires for dynamic computation.

InterestRateIsStandard​

error InterestRateIsStandard()

Reverts when a standard rate variant is supplied with pending rate parameters.

IsPaused​

error IsPaused()

Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).

SnapshotIdDoesNotExists​

error SnapshotIdDoesNotExists(uint256 snapshotId)

Thrown when the requested snapshot identifier has never been taken on this token.

Parameters​

NameTypeDescription
snapshotIduint256The unrecognised snapshot identifier that was supplied.

SnapshotIdNull​

error SnapshotIdNull()

Thrown when a snapshot identifier of zero is supplied; zero is reserved and never assigned to a valid snapshot.

UnexpectedError​

error UnexpectedError(bytes4 _errorId)

Reverts when an unreachable validation state is detected.

Replaces assertions for defensive handling of logically impossible states.

Parameters​

NameTypeDescription
_errorIdbytes4Identifier of the unexpected validation condition.

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.

WrongDates​

error WrongDates(uint256 firstDate, uint256 secondDate)

Reverts when two date values fail their required ordering constraint.

The expected relationship between both dates is defined by the caller's validation context.

Parameters​

NameTypeDescription
firstDateuint256First date participating in the failed comparison.
secondDateuint256Second date participating in the failed comparison.

WrongIndexForAction​

error WrongIndexForAction(uint256 index, bytes32 actionType)

Thrown when a type-scoped index does not correspond to an existing action.

Parameters​

NameTypeDescription
indexuint256The out-of-range index that was provided.
actionTypebytes32The action type against which the index was validated.

WrongTimestamp​

error WrongTimestamp(uint256 timeStamp)

Reverts when a scheduled timestamp is not strictly in the future.

Used for shared scheduling validation where the current block time is read through TimeTravelStorageWrapper.

Parameters​

NameTypeDescription
timeStampuint256Timestamp rejected for scheduling.