Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

Commit 4be79e3

Browse files
authored
Merge pull request #128 from aibtcdev/fix/update-contract-templates
Update contract templates
2 parents 9d19dbb + feb7e6d commit 4be79e3

86 files changed

Lines changed: 5063 additions & 1976 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/aibtc-dao/deploy-dao.ts

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import { validateStacksAddress } from "@stacks/transactions";
44
import {
55
DeployedContractRegistryEntry,
66
GeneratedContractRegistryEntry,
7-
} from "./services/dao-contract-registry";
7+
validateContractDeploymentOrder,
8+
} from "./registries/dao-contract-registry";
89
import { DaoContractGenerator } from "./services/dao-contract-generator";
910
import { DaoContractDeployer } from "./services/dao-contract-deployer";
10-
import { ExpectedContractGeneratorArgs } from "./types/dao-types";
11+
import {
12+
ContractCopyConfig,
13+
ExpectedContractGeneratorArgs,
14+
} from "./types/dao-types";
1115
import {
1216
aibtcCoreRequestBody,
1317
CONFIG,
@@ -106,7 +110,28 @@ async function main(): Promise<ToolResponse<DeployedContractRegistryEntry[]>> {
106110

107111
// Step 1 - generate dao-related contracts
108112

109-
// generate dao contracts
113+
// Define which contracts need multiple copies
114+
/* removing temporarily while we troubleshoot action config
115+
const contractCopies: ContractCopyConfig[] = [
116+
{
117+
type: "EXTENSIONS",
118+
subtype: "TIMED_VAULT_DAO",
119+
count: 5,
120+
},
121+
{
122+
type: "EXTENSIONS",
123+
subtype: "TIMED_VAULT_SBTC",
124+
count: 5,
125+
},
126+
{
127+
type: "EXTENSIONS",
128+
subtype: "TIMED_VAULT_STX",
129+
count: 5,
130+
},
131+
];
132+
*/
133+
134+
// generate dao contracts with multiple copies
110135
const daoContracts = contractGenerator.generateContracts(args);
111136
generatedContracts.push(...Object.values(daoContracts));
112137

@@ -163,7 +188,26 @@ async function main(): Promise<ToolResponse<DeployedContractRegistryEntry[]>> {
163188
});
164189
}
165190

166-
// Step 4 - deploy contracts
191+
// Step 4 - validate and deploy contracts
192+
193+
// Validate deployment order
194+
const isValidDeploymentOrder = validateContractDeploymentOrder();
195+
if (!isValidDeploymentOrder) {
196+
throw new Error("Invalid contract deployment order detected");
197+
}
198+
199+
// Sort contracts by deployment order for logging
200+
const sortedContracts = [...generatedContracts].sort(
201+
(a, b) => a.deploymentOrder - b.deploymentOrder
202+
);
203+
204+
// Log deployment order for debugging
205+
console.log("Deployment order:");
206+
sortedContracts.forEach((contract, index) => {
207+
console.log(
208+
`${index + 1}. ${contract.name} (${contract.type}/${contract.subtype})`
209+
);
210+
});
167211

168212
//console.log(`Deploying ${generatedContracts.length} contracts...`);
169213
//console.log(`- address: ${address}`);

src/aibtc-dao/extensions/core-proposals/deploy-core-proposal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import { getContractName } from "../../services/dao-contract-registry";
4-
import { DeployedCoreProposalRegistryEntry } from "../../services/dao-core-proposal-registry";
3+
import { getContractName } from "../../registries/dao-contract-registry";
4+
import { DeployedCoreProposalRegistryEntry } from "../../registries/dao-core-proposal-registry";
55
import { DaoCoreProposalGenerator } from "../../services/dao-core-proposal-generator";
66
import { DaoCoreProposalDeployer } from "../../services/dao-core-proposal-deployer";
77
import {

src/aibtc-dao/extensions/core-proposals/generate-all-core-proposals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import { GeneratedCoreProposalRegistryEntry } from "../../services/dao-core-proposal-registry";
3+
import { GeneratedCoreProposalRegistryEntry } from "../../registries/dao-core-proposal-registry";
44
import { DaoCoreProposalGenerator } from "../../services/dao-core-proposal-generator";
55
import {
66
CONFIG,

src/aibtc-dao/extensions/core-proposals/generate-core-proposal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import { GeneratedCoreProposalRegistryEntry } from "../../services/dao-core-proposal-registry";
3+
import { GeneratedCoreProposalRegistryEntry } from "../../registries/dao-core-proposal-registry";
44
import { DaoCoreProposalGenerator } from "../../services/dao-core-proposal-generator";
55
import {
66
CONFIG,

src/aibtc-dao/generate-dao.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import * as fs from "fs";
22
import * as path from "path";
33
import { validateStacksAddress } from "@stacks/transactions";
44
import { DaoContractGenerator } from "./services/dao-contract-generator";
5-
import { GeneratedContractRegistryEntry } from "./services/dao-contract-registry";
6-
import { ExpectedContractGeneratorArgs } from "./types/dao-types";
5+
import { GeneratedContractRegistryEntry } from "./registries/dao-contract-registry";
6+
import {
7+
ContractCopyConfig,
8+
ExpectedContractGeneratorArgs,
9+
} from "./types/dao-types";
710
import {
811
CONFIG,
912
convertStringToBoolean,
@@ -100,6 +103,27 @@ async function main(): Promise<ToolResponse<GeneratedContractRegistryEntry[]>> {
100103

101104
// Step 1 - generate dao contracts
102105

106+
// Define which contracts need multiple copies
107+
/* removing temporarily while we troubleshoot action config
108+
const contractCopies: ContractCopyConfig[] = [
109+
{
110+
type: "EXTENSIONS",
111+
subtype: "TIMED_VAULT_DAO",
112+
count: 5,
113+
},
114+
{
115+
type: "EXTENSIONS",
116+
subtype: "TIMED_VAULT_SBTC",
117+
count: 5,
118+
},
119+
{
120+
type: "EXTENSIONS",
121+
subtype: "TIMED_VAULT_STX",
122+
count: 5,
123+
},
124+
];
125+
*/
126+
103127
const daoContracts = contractGenerator.generateContracts(args);
104128
generatedContracts.push(...Object.values(daoContracts));
105129

0 commit comments

Comments
 (0)