Verified contractPartialMIT
ABCLottery
Address0x03639e05a2be56cedd698d5028a11747b2afac3d
- Balance
0 ETH
- Transactions
13
- Compiler
solc 0.8.18
- Same code
Only this contract
Details
- Compiler
- solc 0.8.18+commit.87f61d96
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 17,096,460
- Creation transaction
- 0x1f0f8d5b7f…5a2dd5c0c6
ABCLottery.sol
/*
https://t.me/AppleBitsCoinNews
https://twitter.com/Applebitseth
▄▄▄ ██▓███ ██▓███ ██▓ ▓█████ ▄▄▄▄ ██▓▄▄▄█████▓ ██████ ▄████▄ ▒█████ ██▓ ███▄ █
▒████▄ ▓██░ ██▒▓██░ ██▒▓██▒ ▓█ ▀ ▓█████▄ ▓██▒▓ ██▒ ▓▒▒██ ▒ ▒██▀ ▀█ ▒██▒ ██▒▓██▒ ██ ▀█ █
▒██ ▀█▄ ▓██░ ██▓▒▓██░ ██▓▒▒██░ ▒███ ▒██▒ ▄██▒██▒▒ ▓██░ ▒░░ ▓██▄ ▒▓█ ▄ ▒██░ ██▒▒██▒▓██ ▀█ ██▒
░██▄▄▄▄██ ▒██▄█▓▒ ▒▒██▄█▓▒ ▒▒██░ ▒▓█ ▄ ▒██░█▀ ░██░░ ▓██▓ ░ ▒ ██▒▒▓▓▄ ▄██▒▒██ ██░░██░▓██▒ ▐▌██▒
▓█ ▓██▒▒██▒ ░ ░▒██▒ ░ ░░██████▒░▒████▒░▓█ ▀█▓░██░ ▒██▒ ░ ▒██████▒▒▒ ▓███▀ ░░ ████▓▒░░██░▒██░ ▓██░
▒▒ ▓▒█░▒▓▒░ ░ ░▒▓▒░ ░ ░░ ▒░▓ ░░░ ▒░ ░░▒▓███▀▒░▓ ▒ ░░ ▒ ▒▓▒ ▒ ░░ ░▒ ▒ ░░ ▒░▒░▒░ ░▓ ░ ▒░ ▒ ▒
▒ ▒▒ ░░▒ ░ ░▒ ░ ░ ░ ▒ ░ ░ ░ ░▒░▒ ░ ▒ ░ ░ ░ ░▒ ░ ░ ░ ▒ ░ ▒ ▒░ ▒ ░░ ░░ ░ ▒░
░ ▒ ░░ ░░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ▒ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
}
contract ABCLottery {
error NotUser();
error NotToTime();
error NotOwner();
error NotEnoughETH();
address immutable owner;
IERC20 public abc;
uint public number;
uint public onceLotteryAward;
mapping(address => uint) public userLastStartLottery;
uint total = 1 * 1e6;
event Record(
uint number,
address user,
bool result,
uint userNum,
uint SysNum
);
constructor(address _token) payable {
owner = msg.sender;
abc = IERC20(_token);
onceLotteryAward = msg.value / 8;
}
function setOnceLotteryAward(uint _n) external {
if (msg.sender != owner) {
revert NotOwner();
}
onceLotteryAward = _n;
}
function withdraw() external {
if (msg.sender != owner) {
revert NotOwner();
}
payable(msg.sender).transfer(address(this).balance);
}
function getUserRate(address _user) public view returns (uint) {
return abc.balanceOf(_user) / (1000 * 10 ** 18);
}
function generateRandomNumber() public view returns (uint256) {
uint256 random = uint256(
keccak256(abi.encodePacked(block.timestamp, msg.sender, block.coinbase))
) % 100;
return random;
}
function rollApple() external {
require(msg.sender == tx.origin, "toxin apple");
uint userNum = getUserRate(msg.sender);
if (userNum == 0) {
revert NotUser();
}
if (userLastStartLottery[msg.sender] + 1 days > block.timestamp) {
revert NotToTime();
}
if (address(this).balance < onceLotteryAward) {
revert NotEnoughETH();
}
uint SysNum = generateRandomNumber();
//state change
userLastStartLottery[msg.sender] = block.timestamp;
number++;
bool result;
if (userNum > SysNum) {
result = true;
payable(msg.sender).transfer(onceLotteryAward);
}
emit Record(number, msg.sender, result, userNum, SysNum);
}
receive() external payable {
if (msg.sender != owner) {
revert NotOwner();
}
onceLotteryAward = address(this).balance / 8;
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.