blockchainsmartcontractstontact

TON smart contract. How do I get the current workchain using TACT?


As far as I know, there is a function workchain() in FunC that returns the current workchain. Is there any analogue in TACT for this?


Solution

  • I believe this is a misconception. workchain() is mentioned in some pieces of code in docs indeed (example) and even called a "function", but it is not present in stdlib.rc, and if you take a look at the jetton contracts, you'll find that what they use is in fact an old-fashion way to set a constant:

    int workchain() asm "0 PUSHINT";
    

    So yeah, bad news is – there's no such function, although you can implement it by yourself and hardcode return 0; there until it is introduced or you find a better implementation (note: currently, you'll be dealing only with BaseChain anyways).