Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
a0650a5
Setup env
krebernisak Sep 25, 2025
2e0bf81
Add TON domain - add configurer
krebernisak Sep 25, 2025
5348276
Encode SetConfig message
krebernisak Sep 25, 2025
2e43396
Add ton.ConfigTransformer
krebernisak Sep 25, 2025
53b4555
Implement transformer.ToConfig
krebernisak Sep 25, 2025
f812413
Add sdk/ton/encoder.go
krebernisak Sep 26, 2025
5c0d4b5
Add TON Encoder.HashMetadata
krebernisak Sep 26, 2025
0b765a3
Add sdk/ton/inspector.go
krebernisak Sep 26, 2025
eba6aa4
Add sdk.Inspector#GetRootMetadata
krebernisak Sep 26, 2025
80b0d14
Add sdk/ton/timelock_inspector.go
krebernisak Sep 28, 2025
8c376a5
Add sdk/ton/transaction.go
krebernisak Sep 28, 2025
54494cb
Add sdk/ton/timelock_executor.go
krebernisak Oct 22, 2025
0fa9951
Add sdk/ton/timelock_converter.go
krebernisak Oct 22, 2025
249014d
Add sdk/ton/executor.go
krebernisak Oct 22, 2025
b055bb3
Add signature and proof encoders
krebernisak Oct 22, 2025
863fb58
Update signatures and proof encoders type
krebernisak Oct 22, 2025
1ddf8b2
Add sdk/ton/decoder.go
krebernisak Oct 28, 2025
f10695d
Bump github.com/smartcontractkit/chainlink-ton
krebernisak Oct 29, 2025
49e2dec
Add cselectors.FamilyTon as option
krebernisak Oct 29, 2025
76ce95d
Add changesets and test entrypoints
krebernisak Oct 29, 2025
f9c2968
Add TON e2e setup + TimelockInspectionTestSuite stub (evm)
krebernisak Oct 29, 2025
0ae93df
Add Configurer option to not send transactions (NONEVM-2862) - TON
krebernisak Oct 29, 2025
2f167c8
Add sdk/ton/decoded_operation_test.go
krebernisak Oct 29, 2025
617570f
Add sdk/ton/decoder_test.go
krebernisak Oct 29, 2025
47b88d7
Add sdk/ton/encoder_test.go
krebernisak Oct 30, 2025
3acbf48
Add sdk/ton/config_transformer_test.go
krebernisak Oct 31, 2025
a052762
Add sdk/ton/timelock_converter_test.go
krebernisak Nov 1, 2025
2f20de1
Configure mockery v2
krebernisak Nov 2, 2025
a69d337
Bump chainlink-ton
krebernisak Nov 2, 2025
cb64cf7
Add wallet.TonAPI mock
krebernisak Nov 2, 2025
aa406d8
Add sdk/ton/configurer_test.go
krebernisak Nov 2, 2025
ddb7d0a
Add sdk/ton/executor_test.go
krebernisak Nov 3, 2025
1a16ac5
Add sdk/ton/timelock_executor_test.go
krebernisak Nov 3, 2025
5791987
Add timelock inspector getRoleMembers helper func
krebernisak Nov 3, 2025
93dd466
Add sdk/ton/timelock_inspector_test.go
krebernisak Nov 3, 2025
0625454
Add sdk/ton/timelock_inspector_test.go
krebernisak Nov 4, 2025
765c29c
Reuse common signing test with EVM
krebernisak Nov 7, 2025
27336cc
Apply PR feedback
krebernisak Nov 7, 2025
acc4b71
Add e2e/tests/ton/set_config.go
krebernisak Nov 7, 2025
61b8565
Load MCMS (chainlink-ton) contracts
krebernisak Nov 7, 2025
141b14b
Implement e2e/tests/ton/set_config.go
krebernisak Nov 9, 2025
dd3be7f
Import code from chainlink-ton
krebernisak Nov 9, 2025
f42f10d
Update upstream deps
krebernisak Nov 24, 2025
44fc00a
Fix unit tests
krebernisak Nov 24, 2025
a3e876d
Fix e2e test
krebernisak Nov 24, 2025
28fe4ed
Remove unused deployerKey from tests
krebernisak Nov 24, 2025
fb6f215
Add SignerKeys slice of keys to types.Config + remap func
krebernisak Nov 25, 2025
aa51d15
Revert "Add SignerKeys slice of keys to types.Config + remap func"
krebernisak Nov 27, 2025
2f2bfb1
Fix after commit revert
krebernisak Nov 27, 2025
04e3d00
Refactor TON signers as EVM addr
krebernisak Nov 27, 2025
d452c8f
Add e2e/tests/ton/set_root.go (wip)
krebernisak Nov 27, 2025
f10e79c
Implement e2e/tests/ton/timelock_inspection.go (wip)
krebernisak Nov 28, 2025
d7a0acd
Add tracetracking.WaitForTrace and fix tests
krebernisak Dec 1, 2025
3e07aea
Add 'Build TON contracts' step to CI e2e tests
krebernisak Dec 1, 2025
dbacc46
Add e2e/tests/ton/inspection.go (wip)
krebernisak Dec 1, 2025
4c2c5f4
Fix setConfig payload/test
krebernisak Dec 1, 2025
fcce744
PR feedback
krebernisak Dec 2, 2025
aa14ea9
Remove replace github.com/fbsobreira/gotron-sdk
krebernisak Dec 2, 2025
59352e1
Extract common deploy functionality
krebernisak Dec 2, 2025
b903db7
Update smartcontractkit/.github/actions/ci-lint-go to 3.1.0
krebernisak Dec 2, 2025
418497f
Fix lint errors (wip)
krebernisak Dec 2, 2025
d68f67d
Fix lint errors #2 (wip)
krebernisak Dec 2, 2025
a16cc1a
Fix lint errors #3 - renaming (wip)
krebernisak Dec 2, 2025
e22a430
Fix lint errors #4 (wip)
krebernisak Dec 2, 2025
1eb28a9
Fix lint errors #5 (wip)
krebernisak Dec 2, 2025
d758d67
Fix lint errors #6 (wip)
krebernisak Dec 2, 2025
814fb09
Fix lint errors #7 (wip)
krebernisak Dec 2, 2025
89c8628
Fix lint errors #8 (wip)
krebernisak Dec 2, 2025
ab16668
Fix lint errors #9 (wip)
krebernisak Dec 2, 2025
c6437a3
Fix lint errors #10 (wip)
krebernisak Dec 2, 2025
cd422ae
Fix lint errors #11 (wip)
krebernisak Dec 2, 2025
8b62ddf
Fix lint errors #12 (wip)
krebernisak Dec 2, 2025
f55d98e
Fix lint errors #13 (wip)
krebernisak Dec 2, 2025
c176424
Fix lint errors #14 (wip)
krebernisak Dec 2, 2025
434aa2a
Fix lint errors #16 (wip)
krebernisak Dec 2, 2025
b8ce18d
Fix lint errors #20 (wip)
krebernisak Dec 2, 2025
e43e6ae
Fix lint errors #21 (wip)
krebernisak Dec 2, 2025
9a29dd9
Fix lint errors #22 (wip)
krebernisak Dec 2, 2025
ef916a9
Fix lint errors #23 (wip)
krebernisak Dec 2, 2025
86d9c68
Fix lint errors #24 (wip)
krebernisak Dec 2, 2025
95f08a1
Fix lint errors #25 (wip)
krebernisak Dec 2, 2025
03da7af
Fix lint errors #26 (wip)
krebernisak Dec 2, 2025
5b4eaa2
Fix lint errors #27 (wip)
krebernisak Dec 2, 2025
b95c3fb
Fix lint errors #28 (wip)
krebernisak Dec 2, 2025
9a7bcb5
Fix lint errors #29 (wip)
krebernisak Dec 2, 2025
0b98838
Fix lint errors #30 (wip)
krebernisak Dec 2, 2025
334410a
Fix lint errors #32 (wip)
krebernisak Dec 3, 2025
c7388db
Fix lint errors #33 (wip)
krebernisak Dec 3, 2025
ff6eca9
Fix lint errors #34 (wip)
krebernisak Dec 3, 2025
e14f592
Add .golangci.yml settings.gomoddirectives.replace-allow-list gogo/pr…
krebernisak Dec 3, 2025
cf64fc9
Use .golangci.yml in CI
krebernisak Dec 3, 2025
66b394c
golangci-lint run --fix --config .golangci.yml
krebernisak Dec 3, 2025
f7e39b1
Fix lint errors #35 (wip)
krebernisak Dec 3, 2025
064e9ec
TODO(ton) annotation
krebernisak Dec 3, 2025
df81f28
fix import
huangzhen1997 Dec 8, 2025
6564ee8
Fix merge + reuse code
krebernisak Dec 9, 2025
c3b87b4
Fix TimelockCall min value
krebernisak Dec 9, 2025
57f5e4a
Fix import
krebernisak Dec 9, 2025
1a5b94f
Remove ConfigTransformer as inspector arg
krebernisak Dec 9, 2025
eaf5893
Apply feedback from Pablo
krebernisak Dec 9, 2025
76954b0
Fix EVM test - error check
krebernisak Dec 9, 2025
cb5e087
Add TestIsOperationDone
krebernisak Dec 10, 2025
2f389e8
Fix TestIsOperationDone
krebernisak Dec 10, 2025
f020b40
Update to chore/mcms-polish-4 upstream branch - fix EIP191 signing an…
krebernisak Dec 11, 2025
8a4a945
Add shim for GLOBAL_ID issue
krebernisak Dec 11, 2025
a557d56
Fix unit test
krebernisak Dec 11, 2025
cd2b98a
Rollback style/lint changes
krebernisak Dec 11, 2025
0cf152d
Fix flakes - addr cmp, uint160
krebernisak Dec 12, 2025
43afd26
Update to latest smartcontractkit/chainlink-ton
krebernisak Dec 12, 2025
6b85537
Bump to latest smartcontractkit/chainlink-ton
krebernisak Dec 12, 2025
9d704dd
Revert style/lint changes
krebernisak Dec 12, 2025
6cbe8ab
Import tvm.NewRandomTestWallet fn
krebernisak Dec 12, 2025
ab41663
Bump to latest smartcontractkit/chainlink-ton
krebernisak Dec 12, 2025
a237414
Bump to latest smartcontractkit/chainlink-ton (main)
krebernisak Dec 12, 2025
7bda361
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak Dec 12, 2025
1ff4769
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak Dec 12, 2025
ecb6d47
Cleanup TLBMap injection
krebernisak Dec 15, 2025
59c1463
Add configurer WithDoNotSendInstructionsOnChain test
krebernisak Dec 15, 2025
48b9ec3
Decoder - Handle message with no body - empty cell
krebernisak Dec 15, 2025
8bec36c
Cleanup sdk/ton/timelock_converter_test.go
krebernisak Dec 15, 2025
b29e88c
Add e2e/tests/ton/executable.go (wip)
krebernisak Dec 16, 2025
3809d28
Fix test
krebernisak Dec 16, 2025
090d1da
Fix lint
krebernisak Dec 16, 2025
4dd8e2e
Fix lint
krebernisak Dec 16, 2025
f256d77
Bump to latest, test TimelockInspector
krebernisak Dec 16, 2025
f67376e
Fix mcmston.NewTimelockConverter(mcmston.DefaultSendAmount)
krebernisak Dec 16, 2025
ff0d866
Fix lint
krebernisak Dec 16, 2025
b33df29
Docs
krebernisak Dec 16, 2025
c099684
Fix timelock test gas issue
krebernisak Dec 16, 2025
39ff3ce
Add GenSimpleTestConfig fn
krebernisak Dec 16, 2025
69b5aeb
Move underlying getters to chainlink-ton
krebernisak Dec 17, 2025
d1ac7c5
Add sdk/ton/transaction_test.go
krebernisak Dec 17, 2025
cad400e
Extract ParseAddrGetBlock(ctx, client, address) util
krebernisak Dec 17, 2025
dd38d3d
Bump to latest
krebernisak Dec 17, 2025
1f391af
Bump to latest, remove duplicated code
krebernisak Dec 17, 2025
e2419e1
Extract SendTx util fn
krebernisak Dec 17, 2025
2bd951f
Add coverage, fix deploy bug
krebernisak Dec 17, 2025
0d2f781
Bump to latest
krebernisak Dec 18, 2025
1455ab4
Update to latest chainlink-ton (generic-ops)
krebernisak Dec 29, 2025
bc1ed76
Split out Nix CI e2e setup (supports TON)
krebernisak Jan 13, 2026
31559b4
Update to latest chainlink-ton (generic-ops)
krebernisak Jan 13, 2026
0a9f731
Update neodix42/mylocalton-docker:v3.98
krebernisak Jan 15, 2026
655e2e9
Update to latest chainlink-ton (main)
krebernisak Jan 15, 2026
9a198e8
Bump github.com/ethereum/go-ethereum v1.16.8 - security release
krebernisak Jan 15, 2026
2623599
Polish
krebernisak Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/long-snakes-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smartcontractkit/mcms": minor
---

