Skip to content

Commit 4a6d0fb

Browse files
authored
feat: export missing utilities and enhance deployment tracking (#706)
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
1 parent d8eb386 commit 4a6d0fb

File tree

7 files changed

+72
-16
lines changed

7 files changed

+72
-16
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
"@hashgraph/asset-tokenization-contracts": minor
3+
---
4+
5+
feat: export missing utilities and enhance deployment tracking
6+
7+
Export missing infrastructure and domain utilities from scripts index:
8+
9+
- Export Hedera utilities (`fetchHederaContractId`, `getMirrorNodeUrl`, `isHederaNetwork`) for mirror node integration
10+
- Export deployment file utilities (`loadDeployment`, `findLatestDeployment`, `listDeploymentFiles`) for deployment management
11+
- Export verification utilities (`verifyContract`, `verifyContractCode`, `verifyContractInterface`) for post-deployment validation
12+
- Export selector utility (`getSelector`) for function selector generation
13+
- Export transparent proxy deployment operation (`deployTransparentProxy`)
14+
- Export bond token deployment from factory (`deployBondFromFactory`)
15+
16+
Enhance deployment workflows with better tracking:
17+
18+
- Add optional `existingBlrImplementation` parameter to track BLR implementation address when using existing BLR
19+
- Replace ambiguous `contractId` field with explicit `implementationContractId` and `proxyContractId` fields for proxied contracts (BLR, Factory)
20+
- Improve deployment documentation and upgrade history tracking
21+
- Better integration with Hedera tooling requiring explicit contract IDs
22+
23+
These changes improve the public API consistency and provide better deployment documentation for downstream consumers like GBP.

packages/ats/contracts/scripts/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export * from "./infrastructure/networkConfig";
4343
// Infrastructure operations
4444
export * from "./infrastructure/operations/deployContract";
4545
export * from "./infrastructure/operations/deployProxy";
46+
export * from "./infrastructure/operations/transparentProxyDeployment";
4647
export * from "./infrastructure/operations/upgradeProxy";
4748
export * from "./infrastructure/operations/registerFacets";
4849
export * from "./infrastructure/operations/registerAdditionalFacets";
@@ -55,9 +56,13 @@ export * from "./infrastructure/operations/generateRegistryPipeline";
5556

5657
// Infrastructure utilities
5758
export * from "./infrastructure/utils/validation";
59+
export * from "./infrastructure/utils/deploymentFiles";
60+
export * from "./infrastructure/utils/verification";
5861
export * from "./infrastructure/utils/transaction";
5962
export * from "./infrastructure/utils/logging";
6063
export * from "./infrastructure/utils/naming";
64+
export * from "./infrastructure/utils/hedera";
65+
export * from "./infrastructure/utils/selector";
6166
export * from "./infrastructure/utils/time";
6267

6368
// Infrastructure checkpoint system (deployment resumability)
@@ -112,6 +117,7 @@ export * from "./domain/factory/deploy";
112117

113118
// Token deployment from factory
114119
export * from "./domain/factory/deployEquityToken";
120+
export * from "./domain/factory/deployBondToken";
115121

116122
// ========================================
117123
// Workflows

packages/ats/contracts/scripts/infrastructure/checkpoint/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ export function checkpointToDeploymentOutput(checkpoint: DeploymentCheckpoint):
8282
},
8383
blr: {
8484
implementation: steps.blr.implementation,
85+
implementationContractId: steps.blr.implementationContractId,
8586
proxy: steps.blr.proxy,
86-
contractId: steps.blr.contractId,
87+
proxyContractId: steps.blr.proxyContractId,
8788
},
8889
factory: {
8990
implementation: steps.factory.implementation,
91+
implementationContractId: steps.factory.implementationContractId,
9092
proxy: steps.factory.proxy,
91-
contractId: steps.factory.contractId,
93+
proxyContractId: steps.factory.proxyContractId,
9294
},
9395
},
9496

packages/ats/contracts/scripts/infrastructure/types/checkpoint.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ export interface DeploymentCheckpoint {
114114
blr?: DeployedContract & {
115115
/** Implementation address */
116116
implementation: string;
117+
/** Hedera Contract ID for implementation (if deployed on Hedera network) */
118+
implementationContractId?: string;
117119
/** Proxy address */
118120
proxy: string;
121+
/** Hedera Contract ID for proxy (if deployed on Hedera network) */
122+
proxyContractId?: string;
119123
/** Whether BLR is external (existingBlr workflow) */
120124
isExternal?: boolean;
121125
};
@@ -141,8 +145,12 @@ export interface DeploymentCheckpoint {
141145
factory?: DeployedContract & {
142146
/** Implementation address */
143147
implementation: string;
148+
/** Hedera Contract ID for implementation (if deployed on Hedera network) */
149+
implementationContractId?: string;
144150
/** Proxy address */
145151
proxy: string;
152+
/** Hedera Contract ID for proxy (if deployed on Hedera network) */
153+
proxyContractId?: string;
146154
};
147155
};
148156

packages/ats/contracts/scripts/workflows/deploySystemWithExistingBlr.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ export interface DeploymentWithExistingBlrOutput {
6464
};
6565
blr: {
6666
implementation: string;
67+
implementationContractId?: string;
6768
proxy: string;
68-
contractId?: string;
69+
proxyContractId?: string;
6970
isExternal: true; // Marker to indicate BLR was not deployed here
7071
};
7172
factory: {
7273
implementation: string;
74+
implementationContractId?: string;
7375
proxy: string;
74-
contractId?: string;
76+
proxyContractId?: string;
7577
};
7678
};
7779

