blockchainfunctontac

Can I call a function to get data from other contract in smart contract with FunC in TON blockchain?



I have a question with TON blockchain
Suppose that, I have a smart contract, I want call a function of other smart contract to get data to continue process. How to do it in FunC:
() recv_internal(int msg_value, cell in_msg_full, slice in_msg_body) impure {
    if (in_msg_body.slice_empty?()) { ;; ignore empty messages
        return ();
    }

    slice cs = in_msg_full.begin_parse();
    int flags = cs~load_uint(4);

    if (flags & 1) { ;; ignore all bounced messages
        return ();
    }
    slice sender_address = cs~load_msg_addr();

    ;; TODO: call function of other contract to get data

Thank you!


Solution

  • Although this seems inconvenient, the answer is no: getters are not accessible from other contracts! So you have to either implement passing the data via messages or reconsider your architecture.

    Perhaps you should ask a more specific question if it's not a theoretical one.