Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

func2tolk

БесплатноБез исполняемых скриптовНе проверен

Port TON smart contracts from FunC (.fc/.func) to modern Tolk (.tolk) with Acton: use acton func2tolk when helpful, then refactor storage/messages/opcodes…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

func2tolk

Overview

Port a legacy FunC smart contract to Tolk while preserving:

  • TL-B layout (storage and message bodies)
  • opcode numbers and error codes
  • observable behavior (including bounce handling and send modes)

Prefer Acton as the development framework (build, wrappers, native Tolk tests, scripts, deploy, verify).

Use acton func2tolk as a first-pass converter when it accelerates the job, then treat the output as a draft to audit and refactor into idiomatic, testable Tolk.

For common mappings and gotchas, open references/porting-checklist.md. For public idiomatic examples and original FunC baselines, open references/repo-examples.md.

Non-negotiable rules (MUST follow)

These rules are mandatory for every FunC -> Tolk porting run.

  • MUST follow the idioms in this skill and in:
    • https://docs.ton.org/languages/tolk/idioms-conventions
  • MUST use typed message schemas + union dispatch (type Allowed... + lazy ...fromSlice(...) + match) for known opcode families.
  • MUST use structs for storage/message decoding instead of imperative field-by-field parsing in business logic.
  • MUST use typed maps (map<K, V>) and typed helpers in core logic; raw dict parsing is allowed only at boundaries and must be wrapped immediately.
  • MUST keep TL-B compatibility constraints explicit when deviating from idiomatic code (for example: UnsafeBodyNoRef, any_address?, legacy inline-body quirks).
  • MUST open and apply references/porting-checklist.md during the run.
  • MUST NOT end a porting run before completing the mandatory completion gate in this file.

Forbidden unless explicitly justified by compatibility:

  • manual opcode if/elseif ladders for messages that can be modeled as tagged structs + union + match
  • ad-hoc message parsing (load_uint/load_msg_addr/...) in domain logic where a typed struct is feasible
  • raw udict_* operations spread through core business branches instead of typed map helpers
  • finishing the run without a checklist-based self-audit

Portable references and example corpus

  • Skill references in this skill directory:
    • references/porting-checklist.md
    • references/repo-examples.md
  • Primary public style oracle:
    • https://github.com/ton-blockchain/acton-contracts
    • Each contract suite contains Acton/Tolk contracts, native tests, scripts, generated wrappers, benchmark snapshots where relevant, and a README linking to the original FunC implementation.
  • High-value Acton/Tolk suites to study:
    • jetton-v2 paired with https://github.com/ton-blockchain/jetton-contract/tree/jetton-2.0
    • nft paired with https://github.com/ton-blockchain/nft-contract
    • w5 paired with https://github.com/ton-blockchain/wallet-contract-v5
    • dns paired with https://github.com/ton-blockchain/dns-contract
    • multisig-v2 paired with https://github.com/ton-blockchain/multisig-contract-v2
    • highload-v3 paired with https://github.com/ton-blockchain/highload-wallet-contract-v3
    • notcoin paired with https://github.com/OpenBuilders/notcoin-contract
    • config paired with https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/config-with-ownable-params.fc
    • elector paired with https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/elector-code.fc
  • counter in acton-contracts has no original FunC counterpart; use it only for minimal Acton project mechanics.
  • Acton docs:
    • https://github.com/ton-blockchain/acton/tree/master/docs/content/docs
    • otherwise use acton --help and the official hosted docs
  • Tolk idioms and conventions (docs-first style target):
    • https://docs.ton.org/languages/tolk/idioms-conventions
  • Before running acton ..., cd to the directory that contains Acton.toml (Acton resolves contracts/config relative to it).

Porting workflow (Acton-first)

1) Identify the behavioral contract

  • Locate FunC entrypoints (recv_internal, recv_external, run_ticktock, getters) and list handled opcodes.
  • Extract invariants to preserve:
    • exact storage layout (bit widths, field order, presence/absence of refs)
    • message TL-B layout (including Either payloads and Maybe fields)
    • gas/reserve behavior and send modes
  • Treat existing JS/TS tests as the spec; translate them into native Tolk tests as you port.

2) Set up Acton project structure

  • Scaffold or reuse a project:
    • acton new PROJECT --template empty|counter|jetton
  • Define contracts in Acton.toml under [contracts.*].
  • Use [mappings] to avoid deep relative imports (mirror the @stdlib/... import style).
  • If the system is multi-contract (Jetton minter + wallet, collection + item, etc.), model dependencies in Acton.toml and use acton build --graph to sanity-check the dependency DAG.

3) Translate storage and TL-B types first

  • Split types into files importable by tests/wrappers (avoid putting message/storage structs inside the contract entrypoint file):
    • errors.tolk — error codes
Полный SKILL.md на GitHub

Установить func2tolk в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

SOURCE.mdTRUST.auto.yamlagents/openai.yamlreferences/porting-checklist.mdreferences/repo-examples.md

FAQ

Что делает скилл func2tolk?

Port TON smart contracts from FunC (.fc/.func) to modern Tolk (.tolk) with Acton: use acton func2tolk when helpful, then refactor storage/messages/opcodes into typed structs and serialization, implement Acton-style entrypoints, generate wrappers, migrate JS/TS tests to native Tolk tests, and use acton build/test/script/verify/disasm to preserve TL-B compatibility and behavior. Use when asked to convert, port, or modernize FunC contracts into idiomatic Tolk.

Как установить скилл func2tolk?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл func2tolk запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить func2tolk с