Skip to content

Commit 6746cc1

Browse files
committed
update script
1 parent bfb0834 commit 6746cc1

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

contract_manager/scripts/upgrade_ton_contract.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { hideBin } from "yargs/helpers";
33
import { DefaultStore, loadHotWallet } from "../src";
44
import { TonChain } from "../src/chains";
55
import { CHAINS, toChainName } from "@pythnetwork/xc-admin-common";
6-
import { compile } from "@ton/blueprint";
6+
import fs from "fs";
7+
import path from "path";
78

89
const parser = yargs(hideBin(process.argv))
910
.usage(
@@ -60,15 +61,17 @@ async function main() {
6061
`Upgrading contract on TON ${argv.network} (Chain ID: ${chainId}, Wormhole Chain Name: ${wormholeChainName})`
6162
);
6263

63-
console.log("Compiling new contract code...");
64-
const newCode = await compile("Main");
65-
const newCodeHash = newCode.hash();
66-
console.log("New code hash:", newCodeHash.toString("hex"));
64+
// Read the compiled contract from the build directory
65+
const compiledPath = path.resolve(
66+
__dirname,
67+
"../../target_chains/ton/contracts/build/Main.compiled.json"
68+
);
69+
const compiled = JSON.parse(fs.readFileSync(compiledPath, "utf8"));
70+
const newCodeHash = compiled.hash;
71+
console.log("New code hash:", newCodeHash);
6772

6873
// Generate governance payload for the upgrade
69-
const payload = chain.generateGovernanceUpgradePayload(
70-
newCodeHash.toString("hex")
71-
);
74+
const payload = chain.generateGovernanceUpgradePayload(newCodeHash);
7275
console.log("Generated governance payload");
7376
console.log("Payload:", payload);
7477

contract_manager/wrappers/Main.compile.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)