Ch21 Calling an already deployed contract
- Target Contract: A contract
OtherContract is introduced with functions to manage a state variable (_x), accept Ether (ETH), and emit events. The contract has functions to return its balance, modify _x, and retrieve _x.
- Contract-to-Contract Interaction: Different methods are shown for how to interact with the
OtherContract using its address:
- Passing the contract address as an argument.
- Passing the contract itself as a reference.
- Creating a contract reference within a function.
- Sending ETH during contract function calls with
payable functions.
Quiz Insights:
- Contracts calling other contracts help in code reuse but don't necessarily reduce gas costs.
- Calling functions of a deployed contract can be done using the contract's address and type (either the actual contract or its interface).
- Proper security practices are essential to prevent unauthorized changes to a contract’s state variables.
Ch22 Call
Call is a low-level member function for address type.