Skip to content

feat: split dividend from equity, new DividendFacet#898

Merged
Axel-IoBuilders merged 4 commits intodevelopmentfrom
feat/dividend
Mar 30, 2026
Merged

feat: split dividend from equity, new DividendFacet#898
Axel-IoBuilders merged 4 commits intodevelopmentfrom
feat/dividend

Conversation

@Axel-IoBuilders
Copy link
Copy Markdown
Contributor

Description

split dividend facet from equity facet

Type of change

  • Bug fix 🐞
  • New feature ✨
  • Breaking change 💥
  • Documentation update 📖
  • Refactor 🔧

Testing

Node version:

  • 20
  • 22
  • 24

Checklist

  • Style Guidelines followed ✅
  • Documentation Updated 📚
  • Linters - No New Warnings ⚠️
  • Local Tests Pass ✅
  • Effective Tests Added ✔️
  • No reduction of Coverage

@Axel-IoBuilders Axel-IoBuilders self-assigned this Mar 23, 2026
@Axel-IoBuilders Axel-IoBuilders requested review from a team as code owners March 23, 2026 08:59
@hedera-eng-infrastructure
Copy link
Copy Markdown

hedera-eng-infrastructure commented Mar 23, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Axel-IoBuilders and others added 3 commits March 30, 2026 14:34
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
Signed-off-by: Ruben Martinez <ruben.martinez@io.builders>
Co-authored-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
@Axel-IoBuilders Axel-IoBuilders merged commit 2502ada into development Mar 30, 2026
18 of 19 checks passed
@Axel-IoBuilders Axel-IoBuilders deleted the feat/dividend branch March 30, 2026 14:13
MiguelLZPF added a commit that referenced this pull request Apr 15, 2026
Port the feature introduced by commit 2502ada
("feat: split dividend from equity, new DividendFacet (#898)") on main onto
the lib-diamond migration chain. Stacks on refactor/BBND-1458-voting-split-from-commit
(PR #949, HEAD 4380608) — voting is not yet merged into the migration branch.

Contracts (layer_2):
- New DividendStorageWrapper library at domain/asset/dividend/ (mirrors
  VotingStorageWrapper; no storage slot — state lives in CorporateActions +
  Snapshots). Time reads go through TimeTravelStorageWrapper; emits use
  EvmAccessors.getMsgSender() inline. getSnapshotBalanceForIfDateReached is
  duplicated privately inside the library (voting precedent).
- Two-tier interface: IDividendTypes (4 structs) + IDividend is IDividendTypes
  (events + errors + 8 function sigs). DividendSet keeps source's 7-arg flat
  signature with 3 indexed args (operator, recordDate, executionDate).
- Facet split: Dividend (abstract) + DividendFacetBase (8 selectors +
  IDividend interface id) + standard/DividendFacet (concrete, resolver key).
  Matches Coupon precedent; DividendFacet drops the legacy Common inheritance
  (Common.sol does not exist on the migration branch).
- DividendFacetTimeTravel reduced to trivial `is DividendFacet {}` shape
  (matches CouponFacetTimeTravel/VotingFacetTimeTravel siblings).
- _DIVIDEND_RESOLVER_KEY added to constants/resolverKeys.sol
  (0x63752e3f4bd54d9fec1ad1667ef4de4f80e9a6484fb94f93ea4312aef9c19bea).
- EquityStorageWrapper loses ~140 lines of dividend-specific code;
  getSnapshotBalanceForIfDateReached stays (still used by balance adjustments).
  Equity.sol and IEquity.sol drop dividend externals, types, events, errors.
- EquityUSAFacet selector array 17 -> 9 (drop 8 dividend selectors).
- createConfiguration.ts adds "DividendFacet" to equity facet list (42 -> 43).
- atsRegistry.data.ts regenerated.
- ERC3643/interfaces/IEquity.sol auto-regenerated by tasks/compile.ts.

Tests (verbatim from source):
- New dividend/dividend.test.ts (672 lines, hero).
- equity, erc1410, adjustBalances, clearing, corporateActions,
  scheduledSnapshots, scheduledTasks, snapshots tests updated per source.
- Does NOT port the source's divident.test.ts (byte-identical typo duplicate
  of dividend.test.ts — skipped deliberately).
- erc1410.test.ts carries 9 assertion adaptations: replaces legacy
  `rejectedWith("AccountIsBlocked")` with
  `revertedWithCustomError(controlList, "AccountIsBlocked")`. The migration
  branch had already upgraded these matchers under ethers v6; reverting to
  source's string-match form fails because ethers can't decode the custom
  error via the erc1410Facet ABI without a registered error definition.
  The controlList handle supplies the ABI that decodes selector 0x796c1f0d.

SDK:
- New Dividend port-in with unit test; InjectableDividend wired into
  Handlers.
- Command/query handlers (set/cancel + 6 query types) moved via `git mv` from
  app/usecase/{command,query}/equity/dividend/ to app/usecase/{command,query}/dividend/.
- Requests moved via `git mv` from port/in/request/equity/ to port/in/request/dividend/.
- Domain contexts moved via `git mv` to domain/context/dividend/.
- Equity port-in shrunk (~140 lines of dividend methods removed); matching
  shrink in Equity.unit.test.ts.
- RPCTransactionAdapter and RPCQueryAdapter rewired to use Dividend__factory
  for dividend operations.
- Adapter struct annotations use inferred types instead of
  IDividendTypes.DividendStruct / IVotingTypes.VotingStruct /
  ICouponTypes.CouponStruct. The typechain barrel re-exports namespaces via
  `export type { }` which tsc silently drops (namespaces are not types),
  leaving the Types symbols unavailable on the contracts package entrypoint.
  Dropping the explicit annotation lets TypeScript infer the shape through
  the factory method call (same safety — the factory argument type still
  constrains the literal). Matches the existing votingStruct pattern on the
  parent branch.

Web + integration:
- apps/ats/web/src/services/SDKService.ts reroutes 7 dividend calls from
  Equity.* to Dividend.*; adds Dividend import.
- apps/mass-payout/backend on-chain-distribution repository + spec rewired to
  use Dividend and Coupon (replacing Bond.getAllCoupons /
  Equity.getAllDividends).

Verification:
- npx hardhat test: 1311 passing, 0 failing.
- npm test (integration + scripts): 2220 passing, 0 failing.
- npm run ats:contracts:lint: 0 errors.
- npm run ats:contracts:build: TypeChain regenerates Dividend__factory,
  IDividend__factory, DividendFacet__factory, IDividendTypes__factory.
- npm run ats:sdk:build: clean.
- npm run ats:web:build: clean.
- Every verbatim test (8 of 9) is byte-identical to source 2502ada; only
  erc1410.test.ts carries the AccountIsBlocked matcher adaptations above.

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
MiguelLZPF added a commit that referenced this pull request Apr 15, 2026
Port the feature introduced by commit 2502ada
("feat: split dividend from equity, new DividendFacet (#898)") on main onto
the lib-diamond migration chain. Stacks on refactor/BBND-1458-voting-split-from-commit
(PR #949, HEAD 4380608) — voting is not yet merged into the migration branch.

Contracts (layer_2):
- New DividendStorageWrapper library at domain/asset/dividend/ (mirrors
  VotingStorageWrapper; no storage slot — state lives in CorporateActions +
  Snapshots). Time reads go through TimeTravelStorageWrapper; emits use
  EvmAccessors.getMsgSender() inline. getSnapshotBalanceForIfDateReached is
  duplicated privately inside the library (voting precedent).
- Two-tier interface: IDividendTypes (4 structs) + IDividend is IDividendTypes
  (events + errors + 8 function sigs). DividendSet keeps source's 7-arg flat
  signature with 3 indexed args (operator, recordDate, executionDate).
- Facet split: Dividend (abstract) + DividendFacetBase (8 selectors +
  IDividend interface id) + standard/DividendFacet (concrete, resolver key).
  Matches Coupon precedent; DividendFacet drops the legacy Common inheritance
  (Common.sol does not exist on the migration branch).
- DividendFacetTimeTravel reduced to trivial `is DividendFacet {}` shape
  (matches CouponFacetTimeTravel/VotingFacetTimeTravel siblings).
- _DIVIDEND_RESOLVER_KEY added to constants/resolverKeys.sol
  (0x63752e3f4bd54d9fec1ad1667ef4de4f80e9a6484fb94f93ea4312aef9c19bea).
- EquityStorageWrapper loses ~140 lines of dividend-specific code;
  getSnapshotBalanceForIfDateReached stays (still used by balance adjustments).
  Equity.sol and IEquity.sol drop dividend externals, types, events, errors.
- EquityUSAFacet selector array 17 -> 9 (drop 8 dividend selectors).
- createConfiguration.ts adds "DividendFacet" to equity facet list (42 -> 43).
- atsRegistry.data.ts regenerated.
- ERC3643/interfaces/IEquity.sol auto-regenerated by tasks/compile.ts.

Tests (verbatim from source):
- New dividend/dividend.test.ts (672 lines, hero).
- equity, erc1410, adjustBalances, clearing, corporateActions,
  scheduledSnapshots, scheduledTasks, snapshots tests updated per source.
- Does NOT port the source's divident.test.ts (byte-identical typo duplicate
  of dividend.test.ts — skipped deliberately).
