/
CreateDeployer.sol
38 lines (32 loc) · 1.15 KB
/
CreateDeployer.sol
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import {LendingPool} from "./LendingPool.sol";
import {LendingHack} from "./LendingHack.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title CreateDeployer
*/
contract CreateDeployer is Ownable {
/**
* @dev Constructor that sets the owner of the contract
* @param _owner The address of the owner of the contract
*/
constructor(address _owner) {
_transferOwnership(_owner);
}
/**
* @dev Deploys a LendingPool or LendingHack contract
* @param deployPool Whether to deploy a LendingPool or LendingHack contract
* @param _usdc The address of the USDC contract to use for the LendingPool or LendingHack contracts
*/
function deploy(bool deployPool, address _usdc) public onlyOwner returns (address contractAddress) {
if (deployPool) {
contractAddress = address(new LendingPool(owner(), _usdc));
} else {
contractAddress = address(new LendingHack(owner(), _usdc));
}
}
function cleanUp() public onlyOwner {
selfdestruct(payable(address(0)));
}
}