fix: replace CIP56TransferFactory with AllocationFactory in USDCx bootstrap#265
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #265 +/- ##
=======================================
Coverage ? 32.35%
=======================================
Files ? 127
Lines ? 8968
Branches ? 0
=======================================
Hits ? 2902
Misses ? 5817
Partials ? 249
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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)
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)
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.
Summary
CIP56TransferFactory(atomic, local-only) with DA'sAllocationFactoryfromutility_registry_app_v0— this factory createsTransferOffercontracts onTransferFactory_Transfer, matching devnet behaviour where the receiver must exerciseTransferInstruction_AcceptTransferRule(required inchoiceContextDataat accept time) andInstrumentConfiguration(with emptyholderRequirements, so no credential contracts needed locally)--registry-app-package-idand--registry-package-idflags with defaults fromdeployments/usdcx-dars/manifest.json;docker-bootstrap.shrequires no changesTest plan
docker compose upand verify bootstrap completes without errorscripts/testing/find-transfer-rule.goagainst local devnet and confirmTransferRuleis visibleTransferOffercontract appears on the ledger (vialist-all-contracts.go)Closes #258