Skip to content

Commit 6f9812a

Browse files
fadeevhernan-clich
andauthored
fix: add TON to contract registry to fix init process (#246)
Co-authored-by: Hernan Clich <[email protected]>
1 parent 5cb9a32 commit 6f9812a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/chains/ton/node.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ async function startContainer(dockerImage: string): Promise<Container> {
4242
},
4343
HostConfig: {
4444
AutoRemove: true,
45-
NetworkMode: "host",
45+
PortBindings: {
46+
[`${cfg.PORT_SIDECAR}/tcp`]: [{ HostPort: `${cfg.PORT_SIDECAR}` }],
47+
[`${cfg.PORT_RPC}/tcp`]: [{ HostPort: `${cfg.PORT_RPC}` }],
48+
},
4649
},
4750
Image: dockerImage,
4851
name: cfg.CONTAINER_NAME,

src/chains/ton/setup.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { GatewayOp } from "@zetachain/protocol-contracts-ton/dist/types";
44
import { Gateway } from "@zetachain/protocol-contracts-ton/dist/wrappers/Gateway";
55
import { ethers, NonceManager } from "ethers";
66

7+
import { NetworkID } from "../../constants";
78
import { logger } from "../../logger";
9+
import { registerContracts } from "../../utils";
810
import { zetachainDeposit } from "../zetachain/deposit";
911
import { zetachainDepositAndCall } from "../zetachain/depositAndCall";
1012
import { zetachainExecute } from "../zetachain/execute";
@@ -126,6 +128,25 @@ async function setupThrowable(opts: SetupOptions) {
126128
env,
127129
};
128130

131+
const changeChainStatus =
132+
await opts.zetachainContracts.coreRegistry.changeChainStatus(
133+
BigInt(NetworkID.TON),
134+
ethers.ZeroAddress,
135+
"0x",
136+
true,
137+
{
138+
gasLimit: 1_000_000,
139+
}
140+
);
141+
142+
await changeChainStatus.wait();
143+
144+
await registerContracts(opts.zetachainContracts.coreRegistry, NetworkID.TON, {
145+
gateway: ethers.hexlify(
146+
ethers.toUtf8Bytes(`${gateway.address.toRawString()}`)
147+
),
148+
});
149+
129150
log.info("TON setup complete");
130151
return result;
131152
}

0 commit comments

Comments
 (0)