Complete the code to declare the minimal proxy contract address variable.
address public [1];owner or proxy as the variable name instead of implementation.The variable implementation stores the address of the original contract to clone.
Complete the code to create a minimal proxy clone using assembly.
assembly {
let clone := create(0, [1], 0x37)
}The bytecode 0x3d602d80600a3d3981f3 is the standard minimal proxy creation code prefix.
Fix the error in the function that returns the address of the clone.
function getClone() public view returns (address) {
return [1];
}implementation instead of the clone address.The function should return the clone address, which is the deployed proxy.
Fill both blanks to complete the clone creation and initialization.
function cloneAndInit() external returns (address) {
address [1];
assembly {
[2] := create(0, add(code, 0x20), mload(code))
}
require([1] != address(0), "Clone failed");
return [1];
}The variable clone is declared and assigned the new clone address inside assembly.
Fill all three blanks to complete the dictionary comprehension that maps clone addresses to owners.
mapping(address => address) public [1]; function registerClone(address [2], address [3]) external { clones[[2]] = [3]; }
The mapping is named clones, and the function parameters are cloneAddress and ownerAddr.