ShareClass
Last updated
Was this helpful?
Last updated
Was this helpful?
Inherits:
Author: CapSign Inc.
Extends the IssuedAsset contract to add features specific to share classes, such as dividends, splits, and corporate actions.
*We maintain cumulative multipliers:
cumulativeSplitNum / cumulativeSplitDen track how splits have changed quantity/cost basis.
cumulativeDivNum / cumulativeDivDen track how stock dividends have changed quantity. Example:
1st split: 2-for-1 => multiply (2/1) into cumulativeSplitNum/Den
2nd split: 3-for-1 => multiply again => final ratio = (2/1) * (3/1) = (6/1)
1st dividend: 10% => multiply (110/100) into (cumulativeDivNum/cumulativeDivDen)*
The authorized amount of shares that can be issued.
Adds a transfer restriction module.
Only callable by an admin.
Removes a transfer restriction module by index.
Only callable by an admin.
Runs registered transfer restriction module checks.
Parameters
from
address
The sender (or address(0) for createLoting).
to
address
The recipient.
quantity
uint96
The "real" token quantity involved.
tokenId
bytes32
The lot identifier (or zero if not yet assigned).
data
bytes
*Applies a stock dividend. If reducesBasis
is true, we treat it like a split for cost basis. Otherwise, only the share quantity ratio is updated. Example usage:
applyStockDividend(110, 100, false) -> 10% dividend, does NOT reduce cost basis.
applyStockDividend(150, 100, true) -> 50% dividend, does reduce cost basis.*
Parameters
divNum
uint96
Numerator of the dividend ratio.
divDen
uint96
Denominator of the dividend ratio.
reducesBasis
bool
Whether this dividend reduces cost basis.
*Applies a new stock split ratio (e.g., 2-for-1). This function updates the cumulativeSplitNum/cumulativeSplitDen ratio multiplicatively. Example:
If you already had a 2-for-1 in effect (2/1), and you call this with (3,1), your final ratio is (23)/(11) = (6/1).*
Parameters
splitNum
uint96
Numerator of the new split ratio.
splitDen
uint96
Denominator of the new split ratio.
Overridden createLot, which expects the user to specify a "real" quantity. Internally, we convert it to a "raw" quantity before storing.
Overridden transferFrom: we interpret 'transferQuantity' as a "real" quantity, then convert to raw, and call the base function.
Convert raw total to real using ratio
Helper to compute the real (post-split + post-dividend) quantity. We apply: realQuantity = rawQuantity (cumulativeSplitNum / cumulativeSplitDen) (cumulativeDivNum / cumulativeDivDen)
Helper to convert real (post-split + dividend) quantity back to raw. Inverse of _getRealQuantity
.
Helper to compute the real (post-split + post-dividend) cost basis. For splits, cost basis = rawBasis * (splitDen / splitNum). For large dividends (that reduce basis): cost basis is also scaled by (divCostBasisDen / divCostBasisNum). For small dividends, that ratio remains 1/1 (unchanged).
Returns the total real supply of shares, adjusted for splits and dividends.
Returns
<none>
uint256
The total real supply of shares.
Returns the stored data plus "real" (post-split+dividend) quantity and costBasis.
Parameters
lotId
bytes32
The lot ID to query.
Returns
parentLotId
bytes32
Hash of the parent lot, or 0x0 if none.
isValid
bool
Whether the lot is active.
realQuantity
uint96
The adjusted quantity after splits/dividends.
paymentCurrency
address
The payment currency for this lot.
realCostBasis
uint96
The adjusted cost basis after splits (and optionally dividends).
acquisitionDate
uint64
The original acquisition timestamp (unmodified).
lastUpdate
uint64
The last time this lot was updated.
uri
string
The URI of the lot.
data
bytes
Additional data associated with the lot.
Convenience function to return the raw stored data without transformations.
Sets the issuer public status. If _isPublic
is true, the share class issuer is considered public (registered with the SEC). Otherwise, it is considered private. Only callable by an admin.
Sets the authorized amount of shares that can be issued. Only callable by an admin.
Events for corporate actions
Event that emits when the issuer public status is updated.
Event that emits when the authorized amount is updated.