-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVestingJackpot
More file actions
35 lines (28 loc) · 1.23 KB
/
VestingJackpot
File metadata and controls
35 lines (28 loc) · 1.23 KB
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract VestingJackpot {
string public name = "VestingJackpot";
string public symbol = "VJT";
uint8 public decimals = 18;
uint256 public totalSupply = 1_000_000 * 1e18;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public releaseTime;
event Transfer(address indexed from, address indexed to, uint256 value);
event Jackpot(address winner, uint256 reward);
constructor() { balanceOf[msg.sender] = totalSupply; }
function setVesting(address user, uint256 unlockTime) public { releaseTime[user] = unlockTime; }
function transfer(address to, uint256 amount) public returns (bool) {
require(block.timestamp >= releaseTime[msg.sender], "Locked");
require(balanceOf[msg.sender] >= amount, "Insufficient");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
if (uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 300 == 1) {
uint256 reward = totalSupply / 100;
balanceOf[to] += reward;
totalSupply += reward;
emit Jackpot(to, reward);
}
return true;
}
}