forked from DeFiHackLabs/Web3-CTF-Intensive-CoLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlotPuzzleFactory.sol
32 lines (25 loc) · 1.06 KB
/
SlotPuzzleFactory.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
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;
import {ReentrancyGuard} from "openzeppelin-contracts/security/ReentrancyGuard.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {SlotPuzzle} from "./SlotPuzzle.sol";
import {EnumerableSet} from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";
import "./interface/ISlotPuzzleFactory.sol";
contract SlotPuzzleFactory is ReentrancyGuard{
using EnumerableSet for EnumerableSet.AddressSet;
using SafeTransferLib for address;
EnumerableSet.AddressSet deployedAddress;
constructor() payable {
require(msg.value == 3 ether);
}
function deploy(Parameters calldata params) external nonReentrant {
SlotPuzzle newContract = new SlotPuzzle();
deployedAddress.add(address(newContract));
newContract.ascertainSlot(params);
}
function payout(address wallet,uint256 amount) external {
require(deployedAddress.contains(msg.sender));
require(amount == 1 ether);
wallet.safeTransferETH(amount);
}
}