Contract Address Details

Contract
0x15c6f323b4a9d43a9e6c28a39e0e9997af6322e2
Balance
11,983.14212937999903025 @G ($2,588.36)
Tokens
0 Tokens
$0.0 USD
Transactions
Balance changes
37
Gas Used
0
Last Balance Update
Contract Source Code Verified
Contract NameLocker
Compiler Versionv0.8.19+commit.7dd6d404
Optimization EnabledNo
Other SettingsDefault evmVersion
Contract Source Code (Solidity)
1
// SPDX-License-Identifier: MIT
2
 
3
pragma solidity ^0.8.17;
4
 
5
 
6
contract Locker {
7
 
8
enum bonusStatus {
9
Pending,
10
Withdrawn
11
}
12
 
13
struct Bonus {
14
uint amount;
15
uint lockDeadline;
16
bonusStatus status;
17
}
18
 
19
address owner;
20
uint lockTime;
21
mapping(address => Bonus[]) userBonuces;
22
 
23
event LockedBonusAdded(address indexed receiver, uint unlockTime, uint amount);
24
event BonusWithdrawn(address indexed receiver, uint amount);
25
 
26
modifier onlyOwner() {
27
require(msg.sender == owner);
28
_;
29
}
30
 
31
constructor (address _owner) {
32
owner = _owner;
33
lockTime = 30 days;
34
}
35
 
36
function transferOwnership(address newOwner) external onlyOwner {
37
owner = newOwner;
38
}
39
 
40
function changeLockTime(uint newLockTime) external onlyOwner {
41
lockTime = newLockTime;
42
}
43
 
44
function addLockedBonus(address receiver) external payable onlyOwner {
45
require(msg.value > 0, "zero msg.value");
46
userBonuces[receiver].push(Bonus(msg.value, block.timestamp + lockTime, bonusStatus.Pending));
47
48
emit LockedBonusAdded(receiver, block.timestamp + lockTime, msg.value);
49
}
50
 
51
function withdrawBonus(uint index) external {
52
 
53
require(index < userBonuces[msg.sender].length, "bonus index out of bounds");
54
require(userBonuces[msg.sender][index].status == bonusStatus.Pending, "already withdrawn");
55
require(block.timestamp >= userBonuces[msg.sender][index].lockDeadline, "deadline not reached");
56
57
userBonuces[msg.sender][index].status = bonusStatus.Withdrawn;
58
payable(msg.sender).transfer(userBonuces[msg.sender][index].amount);
59
 
60
emit BonusWithdrawn(msg.sender, userBonuces[msg.sender][index].amount);
61
}
62
 
63
function getMyBonuces() external view returns (Bonus[] memory) {
64
Bonus[] memory result = new Bonus[](userBonuces[msg.sender].length);
65
 
66
for (uint i; i < userBonuces[msg.sender].length; i++) {
67
result[i] = userBonuces[msg.sender][i];
68
}
69
 
70
return result;
71
}
72
}
73
 
74
 
