Skip to content

fix: replace CIP56TransferFactory with AllocationFactory in USDCx bootstrap#265

Merged
sadiq1971 merged 1 commit into
mainfrom
fix/usdcx-allocation-factory
May 7, 2026
Merged

fix: replace CIP56TransferFactory with AllocationFactory in USDCx bootstrap#265
sadiq1971 merged 1 commit into
mainfrom
fix/usdcx-allocation-factory

Conversation

@sadiq1971
Copy link
Copy Markdown
Member

Summary

  • Replaces CIP56TransferFactory (atomic, local-only) with DA's AllocationFactory from utility_registry_app_v0 — this factory creates TransferOffer contracts on TransferFactory_Transfer, matching devnet behaviour where the receiver must exercise TransferInstruction_Accept
  • Adds bootstrap of TransferRule (required in choiceContextData at accept time) and InstrumentConfiguration (with empty holderRequirements, so no credential contracts needed locally)
  • Adds --registry-app-package-id and --registry-package-id flags with defaults from deployments/usdcx-dars/manifest.json; docker-bootstrap.sh requires no changes

Test plan

  • Run docker compose up and verify bootstrap completes without error
  • Run scripts/testing/find-transfer-rule.go against local devnet and confirm TransferRule is visible
  • Initiate a USDCx transfer and confirm a TransferOffer contract appears on the ledger (via list-all-contracts.go)
  • Confirm existing DEMO token E2E tests are unaffected

Closes #258

…tstrap

Switch from CIP56TransferFactory (atomic, local-only) to DA's AllocationFactory
from utility_registry_app_v0. This factory creates TransferOffer contracts on
TransferFactory_Transfer, matching devnet behaviour where the receiver must
exercise TransferInstruction_Accept to complete the transfer.

Also bootstraps TransferRule and InstrumentConfiguration (with empty
holderRequirements) which are required as choiceContextData when the receiver
accepts the transfer offer.

Closes #258
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@804e72f). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #265   +/-   ##
=======================================
  Coverage        ?   32.35%           
=======================================
  Files           ?      127           
  Lines           ?     8968           
  Branches        ?        0           
=======================================
  Hits            ?     2902           
  Misses          ?     5817           
  Partials        ?      249           
Flag Coverage Δ
unittests 32.35% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the USDCx bootstrap script to utilize the utility_registry_app_v0 framework, replacing the legacy CIP56TransferFactory with AllocationFactory, TransferRule, and InstrumentConfiguration. It also refactors contract lookup functions to support specific package IDs. Review feedback recommends defining template identifiers as constants to prevent typos and enhancing command ID generation with a random component to ensure uniqueness during rapid script execution.

I am having trouble creating individual review comments. Click here to see my feedback.

scripts/setup/bootstrap-usdcx.go (100)

medium

Module and entity names like "CIP56.Token" and "CIP56Manager" are used as string literals. To improve code clarity and reduce the risk of typos, it's better to define these as constants.

This practice should be applied to all template identifier strings used in this file, such as in findContractByPkg calls and create... functions.

scripts/setup/bootstrap-usdcx.go (332)

medium

Using time.Now().UnixNano() for CommandId does not guarantee uniqueness across different runs of the script, which could lead to unintended command deduplication if the script is executed in very quick succession. A more robust approach would be to include a random component to ensure the command ID is unique.

This applies to createTransferRule (line 361) and createInstrumentConfiguration (line 390) as well.

@sadiq1971 sadiq1971 self-assigned this May 6, 2026
@salindne salindne self-requested a review May 7, 2026 16:10
@sadiq1971 sadiq1971 merged commit 5cfc51f into main May 7, 2026
2 checks passed
@sadiq1971 sadiq1971 deleted the fix/usdcx-allocation-factory branch May 7, 2026 19:19
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.

fix: update local USDCx bootstrap to create TransferOffer contracts instead of atomic holdings

3 participants