all files / contracts/mocks/ MockCloneable.sol

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                                                      15× 15× 10×                     17× 15× 10×                 44× 39×       16×      
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.6;
 
import "./../utils/Cloneable.sol";
import "./../utils/GovernableInitializable.sol";
 
 
/**
 * @title Mock Cloneable
 * @author solace.fi
 * @notice Mock Cloneable is only used to test Cloneable.
 */
contract MockCloneable is Cloneable, GovernableInitializable {
 
    string public message;
 
    /***************************************
    INITIALIZER
    ***************************************/
 
    /**
     * @notice Creates a new `MockCloneable`. The new instance will be a minimal proxy to this instance.
     * @param message_ The new instance's message.
     * @param governance_ The new instance's [governor](/docs/protocol/governance).
     * @return newInstance The address of the new instance.
     */
    function clone(string calldata message_, address governance_) external returns (address newInstance) {
        newInstance = _deployMinimalProxy();
        MockCloneable(newInstance).initialize(message_, governance_);
        return newInstance;
    }
 
    /**
     * @notice Creates a new `MockCloneable`. The new instance will be a minimal proxy to this instance.
     * @param message_ The new instance's message.
     * @param governance_ The new instance's [governor](/docs/protocol/governance).
     * @param salt_ Input for deterministic address calculation.
     * @return newInstance The address of the new instance.
     */
    function clone2(string calldata message_, address governance_, bytes32 salt_) external returns (address newInstance) {
        newInstance = _deployMinimalProxy(salt_);
        MockCloneable(newInstance).initialize(message_, governance_);
        return newInstance;
    }
 
    /**
     * @notice Initializes the MockCloneable.
     * @param message_ The instance's message.
     * @param governance_ The instance's [governor](/docs/protocol/governance).
     */
    function initialize(string calldata message_, address governance_) external initializer {
        __Governable_init(governance_);
        message = message_;
    }
 
    function setMessage(string calldata message_) external onlyGovernance {
        message = message_;
    }
}