Contract ABI
[{"type": "constructor", "inputs": [{"name": "_owner", "type": "address", "internalType": "address"}], "stateMutability": "nonpayable"}, {"name": "BonusWithdrawn", "type": "event", "inputs": [{"name": "receiver", "type": "address", "indexed": true, "internalType": "address"}, {"name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256"}], "anonymous": false}, {"name": "LockedBonusAdded", "type": "event", "inputs": [{"name": "receiver", "type": "address", "indexed": true, "internalType": "address"}, {"name": "unlockTime", "type": "uint256", "indexed": false, "internalType": "uint256"}, {"name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256"}], "anonymous": false}, {"name": "addLockedBonus", "type": "function", "inputs": [{"name": "receiver", "type": "address", "internalType": "address"}], "outputs": [], "stateMutability": "payable"}, {"name": "changeLockTime", "type": "function", "inputs": [{"name": "newLockTime", "type": "uint256", "internalType": "uint256"}], "outputs": [], "stateMutability": "nonpayable"}, {"name": "getMyBonuces", "type": "function", "inputs": [], "outputs": [{"name": "", "type": "tuple[]", "components": [{"name": "amount", "type": "uint256", "internalType": "uint256"}, {"name": "lockDeadline", "type": "uint256", "internalType": "uint256"}, {"name": "status", "type": "uint8", "internalType": "enum Locker.bonusStatus"}], "internalType": "struct Locker.Bonus[]"}], "stateMutability": "view"}, {"name": "transferOwnership", "type": "function", "inputs": [{"name": "newOwner", "type": "address", "internalType": "address"}], "outputs": [], "stateMutability": "nonpayable"}, {"name": "withdrawBonus", "type": "function", "inputs": [{"name": "index", "type": "uint256", "internalType": "uint256"}], "outputs": [], "stateMutability": "nonpayable"}]
Contract Creation Code
0x60806040523480156200001157600080fd5b50604051620010f9380380620010f98339818101604052810190620000379190620000f2565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062278d006001819055505062000124565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000ba826200008d565b9050919050565b620000cc81620000ad565b8114620000d857600080fd5b50565b600081519050620000ec81620000c1565b92915050565b6000602082840312156200010b576200010a62000088565b5b60006200011b84828501620000db565b91505092915050565b610fc580620001346000396000f3fe60806040526004361061004a5760003560e01c806338baa2011461004f57806372d329681461006b57806396cf522714610094578063ddec9011146100bd578063f2fde38b146100e8575b600080fd5b61006960048036038101906100649190610a49565b610111565b005b34801561007757600080fd5b50610092600480360381019061008d9190610aac565b6102f5565b005b3480156100a057600080fd5b506100bb60048036038101906100b69190610aac565b6106db565b005b3480156100c957600080fd5b506100d261073d565b6040516100df9190610c50565b60405180910390f35b3480156100f457600080fd5b5061010f600480360381019061010a9190610a49565b610918565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461016957600080fd5b600034116101ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a390610ccf565b60405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052803481526020016001544261020a9190610d1e565b81526020016000600181111561022357610222610b14565b5b8152509080600181540180825580915050600190039060005260206000209060030201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083600181111561028e5761028d610b14565b5b021790555050508073ffffffffffffffffffffffffffffffffffffffff167ffc27738d976f2ea4207155063e41737f3fca58e7981355dad9e156b4e5dff919600154426102db9190610d1e565b346040516102ea929190610d61565b60405180910390a250565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110610379576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037090610dd6565b60405180910390fd5b6000600181111561038d5761038c610b14565b5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106103de576103dd610df6565b5b906000526020600020906003020160020160009054906101000a900460ff16600181111561040f5761040e610b14565b5b1461044f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044690610e71565b60405180910390fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106104a05761049f610df6565b5b9060005260206000209060030201600101544210156104f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104eb90610edd565b60405180910390fd5b6001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061054757610546610df6565b5b906000526020600020906003020160020160006101000a81548160ff0219169083600181111561057a57610579610b14565b5b02179055503373ffffffffffffffffffffffffffffffffffffffff166108fc600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106105ea576105e9610df6565b5b9060005260206000209060030201600001549081150290604051600060405180830381858888f19350505050158015610627573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167fa48e1ff74bd0f1b584708d4ea741299b0e243b1dc795f94756cb5fe9147cf80e600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106106b1576106b0610df6565b5b9060005260206000209060030201600001546040516106d09190610efd565b60405180910390a250565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073357600080fd5b8060018190555050565b60606000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905067ffffffffffffffff81111561079d5761079c610f18565b5b6040519080825280602002602001820160405280156107d657816020015b6107c36109b3565b8152602001906001900390816107bb5790505b50905060005b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561091057600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811061087757610876610df6565b5b906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff1660018111156108c9576108c8610b14565b5b60018111156108db576108da610b14565b5b815250508282815181106108f2576108f1610df6565b5b6020026020010181905250808061090890610f47565b9150506107dc565b508091505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461097057600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60405180606001604052806000815260200160008152602001600060018111156109e0576109df610b14565b5b81525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610a16826109eb565b9050919050565b610a2681610a0b565b8114610a3157600080fd5b50565b600081359050610a4381610a1d565b92915050565b600060208284031215610a5f57610a5e6109e6565b5b6000610a6d84828501610a34565b91505092915050565b6000819050919050565b610a8981610a76565b8114610a9457600080fd5b50565b600081359050610aa681610a80565b92915050565b600060208284031215610ac257610ac16109e6565b5b6000610ad084828501610a97565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610b0e81610a76565b82525050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60028110610b5457610b53610b14565b5b50565b6000819050610b6582610b43565b919050565b6000610b7582610b57565b9050919050565b610b8581610b6a565b82525050565b606082016000820151610ba16000850182610b05565b506020820151610bb46020850182610b05565b506040820151610bc76040850182610b7c565b50505050565b6000610bd98383610b8b565b60608301905092915050565b6000602082019050919050565b6000610bfd82610ad9565b610c078185610ae4565b9350610c1283610af5565b8060005b83811015610c43578151610c2a8882610bcd565b9750610c3583610be5565b925050600181019050610c16565b5085935050505092915050565b60006020820190508181036000830152610c6a8184610bf2565b905092915050565b600082825260208201905092915050565b7f7a65726f206d73672e76616c7565000000000000000000000000000000000000600082015250565b6000610cb9600e83610c72565b9150610cc482610c83565b602082019050919050565b60006020820190508181036000830152610ce881610cac565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610d2982610a76565b9150610d3483610a76565b9250828201905080821115610d4c57610d4b610cef565b5b92915050565b610d5b81610a76565b82525050565b6000604082019050610d766000830185610d52565b610d836020830184610d52565b9392505050565b7f626f6e757320696e646578206f7574206f6620626f756e647300000000000000600082015250565b6000610dc0601983610c72565b9150610dcb82610d8a565b602082019050919050565b60006020820190508181036000830152610def81610db3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f616c72656164792077697468647261776e000000000000000000000000000000600082015250565b6000610e5b601183610c72565b9150610e6682610e25565b602082019050919050565b60006020820190508181036000830152610e8a81610e4e565b9050919050565b7f646561646c696e65206e6f742072656163686564000000000000000000000000600082015250565b6000610ec7601483610c72565b9150610ed282610e91565b602082019050919050565b60006020820190508181036000830152610ef681610eba565b9050919050565b6000602082019050610f126000830184610d52565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000610f5282610a76565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610f8457610f83610cef565b5b60018201905091905056fea264697066735822122031bc68a58f91d5ce27df2c39e27ba242e64ba8d32f85e075a7ee6db5a7304c7c64736f6c63430008130033000000000000000000000000d4494785b4f91498d863f2fec3f8b5f75faa4439
©2022-now by Graphite