View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
LPLocker
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 500000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/**
Nchart Token LP locker
Website: nchart.io
Docs: docs.nchart.io
twitter.com/Nchart_
twitter.com/Kekotron_
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/token/ERC20/IERC20.sol";
/**
........
..::::::::::::. .
.:::::::::::::::. =+-.
--::::::::::::::::. =+++-
*##*+::::::::::::::. =+++++
*#####: .::::::::::. =++++++
-######: .:::::::. =++++++-
*######: :. .::::. =+++++++
#######: -=-:. .:. =+++++++
+######: -=====:. =++++++=
:######: -========-. =++++++:
+#####: -===========-.-+++++=
=####: -==============-==+-
:*##: -================-.
:+: -==============-.
:==========-:.
......
*/
/**
* @dev This contract allows locking of an ERC20 LP Token for a period
* of 2 years, and at some point after that, trigger a 90-day timer.
* After the timer expires, the locked LP can be withdrawn.
* No other action may be taken in the interim.
*/
contract LPLocker {
address public owner;
address public immutable tokenContract;
uint256 public immutable earliestUnlockTime;
uint256 public lockUpEndTime;
bool public isLiquidityLocked;
bool public isWithdrawalTriggered;
error CannotAssignOwnerToAddressZero();
error LockupNotEnded();
error LPAlreadyLocked();
error LPNotLocked();
error OnlyOwnerCanCall();
error TwoYearMinimum();
error WithdrawalAlreadyTriggered();
error WithdrawalNotTriggered();
constructor(address tokenContract_) {
earliestUnlockTime = block.timestamp + (365 days * 2);
tokenContract = tokenContract_;
owner = msg.sender;
}
function lockLiquidity(uint256 amount) external {
_requireIsOwner();
if (isLiquidityLocked) {
revert LPAlreadyLocked();
}
IERC20(tokenContract).transferFrom(msg.sender, address(this), amount);
isLiquidityLocked = true;
}
function triggerWithdrawal() external {
_requireIsOwner();
if(block.timestamp < earliestUnlockTime) {
revert TwoYearMinimum();
}
if (!isLiquidityLocked) {
revert LPNotLocked();
}
if (lockUpEndTime != 0) {
revert WithdrawalAlreadyTriggered();
}
lockUpEndTime = block.timestamp + 90 days;
isWithdrawalTriggered = true;
}
function cancelWithdrawalTrigger() external {
_requireIsOwner();
if (!isLiquidityLocked) {
revert LPNotLocked();
}
if (lockUpEndTime == 0) {
revert WithdrawalNotTriggered();
}
lockUpEndTime = 0;
isWithdrawalTriggered = false;
}
function withdrawLP(uint256 amount) external {
_requireIsOwner();
if (!isLiquidityLocked) {
revert LPNotLocked();
}
if (lockUpEndTime == 0) {
revert WithdrawalNotTriggered();
}
if (block.timestamp < lockUpEndTime) {
revert LockupNotEnded();
}
IERC20(tokenContract).transfer(owner, amount);
isLiquidityLocked = false;
lockUpEndTime = 0;
isWithdrawalTriggered = false;
}
function changeOwner(address newOwner) external {
_requireIsOwner();
if (newOwner == address(0)) {
revert CannotAssignOwnerToAddressZero();
}
owner = newOwner;
}
function _requireIsOwner() internal view {
if (msg.sender != owner) {
revert OnlyOwnerCanCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}{
"remappings": [
"@openzeppelin/=lib/openzeppelin-contracts/contracts/",
"@solady/=lib/solady/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solady/=lib/solady/",
"lib/forge-std:ds-test/=lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts:forge-std/=lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/openzeppelin-contracts:openzeppelin/=lib/openzeppelin-contracts/contracts/",
"lib/solady:ds-test/=lib/solady/lib/ds-test/src/",
"lib/solady:forge-std/=lib/solady/test/utils/forge-std/"
],
"optimizer": {
"enabled": true,
"runs": 500000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"tokenContract_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotAssignOwnerToAddressZero","type":"error"},{"inputs":[],"name":"LPAlreadyLocked","type":"error"},{"inputs":[],"name":"LPNotLocked","type":"error"},{"inputs":[],"name":"LockupNotEnded","type":"error"},{"inputs":[],"name":"OnlyOwnerCanCall","type":"error"},{"inputs":[],"name":"TwoYearMinimum","type":"error"},{"inputs":[],"name":"WithdrawalAlreadyTriggered","type":"error"},{"inputs":[],"name":"WithdrawalNotTriggered","type":"error"},{"inputs":[],"name":"cancelWithdrawalTrigger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"changeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earliestUnlockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLiquidityLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWithdrawalTriggered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"lockLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockUpEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"triggerWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawLP","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c060405234801561001057600080fd5b5060405161096938038061096983398101604081905261002f91610063565b61003d426303c26700610093565b60a0526001600160a01b0316608052600080546001600160a01b031916331790556100ba565b60006020828403121561007557600080fd5b81516001600160a01b038116811461008c57600080fd5b9392505050565b808201808211156100b457634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a0516108756100f46000396000818161016301526102010152600081816101170152818161038d01526105e501526108756000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80637992145e11610081578063deec61881161005b578063deec6188146101cf578063e4456ecb146101dc578063e5b12898146101ef57600080fd5b80637992145e146101935780638da5cb5b1461019c578063a6f9dae1146101bc57600080fd5b80632bfbd9cf116100b25780632bfbd9cf146100ff57806355a373d614610112578063607ef17d1461015e57600080fd5b8063041e0185146100ce5780630fff33f5146100d8575b600080fd5b6100d66101f7565b005b6002546100ea90610100900460ff1681565b60405190151581526020015b60405180910390f35b6100d661010d366004610787565b61030d565b6101397f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f6565b6101857f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100f6565b61018560015481565b6000546101399073ffffffffffffffffffffffffffffffffffffffff1681565b6100d66101ca3660046107a0565b61043e565b6002546100ea9060ff1681565b6100d66101ea366004610787565b6104da565b6100d6610685565b6101ff610734565b7f0000000000000000000000000000000000000000000000000000000000000000421015610259576040517fb0e0f50a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460ff16610295576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154156102cf576040517fcaec557300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6102dc426276a7006107dd565b600155600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b610315610734565b60025460ff1615610352576040517f29ccc71d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af11580156103eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040f919061081d565b5050600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b610446610734565b73ffffffffffffffffffffffffffffffffffffffff8116610493576040517fc42ce35d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6104e2610734565b60025460ff1661051e576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460000361055a576040517f25d0a75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154421015610596576040517f37b0c40100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610630573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610654919061081d565b50506002805460006001557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000169055565b61068d610734565b60025460ff166106c9576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154600003610705576040517f25d0a75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600155600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610785576040517f47a8ea5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60006020828403121561079957600080fd5b5035919050565b6000602082840312156107b257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146107d657600080fd5b9392505050565b80820180821115610817577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b60006020828403121561082f57600080fd5b815180151581146107d657600080fdfea2646970667358221220d32da0f4031d494720154ec8178dd00a6b8fafea8ac5f0cc095e72baf61ef20f64736f6c63430008130033000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80637992145e11610081578063deec61881161005b578063deec6188146101cf578063e4456ecb146101dc578063e5b12898146101ef57600080fd5b80637992145e146101935780638da5cb5b1461019c578063a6f9dae1146101bc57600080fd5b80632bfbd9cf116100b25780632bfbd9cf146100ff57806355a373d614610112578063607ef17d1461015e57600080fd5b8063041e0185146100ce5780630fff33f5146100d8575b600080fd5b6100d66101f7565b005b6002546100ea90610100900460ff1681565b60405190151581526020015b60405180910390f35b6100d661010d366004610787565b61030d565b6101397f000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f6565b6101857f00000000000000000000000000000000000000000000000000000000688e56db81565b6040519081526020016100f6565b61018560015481565b6000546101399073ffffffffffffffffffffffffffffffffffffffff1681565b6100d66101ca3660046107a0565b61043e565b6002546100ea9060ff1681565b6100d66101ea366004610787565b6104da565b6100d6610685565b6101ff610734565b7f00000000000000000000000000000000000000000000000000000000688e56db421015610259576040517fb0e0f50a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460ff16610295576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154156102cf576040517fcaec557300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6102dc426276a7006107dd565b600155600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b610315610734565b60025460ff1615610352576040517f29ccc71d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290527f000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce73ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af11580156103eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040f919061081d565b5050600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b610446610734565b73ffffffffffffffffffffffffffffffffffffffff8116610493576040517fc42ce35d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6104e2610734565b60025460ff1661051e576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460000361055a576040517f25d0a75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154421015610596576040517f37b0c40100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018390527f000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce9091169063a9059cbb906044016020604051808303816000875af1158015610630573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610654919061081d565b50506002805460006001557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000169055565b61068d610734565b60025460ff166106c9576040517f7c12310400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154600003610705576040517f25d0a75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600155600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610785576040517f47a8ea5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60006020828403121561079957600080fd5b5035919050565b6000602082840312156107b257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146107d657600080fd5b9392505050565b80820180821115610817577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b60006020828403121561082f57600080fd5b815180151581146107d657600080fdfea2646970667358221220d32da0f4031d494720154ec8178dd00a6b8fafea8ac5f0cc095e72baf61ef20f64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce
-----Decoded View---------------
Arg [0] : tokenContract_ (address): 0xD0638b91bC6B301A0eEF5A109ED11cb30ed13bCE
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d0638b91bc6b301a0eef5a109ed11cb30ed13bce
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.