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★ 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.mdduring 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/elseifladders 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.mdreferences/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-v2paired withhttps://github.com/ton-blockchain/jetton-contract/tree/jetton-2.0nftpaired withhttps://github.com/ton-blockchain/nft-contractw5paired withhttps://github.com/ton-blockchain/wallet-contract-v5dnspaired withhttps://github.com/ton-blockchain/dns-contractmultisig-v2paired withhttps://github.com/ton-blockchain/multisig-contract-v2highload-v3paired withhttps://github.com/ton-blockchain/highload-wallet-contract-v3notcoinpaired withhttps://github.com/OpenBuilders/notcoin-contractconfigpaired withhttps://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/config-with-ownable-params.fcelectorpaired withhttps://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/elector-code.fc
counterinacton-contractshas 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 --helpand the official hosted docs
- Tolk idioms and conventions (docs-first style target):
https://docs.ton.org/languages/tolk/idioms-conventions
- Before running
acton ...,cdto the directory that containsActon.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
Eitherpayloads andMaybefields) - 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.tomlunder[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.tomland useacton build --graphto 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
Установить func2tolk в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic