Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- Lockup
- Optimization enabled
- false
- Compiler version
- v0.8.13+commit.abaa5c0e
- EVM Version
- default
- Verified at
- 2022-06-13T07:51:14.193006Z
Contract source code
// File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (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 `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); /** * @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: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: lp1.sol //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; contract Lockup is ReentrancyGuard, Ownable { using Address for address; using SafeERC20 for IERC20; using SafeMath for uint256; struct LOCKER { uint256 id; address token; address owner; uint256 amount; uint256 unlockTime; } uint256 private lockerCount = 0; LOCKER[] private lockers; uint256 public lockFee = 100000000000000000; //0.1 BNB uint public lockFeeLp = 50; // 0.5% = 50/10000 event Locking(address, address, uint256, uint256); event Unlocking(uint, address, uint256); event Extending(uint, address, uint256); event Increasing(uint, address, uint256); event OwnershipTransfering(uint, address, address); function lockByLp(address _token, uint256 _amount, uint256 _unlockTime) public { require(_token != address(0), "Zero address"); require(_unlockTime >= block.timestamp, "Invalid unlock time"); require(_amount > 0, "Invalid token amount"); IERC20 tokenContract = IERC20(address(_token)); tokenContract.transferFrom(msg.sender, address(this), _amount.add(_amount.mul(lockFeeLp).div(10000))); lockers.push(LOCKER(lockerCount, _token, msg.sender, _amount, _unlockTime)); lockerCount ++; emit Locking(_token, msg.sender, _amount, _unlockTime); } function lockByNative(address _token, uint256 _amount, uint256 _unlockTime) public payable { require(_token != address(0), "Zero address"); require(_unlockTime >= block.timestamp, "Invalid unlock time"); require(_amount > 0, "Invalid token amount"); require(lockFee <= msg.value, "Native token is not correct"); IERC20 tokenContract = IERC20(address(_token)); tokenContract.transferFrom(msg.sender, address(this), _amount); lockers.push(LOCKER(lockerCount, _token, msg.sender, _amount, _unlockTime)); lockerCount ++; emit Locking(_token, msg.sender, _amount, _unlockTime); } function unlock(uint256 _id, uint256 _amount) public { require(_id < lockerCount, "Invalid locker id"); uint _idx = 0; for(_idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].id == _id){ require(lockers[_idx].unlockTime <= block.timestamp, "Invalid unlock time"); require(lockers[_idx].owner == msg.sender, "Invalid Owner"); IERC20 tokenContract = IERC20(address(lockers[_idx].token)); lockers[_idx].amount -= _amount; tokenContract.transfer(msg.sender, _amount); emit Unlocking(_id, msg.sender, _amount); if(lockers[_idx].amount == 0) { lockers[_idx] = lockers[lockers.length - 1]; lockers.pop(); } break; } } } function extend(uint256 _id, uint256 _unlockTime) public { require(_id < lockerCount, "Invalid locker id"); require(_unlockTime >= block.timestamp, "Invalid unlock time"); uint _idx = 0; for(_idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].id == _id){ require(lockers[_idx].owner == msg.sender, "Invalid owner"); require(lockers[_idx].unlockTime <= _unlockTime, "Invalid unlock time"); lockers[_idx].unlockTime = _unlockTime; emit Extending(_id, msg.sender, _unlockTime); break; } } } function increaseByLp(uint256 _id, uint256 _amount) public { require(_id < lockerCount, "Invalid locker id"); require(_amount > 0, "Invalid token amount"); uint _idx = 0; for(_idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].id == _id){ require(lockers[_idx].owner == msg.sender, "Invalid owner"); IERC20 tokenContract = IERC20(address(lockers[_idx].token)); tokenContract.transferFrom(msg.sender, address(this), _amount.add(_amount.div(200))); lockers[_idx].amount += _amount; emit Increasing(_id, msg.sender, _amount); break; } } } function increaseByNative(uint _id, uint256 _amount) public payable { require(_id < lockerCount, "Invalid locker id"); require(_amount > 0, "Invalid token amount"); require(lockFee <= msg.value, "Native token is not correct"); uint _idx = 0; for(_idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].id == _id){ require(lockers[_idx].owner == msg.sender, "Invalid owner"); IERC20 tokenContract = IERC20(address(lockers[_idx].token)); tokenContract.transferFrom(msg.sender, address(this), _amount); lockers[_idx].amount += _amount; emit Increasing(_id, msg.sender, _amount); break; } } } function changeOwner(uint256 _id, address _newOwner) public { require(_id < lockerCount, "Invalid locker id"); require(_newOwner != address(0), "Must be non-zero address"); uint _idx = 0; for(_idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].id == _id){ require(lockers[_idx].owner == msg.sender, "Invalid owner"); lockers[_idx].owner = _newOwner; emit OwnershipTransfering(_id, msg.sender, _newOwner); break; } } } function isExistence(uint _id) public view returns (bool) { for(uint i = 0;i < lockers.length;i ++){ if(lockers[i].id == _id){ return true; } } return false; } function getUnlockTime(uint _id) private view returns (uint256) { for(uint i = 0;i < lockers.length;i ++){ if(lockers[i].id == _id){ return lockers[i].unlockTime; } } return 0; } function lockerCountOf(address _owner) public view returns (uint) { uint _count = 0; for(uint i = 0;i < lockers.length;i ++){ if(lockers[i].owner == _owner){ _count ++; } } return _count; } function lockersOf(address _owner) public view returns (LOCKER[] memory) { uint _count = lockerCountOf(_owner); LOCKER[] memory _lockers = new LOCKER[](_count); _count = 0; for(uint i = 0;i < lockers.length;i ++){ if(lockers[i].owner == _owner){ LOCKER storage _tmp = lockers[i]; _lockers[_count] = _tmp; _count ++; } } return _lockers; } function allLockers() public view returns (LOCKER[] memory) { uint _count = lockers.length; LOCKER[] memory _lockers = new LOCKER[](_count); for(uint i = 0;i < lockers.length;i ++){ LOCKER storage _tmp = lockers[i]; _lockers[i] = _tmp; } return _lockers; } function withdraw() external onlyOwner{ payable(msg.sender).transfer(address(this).balance); } function setLockFeeLp(uint _lockFeeLp) external onlyOwner { require(_lockFeeLp >= 0, "Invalid fee percentage"); require(_lockFeeLp <= 10000, "Invalid fee percentage"); lockFeeLp = _lockFeeLp; } function setLockFee(uint256 _lockFee) external onlyOwner { require(_lockFee >= 0, "Invalid fee percentage"); lockFee = _lockFee; } function withdrawLp(address _tokenAddr) external onlyOwner { require(_tokenAddr != address(0), "Invalid token address"); uint256 _lockedAmount = 0; for(uint _idx = 0;_idx < lockers.length;_idx ++){ if(lockers[_idx].token == _tokenAddr){ _lockedAmount = _lockedAmount + lockers[_idx].amount; } } IERC20 _tokenContract = IERC20(address(_tokenAddr)); uint256 _tokenBalance = _tokenContract.balanceOf(address(this)); uint _tokenAmountToWithdraw = _tokenBalance.sub(_lockedAmount); if(_tokenAmountToWithdraw > 0){ _tokenContract.transfer(msg.sender, _tokenAmountToWithdraw); } } }
Contract ABI
[{"type":"event","name":"Extending","inputs":[{"type":"uint256","name":"","internalType":"uint256","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Increasing","inputs":[{"type":"uint256","name":"","internalType":"uint256","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Locking","inputs":[{"type":"address","name":"","internalType":"address","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransfering","inputs":[{"type":"uint256","name":"","internalType":"uint256","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unlocking","inputs":[{"type":"uint256","name":"","internalType":"uint256","indexed":false},{"type":"address","name":"","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct Lockup.LOCKER[]","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"}]}],"name":"allLockers","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeOwner","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"address","name":"_newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"extend","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"uint256","name":"_unlockTime","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"increaseByLp","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"increaseByNative","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExistence","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockByLp","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_unlockTime","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"lockByNative","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_unlockTime","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lockFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lockFeeLp","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lockerCountOf","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct Lockup.LOCKER[]","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"}]}],"name":"lockersOf","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLockFee","inputs":[{"type":"uint256","name":"_lockFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLockFeeLp","inputs":[{"type":"uint256","name":"_lockFeeLp","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlock","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawLp","inputs":[{"type":"address","name":"_tokenAddr","internalType":"address"}]}]
Deployed ByteCode
0x60806040526004361061011f5760003560e01c80639b50f386116100a0578063b8c1719a11610064578063b8c1719a1461038d578063c89258db146103b6578063ca8b2b1b146103df578063d4426b381461040a578063f2fde38b146104355761011f565b80639b50f386146102b95780639b91e8bf146102d55780639ea311db146102fe5780639f7260bd1461033b578063b2b32887146103645761011f565b80636a3ce832116100e75780636a3ce832146101f5578063715018a614610211578063784796f7146102285780637fe9f9cb146102515780638da5cb5b1461028e5761011f565b80630457a486146101245780630a7683f01461014d5780633ccfd60b1461018a57806356a06235146101a15780635bfadb24146101cc575b600080fd5b34801561013057600080fd5b5061014b600480360381019061014691906128b4565b61045e565b005b34801561015957600080fd5b50610174600480360381019061016f91906128f4565b610759565b604051610181919061293c565b60405180910390f35b34801561019657600080fd5b5061019f6107c2565b005b3480156101ad57600080fd5b506101b6610887565b6040516101c39190612966565b60405180910390f35b3480156101d857600080fd5b506101f360048036038101906101ee91906128b4565b61088d565b005b61020f600480360381019061020a91906128b4565b610d89565b005b34801561021d57600080fd5b506102266110a4565b005b34801561023457600080fd5b5061024f600480360381019061024a91906129df565b61112c565b005b34801561025d57600080fd5b5061027860048036038101906102739190612a1f565b61138a565b6040516102859190612b81565b60405180910390f35b34801561029a57600080fd5b506102a36115c5565b6040516102b09190612bb2565b60405180910390f35b6102d360048036038101906102ce9190612bcd565b6115ef565b005b3480156102e157600080fd5b506102fc60048036038101906102f79190612bcd565b611938565b005b34801561030a57600080fd5b5061032560048036038101906103209190612a1f565b611c76565b6040516103329190612966565b60405180910390f35b34801561034757600080fd5b50610362600480360381019061035d91906128f4565b611d31565b005b34801561037057600080fd5b5061038b60048036038101906103869190612a1f565b611dfb565b005b34801561039957600080fd5b506103b460048036038101906103af91906128f4565b6120e1565b005b3480156103c257600080fd5b506103dd60048036038101906103d891906128b4565b6121f0565b005b3480156103eb57600080fd5b506103f4612450565b6040516104019190612966565b60405180910390f35b34801561041657600080fd5b5061041f612456565b60405161042c9190612b81565b60405180910390f35b34801561044157600080fd5b5061045c60048036038101906104579190612a1f565b612601565b005b60025482106104a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049990612c7d565b60405180910390fd5b600081116104e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104dc90612ce9565b60405180910390fd5b60005b60038054905081101561075457826003828154811061050a57610509612d09565b5b90600052602060002090600502016000015403610741573373ffffffffffffffffffffffffffffffffffffffff166003828154811061054c5761054b612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105cb90612d84565b60405180910390fd5b6000600382815481106105ea576105e9612d09565b5b906000526020600020906005020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323b872dd333061066261065360c8896126f890919063ffffffff16565b8861270e90919063ffffffff16565b6040518463ffffffff1660e01b815260040161068093929190612da4565b6020604051808303816000875af115801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190612e07565b5082600383815481106106d9576106d8612d09565b5b906000526020600020906005020160030160008282546106f99190612e63565b925050819055507f4999cd8dbcd222a69adfa39414998b13ae0e98e6c4339436d5de4a2a2999e63c84338560405161073393929190612eb9565b60405180910390a150610754565b808061074c90612ef0565b9150506104e8565b505050565b600080600090505b6003805490508110156107b757826003828154811061078357610782612d09565b5b906000526020600020906005020160000154036107a45760019150506107bd565b80806107af90612ef0565b915050610761565b50600090505b919050565b6107ca612724565b73ffffffffffffffffffffffffffffffffffffffff166107e86115c5565b73ffffffffffffffffffffffffffffffffffffffff161461083e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083590612f84565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610884573d6000803e3d6000fd5b50565b60045481565b60025482106108d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c890612c7d565b60405180910390fd5b60005b600380549050811015610d845782600382815481106108f6576108f5612d09565b5b90600052602060002090600502016000015403610d7157426003828154811061092257610921612d09565b5b9060005260206000209060050201600401541115610975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096c90612ff0565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600382815481106109a05761099f612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1f9061305c565b60405180910390fd5b600060038281548110610a3e57610a3d612d09565b5b906000526020600020906005020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508260038381548110610a8757610a86612d09565b5b90600052602060002090600502016003016000828254610aa7919061307c565b925050819055508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff1660e01b8152600401610ae99291906130b0565b6020604051808303816000875af1158015610b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2c9190612e07565b507fe0c90f60ab4d9bd09691c892c2a235b46d53364a1f69601206f877abd5f388f9843385604051610b6093929190612eb9565b60405180910390a1600060038381548110610b7e57610b7d612d09565b5b90600052602060002090600502016003015403610d6b5760036001600380549050610ba9919061307c565b81548110610bba57610bb9612d09565b5b906000526020600020906005020160038381548110610bdc57610bdb612d09565b5b9060005260206000209060050201600082015481600001556001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060038201548160030155600482015481600401559050506003805480610ceb57610cea6130d9565b5b60019003818190600052602060002090600502016000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560038201600090556004820160009055505090555b50610d84565b8080610d7c90612ef0565b9150506108d4565b505050565b6002548210610dcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc490612c7d565b60405180910390fd5b60008111610e10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0790612ce9565b60405180910390fd5b346004541115610e55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4c90613154565b60405180910390fd5b60005b60038054905081101561109f578260038281548110610e7a57610e79612d09565b5b9060005260206000209060050201600001540361108c573373ffffffffffffffffffffffffffffffffffffffff1660038281548110610ebc57610ebb612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3b90612d84565b60405180910390fd5b600060038281548110610f5a57610f59612d09565b5b906000526020600020906005020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401610fcb93929190612da4565b6020604051808303816000875af1158015610fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100e9190612e07565b50826003838154811061102457611023612d09565b5b906000526020600020906005020160030160008282546110449190612e63565b925050819055507f4999cd8dbcd222a69adfa39414998b13ae0e98e6c4339436d5de4a2a2999e63c84338560405161107e93929190612eb9565b60405180910390a15061109f565b808061109790612ef0565b915050610e58565b505050565b6110ac612724565b73ffffffffffffffffffffffffffffffffffffffff166110ca6115c5565b73ffffffffffffffffffffffffffffffffffffffff1614611120576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111790612f84565b60405180910390fd5b61112a600061272c565b565b6002548210611170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116790612c7d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d6906131c0565b60405180910390fd5b60005b60038054905081101561138557826003828154811061120457611203612d09565b5b90600052602060002090600502016000015403611372573373ffffffffffffffffffffffffffffffffffffffff166003828154811061124657611245612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c590612d84565b60405180910390fd5b81600382815481106112e3576112e2612d09565b5b906000526020600020906005020160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fbc094e7db0fd84a424331bf9edba2809f989e4be78687d4e4ee6015fde3e53ae833384604051611365939291906131e0565b60405180910390a1611385565b808061137d90612ef0565b9150506111e2565b505050565b6060600061139783611c76565b905060008167ffffffffffffffff8111156113b5576113b4613217565b5b6040519080825280602002602001820160405280156113ee57816020015b6113db61281e565b8152602001906001900390816113d35790505b5090506000915060005b6003805490508110156115ba578473ffffffffffffffffffffffffffffffffffffffff16600382815481106114305761142f612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036115a75760006003828154811061149357611492612d09565b5b90600052602060002090600502019050806040518060a0016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016003820154815260200160048201548152505083858151811061158c5761158b612d09565b5b602002602001018190525083806115a290612ef0565b945050505b80806115b290612ef0565b9150506113f8565b508092505050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165590613292565b60405180910390fd5b428110156116a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169890612ff0565b60405180910390fd5b600082116116e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116db90612ce9565b60405180910390fd5b346004541115611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613154565b60405180910390fd5b60008390508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b815260040161176b93929190612da4565b6020604051808303816000875af115801561178a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ae9190612e07565b5060036040518060a0016040528060025481526020018673ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030155608082015181600401555050600260008154809291906118f090612ef0565b91905055507f7059e4baf55d4f0976de149f01729e2b3a7a1dc64380cc74428a6041e9edc3028433858560405161192a94939291906132b2565b60405180910390a150505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036119a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199e90613292565b60405180910390fd5b428110156119ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e190612ff0565b60405180910390fd5b60008211611a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2490612ce9565b60405180910390fd5b60008390508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330611a8b611a7c612710611a6e6005548b6127f290919063ffffffff16565b6126f890919063ffffffff16565b8861270e90919063ffffffff16565b6040518463ffffffff1660e01b8152600401611aa993929190612da4565b6020604051808303816000875af1158015611ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aec9190612e07565b5060036040518060a0016040528060025481526020018673ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040155505060026000815480929190611c2e90612ef0565b91905055507f7059e4baf55d4f0976de149f01729e2b3a7a1dc64380cc74428a6041e9edc30284338585604051611c6894939291906132b2565b60405180910390a150505050565b6000806000905060005b600380549050811015611d27578373ffffffffffffffffffffffffffffffffffffffff1660038281548110611cb857611cb7612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611d14578180611d1090612ef0565b9250505b8080611d1f90612ef0565b915050611c80565b5080915050919050565b611d39612724565b73ffffffffffffffffffffffffffffffffffffffff16611d576115c5565b73ffffffffffffffffffffffffffffffffffffffff1614611dad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da490612f84565b60405180910390fd5b6000811015611df1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de890613343565b60405180910390fd5b8060048190555050565b611e03612724565b73ffffffffffffffffffffffffffffffffffffffff16611e216115c5565b73ffffffffffffffffffffffffffffffffffffffff1614611e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6e90612f84565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611ee6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611edd906133af565b60405180910390fd5b6000805b600380549050811015611fb6578273ffffffffffffffffffffffffffffffffffffffff1660038281548110611f2257611f21612d09565b5b906000526020600020906005020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611fa35760038181548110611f8357611f82612d09565b5b90600052602060002090600502016003015482611fa09190612e63565b91505b8080611fae90612ef0565b915050611eea565b50600082905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611ff79190612bb2565b602060405180830381865afa158015612014573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203891906133e4565b9050600061204f848361280890919063ffffffff16565b905060008111156120da578273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016120959291906130b0565b6020604051808303816000875af11580156120b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d89190612e07565b505b5050505050565b6120e9612724565b73ffffffffffffffffffffffffffffffffffffffff166121076115c5565b73ffffffffffffffffffffffffffffffffffffffff161461215d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215490612f84565b60405180910390fd5b60008110156121a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219890613343565b60405180910390fd5b6127108111156121e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121dd90613343565b60405180910390fd5b8060058190555050565b6002548210612234576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222b90612c7d565b60405180910390fd5b42811015612277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226e90612ff0565b60405180910390fd5b60005b60038054905081101561244b57826003828154811061229c5761229b612d09565b5b90600052602060002090600502016000015403612438573373ffffffffffffffffffffffffffffffffffffffff16600382815481106122de576122dd612d09565b5b906000526020600020906005020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612366576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235d90612d84565b60405180910390fd5b816003828154811061237b5761237a612d09565b5b90600052602060002090600502016004015411156123ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123c590612ff0565b60405180910390fd5b81600382815481106123e3576123e2612d09565b5b9060005260206000209060050201600401819055507f0edf60839a53eca485ba547288f02ef7416d47e54f68bc6ef75965751a7b812083338460405161242b93929190612eb9565b60405180910390a161244b565b808061244390612ef0565b91505061227a565b505050565b60055481565b60606000600380549050905060008167ffffffffffffffff81111561247e5761247d613217565b5b6040519080825280602002602001820160405280156124b757816020015b6124a461281e565b81526020019060019003908161249c5790505b50905060005b6003805490508110156125f8576000600382815481106124e0576124df612d09565b5b90600052602060002090600502019050806040518060a0016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600382015481526020016004820154815250508383815181106125d9576125d8612d09565b5b60200260200101819052505080806125f090612ef0565b9150506124bd565b50809250505090565b612609612724565b73ffffffffffffffffffffffffffffffffffffffff166126276115c5565b73ffffffffffffffffffffffffffffffffffffffff161461267d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267490612f84565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036126ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126e390613483565b60405180910390fd5b6126f58161272c565b50565b6000818361270691906134d2565b905092915050565b6000818361271c9190612e63565b905092915050565b600033905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081836128009190613503565b905092915050565b60008183612816919061307c565b905092915050565b6040518060a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b600080fd5b6000819050919050565b6128918161287e565b811461289c57600080fd5b50565b6000813590506128ae81612888565b92915050565b600080604083850312156128cb576128ca612879565b5b60006128d98582860161289f565b92505060206128ea8582860161289f565b9150509250929050565b60006020828403121561290a57612909612879565b5b60006129188482850161289f565b91505092915050565b60008115159050919050565b61293681612921565b82525050565b6000602082019050612951600083018461292d565b92915050565b6129608161287e565b82525050565b600060208201905061297b6000830184612957565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006129ac82612981565b9050919050565b6129bc816129a1565b81146129c757600080fd5b50565b6000813590506129d9816129b3565b92915050565b600080604083850312156129f6576129f5612879565b5b6000612a048582860161289f565b9250506020612a15858286016129ca565b9150509250929050565b600060208284031215612a3557612a34612879565b5b6000612a43848285016129ca565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612a818161287e565b82525050565b612a90816129a1565b82525050565b60a082016000820151612aac6000850182612a78565b506020820151612abf6020850182612a87565b506040820151612ad26040850182612a87565b506060820151612ae56060850182612a78565b506080820151612af86080850182612a78565b50505050565b6000612b0a8383612a96565b60a08301905092915050565b6000602082019050919050565b6000612b2e82612a4c565b612b388185612a57565b9350612b4383612a68565b8060005b83811015612b74578151612b5b8882612afe565b9750612b6683612b16565b925050600181019050612b47565b5085935050505092915050565b60006020820190508181036000830152612b9b8184612b23565b905092915050565b612bac816129a1565b82525050565b6000602082019050612bc76000830184612ba3565b92915050565b600080600060608486031215612be657612be5612879565b5b6000612bf4868287016129ca565b9350506020612c058682870161289f565b9250506040612c168682870161289f565b9150509250925092565b600082825260208201905092915050565b7f496e76616c6964206c6f636b6572206964000000000000000000000000000000600082015250565b6000612c67601183612c20565b9150612c7282612c31565b602082019050919050565b60006020820190508181036000830152612c9681612c5a565b9050919050565b7f496e76616c696420746f6b656e20616d6f756e74000000000000000000000000600082015250565b6000612cd3601483612c20565b9150612cde82612c9d565b602082019050919050565b60006020820190508181036000830152612d0281612cc6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f496e76616c6964206f776e657200000000000000000000000000000000000000600082015250565b6000612d6e600d83612c20565b9150612d7982612d38565b602082019050919050565b60006020820190508181036000830152612d9d81612d61565b9050919050565b6000606082019050612db96000830186612ba3565b612dc66020830185612ba3565b612dd36040830184612957565b949350505050565b612de481612921565b8114612def57600080fd5b50565b600081519050612e0181612ddb565b92915050565b600060208284031215612e1d57612e1c612879565b5b6000612e2b84828501612df2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612e6e8261287e565b9150612e798361287e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612eae57612ead612e34565b5b828201905092915050565b6000606082019050612ece6000830186612957565b612edb6020830185612ba3565b612ee86040830184612957565b949350505050565b6000612efb8261287e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612f2d57612f2c612e34565b5b600182019050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612f6e602083612c20565b9150612f7982612f38565b602082019050919050565b60006020820190508181036000830152612f9d81612f61565b9050919050565b7f496e76616c696420756e6c6f636b2074696d6500000000000000000000000000600082015250565b6000612fda601383612c20565b9150612fe582612fa4565b602082019050919050565b6000602082019050818103600083015261300981612fcd565b9050919050565b7f496e76616c6964204f776e657200000000000000000000000000000000000000600082015250565b6000613046600d83612c20565b915061305182613010565b602082019050919050565b6000602082019050818103600083015261307581613039565b9050919050565b60006130878261287e565b91506130928361287e565b9250828210156130a5576130a4612e34565b5b828203905092915050565b60006040820190506130c56000830185612ba3565b6130d26020830184612957565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e617469766520746f6b656e206973206e6f7420636f72726563740000000000600082015250565b600061313e601b83612c20565b915061314982613108565b602082019050919050565b6000602082019050818103600083015261316d81613131565b9050919050565b7f4d757374206265206e6f6e2d7a65726f20616464726573730000000000000000600082015250565b60006131aa601883612c20565b91506131b582613174565b602082019050919050565b600060208201905081810360008301526131d98161319d565b9050919050565b60006060820190506131f56000830186612957565b6132026020830185612ba3565b61320f6040830184612ba3565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f5a65726f20616464726573730000000000000000000000000000000000000000600082015250565b600061327c600c83612c20565b915061328782613246565b602082019050919050565b600060208201905081810360008301526132ab8161326f565b9050919050565b60006080820190506132c76000830187612ba3565b6132d46020830186612ba3565b6132e16040830185612957565b6132ee6060830184612957565b95945050505050565b7f496e76616c6964206665652070657263656e7461676500000000000000000000600082015250565b600061332d601683612c20565b9150613338826132f7565b602082019050919050565b6000602082019050818103600083015261335c81613320565b9050919050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b6000613399601583612c20565b91506133a482613363565b602082019050919050565b600060208201905081810360008301526133c88161338c565b9050919050565b6000815190506133de81612888565b92915050565b6000602082840312156133fa576133f9612879565b5b6000613408848285016133cf565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061346d602683612c20565b915061347882613411565b604082019050919050565b6000602082019050818103600083015261349c81613460565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006134dd8261287e565b91506134e88361287e565b9250826134f8576134f76134a3565b5b828204905092915050565b600061350e8261287e565b91506135198361287e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561355257613551612e34565b5b82820290509291505056fea2646970667358221220c6164bfd2eb921ca606935ac8d8aacd7eea1c94287dba0c555b0a789ba1a95e064736f6c634300080d0033