Complete the code to declare a smart contract named MyContract.
contract [1] {
// contract code
}The contract name should start with a capital letter and match the deployment name. Here, MyContract is the correct name.
Complete the code to define a public state variable named owner of type address.
address public [1];The variable owner is commonly used to store the address of the contract owner and is declared as public to allow external access.
Fix the error in the constructor to set the owner to the address that deploys the contract.
constructor() {
[1] = msg.sender;
}The constructor should assign msg.sender to the state variable owner. Using owner directly is correct.
Fill both blanks to create a function named getOwner that returns the owner address.
function [1]() public view returns ([2]) { return owner; }
The function name should be getOwner and it returns an address type.
Fill all three blanks to deploy the contract and assign the owner correctly.
contract [1] { address public [2]; constructor() { [3] = msg.sender; } }
The contract name is MyContract, the state variable is owner, and the constructor assigns msg.sender to owner.