L1X VM Cross-Contract Calls
Last updated
Last updated
eBPF runtime allows a smart-contract to call another smart-contract's function. The smart-contract is halted until the called smart-contract finishes execution.
When Smart-Contract A calls Smart-Contract B, the is Smart-Contract B is executed in the following context:
The caller_address()
API function will return the Smart-Contract A contract instance address
transfer_from_caller()
API function will transfer tokens from Smart-Contract A balance to Smart-Contract B balance
contract_instance_address
API function will return Smart-Contract B contract instance address
contract_owner_address
API function will return Smart-Contract B contract owner address
If Smart-Contract A has been called in read-only context then Smart-Contract B will be called in the same context. It means Smart-Contract B will not be able to modify its own persistent storage.
Diagram