👋
github.com/GusarichReputation
Badges 6
Editor Eureka! Newbie 2 × Reporter Enthusiast Nice ProfileThat hapepns because of the operation priorities. It executes | at first, and then ==. Add brackets to change it.
There may be several ways to implement such logic.
If each subscriber has his own smart contact, you can simply save a list of his subscriptions in the data of this contract. But note that in this case, as the number of subscriptions becomes bigger, all operations with them will become quite expensive.
Performing complex calculations on-chain can be expensive, so if there is
such an opportunity, it is better to move these calculations to the off-chain backend. Ideally, if complex calculations are performed off-chain, in a smart contract it is enough only to check the correctness of these calculations.
Any blockchain account can hold NFT items. The NFT item contract just stores the address of its owner in storage, and there are no restrictions on the owner contract.
NFT item source code:
There is no built-in sqrt()
function, but you can use the one from open-contracts
repository:
There is also a list of community libraries for FunC in documentation:
No. Metamask only works with EVM chains (like Ethereum or Polygon). And TON has completely different architecture and virtual machine called TVM.
Yes, you can make recursive calls in FunC. And it is basically the same as in other programming languages.
Simple example of recursive pow
function:
int pow (int num, int base) {
if (base == 0) {
return 1;
}
if (base % 2 == 1) {
return pow(num, base - 1) * num;
}
int sqr = pow(num, base / 2);
return sqr * sqr;
}
This is the network config, which contains several parameters (gas price, for example).
In most cases you will be fine with the default, because it's the same as the real one.
Read more about config in documentation:
You have declared some function which is already declared in toncli
libraries. List of these libraries is available in their sources on Github:
Usually it happens when you redeclare some function from stdlib.func
or math.func
PUSHINT
is TVM-asm instruction and required for assembling the smart contract. Analogue from Fift is just writing number 1
or any other that you want.
Using TVM opcodes outside of smart contract is not possible.
Metamask currently can only work with EVM chains (ethereum, bsc, polygon...). TON is not on EVM, so you can't use it in Metamask.
There is an extension for FunC and Fift languages that are used in TON.
toncli
is just a tool used to develop on TON, you can run it in any terminal (including the VS Code integrated one).
You've made a mistake in the target name. It's RLDP and not ADNL proxy.
Correct command:cmake --build . --target rldp-http-proxy
There is an easy-to-use docker container for TON Proxy:
https://github.com/kdimentionaltree/ton-proxy-docker
You can run TON Proxy on your server in a few simple steps below if you already have some website running on port 80.
git clone https://github.com/kdimentionaltree/ton-proxy-docker.git
cd ton-proxy-docker
docker-compose build
./init.sh
docker-compose up -d
Also note that on 4th step you will get some output in terminal that is important. You will se...
You can save transaction hash before sending it and then query Toncenter API method getTransactionByInMessageHash to check if transaction with such hash was confirmed or not
Example:
// Sleep function:
const sleep = ms => new Promise(r => setTimeout(r, ms))
// `msg` is a Cell containing your external message
// Convert message Cell to BOC String
const boc = await ...