Skip to main content

CouponListing

Asset Tokenization Studio Team

CouponListing

Abstract implementation of ICouponListing, providing read-only queries for the ordered coupon list and the scheduled coupon listing.

Reads from CouponStorageWrapper, ScheduledTasksStorageWrapper, and TimeTravelStorageWrapper. Intended to be inherited by CouponListingFacet.

Methods​

getCouponFromOrderedListAt​

function getCouponFromOrderedListAt(uint256 _pos, bool _includeDisabled) external view returns (uint256 couponID_)

Retrieves a coupon ID from the ordered list at a specific position.

Parameters​

NameTypeDescription
_posuint256The position in the ordered coupon list.
_includeDisabledboolWhen true, cancelled coupons are counted in the list; when false, only active coupons are visible.

Returns​

NameTypeDescription
couponID_uint256The coupon ID at the specified position.

getCouponsOrderedList​

function getCouponsOrderedList(uint256 _pageIndex, uint256 _pageLength, bool _includeDisabled) external view returns (uint256[] couponIDs_)

Retrieves a paginated list of coupon IDs in order.

Parameters​

NameTypeDescription
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of coupons per page.
_includeDisabledboolWhen true, cancelled coupons are included in the page; when false, only active coupons are returned.

Returns​

NameTypeDescription
couponIDs_uint256[]Array of coupon IDs for the specified page.

getCouponsOrderedListTotal​

function getCouponsOrderedListTotal(bool _includeDisabled) external view returns (uint256 total_)

Retrieves the total number of coupons in the ordered list adjusted to the current timestamp.

Parameters​

NameTypeDescription
_includeDisabledboolWhen true, cancelled coupons are counted; when false, only active coupons are counted.

Returns​

NameTypeDescription
total_uint256The total count of coupons.

getScheduledCouponListing​

function getScheduledCouponListing(uint256 _pageIndex, uint256 _pageLength, bool _includeDisabled) external view returns (struct ScheduledTask[] scheduledCouponListing_)

Retrieves a paginated list of scheduled coupon listing tasks.

Parameters​

NameTypeDescription
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of tasks per page.
_includeDisabledboolWhen true, tasks belonging to cancelled corporate actions are included; when false, only active tasks are returned.

Returns​

NameTypeDescription
scheduledCouponListing_ScheduledTask[]Array of scheduled coupon listing tasks.

initializeCouponListing​

function initializeCouponListing() external nonpayable

Initialises the coupon listing capability on the token.

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

scheduledCouponListingCount​

function scheduledCouponListingCount(bool _includeDisabled) external view returns (uint256)

Returns the number of scheduled coupon listing tasks.

Parameters​

NameTypeDescription
_includeDisabledboolWhen true, tasks belonging to cancelled corporate actions are counted; when false, only active tasks are counted.

Returns​

NameTypeDescription
_0uint256The count of scheduled coupon listing tasks.

Events​

CouponListingInitialized​

event CouponListingInitialized()

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

Fires exclusively from initializeCouponListing.

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.

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.

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.