pragma solidity 0.8.20;
contract BadBoiBaaaaaatekWithPayable {
bool public enabled;
mapping(uint => string) public dataStorage;
event StateUpdated(bool indexed _state);
- Updates State *
function updateState(bool _state) external {
enabled = _state;
emit StateUpdated({ _state: _state });
}
- Allows you to update a key with some data *
function updateKey(uint _key, string calldata value) external {
require(enabled, "not enabled");
dataStorage[_key] = value;
}
moneybucket with datastorage *
function receiveMoney(uint _key, string calldata value) external payable {
require(msg.value > 0, "you have to send something");
dataStorage[_key] = value;
}
moneybucket *
function receiveMoneyOnlyPayable() external payable {
require(msg.value > 0, "you have to send something");
}
free money for you if there is some in here! *
function withdrawAll(address recipient) public {
uint256 balance = address(this).balance;