Add TON implementation and unit/e2e tests
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* @smartcontractkit/op-tooling

# Nix shell setup (supports TON e2e tests)
/.github/workflows/pull-request-main-nix.yml @smartcontractkit/ccip-ton
56 changes: 56 additions & 0 deletions .github/workflows/pull-request-main-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: pull-request-main-nix

on:
merge_group:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
ci-test-e2e:
name: Tests E2E - Nix setup
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Install Nix
uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Checkout code
uses: actions/checkout@v4

- name: Build TON contracts
id: ton-contracts-build
shell: bash
run: |
PATH_CONTRACTS_TON_PKG="$(nix build .#chainlink-ton-contracts --print-out-paths)/"
PATH_CONTRACTS_TON="$PATH_CONTRACTS_TON_PKG/lib/node_modules/@chainlink/contracts-ton/build/"
echo "path=$PATH_CONTRACTS_TON" >> "$GITHUB_OUTPUT"

- name: Run e2e tests
uses: smartcontractkit/.github/actions/ci-test-go@ci-test-go/1.0.0
with:
checkout-repo: false
use-go-cache: true
go-test-cmd: |
set +e

echo "::group::TON"
export PATH_CONTRACTS_TON="${{ steps.ton-contracts-build.outputs.path }}"
CTF_CONFIGS=../config.ton.toml go test -p=1 -tags=e2e -v ./e2e/tests/... -run=TestTONSuite || ton_failure=true
echo "::endgroup::"

