How do I call another contracts’ function from within one contract?
Do I need to include/import the callee contract that I need to call from within a caller contract? If yes, how?
The following is a sample code:
contract Callee =
// has some state
// has an init function
stateful entrypoint calleeFunction(param1: int, param2: address) =
require(Call.caller == state.owner, "Only owner")
internal_function(param1: int, param2: address)
stateful function internal_function(param1: int, param2: address) =
// some logic here; state is modified
Without importing the Callee contract, I’m getting this
type_error: Unbound type Callee
// How to import??
contract Caller =
// has some state
// has an init function
stateful entrypoint initiatorFunction(calleeContractAddr: Callee ,param1: int, param2: address) =
calleeContractAddr.calleeFunction(param1, param2)
Also, the initiatorFunction of the Caller contract will take the address of the Callee contract as the first argument as per the example, right?