Key differences
Fift executes at compile-time - when your compiler builds the smart contract code BOC after processing FunC code. Fift can appear in different forms:-
TVM opcode definitions in
Asm.fif
: -
wallet_v3_r2.fif
:
Smart contract usage
(Fift) Including large BoCs in contracts
When usingtoncli
, you can include large BoCs by:
- Editing
project.yaml
to includefift/blob.fif
:
-
Adding the BoC to
fift/blob.boc
-
Including this code in
fift/blob.fif
:
(TVM assembly) Converting integers to strings
Fift primitives can’t convert integers to strings at runtime because Fift operates at compile-time. For runtime conversion, use TVM assembly like this solution from TON Smart Challenge 3:(TVM assembly) Efficient modulo multiplication
Compare these implementations:x{A988}
opcode implements an optimized division operation with built-in multiplication (as specified in section 5.2 Division). This specialized instruction directly computes just the modulo remainder of the operation, skipping unnecessary computation steps. The s,
suffix then handles the result storage - it takes the resulting slice from the stack’s top and efficiently writes it into the target builder. Together, this combination delivers substantial gas savings compared to conventional approaches.