[[ -n "${ton_failure}" ]] && echo "🚨 TON e2e tests failed."
[[ -n "${ton_failure}" ]] && {
exit 1
} || {
echo "Exiting"
exit 0
}
18 changes: 18 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ mockname: "{{.InterfaceName}}"
inpackage: false
outpkg: mocks
packages:
github.com/xssnick/tonutils-go/ton/wallet:
config:
all: false
outpkg: "mock_ton"
interfaces:
TonAPI:
config:
dir: "./sdk/ton/mocks"
filename: "wallet.go"
github.com/xssnick/tonutils-go/ton:
config:
all: false
outpkg: "mock_ton"
interfaces:
APIClientWrapped:
config:
dir: "./sdk/ton/mocks"
filename: "api.go"
github.com/smartcontractkit/mcms/sdk:
github.com/smartcontractkit/mcms/sdk/evm:
github.com/smartcontractkit/mcms/sdk/evm/bindings:
Expand Down
18 changes: 18 additions & 0 deletions e2e/config.ton.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[settings]
private_keys = [
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
]

[ton_config]
chain_id = "-217"
type = "ton"
image = "ghcr.io/neodix42/mylocalton-docker:v3.98"

[ton_config.out]
family = "ton"

[ton_config.custom_env]
NEXT_BLOCK_GENERATION_DELAY = "0.5"
VERSION_CAPABILITIES = "12"
3 changes: 1 addition & 2 deletions e2e/tests/aptos/set_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package aptos

