/awesome-ton-smart-contracts

💎 A collection of awesome tools, docs and guides for developing smart contracts for the TON blockchain

awesome-ton-smart-contracts

list of links to articles and tools which can help you to start developing smart-contracts for TON blockchain

FAQ

What is smart-contract?

Self executing program hosted at blockchain. For example in the TON blockchain every wallet is smart-contract. Smart-contract have state and persistent storage, which can contain any sort of variables. Smart-contract can store data, move funds to other smart-contracts, compute something.

How to start using or developing smart-contracts?

To begin with, you must pay attention to two existing programming languages related to developing smart contracts in TON: FunC and Fift. FunC is used to write the logic of contracts, it is compiled to fift-asm code, which can then be translated to bytecode for TVM. The functionality of Fift is very wide. To begin with, fift-asm is an Asm.fif program that allows you to translate asm-like(fift-asm) code into byte code for TVM. We also use Fift to automatically test and write queries to smart contracts.

You can get the binaries of the FunC compiler and the Fift interpreter by building code from newton-blockchain/ton repo.

You can use toncli to easily and conveniently develop smart contracts using FunC and Fift, especially useful if you are a beginner. The tonweb library is available for writing web interfaces. The official documentation can also help you a lot.

Chats:

About fift and func which are used to develop smart contracts:

  1. Fift official docs
  2. FunC official docs
  3. Fift instructions in C++

About TL-B

TL-B (Type Language - Binary) serves to describe the type system, constructors, and existing functions. For example we can use TL-B schemes to build binary structures associated with the TON blockchain. Special TL-B parsers can read schemes to deserialize binary data into different objects. (definition from the documentation)

  1. Documentation with examples
  2. Some about TL-B are described in tvm.pdf

Smart contracts examples:

  1. Official smart contracts (wallets, givers, etc.)
  2. https://github.com/ton-blockchain/wallet-contract
  3. Telegram contests, a lot of different smart contracts
    1. https://contest.com/blockchain
    2. https://contest.com/blockchain-2 & https://contest.com/blockchain-2-bonus
  4. Gambling smart contract
  5. Auction smart contract
  6. Smart contract with text sending
  7. Example of simple token contract
  8. Official draft fungible, non-fungible token contracts
  9. Wallet v4 contract (Supports external plugins installation)
  10. TRC-20 (like ERC-20) token contract
  11. Examples of using fift runvm to run transactions

Articles about smartcontracts:

  1. Official guidelines - https://ton.org/docs/#/howto/smart-contract-guidelines
  2. Develop, deploy and use lottery smart contract - https://habr.com/ru/post/494528/
  3. Extend wallet smart contract and deploy it - https://telegra.ph/Hello-World-TON-smart-contract-for-15-minutes-11-20

Deploy smart contract:

  1. Smart contract deployer by t.me/ProjectManageRR
  2. TON CLI by t.me/disintar
  3. Documented generate.fif by t.me/disintar
  4. Lite-client installation guide. Via lite-client you can send .boc file to deploy smart contract to blockchain

IDE plugins and syntax highlighting

  1. Intellij Platform plugin
  2. neovim FunC syntax highlighting
  3. Visual Studio Code fift syntax highlighting and FunC syntax highlighting