- erc1410.test.ts carries 9 assertion adaptations: replaces legacy
  `rejectedWith("AccountIsBlocked")` with
  `revertedWithCustomError(controlList, "AccountIsBlocked")`. The migration
  branch had already upgraded these matchers under ethers v6; reverting to
  source's string-match form fails because ethers can't decode the custom
  error via the erc1410Facet ABI without a registered error definition.
  The controlList handle supplies the ABI that decodes selector 0x796c1f0d.

SDK:
- New Dividend port-in with unit test; InjectableDividend wired into
  Handlers.
- Command/query handlers (set/cancel + 6 query types) moved via `git mv` from
  app/usecase/{command,query}/equity/dividend/ to app/usecase/{command,query}/dividend/.
- Requests moved via `git mv` from port/in/request/equity/ to port/in/request/dividend/.
- Domain contexts moved via `git mv` to domain/context/dividend/.
- Equity port-in shrunk (~140 lines of dividend methods removed); matching
  shrink in Equity.unit.test.ts.
- RPCTransactionAdapter and RPCQueryAdapter rewired to use Dividend__factory
  for dividend operations.
- Adapter struct annotations use inferred types instead of
  IDividendTypes.DividendStruct / IVotingTypes.VotingStruct /
  ICouponTypes.CouponStruct. The typechain barrel re-exports namespaces via
  `export type { }` which tsc silently drops (namespaces are not types),
  leaving the Types symbols unavailable on the contracts package entrypoint.
  Dropping the explicit annotation lets TypeScript infer the shape through
  the factory method call (same safety — the factory argument type still
  constrains the literal). Matches the existing votingStruct pattern on the
  parent branch.

Web + integration:
- apps/ats/web/src/services/SDKService.ts reroutes 7 dividend calls from
  Equity.* to Dividend.*; adds Dividend import.
- apps/mass-payout/backend on-chain-distribution repository + spec rewired to
  use Dividend and Coupon (replacing Bond.getAllCoupons /
  Equity.getAllDividends).

Verification:
- npx hardhat test: 1311 passing, 0 failing.
- npm test (integration + scripts): 2220 passing, 0 failing.
- npm run ats:contracts:lint: 0 errors.
- npm run ats:contracts:build: TypeChain regenerates Dividend__factory,
  IDividend__factory, DividendFacet__factory, IDividendTypes__factory.
- npm run ats:sdk:build: clean.
- npm run ats:web:build: clean.
- Every verbatim test (8 of 9) is byte-identical to source 2502ada; only
  erc1410.test.ts carries the AccountIsBlocked matcher adaptations above.

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
MiguelLZPF added a commit that referenced this pull request Apr 15, 2026
Port the feature introduced by commit 2502ada
("feat: split dividend from equity, new DividendFacet (#898)") on main onto
the lib-diamond migration chain. Stacks on refactor/BBND-1458-voting-split-from-commit
(PR #949, HEAD 4380608) — voting is not yet merged into the migration branch.

Contracts (layer_2):
- New DividendStorageWrapper library at domain/asset/dividend/ (mirrors
  VotingStorageWrapper; no storage slot — state lives in CorporateActions +
  Snapshots). Time reads go through TimeTravelStorageWrapper; emits use
  EvmAccessors.getMsgSender() inline. getSnapshotBalanceForIfDateReached is
  duplicated privately inside the library (voting precedent).
- Two-tier interface: IDividendTypes (4 structs) + IDividend is IDividendTypes
  (events + errors + 8 function sigs). DividendSet keeps source's 7-arg flat
  signature with 3 indexed args (operator, recordDate, executionDate).
- Facet split: Dividend (abstract) + DividendFacetBase (8 selectors +
  IDividend interface id) + standard/DividendFacet (concrete, resolver key).
  Matches Coupon precedent; DividendFacet drops the legacy Common inheritance
  (Common.sol does not exist on the migration branch).
- DividendFacetTimeTravel reduced to trivial `is DividendFacet {}` shape
  (matches CouponFacetTimeTravel/VotingFacetTimeTravel siblings).
- _DIVIDEND_RESOLVER_KEY added to constants/resolverKeys.sol
  (0x63752e3f4bd54d9fec1ad1667ef4de4f80e9a6484fb94f93ea4312aef9c19bea).
- EquityStorageWrapper loses ~140 lines of dividend-specific code;
  getSnapshotBalanceForIfDateReached stays (still used by balance adjustments).
  Equity.sol and IEquity.sol drop dividend externals, types, events, errors.
- EquityUSAFacet selector array 17 -> 9 (drop 8 dividend selectors).
- createConfiguration.ts adds "DividendFacet" to equity facet list (42 -> 43).
- atsRegistry.data.ts regenerated.
- ERC3643/interfaces/IEquity.sol auto-regenerated by tasks/compile.ts.

Tests (verbatim from source):
- New dividend/dividend.test.ts (672 lines, hero).
- equity, erc1410, adjustBalances, clearing, corporateActions,
  scheduledSnapshots, scheduledTasks, snapshots tests updated per source.
- Does NOT port the source's divident.test.ts (byte-identical typo duplicate
  of dividend.test.ts — skipped deliberately).
