ipld-eth-db-validator/test/contract/contracts/Test.sol

30 lines
655 B
Solidity

// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
contract Test {
event logPut (address, uint256);
address payable owner;
mapping(address => uint256) public data;
modifier onlyOwner {
require(msg.sender == owner, "Only owner can call this function.");
_;
}
constructor() {
owner = payable(msg.sender);
}
function Put(uint256 value) public {
emit logPut(msg.sender, value);
data[msg.sender] = value;
}
function close() public onlyOwner {
(bool ok, ) = owner.call{value: address(this).balance}("");
require(ok, "ETH transfer failed");
}
}