Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How do you hardcode an address in FunC ?

How do you hardcode an address in a smart contract? An example in both FunC would be helpful.

https://t.me/tondev_eng/4099

Votes Newest

Answers 2


The contract address is a hash of the code's **stateInit**.

If you change the initial storage of the contract, you are changing the future address of the contract. However, the future contract address is deterministic (known before you deploy), so you can pass the address to the storage, as part of the initializations of the contract.

For example, the Tact language down below shows how I can create a stateInit code to get Smart Contract address:

contract Example {
    any_int: Int;

    init() {
        self.any_int = 0;
    }

    receive("A") {
        let contractInit: StateInit = initOf TargetContract(self.any_int, 666);
        send(SendParameters{
            to: contractAddress(contractInit),
            value: 0,
            mode: 0 + 64 + 128,
            bounce: false
        });
    }
}

contract TargetContract {
    counter: Int;
    balance: Int;

    init(input_counter: Int, input_balance: Int){
        self.counter = input_counter;
        self.balance = input_balance;
    }

    receive(){
        // empty, means do nothing when receive empty body message.
    }
}

As you can see, we can change the parameters that the second contract needs to predetermine the contract address since we got the stateInit code.

-1
-1
wiki
Posted one year ago
Edited one year ago

In FunC you can use string literals with a tag. For example: "Ef8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM0vF"a

More info: https://ton.org/docs/develop/func/literals_identifiers#string-literals

2
2
Posted one year ago