Search code examples
solidityeverscale

How DeBots recognize a value for external message


Please help me understand how DeBot understands which value to attach to an external message. In my Debot contract, I have an interface:

interface SafeAccount {
   function sendTransaction(address dest, uint128 value, bool bounce, uint8 flags, TvmCell payload) external;
}

Later, I call this method by sending an outbound external message:

SafeAccount(uAccount).sendTransaction{
            abiVer: 2,
            extMsg: true,
            sign: true,
            pubkey: pubkey,
            time: uint64(now),
            expire: 0,
            callbackId: 0,
            onErrorId: 0
        }(destAddress, INITIAL_BALANCE, false, 3, empty);
    }

The destination contract does not have this method and doesn't have a fallback function. Still, it somehow understands that it needs to send the value equal to the initial balance variable.

What is even more interesting, it ignores the extMsg: true and sends the internal message.

Why does it happen?


Solution

  • Initially DeBots send external messages, but if you send an external message to your account aka wallet, most likely it supports sendTransaction (as one of the contracts derived from SafeMultisigWallet), thus this external message will urge this contract to send an internal message with the parameters you provide.