@@ -155,6 +157,9 @@ export interface DeploySystemWithExistingBlrOptions extends ResumeOptions {
155157

156158
/** Enable post-deployment bytecode verification (default: from network config) */
157159
verifyDeployment?: boolean;
160+
161+
/** Existing BLR implementation address (optional, for documentation) */
162+
existingBlrImplementation?: string;
158163
}
159164

160165
/**
@@ -351,7 +356,7 @@ export async function deploySystemWithExistingBlr(
351356
if (!checkpoint.steps.blr) {
352357
checkpoint.steps.blr = {
353358
address: blrAddress,
354-
implementation: "N/A (External BLR)",
359+
implementation: options.existingBlrImplementation || "N/A (External BLR)",
355360
proxy: blrAddress,
356361
txHash: "",
357362
deployedAt: new Date().toISOString(),
@@ -707,16 +712,20 @@ export async function deploySystemWithExistingBlr(
707712
contractId: await getContractId(proxyAdmin.address),
708713
},
709714
blr: {
710-
implementation: "N/A (External BLR)",
715+
implementation: options.existingBlrImplementation || "N/A (External BLR)",
716+
implementationContractId: options.existingBlrImplementation
717+
? await getContractId(options.existingBlrImplementation)
718+
: undefined,
711719
proxy: blrAddress,
712-
contractId: await getContractId(blrAddress),
720+
proxyContractId: await getContractId(blrAddress),
713721
isExternal: true,
714722
},
715723
factory: factoryResult
716724
? {
717725
implementation: factoryResult.implementationAddress,
726+
implementationContractId: await getContractId(factoryResult.implementationAddress),
718727
proxy: factoryResult.factoryAddress,
719-
contractId: await getContractId(factoryResult.factoryAddress),
728+
proxyContractId: await getContractId(factoryResult.factoryAddress),
720729
}
721730
: {
722731
implementation: "N/A (Not deployed)",

packages/ats/contracts/scripts/workflows/deploySystemWithNewBlr.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ export interface DeploymentOutput {
6666
};
6767
blr: {
6868
implementation: string;
69+
implementationContractId?: string;
6970
proxy: string;
70-
contractId?: string;
71+
proxyContractId?: string;
7172
};
7273
factory: {
7374
implementation: string;
75+
implementationContractId?: string;
7476
proxy: string;
75-
contractId?: string;
77+
proxyContractId?: string;
7678
};
7779
};
7880

@@ -681,13 +683,15 @@ export async function deploySystemWithNewBlr(
681683
},
682684
blr: {
683685
implementation: blrResult.implementationAddress,
686+
implementationContractId: await getContractId(blrResult.implementationAddress),
684687
proxy: blrResult.blrAddress,
685-
contractId: await getContractId(blrResult.blrAddress),
688+
proxyContractId: await getContractId(blrResult.blrAddress),
686689
},
687690
factory: {
688691
implementation: factoryResult.implementationAddress,
692+
implementationContractId: await getContractId(factoryResult.implementationAddress),
689693
proxy: factoryResult.factoryAddress,
690-
contractId: await getContractId(factoryResult.factoryAddress),
694+
proxyContractId: await getContractId(factoryResult.factoryAddress),
691695
},
692696
},
693697

packages/ats/contracts/test/scripts/unit/checkpoint/utils.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ describe("Checkpoint Utilities", () => {
3333
blr: {
3434
address: "0x2222222222222222222222222222222222222222",
3535
implementation: "0x2222222222222222222222222222222222222221",
36+
implementationContractId: "0.0.2221",
3637
proxy: "0x2222222222222222222222222222222222222222",
37-
contractId: "0.0.2222",
38+
proxyContractId: "0.0.2222",
3839
txHash: "0xdef456",
3940
deployedAt: "2025-11-08T10:02:00.000Z",
4041
},
@@ -78,8 +79,9 @@ describe("Checkpoint Utilities", () => {
7879
factory: {
7980
address: "0x5555555555555555555555555555555555555555",
8081
implementation: "0x5555555555555555555555555555555555555554",
82+
implementationContractId: "0.0.5554",
8183
proxy: "0x5555555555555555555555555555555555555555",
82-
contractId: "0.0.5555",
84+
proxyContractId: "0.0.5555",
8385
txHash: "0xstu901",
8486
gasUsed: "800000",
8587
deployedAt: "2025-11-08T10:14:00.000Z",
@@ -99,12 +101,14 @@ describe("Checkpoint Utilities", () => {
99101
expect(output.infrastructure.proxyAdmin.contractId).to.equal("0.0.1111");
100102

101103
expect(output.infrastructure.blr.implementation).to.equal("0x2222222222222222222222222222222222222221");
104+
expect(output.infrastructure.blr.implementationContractId).to.equal("0.0.2221");
102105
expect(output.infrastructure.blr.proxy).to.equal("0x2222222222222222222222222222222222222222");
103-
expect(output.infrastructure.blr.contractId).to.equal("0.0.2222");
106+
expect(output.infrastructure.blr.proxyContractId).to.equal("0.0.2222");
104107

105108
expect(output.infrastructure.factory.implementation).to.equal("0x5555555555555555555555555555555555555554");
109+
expect(output.infrastructure.factory.implementationContractId).to.equal("0.0.5554");
106110
expect(output.infrastructure.factory.proxy).to.equal("0x5555555555555555555555555555555555555555");
107-
expect(output.infrastructure.factory.contractId).to.equal("0.0.5555");
111+
expect(output.infrastructure.factory.proxyContractId).to.equal("0.0.5555");
108112

109113
// Facets
110114
expect(output.facets).to.have.lengthOf(2);

0 commit comments

Comments
 (0)