[M1: Audit 2: L-07]: CIP112: Document creation-time policy and check the pause at delivery in the custom example

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
65/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active

Research direction

Start with the token-cip112-v1 and token-cip112-utils READMEs, the integration guide, and the custom example's README.md; then inspect MyTransferInstruction, MyAllocation, and the MyRules_Pause and MyRules_Unpause choices. Follow how choice context supplies extraArgs and how the rules contract is fetched. Done means the docs explain creation-time policy and accounting corrections, and the custom example checks pause status at delivery with consuming pause and unpause choices.

Written by the indexing model from the issue text.

Description

Addresses L-07

A pending transfer instruction or allocation is accepted, rejected, withdrawn, settled or cancelled on the pending contract itself, not on the rules contract. Any policy a consumer writes in a factory body, such as a pause, an allowlist, a cap or a fee, is therefore checked only when the pending contract is created. The default TokenRules has no such policy, so the default templates are not affected.

A consumer that needs policy or accounting at delivery owns its pending templates. Each choice already receives the full choice argument, including extraArgs, so the template can resolve its rules contract from the choice context before calling the -utils body. It can also correct its accounting after a reject, withdraw or cancel. This is the pattern Splice's Amulet follows on accept. -utils and the default templates are unchanged.

Documentation:

  • the token-cip112-v1 and token-cip112-utils READMEs say that factory-side policy binds only at creation, and that consumers who count totals when an offer is made must correct them on reject, withdraw and cancel;
  • the integration guide shows how to check policy at delivery: resolve the rules contract from extraArgs.context, fetch it as the consumer's template, check its admin, and rely on the fetch failing for an archived contract;
  • the custom example's README.md replaces its pause caveat with a description of the check at delivery.

Custom example:

  • MyTransferInstruction accept and MyAllocation settle resolve MyRules from the choice context and refuse delivery while the registry is paused;
  • MyRules_Pause and MyRules_Unpause are consuming, so a rules contract ID from before the pause cannot be replayed.
Dominant language
Haskell
Stars
5
Forks
0
Avg merge
1d 36m
Merged PRs (30d)
11

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenZeppelin/canton-contracts

All issues in OpenZeppelin/canton-contracts

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.