import (
"slices"
"strings"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
Expand All @@ -30,7 +29,7 @@ func (a *TestSuite) TestSetConfig() {
signers[i] = crypto.PubkeyToAddress(key.PublicKey)
}
slices.SortFunc(signers[:], func(a, b common.Address) int {
return strings.Compare(strings.ToLower(a.Hex()), strings.ToLower(b.Hex()))
return a.Cmp(b)
})

bypasserConfig := &types.Config{
Expand Down
10 changes: 10 additions & 0 deletions e2e/tests/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
evme2e "github.com/smartcontractkit/mcms/e2e/tests/evm"
solanae2e "github.com/smartcontractkit/mcms/e2e/tests/solana"
suie2e "github.com/smartcontractkit/mcms/e2e/tests/sui"
tone2e "github.com/smartcontractkit/mcms/e2e/tests/ton"
)

func TestEVMSuite(t *testing.T) {
Expand Down Expand Up @@ -39,3 +40,12 @@ func TestSuiSuite(t *testing.T) {
suite.Run(t, new(suie2e.TimelockCancelProposalTestSuite))
suite.Run(t, new(suie2e.MCMSUserUpgradeTestSuite))
}

func TestTONSuite(t *testing.T) {
suite.Run(t, new(tone2e.SigningTestSuite))
suite.Run(t, new(tone2e.SetConfigTestSuite))
suite.Run(t, new(tone2e.SetRootTestSuite))
suite.Run(t, new(tone2e.InspectionTestSuite))
suite.Run(t, new(tone2e.ExecutionTestSuite))
suite.Run(t, new(tone2e.TimelockInspectionTestSuite))
}
32 changes: 32 additions & 0 deletions e2e/tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"github.com/gagliardetto/solana-go/rpc/ws"
"github.com/joho/godotenv"
"github.com/stretchr/testify/require"
"github.com/xssnick/tonutils-go/ton"

tonchain "github.com/smartcontractkit/chainlink-ton/pkg/ton/chain"

"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
Expand All @@ -39,6 +42,7 @@ type Config struct {
SolanaChain *blockchain.Input `toml:"solana_config"`
AptosChain *blockchain.Input `toml:"aptos_config"`
SuiChain *blockchain.Input `toml:"sui_config"`
TonChain *blockchain.Input `toml:"ton_config"`

Settings struct {
PrivateKeys []string `toml:"private_keys"`
Expand All @@ -57,6 +61,8 @@ type TestSetup struct {
AptosBlockchain *blockchain.Output
SuiClient sui.ISuiAPI
SuiBlockchain *blockchain.Output
TonClient *ton.APIClient
TonBlockchain *blockchain.Output
Config
}

Expand Down Expand Up @@ -203,6 +209,30 @@ func InitializeSharedTestSetup(t *testing.T) *TestSetup {
t.Logf("Initialized Sui RPC client @ %s", nodeURL)
}

var (
tonClient *ton.APIClient
tonBlockchainOutput *blockchain.Output
)
if in.TonChain != nil {
// Use blockchain network setup (fallback)
ports := freeport.GetN(t, 2)
port := ports[0]
faucetPort := ports[1]
in.TonChain.Port = strconv.Itoa(port)
in.TonChain.FaucetPort = strconv.Itoa(faucetPort)

tonBlockchainOutput, err = blockchain.NewBlockchainNetwork(in.TonChain)
require.NoError(t, err, "Failed to initialize TON blockchain")

nodeURL := tonBlockchainOutput.Nodes[0].ExternalHTTPUrl
pool, err := tonchain.CreateLiteserverConnectionPool(ctx, nodeURL)
require.NoError(t, err, "Failed to initialize TON client - failed to create liteserver connection pool")
tonClient = ton.NewAPIClient(pool, ton.ProofCheckPolicyFast)

// Test liveness, will also fetch ChainID
t.Logf("Initialized TON RPC client @ %s", nodeURL)
}

sharedSetup = &TestSetup{
ClientA: ethClientA,
ClientB: ethClientB,
Expand All @@ -213,6 +243,8 @@ func InitializeSharedTestSetup(t *testing.T) *TestSetup {
AptosBlockchain: aptosBlockchainOutput,
SuiClient: suiClient,
SuiBlockchain: suiBlockchainOutput,
TonClient: tonClient,
TonBlockchain: tonBlockchainOutput,
Config: *in,
}
})
Expand Down
3 changes: 1 addition & 2 deletions e2e/tests/sui/set_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package sui

import (
"slices"
"strings"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
Expand All @@ -26,7 +25,7 @@ func (s *TestSuite) TestSetConfig() {
signers[i] = crypto.PubkeyToAddress(key.PublicKey)
}
slices.SortFunc(signers[:], func(a, b common.Address) int {
return strings.Compare(strings.ToLower(a.Hex()), strings.ToLower(b.Hex()))
return a.Cmp(b)
})

bypasserConfig := &types.Config{
Expand Down
122 changes: 122 additions & 0 deletions e2e/tests/ton/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//go:build e2e

package tone2e

import (
"context"
"fmt"
"os"
"path/filepath"

"github.com/ethereum/go-ethereum/common"

"github.com/xssnick/tonutils-go/address"
"github.com/xssnick/tonutils-go/tlb"
"github.com/xssnick/tonutils-go/ton"
"github.com/xssnick/tonutils-go/ton/wallet"
"github.com/xssnick/tonutils-go/tvm/cell"

"github.com/smartcontractkit/chainlink-ton/pkg/bindings/mcms/mcms"
"github.com/smartcontractkit/chainlink-ton/pkg/bindings/mcms/timelock"
"github.com/smartcontractkit/chainlink-ton/pkg/ton/tracetracking"
"github.com/smartcontractkit/chainlink-ton/pkg/ton/wrappers"

"github.com/smartcontractkit/mcms/internal/testutils"
"github.com/smartcontractkit/mcms/types"
)

const (
EnvPathContracts = "PATH_CONTRACTS_TON"

PathContractsMCMS = "mcms.MCMS.compiled.json"
PathContractsTimelock = "mcms.RBACTimelock.compiled.json"
)

func must[E any](out E, err error) E {
if err != nil {
panic(err)
}

return out
}

type DeployOpts struct {
// Connection
Client *ton.APIClient
Wallet *wallet.Wallet

// Deployment info
ContractPath string

Amount tlb.Coins
Data any
Body any
}

func DeployContract(ctx context.Context, opts DeployOpts) (*address.Address, error) {
contractCode, err := wrappers.ParseCompiledContract(opts.ContractPath)
if err != nil {
return nil, fmt.Errorf("failed to parse compiled contract: %w", err)
}

contractData, ok := opts.Data.(*cell.Cell) // Cell or we try to decode
if !ok {
contractData, err = tlb.ToCell(opts.Data)
if err != nil {
return nil, fmt.Errorf("failed to create contract data cell: %w", err)
}
}

bodyCell, ok := opts.Body.(*cell.Cell) // Cell or we try to decode
if !ok {
bodyCell, err = tlb.ToCell(opts.Body)
if err != nil {
return nil, fmt.Errorf("failed to create contract body cell: %w", err)
}
}

_client := tracetracking.NewSignedAPIClient(opts.Client, *opts.Wallet)
contract, _, err := wrappers.Deploy(ctx, &_client, contractCode, contractData, opts.Amount, bodyCell)
if err != nil {
return nil, fmt.Errorf("failed to deploy contract: %w", err)
}

return contract.Address, nil
}

func DeployMCMSContract(ctx context.Context, client *ton.APIClient, w *wallet.Wallet, amount tlb.Coins, data mcms.Data) (*address.Address, error) {
return DeployContract(ctx, DeployOpts{
Client: client,
Wallet: w,
ContractPath: filepath.Join(os.Getenv(EnvPathContracts), PathContractsMCMS),
Amount: amount,
Data: data,
Body: cell.BeginCell().EndCell(), // empty cell, top up
})
}

func DeployTimelockContract(ctx context.Context, client *ton.APIClient, w *wallet.Wallet, amount tlb.Coins, data timelock.Data, body timelock.Init) (*address.Address, error) {
return DeployContract(ctx, DeployOpts{
Client: client,
Wallet: w,
ContractPath: filepath.Join(os.Getenv(EnvPathContracts), PathContractsTimelock),
Amount: amount,
Data: data,
Body: body,
})
}

// GenSimpleTestMCMSConfig generates a simple test configuration that's used in e2e tests.
func GenSimpleTestMCMSConfig(signers []testutils.ECDSASigner) *types.Config {
return &types.Config{
Quorum: 1,
Signers: []common.Address{signers[0].Address()},
GroupSigners: []types.Config{
{
Quorum: 1,
Signers: []common.Address{signers[1].Address()},
GroupSigners: []types.Config{},
},
},
}
}
Loading
Loading