- erc1410.test.ts carries 9 assertion adaptations: replaces legacy
  `rejectedWith("AccountIsBlocked")` with
  `revertedWithCustomError(controlList, "AccountIsBlocked")`. The migration
  branch had already upgraded these matchers under ethers v6; reverting to
  source's string-match form fails because ethers can't decode the custom
  error via the erc1410Facet ABI without a registered error definition.
  The controlList handle supplies the ABI that decodes selector 0x796c1f0d.

SDK:
- New Dividend port-in with unit test; InjectableDividend wired into
  Handlers.
- Command/query handlers (set/cancel + 6 query types) moved via `git mv` from
  app/usecase/{command,query}/equity/dividend/ to app/usecase/{command,query}/dividend/.
- Requests moved via `git mv` from port/in/request/equity/ to port/in/request/dividend/.
- Domain contexts moved via `git mv` to domain/context/dividend/.
- Equity port-in shrunk (~140 lines of dividend methods removed); matching
  shrink in Equity.unit.test.ts.
- RPCTransactionAdapter and RPCQueryAdapter rewired to use Dividend__factory
  for dividend operations.
- Adapter struct annotations use inferred types instead of
  IDividendTypes.DividendStruct / IVotingTypes.VotingStruct /
  ICouponTypes.CouponStruct. The typechain barrel re-exports namespaces via
  `export type { }` which tsc silently drops (namespaces are not types),
  leaving the Types symbols unavailable on the contracts package entrypoint.
  Dropping the explicit annotation lets TypeScript infer the shape through
  the factory method call (same safety — the factory argument type still
  constrains the literal). Matches the existing votingStruct pattern on the
  parent branch.

Web + integration:
- apps/ats/web/src/services/SDKService.ts reroutes 7 dividend calls from
  Equity.* to Dividend.*; adds Dividend import.
- apps/mass-payout/backend on-chain-distribution repository + spec rewired to
  use Dividend and Coupon (replacing Bond.getAllCoupons /
  Equity.getAllDividends).

Verification:
- npx hardhat test: 1311 passing, 0 failing.
- npm test (integration + scripts): 2220 passing, 0 failing.
- npm run ats:contracts:lint: 0 errors.
- npm run ats:contracts:build: TypeChain regenerates Dividend__factory,
  IDividend__factory, DividendFacet__factory, IDividendTypes__factory.
