Source Code
Latest 25 from a total of 268 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 19504629 | 728 days ago | IN | 0 ETH | 0.00090155 | ||||
| Withdraw | 18563218 | 860 days ago | IN | 0 ETH | 0.00286604 | ||||
| Withdraw | 18449449 | 876 days ago | IN | 0 ETH | 0.00069222 | ||||
| Withdraw | 18111144 | 923 days ago | IN | 0 ETH | 0.00041506 | ||||
| Withdraw | 17402969 | 1022 days ago | IN | 0 ETH | 0.00093638 | ||||
| Withdraw | 16947657 | 1087 days ago | IN | 0 ETH | 0.00220155 | ||||
| Withdraw | 16898247 | 1094 days ago | IN | 0 ETH | 0.00156922 | ||||
| Withdraw | 16818787 | 1105 days ago | IN | 0 ETH | 0.00104844 | ||||
| Withdraw | 16621152 | 1133 days ago | IN | 0 ETH | 0.00158457 | ||||
| Withdraw | 16569227 | 1140 days ago | IN | 0 ETH | 0.00076788 | ||||
| Withdraw | 16492332 | 1151 days ago | IN | 0 ETH | 0.00177934 | ||||
| Withdraw | 16321485 | 1174 days ago | IN | 0 ETH | 0.00093085 | ||||
| Withdraw | 16318092 | 1175 days ago | IN | 0 ETH | 0.00071473 | ||||
| Withdraw | 16317743 | 1175 days ago | IN | 0 ETH | 0.00067028 | ||||
| Withdraw | 16289663 | 1179 days ago | IN | 0 ETH | 0.00073812 | ||||
| Withdraw | 16269203 | 1182 days ago | IN | 0 ETH | 0.00049412 | ||||
| Withdraw | 16232949 | 1187 days ago | IN | 0 ETH | 0.00062299 | ||||
| Withdraw | 16227946 | 1188 days ago | IN | 0 ETH | 0.00133829 | ||||
| Withdraw | 16227408 | 1188 days ago | IN | 0 ETH | 0.00073795 | ||||
| Withdraw | 16226174 | 1188 days ago | IN | 0 ETH | 0.00060535 | ||||
| Withdraw | 16216830 | 1189 days ago | IN | 0 ETH | 0.0005976 | ||||
| Withdraw | 16206105 | 1191 days ago | IN | 0 ETH | 0.00060028 | ||||
| Withdraw | 16178704 | 1194 days ago | IN | 0 ETH | 0.00133085 | ||||
| Withdraw | 16157938 | 1197 days ago | IN | 0 ETH | 0.00063129 | ||||
| Withdraw | 16139549 | 1200 days ago | IN | 0 ETH | 0.00067554 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PKNPremium
Compiler Version
v0.8.7+commit.e28d00a7
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2021-09-21
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: stacking.sol
pragma solidity ^0.8.3;
// This contract handles staking PKN to get access to premium features
contract PKNPremium {
uint256 constant LOCK_PERIOD = 365 days;
mapping(address => uint256) _pknStakedBy;
mapping(address => uint256) _unlockTimeOf;
IERC20 public immutable PKN;
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event Renew(address user, uint256 amount);
constructor(IERC20 _PKN) {
PKN = _PKN;
}
function pknStackedBy(address user) public view returns(uint256) {
return _pknStakedBy[user];
}
function unlockTimeOf(address user) public view returns(uint256) {
return _unlockTimeOf[user];
}
function isSubscriptionActive(address user) public view returns(bool) {
return block.timestamp < unlockTimeOf(user);
}
// Locks PKN for locking period
function deposit(uint256 _amount) public {
_unlockTimeOf[msg.sender] = _getUnlockTime(block.timestamp);
_pknStakedBy[msg.sender] += _amount;
PKN.transferFrom(msg.sender, address(this), _amount);
emit Deposit(msg.sender, _amount);
}
// Withdraw the unlocked PKN
function withdraw(uint256 _amount) public {
require(pknStackedBy(msg.sender) >= _amount, "PKNPremium: Amount too high!");
require(!isSubscriptionActive(msg.sender), "PKNPremium: PKN not unlocked yet!");
_pknStakedBy[msg.sender] -= _amount;
PKN.transfer(msg.sender, _amount);
emit Withdraw(msg.sender, _amount);
}
// renew an existing or expired subscription
function renew() public {
require(pknStackedBy(msg.sender) > 0, "PKNPremium: No PKN stacked!");
_unlockTimeOf[msg.sender] = _getUnlockTime(block.timestamp);
emit Renew(msg.sender, _pknStakedBy[msg.sender]);
}
function _getUnlockTime(uint256 startTime) internal pure returns(uint256) {
return startTime + LOCK_PERIOD;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IERC20","name":"_PKN","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Renew","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"PKN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isSubscriptionActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"pknStackedBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renew","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"unlockTimeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060405234801561001057600080fd5b506040516106cd3803806106cd83398101604081905261002f91610044565b60601b6001600160601b031916608052610074565b60006020828403121561005657600080fd5b81516001600160a01b038116811461006d57600080fd5b9392505050565b60805160601c61062d6100a060003960008181610144015281816103580152610476015261062d6000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806339aff86e1161005b57806339aff86e146100df578063469a694714610116578063688c3e401461013f578063b6b55f251461017e57600080fd5b80630d932e7014610082578063144013291461008c5780632e1a7d4d146100cc575b600080fd5b61008a610191565b005b6100b761009a366004610547565b6001600160a01b0316600090815260016020526040902054421090565b60405190151581526020015b60405180910390f35b61008a6100da366004610599565b610250565b6101086100ed366004610547565b6001600160a01b031660009081526020819052604090205490565b6040519081526020016100c3565b610108610124366004610547565b6001600160a01b031660009081526001602052604090205490565b6101667f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c3565b61008a61018c366004610599565b61041a565b33600090815260208190526040812054116101f35760405162461bcd60e51b815260206004820152601b60248201527f504b4e5072656d69756d3a204e6f20504b4e20737461636b656421000000000060448201526064015b60405180910390fd5b6101fc42610531565b3360008181526001602090815260408083209490945581815290839020548351928352908201527fce26e41bd18ae64320dcb51e02d1330ff86fb72f105d9d4e75be09cad22e9935910160405180910390a1565b336000908152602081905260409020548111156102af5760405162461bcd60e51b815260206004820152601c60248201527f504b4e5072656d69756d3a20416d6f756e7420746f6f2068696768210000000060448201526064016101ea565b336000908152600160205260409020544210156103185760405162461bcd60e51b815260206004820152602160248201527f504b4e5072656d69756d3a20504b4e206e6f7420756e6c6f636b6564207965746044820152602160f81b60648201526084016101ea565b33600090815260208190526040812080548392906103379084906105ca565b909155505060405163a9059cbb60e01b8152336004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb90604401602060405180830381600087803b1580156103a457600080fd5b505af11580156103b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103dc9190610577565b5060408051338152602081018390527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436491015b60405180910390a150565b61042342610531565b33600090815260016020908152604080832093909355819052908120805483929061044f9084906105b2565b90915550506040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90606401602060405180830381600087803b1580156104c257600080fd5b505af11580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa9190610577565b5060408051338152602081018390527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910161040f565b60006105416301e13380836105b2565b92915050565b60006020828403121561055957600080fd5b81356001600160a01b038116811461057057600080fd5b9392505050565b60006020828403121561058957600080fd5b8151801515811461057057600080fd5b6000602082840312156105ab57600080fd5b5035919050565b600082198211156105c5576105c56105e1565b500190565b6000828210156105dc576105dc6105e1565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122047d28f3c56e4140e3ea251999551edbd1238befdbeede402b5308169dfd7ed3164736f6c63430008070033000000000000000000000000df09a216fac5adc3e640db418c0b956076509503
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806339aff86e1161005b57806339aff86e146100df578063469a694714610116578063688c3e401461013f578063b6b55f251461017e57600080fd5b80630d932e7014610082578063144013291461008c5780632e1a7d4d146100cc575b600080fd5b61008a610191565b005b6100b761009a366004610547565b6001600160a01b0316600090815260016020526040902054421090565b60405190151581526020015b60405180910390f35b61008a6100da366004610599565b610250565b6101086100ed366004610547565b6001600160a01b031660009081526020819052604090205490565b6040519081526020016100c3565b610108610124366004610547565b6001600160a01b031660009081526001602052604090205490565b6101667f000000000000000000000000df09a216fac5adc3e640db418c0b95607650950381565b6040516001600160a01b0390911681526020016100c3565b61008a61018c366004610599565b61041a565b33600090815260208190526040812054116101f35760405162461bcd60e51b815260206004820152601b60248201527f504b4e5072656d69756d3a204e6f20504b4e20737461636b656421000000000060448201526064015b60405180910390fd5b6101fc42610531565b3360008181526001602090815260408083209490945581815290839020548351928352908201527fce26e41bd18ae64320dcb51e02d1330ff86fb72f105d9d4e75be09cad22e9935910160405180910390a1565b336000908152602081905260409020548111156102af5760405162461bcd60e51b815260206004820152601c60248201527f504b4e5072656d69756d3a20416d6f756e7420746f6f2068696768210000000060448201526064016101ea565b336000908152600160205260409020544210156103185760405162461bcd60e51b815260206004820152602160248201527f504b4e5072656d69756d3a20504b4e206e6f7420756e6c6f636b6564207965746044820152602160f81b60648201526084016101ea565b33600090815260208190526040812080548392906103379084906105ca565b909155505060405163a9059cbb60e01b8152336004820152602481018290527f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095036001600160a01b03169063a9059cbb90604401602060405180830381600087803b1580156103a457600080fd5b505af11580156103b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103dc9190610577565b5060408051338152602081018390527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436491015b60405180910390a150565b61042342610531565b33600090815260016020908152604080832093909355819052908120805483929061044f9084906105b2565b90915550506040516323b872dd60e01b8152336004820152306024820152604481018290527f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095036001600160a01b0316906323b872dd90606401602060405180830381600087803b1580156104c257600080fd5b505af11580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa9190610577565b5060408051338152602081018390527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910161040f565b60006105416301e13380836105b2565b92915050565b60006020828403121561055957600080fd5b81356001600160a01b038116811461057057600080fd5b9392505050565b60006020828403121561058957600080fd5b8151801515811461057057600080fd5b6000602082840312156105ab57600080fd5b5035919050565b600082198211156105c5576105c56105e1565b500190565b6000828210156105dc576105dc6105e1565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122047d28f3c56e4140e3ea251999551edbd1238befdbeede402b5308169dfd7ed3164736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000df09a216fac5adc3e640db418c0b956076509503
-----Decoded View---------------
Arg [0] : _PKN (address): 0xdf09a216Fac5ADC3e640Db418C0b956076509503
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000df09a216fac5adc3e640db418c0b956076509503
Deployed Bytecode Sourcemap
2965:1953:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4540:244;;;:::i;:::-;;3623:132;;;;;;:::i;:::-;-1:-1:-1;;;;;3588:19:0;3687:4;3588:19;;;:13;:19;;;;;;3711:15;:36;;3623:132;;;;1596:14:1;;1589:22;1571:41;;1559:2;1544:18;3623:132:0;;;;;;;;4116:366;;;;;;:::i;:::-;;:::i;3388:109::-;;;;;;:::i;:::-;-1:-1:-1;;;;;3471:18:0;3444:7;3471:18;;;;;;;;;;;;3388:109;;;;3105:25:1;;;3093:2;3078:18;3388:109:0;2959:177:1;3505:110:0;;;;;;:::i;:::-;-1:-1:-1;;;;;3588:19:0;3561:7;3588:19;;;:13;:19;;;;;;;3505:110;3139:27;;;;;;;;-1:-1:-1;;;;;1800:32:1;;;1782:51;;1770:2;1755:18;3139:27:0;1623:216:1;3800:274:0;;;;;;:::i;:::-;;:::i;4540:244::-;4596:10;4610:1;3471:18;;;;;;;;;;;4583:28;4575:68;;;;-1:-1:-1;;;4575:68:0;;2448:2:1;4575:68:0;;;2430:21:1;2487:2;2467:18;;;2460:30;2526:29;2506:18;;;2499:57;2573:18;;4575:68:0;;;;;;;;;4684:31;4699:15;4684:14;:31::i;:::-;4670:10;4656:25;;;;:13;:25;;;;;;;;:59;;;;4751:24;;;;;;;;4733:43;;1326:51:1;;;1393:18;;;1386:34;4733:43:0;;1299:18:1;4733:43:0;;;;;;;4540:244::o;4116:366::-;4190:10;3444:7;3471:18;;;;;;;;;;;4205:7;-1:-1:-1;4177:35:0;4169:76;;;;-1:-1:-1;;;4169:76:0;;2804:2:1;4169:76:0;;;2786:21:1;2843:2;2823:18;;;2816:30;2882;2862:18;;;2855:58;2930:18;;4169:76:0;2602:352:1;4169:76:0;4286:10;3687:4;3588:19;;;:13;:19;;;;;;3711:15;:36;4264:33;4256:79;;;;-1:-1:-1;;;4256:79:0;;2046:2:1;4256:79:0;;;2028:21:1;2085:2;2065:18;;;2058:30;2124:34;2104:18;;;2097:62;-1:-1:-1;;;2175:18:1;;;2168:31;2216:19;;4256:79:0;1844:397:1;4256:79:0;4361:10;4348:12;:24;;;;;;;;;;:35;;4376:7;;4348:12;:35;;4376:7;;4348:35;:::i;:::-;;;;-1:-1:-1;;4394:33:0;;-1:-1:-1;;;4394:33:0;;4407:10;4394:33;;;1326:51:1;1393:18;;;1386:34;;;4394:3:0;-1:-1:-1;;;;;4394:12:0;;;;1299:18:1;;4394:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;4445:29:0;;;4454:10;1326:51:1;;1408:2;1393:18;;1386:34;;;4445:29:0;;1299:18:1;4445:29:0;;;;;;;;4116:366;:::o;3800:274::-;3880:31;3895:15;3880:14;:31::i;:::-;3866:10;3852:25;;;;:13;:25;;;;;;;;:59;;;;3922:24;;;;;;:35;;3950:7;;3852:25;3922:35;;3950:7;;3922:35;:::i;:::-;;;;-1:-1:-1;;3968:52:0;;-1:-1:-1;;;3968:52:0;;3985:10;3968:52;;;1012:34:1;4005:4:0;1062:18:1;;;1055:43;1114:18;;;1107:34;;;3968:3:0;-1:-1:-1;;;;;3968:16:0;;;;947:18:1;;3968:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;4038:28:0;;;4046:10;1326:51:1;;1408:2;1393:18;;1386:34;;;4038:28:0;;1299:18:1;4038:28:0;1152:274:1;4792:123:0;4857:7;4884:23;3025:8;4884:9;:23;:::i;:::-;4877:30;4792:123;-1:-1:-1;;4792:123:0:o;14:286:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;168:23;;-1:-1:-1;;;;;220:31:1;;210:42;;200:70;;266:1;263;256:12;200:70;289:5;14:286;-1:-1:-1;;;14:286:1:o;305:277::-;372:6;425:2;413:9;404:7;400:23;396:32;393:52;;;441:1;438;431:12;393:52;473:9;467:16;526:5;519:13;512:21;505:5;502:32;492:60;;548:1;545;538:12;587:180;646:6;699:2;687:9;678:7;674:23;670:32;667:52;;;715:1;712;705:12;667:52;-1:-1:-1;738:23:1;;587:180;-1:-1:-1;587:180:1:o;3141:128::-;3181:3;3212:1;3208:6;3205:1;3202:13;3199:39;;;3218:18;;:::i;:::-;-1:-1:-1;3254:9:1;;3141:128::o;3274:125::-;3314:4;3342:1;3339;3336:8;3333:34;;;3347:18;;:::i;:::-;-1:-1:-1;3384:9:1;;3274:125::o;3404:127::-;3465:10;3460:3;3456:20;3453:1;3446:31;3496:4;3493:1;3486:15;3520:4;3517:1;3510:15
Swarm Source
ipfs://47d28f3c56e4140e3ea251999551edbd1238befdbeede402b5308169dfd7ed31
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.