feat: split dividend from equity, new DividendFacet#898
Merged
Axel-IoBuilders merged 4 commits intodevelopmentfrom Mar 30, 2026
Merged
feat: split dividend from equity, new DividendFacet#898Axel-IoBuilders merged 4 commits intodevelopmentfrom
Axel-IoBuilders merged 4 commits intodevelopmentfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
84c9df5 to
7484ffc
Compare
AlbertoMolinaIoBuilders
approved these changes
Mar 24, 2026
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>
2d006e2 to
6e4e070
Compare
Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com>
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>
12 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
split dividend facet from equity facet
Type of change
Testing
Node version:
Checklist