- npm run ats:sdk:build: clean.
- npm run ats:web:build: clean.
- Every verbatim test (8 of 9) is byte-identical to source 2502ada; only
  erc1410.test.ts carries the AccountIsBlocked matcher adaptations above.

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
MiguelLZPF added a commit that referenced this pull request Apr 15, 2026
Port the feature introduced by commit 2502ada
("feat: split dividend from equity, new DividendFacet (#898)") on main onto
the lib-diamond migration chain. Stacks on refactor/BBND-1458-voting-split-from-commit
(PR #949, HEAD 4380608) — voting is not yet merged into the migration branch.

Contracts (layer_2):
- New DividendStorageWrapper library at domain/asset/dividend/ (mirrors
  VotingStorageWrapper; no storage slot — state lives in CorporateActions +
  Snapshots). Time reads go through TimeTravelStorageWrapper; emits use
  EvmAccessors.getMsgSender() inline. getSnapshotBalanceForIfDateReached is
  duplicated privately inside the library (voting precedent).
- Two-tier interface: IDividendTypes (4 structs) + IDividend is IDividendTypes
  (events + errors + 8 function sigs). DividendSet keeps source's 7-arg flat
  signature with 3 indexed args (operator, recordDate, executionDate).
- Facet split: Dividend (abstract) + DividendFacetBase (8 selectors +
  IDividend interface id) + standard/DividendFacet (concrete, resolver key).
  Matches Coupon precedent; DividendFacet drops the legacy Common inheritance
  (Common.sol does not exist on the migration branch).
- DividendFacetTimeTravel reduced to trivial `is DividendFacet {}` shape
  (matches CouponFacetTimeTravel/VotingFacetTimeTravel siblings).
- _DIVIDEND_RESOLVER_KEY added to constants/resolverKeys.sol
  (0x63752e3f4bd54d9fec1ad1667ef4de4f80e9a6484fb94f93ea4312aef9c19bea).
- EquityStorageWrapper loses ~140 lines of dividend-specific code;
  getSnapshotBalanceForIfDateReached stays (still used by balance adjustments).
  Equity.sol and IEquity.sol drop dividend externals, types, events, errors.
- EquityUSAFacet selector array 17 -> 9 (drop 8 dividend selectors).
- createConfiguration.ts adds "DividendFacet" to equity facet list (42 -> 43).
- atsRegistry.data.ts regenerated.
- ERC3643/interfaces/IEquity.sol auto-regenerated by tasks/compile.ts.

Tests (verbatim from source):
- New dividend/dividend.test.ts (672 lines, hero).
- equity, erc1410, adjustBalances, clearing, corporateActions,
  scheduledSnapshots, scheduledTasks, snapshots tests updated per source.
- Does NOT port the source's divident.test.ts (byte-identical typo duplicate
  of dividend.test.ts — skipped deliberately).
- erc1410.test.ts carries 9 assertion adaptations: replaces legacy
  `rejectedWith("AccountIsBlocked")` with
  `revertedWithCustomError(controlList, "AccountIsBlocked")`. The migration
  branch had already upgraded these matchers under ethers v6; reverting to
  source's string-match form fails because ethers can't decode the custom
  error via the erc1410Facet ABI without a registered error definition.
  The controlList handle supplies the ABI that decodes selector 0x796c1f0d.

SDK:
- New Dividend port-in with unit test; InjectableDividend wired into
  Handlers.
- Command/query handlers (set/cancel + 6 query types) moved via `git mv` from
  app/usecase/{command,query}/equity/dividend/ to app/usecase/{command,query}/dividend/.
- Requests moved via `git mv` from port/in/request/equity/ to port/in/request/dividend/.
- Domain contexts moved via `git mv` to domain/context/dividend/.
- Equity port-in shrunk (~140 lines of dividend methods removed); matching
  shrink in Equity.unit.test.ts.
- RPCTransactionAdapter and RPCQueryAdapter rewired to use Dividend__factory
  for dividend operations.
- Adapter struct annotations use inferred types instead of
  IDividendTypes.DividendStruct / IVotingTypes.VotingStruct /
  ICouponTypes.CouponStruct. The typechain barrel re-exports namespaces via
  `export type { }` which tsc silently drops (namespaces are not types),
  leaving the Types symbols unavailable on the contracts package entrypoint.
  Dropping the explicit annotation lets TypeScript infer the shape through
  the factory method call (same safety — the factory argument type still
  constrains the literal). Matches the existing votingStruct pattern on the
  parent branch.

Web + integration:
- apps/ats/web/src/services/SDKService.ts reroutes 7 dividend calls from
  Equity.* to Dividend.*; adds Dividend import.
- apps/mass-payout/backend on-chain-distribution repository + spec rewired to
  use Dividend and Coupon (replacing Bond.getAllCoupons /
  Equity.getAllDividends).

Verification:
- npx hardhat test: 1311 passing, 0 failing.
- npm test (integration + scripts): 2220 passing, 0 failing.
- npm run ats:contracts:lint: 0 errors.
- npm run ats:contracts:build: TypeChain regenerates Dividend__factory,
  IDividend__factory, DividendFacet__factory, IDividendTypes__factory.
- npm run ats:sdk:build: clean.
- npm run ats:web:build: clean.
- Every verbatim test (8 of 9) is byte-identical to source 2502ada; only
  erc1410.test.ts carries the AccountIsBlocked matcher adaptations above.

Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants