Skip to content

L-10: Add merge and split choices on holdings - #131

Open
haseebrabbani wants to merge 1 commit into
audit-m1-02-l05from
audit-m1-02-l10
Open

haseebrabbani wants to merge 1 commit into
audit-m1-02-l05from
audit-m1-02-l10

Conversation

@haseebrabbani

Copy link
Copy Markdown
Collaborator

Closes #94. Stacked on #116 (base audit-m1-02-l05).

Changes

  • token-cip112-utils: holdingMergeImpl and holdingSplitImpl, bodies of consuming merge and split choices controlled by the account parties. Value is conserved and each emits one holdings-change event with no transfer legs.
  • Merge inputs go through fundHolding and must match the exercised holding's admin, account and instrument; expired locks are accepted, live ones refused.
  • The exercised holding of a merge or split must carry no lock, even an expired one, since its lock holders would witness the whole rebalance.
  • token-cip112-v1: TokenHolding_Merge and TokenHolding_Split.
  • Custom example: MyHolding_Merge and MyHolding_Split refuse a frozen holding; merge inputs run MyHolding_Spend and must carry the exercised holding's AppRoles.
  • Docs: rebalancing through the choices and through a self-transfer (interface-only wallets cannot see template choices); merges and splits bypass the registry's transfer policy; custom templates must apply their own spend rules to the exercised holding.

Notes

Add holdingMergeImpl and holdingSplitImpl to the utils and expose them as
TokenHolding_Merge and TokenHolding_Split, controlled by the account
parties. Both conserve value and emit a holdings-change event with no
transfer legs. A merge consumes its inputs through fundHolding, so they
must share the exercised holding's admin, account and instrument, and an
expired lock is accepted while a live one is refused. Both refuse an
exercised holding with any lock, since its lock holders would see the
whole rebalance.

The custom example adds MyHolding_Merge and MyHolding_Split with a freeze
check on the exercised holding, and a merge refuses inputs that carry
other roles. The READMEs and the integration guide describe rebalancing
through the choices and through a self-transfer, and note that merges and
splits bypass the registry's transfer policy.

Closes #94
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.

1 participant