Contract interoperability
One of the key feature of yallo is the ability for contract to interact with other contracts easily. We provide a syntax for calling other contracts or deploy new one.
Calling other contracts
The first way to call another contract is using their interface abstraction as follow; we first get the instance of an IToken (see Contract structure page) at a given tokenContractAddress. We then point to the getBalance entrypoint passing an address to investigate and the reference to a nat entrypoint from this contract.
The previous code creates a operation with 0mtz inside; if we want to call another contract passing an amount, we do:
We can also get getBalance without using the interface IToken:
Deploy a contract
Yallo also allow deploying a contract from another contract. For instance, we can deploy the Token contract from another contract:
We use the constructor of Token to produce the initial storage.
Last updated