-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calyptus282.sol
44 lines (34 loc) · 1.2 KB
/
Calyptus282.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
39
40
41
42
43
44
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
contract ForceFeed {
// Custom errors
error BalanceNotIncreased();
// Mapping to store winners
mapping(address participant => string userId) public bookOfWinners;
// Variable to store the last noted balance
uint256 private lastBalance;
constructor() {
// Initialize the lastBalance with the current balance (likely to be 0 at deployment)
lastBalance = address(this).balance;
}
// Function to check the balance and update winners
function checkBalanceAndRecordWinner(string memory userId) public {
// Check if the current balance is greater than the last noted balance
if (address(this).balance <= lastBalance) {
revert BalanceNotIncreased();
}
// Record the caller in the book of winners
bookOfWinners[msg.sender] = userId;
// Update the lastBalance to the current balance
lastBalance = address(this).balance;
}
}
contract Kill {
constructor() payable {}
function kill(address _addr) external payable {
selfdestruct(payable(_addr));
}
function getB() external pure returns (uint) {
return 4343;
}
}