- Contract name:
- PresaleFactory
- Optimization enabled
- true
- Compiler version
- v0.8.13+commit.abaa5c0e
- Optimization runs
- 5000
- EVM Version
- default
- Verified at
- 2024-07-20T06:18:20.651856Z
contracts/Presale/Meter/PresaleFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Presale.sol";
contract PresaleFactory {
function deploy(
address manage,
address wethfact,
address setting,
address lockaddr
) external payable returns (PresaleV1) {
return
(new PresaleV1){value: msg.value}(
manage,
wethfact,
setting,
lockaddr
);
}
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
@openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
contracts/interfaces/IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// 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);
}
contracts/LiquidityLock/LPLock.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract LPLocker {
address public owner;
uint256 public price;
uint256 public penaltyfee;
struct holder {
address holderAddress;
mapping(address => Token) tokens;
}
struct Token {
uint256 balance;
address tokenAddress;
uint256 unlockTime;
}
modifier onlyOwner() {
require(msg.sender == owner, "Only available to the contract owner.");
_;
}
mapping(address => holder) public holders;
constructor(address _owner, uint256 _price) {
owner = _owner;
price = _price;
penaltyfee = 10; // default value
}
event Hold(
address indexed holder,
address token,
uint256 amount,
uint256 unlockTime
);
event PanicWithdraw(
address indexed holder,
address token,
uint256 amount,
uint256 unlockTime
);
event Withdrawal(address indexed holder, address token, uint256 amount);
event FeesClaimed();
event SetOwnerSuccess(address owner);
event SetPriceSuccess(uint256 _price);
event SetPenaltyFeeSuccess(uint256 _fee);
event OwnerWithdrawSuccess(uint256 amount);
function lpLock(
address token,
uint256 amount,
uint256 unlockTime,
address withdrawer
) public payable {
require(msg.value >= price, "Required price is low");
holder storage holder0 = holders[withdrawer];
holder0.holderAddress = withdrawer;
Token storage lockedToken = holders[withdrawer].tokens[token];
if (lockedToken.balance > 0) {
lockedToken.balance += amount;
if (lockedToken.unlockTime < unlockTime) {
lockedToken.unlockTime = unlockTime;
}
} else {
holders[withdrawer].tokens[token] = Token(
amount,
token,
unlockTime
);
}
IERC20(token).transferFrom(withdrawer, address(this), amount);
emit Hold(withdrawer, token, amount, unlockTime);
}
function withdraw(address token) public {
holder storage holder0 = holders[msg.sender];
require(
msg.sender == holder0.holderAddress,
"Only available to the token owner."
);
require(
block.timestamp > holder0.tokens[token].unlockTime,
"Unlock time not reached yet."
);
uint256 amount = holder0.tokens[token].balance;
holder0.tokens[token].balance = 0;
IERC20(token).transfer(msg.sender, amount);
emit Withdrawal(msg.sender, token, amount);
}
function panicWithdraw(address token) public {
holder storage holder0 = holders[msg.sender];
require(
msg.sender == holder0.holderAddress,
"Only available to the token owner."
);
uint256 feeAmount = (holder0.tokens[token].balance / 100) * penaltyfee;
uint256 withdrawalAmount = holder0.tokens[token].balance - feeAmount;
holder0.tokens[token].balance = 0;
//Transfers fees to the contract administrator/owner
// holders[address(owner)].tokens[token].balance = feeAmount;
// Transfers fees to the token owner
IERC20(token).transfer(msg.sender, withdrawalAmount);
// Transfers fees to the contract administrator/owner
IERC20(token).transfer(owner, feeAmount);
emit PanicWithdraw(
msg.sender,
token,
withdrawalAmount,
holder0.tokens[token].unlockTime
);
}
// function claimTokenListFees(address[] memory tokenList) public onlyOwner {
// for (uint256 i = 0; i < tokenList.length; i++) {
// uint256 amount = holders[owner].tokens[tokenList[i]].balance;
// if (amount > 0) {
// holders[owner].tokens[tokenList[i]].balance = 0;
// IERC20(tokenList[i]).transfer(owner, amount);
// }
// }
// emit FeesClaimed();
// }
// function claimTokenFees(address token) public onlyOwner {
// uint256 amount = holders[owner].tokens[token].balance;
// require(amount > 0, "No fees available for claiming.");
// holders[owner].tokens[token].balance = 0;
// IERC20(token).transfer(owner, amount);
// emit FeesClaimed();
// }
function OwnerWithdraw() public onlyOwner {
uint256 amount = address(this).balance;
address payable ownerAddress = payable(owner);
ownerAddress.transfer(amount);
emit OwnerWithdrawSuccess(amount);
}
function getcurtime() public view returns (uint256) {
return block.timestamp;
}
function GetBalance(address token) public view returns (uint256) {
Token storage lockedToken = holders[msg.sender].tokens[token];
return lockedToken.balance;
}
function SetOwner(address contractowner) public onlyOwner {
owner = contractowner;
emit SetOwnerSuccess(owner);
}
function SetPrice(uint256 _price) public onlyOwner {
price = _price;
emit SetPriceSuccess(price);
}
// function GetPrice() public view returns (uint256) {
// return price;
// }
function SetPenaltyFee(uint256 _penaltyfee) public onlyOwner {
penaltyfee = _penaltyfee;
emit SetPenaltyFeeSuccess(penaltyfee);
}
// function GetPenaltyFee() public view returns (uint256) {
// return penaltyfee;
// }
function GetUnlockTime(address token) public view returns (uint256) {
Token storage lockedToken = holders[msg.sender].tokens[token];
return lockedToken.unlockTime;
}
}
contracts/Presale/Meter/Presale.sol
// SPDX-License-Identifier: UNLICENSED
// @Credits Defi Site Network 2021
// Presale contract. Version 1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../../interfaces/IWETH.sol";
import "../TransferHelper.sol";
import "./SharedStructs.sol";
import "./PresaleLockForwarder.sol";
import "../PresaleSettings.sol";
contract PresaleV1 is ReentrancyGuard {
/// @notice Presale Contract Version, used to choose the correct ABI to decode the contract
// uint256 public contract_version = 1;
struct PresaleFeeInfo {
uint256 raised_fee; // divided by 100
uint256 sold_fee; // divided by 100
uint256 referral_fee; // divided by 100
address payable raise_fee_address;
address payable sole_fee_address;
address payable referral_fee_address; // if this is not address(0), there is a valid referral
}
struct PresaleStatus {
bool lp_generation_complete; // final flag required to end a presale and enable withdrawls
bool force_failed; // set this flag to force fail the presale
uint256 raised_amount; // total base currency raised (usually ETH)
uint256 sold_amount; // total presale tokens sold
uint256 token_withdraw; // total tokens withdrawn post successful presale
uint256 base_withdraw; // total base tokens withdrawn on presale failure
uint256 num_buyers; // number of unique participants
}
struct BuyerInfo {
uint256 base; // total base token (usually ETH) deposited by user, can be withdrawn on presale failure
uint256 sale; // num presale tokens a user is owed, can be withdrawn on presale success
}
struct TokenInfo {
string name;
string symbol;
uint256 totalsupply;
uint256 decimal;
}
SharedStructs.PresaleInfo public presale_info;
PresaleStatus public status;
SharedStructs.PresaleLink public link;
PresaleFeeInfo public presale_fee_info;
TokenInfo public tokeninfo;
address manage_addr;
// IUniswapV2Factory public uniswapfactory;
IWETH private WETH;
PresaleSettings public presale_setting;
PresaleLockForwarder public presale_lock_forwarder;
mapping(address => BuyerInfo) public buyers;
event UserDepsitedSuccess(address, uint256);
event UserWithdrawSuccess(uint256);
event UserWithdrawTokensSuccess(uint256);
event AddLiquidtySuccess(uint256);
constructor(
address manage,
address wethfact,
address setting,
address lockaddr
) payable {
presale_setting = PresaleSettings(setting);
require(
msg.value >= presale_setting.getLockFee(),
"Balance is insufficent"
);
manage_addr = manage;
// uniswapfactory = IUniswapV2Factory(uniswapfact);
WETH = IWETH(wethfact);
presale_lock_forwarder = PresaleLockForwarder(lockaddr);
}
function init_private(SharedStructs.PresaleInfo memory _presale_info)
external
{
require(msg.sender == manage_addr, "Only manage address is available");
presale_info = _presale_info;
//Set token token info
tokeninfo.name = IERC20Metadata(_presale_info.sale_token).name();
tokeninfo.symbol = IERC20Metadata(_presale_info.sale_token).symbol();
tokeninfo.decimal = IERC20Metadata(_presale_info.sale_token).decimals();
tokeninfo.totalsupply = IERC20Metadata(_presale_info.sale_token)
.totalSupply();
}
function init_link(SharedStructs.PresaleLink memory _link) external {
require(msg.sender == manage_addr, "Only manage address is available");
link = _link;
}
function init_fee() external {
require(msg.sender == manage_addr, "Only manage address is available");
presale_fee_info.raised_fee = presale_setting.getRasiedFee(); // divided by 100
presale_fee_info.sold_fee = presale_setting.getSoldFee(); // divided by 100
presale_fee_info.referral_fee = presale_setting.getRefferralFee(); // divided by 100
presale_fee_info.raise_fee_address = presale_setting
.getRaisedFeeAddress();
presale_fee_info.sole_fee_address = presale_setting.getSoleFeeAddress();
presale_fee_info.referral_fee_address = presale_setting
.getReferralFeeAddress(); // if this is not address(0), there is a valid referral
}
modifier onlyPresaleOwner() {
require(presale_info.presale_owner == msg.sender, "NOT PRESALE OWNER");
_;
}
// uint256 tempstatus;
// function setTempStatus(uint256 flag) public {
// tempstatus = flag;
// }
function presaleStatus() public view returns (uint256) {
// return tempstatus;
if (status.force_failed) {
return 3; // FAILED - force fail
}
if (
(block.timestamp > presale_info.presale_end) &&
(status.raised_amount < presale_info.softcap)
) {
return 3;
}
if (status.raised_amount >= presale_info.hardcap) {
return 2; // SUCCESS - hardcap met
}
if (
(block.timestamp > presale_info.presale_end) &&
(status.raised_amount >= presale_info.softcap)
) {
return 2; // SUCCESS - preslae end and soft cap reached
}
if (
(block.timestamp >= presale_info.presale_start) &&
(block.timestamp <= presale_info.presale_end)
) {
return 1; // ACTIVE - deposits enabled
}
return 0; // QUED - awaiting start block
}
// accepts msg.value for eth or _amount for ERC20 tokens
function userDeposit() public payable nonReentrant {
require(presaleStatus() == 1, "NOT ACTIVE"); //
require(presale_info.raise_min <= msg.value, "balance is insufficent");
require(presale_info.raise_max >= msg.value, "balance is too much");
BuyerInfo storage buyer = buyers[msg.sender];
uint256 amount_in = msg.value;
uint256 allowance = presale_info.raise_max - buyer.base;
uint256 remaining = presale_info.hardcap - status.raised_amount;
allowance = allowance > remaining ? remaining : allowance;
if (amount_in > allowance) {
amount_in = allowance;
}
uint256 tokensSold = (amount_in * presale_info.token_rate) / (10**18);
require(tokensSold > 0, "ZERO TOKENS");
require(
tokensSold <=
IERC20(presale_info.sale_token).balanceOf(address(this)),
"Token reamin error"
);
if (buyer.base == 0) {
status.num_buyers++;
}
buyers[msg.sender].base = buyers[msg.sender].base + amount_in;
buyers[msg.sender].sale = buyers[msg.sender].sale + tokensSold;
status.raised_amount = status.raised_amount + amount_in;
status.sold_amount = status.sold_amount + tokensSold;
// return unused ETH
if (amount_in < msg.value) {
payable(msg.sender).transfer(msg.value - amount_in);
}
emit UserDepsitedSuccess(msg.sender, msg.value);
}
// withdraw presale tokens
// percentile withdrawls allows fee on transfer or rebasing tokens to still work
function userWithdrawTokens() public nonReentrant {
require(status.lp_generation_complete, "AWAITING LP GENERATION");
BuyerInfo storage buyer = buyers[msg.sender];
uint256 tokensRemainingDenominator = status.sold_amount -
status.token_withdraw;
uint256 tokensOwed = (IERC20(presale_info.sale_token).balanceOf(
address(this)
) * buyer.sale) / tokensRemainingDenominator;
require(tokensOwed > 0, "NOTHING TO WITHDRAW");
status.token_withdraw = status.token_withdraw + buyer.sale;
buyers[msg.sender].sale = 0;
buyers[msg.sender].base = 0;
TransferHelper.safeTransfer(
address(presale_info.sale_token),
msg.sender,
tokensOwed
);
emit UserWithdrawTokensSuccess(tokensOwed);
}
// on presale failure
// percentile withdrawls allows fee on transfer or rebasing tokens to still work
function userWithdrawBaseTokens() public nonReentrant {
require(presaleStatus() == 3, "NOT FAILED"); // FAILED
if (msg.sender == presale_info.presale_owner) {
ownerWithdrawTokens();
// return;
}
BuyerInfo storage buyer = buyers[msg.sender];
uint256 baseRemainingDenominator = status.raised_amount -
status.base_withdraw;
uint256 remainingBaseBalance = address(this).balance;
uint256 tokensOwed = (remainingBaseBalance * buyer.base) /
baseRemainingDenominator;
require(tokensOwed > 0, "NOTHING TO WITHDRAW");
status.base_withdraw = status.base_withdraw + buyer.base;
buyer.base = 0;
buyer.sale = 0;
address payable reciver = payable(msg.sender);
reciver.transfer(tokensOwed);
emit UserWithdrawSuccess(tokensOwed);
// TransferHelper.safeTransferBaseToken(address(presale_info.base_token), msg.sender, tokensOwed, false);
}
// on presale failure
// allows the owner to withdraw the tokens they sent for presale & initial liquidity
function ownerWithdrawTokens() private onlyPresaleOwner {
require(presaleStatus() == 3, "Only failed status"); // FAILED
TransferHelper.safeTransfer(
address(presale_info.sale_token),
presale_info.presale_owner,
IERC20(presale_info.sale_token).balanceOf(address(this))
);
emit UserWithdrawSuccess(
IERC20(presale_info.sale_token).balanceOf(address(this))
);
}
// Can be called at any stage before or during the presale to cancel it before it ends.
// If the pair already exists on uniswap and it contains the presale token as liquidity
// the final stage of the presale 'addLiquidity()' will fail. This function
// allows anyone to end the presale prematurely to release funds in such a case.
function forceFailIfPairExists() public {
require(!status.lp_generation_complete && !status.force_failed);
if (
presale_lock_forwarder.uniswapPairIsInitialised(
address(presale_info.sale_token),
address(WETH)
)
) {
status.force_failed = true;
}
}
// if something goes wrong in LP generation
// function forceFail () external {
// require(msg.sender == OCTOFI_FEE_ADDRESS);
// status.force_failed = true;
// }
// on presale success, this is the final step to end the presale, lock liquidity and enable withdrawls of the sale token.
// This function does not use percentile distribution. Rebasing mechanisms, fee on transfers, or any deflationary logic
// are not taken into account at this stage to ensure stated liquidity is locked and the pool is initialised according to
// the presale parameters and fixed prices.
function addLiquidity() public nonReentrant onlyPresaleOwner {
require(!status.lp_generation_complete, "GENERATION COMPLETE");
require(presaleStatus() == 2, "NOT SUCCESS"); // SUCCESS
// Fail the presale if the pair exists and contains presale token liquidity
if (
presale_lock_forwarder.uniswapPairIsInitialised(
address(presale_info.sale_token),
address(WETH)
)
) {
status.force_failed = true;
emit AddLiquidtySuccess(0);
return;
}
// require(!presale_lock_forwarder.uniswapPairIsInitialised(address(presale_info.sale_token), address(WETH)), "Liqudity exist");
uint256 presale_raisedfee = (status.raised_amount *
presale_setting.getRasiedFee()) / 100;
// base token liquidity
uint256 baseLiquidity = ((status.raised_amount - presale_raisedfee) *
(presale_info.liqudity_percent)) / 100;
// WETH.deposit{value : baseLiquidity}();
// require(WETH.approve(address(presale_lock_forwarder), baseLiquidity), 'approve failed.');
// TransferHelper.safeApprove(address(presale_info.base_token), address(presale_lock_forwarder), baseLiquidity);
// sale token liquidity
uint256 tokenLiquidity = (baseLiquidity * presale_info.listing_rate) /
(10**18);
require(tokenLiquidity > 0, "ZERO Tokens");
TransferHelper.safeApprove(
address(presale_info.sale_token),
address(presale_lock_forwarder),
tokenLiquidity
);
presale_lock_forwarder.lockLiquidity{
value: presale_setting.getLockFee() + baseLiquidity
}(
address(presale_info.sale_token),
baseLiquidity,
tokenLiquidity,
presale_info.lock_end,
presale_info.presale_owner
);
uint256 presaleSoldFee = (status.sold_amount *
presale_setting.getSoldFee()) / 100;
address payable reciver = payable(
address(presale_fee_info.raise_fee_address)
);
reciver.transfer(presale_raisedfee);
// TransferHelper.safeTransferBaseToken(address(presale_info.base_token), presale_fee_info.raise_fee_address, presale_raisedfee, false);
TransferHelper.safeTransfer(
address(presale_info.sale_token),
presale_fee_info.sole_fee_address,
presaleSoldFee
);
// burn unsold tokens
uint256 remainingSBalance = IERC20(presale_info.sale_token).balanceOf(
address(this)
);
if (remainingSBalance > status.sold_amount) {
uint256 burnAmount = remainingSBalance - status.sold_amount;
TransferHelper.safeTransfer(
address(presale_info.sale_token),
0x000000000000000000000000000000000000dEaD,
burnAmount
);
}
// send remaining base tokens to presale owner
uint256 remainingBaseBalance = address(this).balance;
address payable presale_fee_reciver = payable(
address(presale_info.presale_owner)
);
presale_fee_reciver.transfer(remainingBaseBalance);
status.lp_generation_complete = true;
emit AddLiquidtySuccess(1);
}
function destroy() public {
require(status.lp_generation_complete, "lp generation incomplete");
selfdestruct(presale_info.presale_owner);
}
// function getTokenNmae() public view returns (string memory) {
// return presale_info.sale_token.name();
// }
// function getTokenSymbol() public view returns (string memory) {
// return presale_info.sale_token.symbol();
// }
}
contracts/Presale/Meter/PresaleLockForwarder.sol
// SPDX-License-Identifier: UNLICENSED
// @Credits Unicrypt Network 2021
/**
This contract creates the lock on behalf of each presale. This contract will be whitelisted to bypass the flat rate
ETH fee. Please do not use the below locking code in your own contracts as the lock will fail without the ETH fee
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./PresaleManage.sol";
import "../../interfaces/IWETH.sol";
import "../../interfaces/IUniswapV2Factory.sol";
import "../../interfaces/IUniswapV2Router02.sol";
import "../../interfaces/IUniswapV2Pair.sol";
import "../../LiquidityLock/LPLock.sol";
import "../TransferHelper.sol";
contract PresaleLockForwarder {
LPLocker public lplocker;
IUniswapV2Factory public uniswapfactory;
IUniswapV2Router02 public uniswaprouter;
PresaleManage manage;
IWETH public WETH;
mapping(address => address) public locked_lp_tokens;
mapping(address => address) public locked_lp_owner;
constructor(
address _manage,
address lplock_addrress,
address unifactaddr,
address unirouter,
address wethaddr
) public {
lplocker = LPLocker(lplock_addrress);
uniswapfactory = IUniswapV2Factory(unifactaddr);
uniswaprouter = IUniswapV2Router02(unirouter);
WETH = IWETH(wethaddr);
manage = PresaleManage(_manage);
}
/**
Send in _token0 as the PRESALE token, _token1 as the BASE token (usually WETH) for the check to work. As anyone can create a pair,
and send WETH to it while a presale is running, but no one should have access to the presale token. If they do and they send it to
the pair, scewing the initial liquidity, this function will return true
*/
function uniswapPairIsInitialised(address _token0, address _token1)
public
view
returns (bool)
{
address pairAddress = uniswapfactory.getPair(_token0, _token1);
if (pairAddress == address(0)) {
return false;
}
uint256 balance = IERC20(_token0).balanceOf(pairAddress);
if (balance > 0) {
return true;
}
return false;
}
// function lockLiquidity (IERC20 _saleToken, uint256 _unlock_date, address payable _withdrawer) payable external {
// require(msg.value >= lplocker.price(), 'Balance is insufficient');
// address pair = uniswapfactory.getPair(address(WETH), address(_saleToken));
// uint256 totalLPTokensMinted = IUniswapV2Pair(pair).balanceOf(address(this));
// require(totalLPTokensMinted != 0 , "LP creation failed");
// TransferHelper.safeApprove(pair, address(lplocker), totalLPTokensMinted);
// uint256 unlock_date = _unlock_date > 9999999999 ? 9999999999 : _unlock_date;
// lplocker.lpLock{value:lplocker.price()}(pair, totalLPTokensMinted, unlock_date, _withdrawer );
// lptokens[msg.sender] = pair;
// }
function lockLiquidity(
address _saleToken,
uint256 _baseAmount,
uint256 _saleAmount,
uint256 _unlock_date,
address payable _withdrawer
) external payable {
require(manage.IsRegistered(msg.sender), "PRESALE NOT REGISTERED");
require(
msg.value >= lplocker.price() + _baseAmount,
"Balance is insufficient"
);
// if (pair == address(0)) {
// uniswapfactory.createPair(address(WETH), address(_saleToken));
// pair = uniswapfactory.getPair(address(WETH), address(_saleToken));
// }
// require(WETH.transferFrom(msg.sender, address(this), _baseAmount), 'WETH transfer failed.');
// TransferHelper.safeTransferFrom(address(_baseToken), msg.sender, address(pair), _baseAmount);
TransferHelper.safeTransferFrom(
address(_saleToken),
msg.sender,
address(this),
_saleAmount
);
// IUniswapV2Pair(pair).mint(address(this));
// return;
// require(WETH.approve(address(uniswaprouter), _baseAmount), 'router approve failed.');
// _saleToken.approve(address(uniswaprouter), _saleAmount);
TransferHelper.safeApprove(
address(_saleToken),
address(uniswaprouter),
_saleAmount
);
// construct token path
// address[] memory path = new address[](2);
// path[0] = address(WETH);
// path[1] = address(_saleToken);
// IUniswapV2Router02(uniswaprouter).swapExactTokensForTokens(
// WETH.balanceOf(address(this)).div(2),
// 0,
// path,
// address(this),
// block.timestamp + 5 minutes
// );
// // calculate balances and add liquidity
// uint256 wethBalance = WETH.balanceOf(address(this));
// uint256 balance = _saleToken.balanceOf(address(this));
// IUniswapV2Router02(uniswaprouter).addLiquidity(
// address(_saleToken),
// address(WETH),
// balance,
// wethBalance,
// 0,
// 0,
// address(this),
// block.timestamp + 5 minutes
// );
IUniswapV2Router02(address(uniswaprouter)).addLiquidityETH{
value: _baseAmount
}(
address(_saleToken),
_saleAmount,
0,
0,
payable(address(this)),
block.timestamp + 5 minutes
);
address pair = uniswapfactory.getPair(
address(WETH),
address(_saleToken)
);
uint256 totalLPTokensMinted = IUniswapV2Pair(pair).balanceOf(
address(this)
);
require(totalLPTokensMinted != 0, "LP creation failed");
TransferHelper.safeApprove(
pair,
address(lplocker),
totalLPTokensMinted
);
uint256 unlock_date = _unlock_date > 9999999999
? 9999999999
: _unlock_date;
lplocker.lpLock{value: lplocker.price()}(
pair,
totalLPTokensMinted,
unlock_date,
_withdrawer
);
locked_lp_tokens[address(_saleToken)] = pair;
locked_lp_owner[address(_saleToken)] = _withdrawer;
payable(_withdrawer).transfer(address(this).balance);
}
}
contracts/Presale/Meter/PresaleManage.sol
// SPDX-License-Identifier: UNLICENSED
// @Credits Unicrypt Network 2021
// This contract generates Presale01 contracts and registers them in the PresaleFactory.
// Ideally you should not interact with this contract directly, and use the Octofi presale app instead so warnings can be shown where necessary.
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../TransferHelper.sol";
import "../PresaleSettings.sol";
import "./SharedStructs.sol";
import "./PresaleLockForwarder.sol";
import "./PresaleFactory.sol";
import "./Presale.sol";
contract PresaleManage {
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private presales;
PresaleFactory internal presaleFactory;
address public presale_lock_forward_addr;
address public presale_setting_addr;
PresaleLockForwarder _lock;
address private uniswap_factory_address;
address private uniswap_pair_address;
address private weth_address;
address payable owner;
SharedStructs.PresaleInfo presale_info;
SharedStructs.PresaleLink presalelink;
PresaleSettings public settings;
event OwnerWithdrawSuccess(uint256 value);
event CreatePreslaeSuccess(address, address);
constructor(
address payable _owner,
address lock_addr,
address uniswapfactory_addr,
address uniswaprouter_Addr,
address weth_addr,
PresaleFactory _presaleFactory
) {
owner = _owner;
uniswap_factory_address = uniswapfactory_addr;
weth_address = weth_addr;
_lock = new PresaleLockForwarder(
address(this),
lock_addr,
uniswapfactory_addr,
uniswaprouter_Addr,
weth_addr
);
presale_lock_forward_addr = address(_lock);
PresaleSettings _setting;
_setting = new PresaleSettings(address(this), _owner, lock_addr);
_setting.init(owner, 0.01 ether, owner, 10, owner, 10, owner, 10);
presale_setting_addr = address(_setting);
settings = PresaleSettings(presale_setting_addr);
presaleFactory = _presaleFactory;
}
function ownerWithdraw() public {
require(
msg.sender == settings.getCreateFeeAddress(),
"Only creater can withdraw"
);
address payable reciver = payable(settings.getCreateFeeAddress());
reciver.transfer(address(this).balance);
// owner.transfer(address(this).balance);
emit OwnerWithdrawSuccess(address(this).balance);
}
/**
* @notice Creates a new Presale contract and registers it in the PresaleFactory.sol.
*/
function calculateAmountRequired(
uint256 _amount,
uint256 _tokenPrice,
uint256 _listingRate,
uint256 _liquidityPercent,
uint256 _tokenFee
) public pure returns (uint256) {
uint256 tokenamount = (_amount * _tokenPrice) / (10**18);
uint256 TokenFee = (((_amount * _tokenFee) / 100) / 10**18) *
_tokenPrice;
uint256 liqudityrateamount = (_amount * _listingRate) / (10**18);
uint256 liquiditytoken = (liqudityrateamount * _liquidityPercent) / 100;
uint256 tokensRequiredForPresale = tokenamount +
liquiditytoken +
TokenFee;
return tokensRequiredForPresale;
}
function createPresale(
SharedStructs.PresaleInfo memory _presale_info,
SharedStructs.PresaleLink memory _presalelink
) public payable {
presale_info = _presale_info;
presalelink = _presalelink;
// if ( (presale_info.presale_end - presale_info.presale_start) < 1 weeks) {
// presale_info.presale_end = presale_info.presale_start + 1 weeks;
// }
// if ( (presale_info.lock_end - presale_info.lock_start) < 4 weeks) {
// presale_info.lock_end = presale_info.lock_start + 4 weeks;
// }
// Charge ETH fee for contract creation
require(
msg.value >= settings.getPresaleCreateFee() + settings.getLockFee(),
"Balance is insufficent"
);
require(_presale_info.token_rate > 0, "token rate is invalid");
require(
_presale_info.raise_min < _presale_info.raise_max,
"raise min/max in invalid"
);
require(
_presale_info.softcap <= _presale_info.hardcap,
"softcap/hardcap is invalid"
);
require(
_presale_info.liqudity_percent >= 30 &&
_presale_info.liqudity_percent <= 100,
"Liqudity percent is invalid"
);
require(_presale_info.listing_rate > 0, "Listing rate is invalid");
require(
(_presale_info.presale_end - _presale_info.presale_start) > 0,
"Presale start/end time is invalid"
);
require(
(_presale_info.lock_end - _presale_info.lock_start) >= 4 weeks,
"Lock end is invalid"
);
// Calculate required token amount
uint256 tokensRequiredForPresale = calculateAmountRequired(
_presale_info.hardcap,
_presale_info.token_rate,
_presale_info.listing_rate,
_presale_info.liqudity_percent,
settings.getSoldFee()
);
// Create New presale
PresaleV1 newPresale = presaleFactory.deploy{
value: settings.getLockFee()
}(
address(this),
weth_address,
presale_setting_addr,
presale_lock_forward_addr
);
// newPresale.delegatecall(bytes4(sha3("destroy()")));
if (address(newPresale) == address(0)) {
// newPresale.destroy();
require(false, "Create presale Failed");
}
TransferHelper.safeTransferFrom(
address(_presale_info.sale_token),
address(msg.sender),
address(newPresale),
tokensRequiredForPresale
);
newPresale.init_private(_presale_info);
newPresale.init_link(_presalelink);
newPresale.init_fee();
presales.add(address(newPresale));
emit CreatePreslaeSuccess(address(newPresale), address(msg.sender));
}
function getCount() external view returns (uint256) {
return presales.length();
}
function getBalance() external view returns (uint256) {
return address(this).balance;
}
function getPresaleAt(uint256 index) external view returns (address) {
return presales.at(index);
}
function IsRegistered(address presale_addr) external view returns (bool) {
return presales.contains(presale_addr);
}
}
contracts/Presale/Meter/SharedStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SharedStructs {
struct PresaleInfo {
address payable presale_owner;
address sale_token; // sale token
uint256 token_rate; // 1 base token = ? s_tokens, fixed price
uint256 raise_min; // maximum base token BUY amount per buyer
uint256 raise_max; // the amount of presale tokens up for presale
uint256 hardcap; // Maximum riase amount
uint256 softcap; //Minimum raise amount
uint256 liqudity_percent; // divided by 1000
uint256 listing_rate; // fixed rate at which the token will list on uniswap
uint256 lock_end; // uniswap lock timestamp -> e.g. 2 weeks
uint256 lock_start;
uint256 presale_end; // presale period
uint256 presale_start; // presale start
}
struct PresaleLink {
string website_link;
string github_link;
string twitter_link;
string reddit_link;
string telegram_link;
}
}
contracts/Presale/PresaleSettings.sol
// SPDX-License-Identifier: UNLICENSED
// @Credits Unicrypt Network 2021
// Settings to initialize presale contracts and edit fees.
pragma solidity ^0.8.0;
interface ILpLocker {
function price() external pure returns (uint256);
}
contract PresaleSettings {
address private owner;
address private manage;
ILpLocker locker;
struct SettingsInfo {
uint256 raised_fee; // divided by 100
uint256 sold_fee; // divided by 100
uint256 referral_fee; // divided by 100
uint256 presale_create_fee; // divided by 100
address payable raise_fee_address;
address payable sole_fee_address;
address payable referral_fee_address; // if this is not address(0), there is a valid referral
address payable create_fee_address; // if this is not address(0), there is a valid referral
}
SettingsInfo public info;
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyManager() {
require(manage == msg.sender, "Ownable: caller is not the manager");
_;
}
event setRaiseFeeAddrSuccess(address indexed addr);
event setRaisedFeeSuccess(uint256 num);
event setSoleFeeAddrSuccess(address indexed addr);
event setSoldFeeSuccess(uint256 num);
event setReferralFeeAddrSuccess(address addr);
event setReferralFeeSuccess(uint256 num);
event setCreateFeeAddrSuccess(address addr);
event setCreateFeeSuccess(uint256 num);
event setFeeInfoSuccess(uint256);
constructor(
address _manage,
address _owner,
address lockaddr
) public {
owner = _owner;
manage = _manage;
locker = ILpLocker(lockaddr);
}
function init(
address payable _presale_create_fee_addr,
uint256 _presale_create_fee,
address payable _raise_fee_addr,
uint256 _raised_fee,
address payable _sole_fee_address,
uint256 _sold_fee,
address payable _referral_fee_address,
uint256 _referral_fee
) public onlyManager {
info.presale_create_fee = _presale_create_fee;
info.raise_fee_address = _raise_fee_addr;
info.raised_fee = _raised_fee;
info.sole_fee_address = _sole_fee_address;
info.sold_fee = _sold_fee;
info.referral_fee_address = _referral_fee_address;
info.referral_fee = _referral_fee;
info.create_fee_address = _presale_create_fee_addr;
}
function getRaisedFeeAddress()
external
view
returns (address payable _raise_fee_addr)
{
return info.raise_fee_address;
}
function setRaisedFeeAddress(address payable _raised_fee_addr)
external
onlyOwner
{
info.raise_fee_address = _raised_fee_addr;
emit setRaiseFeeAddrSuccess(info.raise_fee_address);
}
function getRasiedFee() external view returns (uint256) {
return info.raised_fee;
}
function setRaisedFee(uint256 _raised_fee) external onlyOwner {
info.raised_fee = _raised_fee;
emit setRaisedFeeSuccess(info.raised_fee);
}
function getSoleFeeAddress()
external
view
returns (address payable _sole_fee_address)
{
return info.sole_fee_address;
}
function setSoleFeeAddress(address payable _sole_fee_address)
external
onlyOwner
{
info.sole_fee_address = _sole_fee_address;
emit setSoleFeeAddrSuccess(info.sole_fee_address);
}
function getSoldFee() external view returns (uint256) {
return info.sold_fee;
}
function setSoldFee(uint256 _sold_fee) external onlyOwner {
info.sold_fee = _sold_fee;
emit setSoldFeeSuccess(info.sold_fee);
}
function getReferralFeeAddress() external view returns (address payable) {
return info.referral_fee_address;
}
function setReferralFeeAddress(address payable _referral_fee_address)
external
onlyOwner
{
info.sole_fee_address = _referral_fee_address;
emit setReferralFeeAddrSuccess(info.referral_fee_address);
}
function getRefferralFee() external view returns (uint256) {
return info.referral_fee;
}
function setRefferralFee(uint256 _referral_fee) external onlyOwner {
info.referral_fee = _referral_fee;
emit setReferralFeeSuccess(info.referral_fee);
}
function getLockFee() external view returns (uint256) {
return locker.price();
}
function getPresaleCreateFee() external view returns (uint256) {
return info.presale_create_fee;
}
function setSetPresaleCreateFee(uint256 _presale_create_fee)
external
onlyOwner
{
info.presale_create_fee = _presale_create_fee;
emit setCreateFeeSuccess(info.presale_create_fee);
}
function getCreateFeeAddress() external view returns (address payable) {
return info.create_fee_address;
}
function setCreateFeeAddress(address payable _create_fee_address)
external
onlyOwner
{
info.create_fee_address = _create_fee_address;
emit setReferralFeeAddrSuccess(info.create_fee_address);
}
function setFeeInfo(
address payable _create_address,
address payable _raise_address,
address payable _sold_address,
uint256 _create_fee,
uint256 _raise_fee,
uint256 _sold_fee
) external onlyOwner {
info.create_fee_address = _create_address;
info.raise_fee_address = _raise_address;
info.sole_fee_address = _sold_address;
info.presale_create_fee = _create_fee;
info.raised_fee = _raise_fee;
info.sold_fee = _sold_fee;
emit setFeeInfoSuccess(1);
}
}
contracts/Presale/TransferHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
helper methods for interacting with ERC20 tokens that do not consistently return true/false
with the addition of a transfer function to send eth or an erc20 token
*/
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x095ea7b3, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: APPROVE_FAILED"
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0xa9059cbb, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FAILED"
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x23b872dd, from, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FROM_FAILED"
);
}
// sends ETH or an erc20 token
function safeTransferBaseToken(
address token,
address payable to,
uint256 value,
bool isERC20
) internal {
if (!isERC20) {
to.transfer(value);
} else {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0xa9059cbb, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FAILED"
);
}
}
}
contracts/interfaces/IUniswapV2Factory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
contracts/interfaces/IUniswapV2Pair.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
contracts/interfaces/IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IUniswapV2Router01.sol";
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contracts/interfaces/IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function balanceOf(address owner) external view returns (uint256);
function decimals() external view returns (uint256);
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","devdoc","userdoc","storageLayout","evm.gasEstimates"],"":["ast"]}},"optimizer":{"runs":5000,"enabled":true},"metadata":{"useLiteralContent":true},"libraries":{}}
Contract ABI
[{"type":"function","stateMutability":"payable","outputs":[{"type":"address","name":"","internalType":"contract PresaleV1"}],"name":"deploy","inputs":[{"type":"address","name":"manage","internalType":"address"},{"type":"address","name":"wethfact","internalType":"address"},{"type":"address","name":"setting","internalType":"address"},{"type":"address","name":"lockaddr","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50613074806100206000396000f3fe60806040526004361061001e5760003560e01c8063fd82b73a14610023575b600080fd5b610036610031366004610104565b61005f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60003485858585604051610072906100ce565b73ffffffffffffffffffffffffffffffffffffffff94851681529284166020840152908316604083015290911660608201526080016040518091039082f09050801580156100c4573d6000803e3d6000fd5b5095945050505050565b612ee68061015983390190565b803573ffffffffffffffffffffffffffffffffffffffff811681146100ff57600080fd5b919050565b6000806000806080858703121561011a57600080fd5b610123856100db565b9350610131602086016100db565b925061013f604086016100db565b915061014d606086016100db565b90509295919450925056fe608060405260405162002ee638038062002ee6833981016040819052620000269162000161565b6001600055602580546001600160a01b0319166001600160a01b0384169081179091556040805163db28dbd160e01b8152905163db28dbd1916004808201926020929091908290030181865afa15801562000085573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ab9190620001be565b341015620000ff5760405162461bcd60e51b815260206004820152601660248201527f42616c616e636520697320696e737566666963656e7400000000000000000000604482015260640160405180910390fd5b602380546001600160a01b03199081166001600160a01b03968716179091556024805482169486169490941790935560268054909316931692909217905550620001d8565b80516001600160a01b03811681146200015c57600080fd5b919050565b600080600080608085870312156200017857600080fd5b620001838562000144565b9350620001936020860162000144565b9250620001a36040860162000144565b9150620001b36060860162000144565b905092959194509250565b600060208284031215620001d157600080fd5b5051919050565b612cfe80620001e86000396000f3fe6080604052600436106101295760003560e01c806397a993aa116100a5578063c39e7dbb11610074578063e86e634011610059578063e86e63401461046a578063f0057eef1461047f578063fe8121de1461049f57600080fd5b8063c39e7dbb14610440578063e8078d941461045557600080fd5b806397a993aa1461039a5780639d1213a7146103e3578063ac34c96d14610408578063acfb23551461041d57600080fd5b806348146113116100fc5780638288f95c116100e15780638288f95c146102f057806383197ef01461036557806387d512591461037a57600080fd5b806348146113146102285780634d18b5e21461023057600080fd5b80631c4695f41461012e578063200d2ed21461015d5780633c6ec90f146101ce5780634650d20d146101f0575b600080fd5b34801561013a57600080fd5b506101436104b4565b604051610154959493929190612686565b60405180910390f35b34801561016957600080fd5b50600e54600f546010546011546012546013546101979560ff80821696610100909204169490939092909187565b6040805197151588529515156020880152948601939093526060850191909152608084015260a083015260c082015260e001610154565b3480156101da57600080fd5b506101ee6101e93660046127c8565b61077e565b005b3480156101fc57600080fd5b50602554610210906001600160a01b031681565b6040516001600160a01b039091168152602001610154565b6101ee610a6f565b34801561023c57600080fd5b50600154600254600354600454600554600654600754600854600954600a54600b54600c54600d546102839c6001600160a01b039081169c169a999897969594939291908d565b604080516001600160a01b039e8f1681529d909c1660208e01529a8c019990995260608b019790975260808a019590955260a089019390935260c088019190915260e08701526101008601526101208501526101408401526101608301526101808201526101a001610154565b3480156102fc57600080fd5b50601954601a54601b54601c54601d54601e54610329959493926001600160a01b03908116928116911686565b604080519687526020870195909552938501929092526001600160a01b03908116606085015290811660808401521660a082015260c001610154565b34801561037157600080fd5b506101ee610e2e565b34801561038657600080fd5b506101ee6103953660046128ff565b610e8e565b3480156103a657600080fd5b506103ce6103b53660046129fc565b6027602052600090815260409020805460019091015482565b60408051928352602083019190915201610154565b3480156103ef57600080fd5b506103f8610f75565b6040516101549493929190612a20565b34801561041457600080fd5b506101ee6110a1565b34801561042957600080fd5b506104326114b0565b604051908152602001610154565b34801561044c57600080fd5b506101ee61153e565b34801561046157600080fd5b506101ee6116c8565b34801561047657600080fd5b506101ee611dcd565b34801561048b57600080fd5b50602654610210906001600160a01b031681565b3480156104ab57600080fd5b506101ee611ebb565b6014805481906104c390612a59565b80601f01602080910402602001604051908101604052809291908181526020018280546104ef90612a59565b801561053c5780601f106105115761010080835404028352916020019161053c565b820191906000526020600020905b81548152906001019060200180831161051f57829003601f168201915b50505050509080600101805461055190612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461057d90612a59565b80156105ca5780601f1061059f576101008083540402835291602001916105ca565b820191906000526020600020905b8154815290600101906020018083116105ad57829003601f168201915b5050505050908060020180546105df90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461060b90612a59565b80156106585780601f1061062d57610100808354040283529160200191610658565b820191906000526020600020905b81548152906001019060200180831161063b57829003601f168201915b50505050509080600301805461066d90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461069990612a59565b80156106e65780601f106106bb576101008083540402835291602001916106e6565b820191906000526020600020905b8154815290600101906020018083116106c957829003601f168201915b5050505050908060040180546106fb90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461072790612a59565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050905085565b6023546001600160a01b031633146107dd5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064015b60405180910390fd5b8051600180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b03938416179091556020830151600280549092169216918217905560408083015160035560608301516004908155608084015160055560a084015160065560c084015160075560e0840151600855610100840151600955610120840151600a55610140840151600b55610160840151600c55610180840151600d5581517f06fdde0300000000000000000000000000000000000000000000000000000000815291516306fdde039280830192600092918290030181865afa1580156108d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ff9190810190612aac565b805161091391601f91602090910190612595565b5080602001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261097e9190810190612aac565b80516109909160209190820190612595565b5080602001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f79190612b23565b60ff16601f6003018190555080602001516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190612b46565b60215550565b610a776120b3565b610a7f6114b0565b600114610ace5760405162461bcd60e51b815260206004820152600a60248201527f4e4f54204143544956450000000000000000000000000000000000000000000060448201526064016107d4565b600454341015610b205760405162461bcd60e51b815260206004820152601660248201527f62616c616e636520697320696e737566666963656e740000000000000000000060448201526064016107d4565b600554341115610b725760405162461bcd60e51b815260206004820152601360248201527f62616c616e636520697320746f6f206d7563680000000000000000000000000060448201526064016107d4565b3360009081526027602052604081208054600554919234929091610b9591612b8e565b600f54600654919250600091610bab9190612b8e565b9050808211610bba5781610bbc565b805b915081831115610bca578192505b600354600090670de0b6b3a764000090610be49086612ba5565b610bee9190612be2565b905060008111610c405760405162461bcd60e51b815260206004820152600b60248201527f5a45524f20544f4b454e5300000000000000000000000000000000000000000060448201526064016107d4565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc59190612b46565b811115610d145760405162461bcd60e51b815260206004820152601260248201527f546f6b656e207265616d696e206572726f72000000000000000000000000000060448201526064016107d4565b8454600003610d335760138054906000610d2d83612c1d565b91905055505b33600090815260276020526040902054610d4e908590612c55565b33600090815260276020526040902090815560010154610d6f908290612c55565b33600090815260276020526040902060010155600f54610d90908590612c55565b600f55601054610da1908290612c55565b60105534841015610de457336108fc610dba8634612b8e565b6040518115909202916000818181858888f19350505050158015610de2573d6000803e3d6000fd5b505b604080513381523460208201527f6800c78b31b30f29de1de17ff27c5e7c5a990802a69fd1216dd496bafd9c6e0191015b60405180910390a15050505050610e2c6001600055565b565b600e5460ff16610e805760405162461bcd60e51b815260206004820152601860248201527f6c702067656e65726174696f6e20696e636f6d706c657465000000000000000060448201526064016107d4565b6001546001600160a01b0316ff5b6023546001600160a01b03163314610ee85760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064016107d4565b805180518291601491610f02918391602090910190612595565b506020828101518051610f1b9260018501920190612595565b5060408201518051610f37916002840191602090910190612595565b5060608201518051610f53916003840191602090910190612595565b5060808201518051610f6f916004840191602090910190612595565b50505050565b601f80548190610f8490612a59565b80601f0160208091040260200160405190810160405280929190818152602001828054610fb090612a59565b8015610ffd5780601f10610fd257610100808354040283529160200191610ffd565b820191906000526020600020905b815481529060010190602001808311610fe057829003601f168201915b50505050509080600101805461101290612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461103e90612a59565b801561108b5780601f106110605761010080835404028352916020019161108b565b820191906000526020600020905b81548152906001019060200180831161106e57829003601f168201915b5050505050908060020154908060030154905084565b6023546001600160a01b031633146110fb5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064016107d4565b602560009054906101000a90046001600160a01b03166001600160a01b031663fca19d276040518163ffffffff1660e01b8152600401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111729190612b46565b601955602554604080517f6159ae5900000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691636159ae59916004808201926020929091908290030181865afa1580156111d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fc9190612b46565b601a55602554604080517fb25b298f00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163b25b298f916004808201926020929091908290030181865afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112869190612b46565b601b55602554604080517f7480ba7f00000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691637480ba7f916004808201926020929091908290030181865afa1580156112ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113109190612c6d565b601c80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055602554604080517f89b23cff000000000000000000000000000000000000000000000000000000008152905191909216916389b23cff9160048083019260209291908290030181865afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190612c6d565b601d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055602554604080517f86c90a9f000000000000000000000000000000000000000000000000000000008152905191909216916386c90a9f9160048083019260209291908290030181865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190612c6d565b601e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600e54600090610100900460ff16156114c95750600390565b600c54421180156114dd5750600754600f54105b156114e85750600390565b600654600f54106114f95750600290565b600c544211801561150e5750600754600f5410155b156115195750600290565b600d54421080159061152d5750600c544211155b156115385750600190565b50600090565b6115466120b3565b61154e6114b0565b60031461159d5760405162461bcd60e51b815260206004820152600a60248201527f4e4f54204641494c45440000000000000000000000000000000000000000000060448201526064016107d4565b6001546001600160a01b031633036115b7576115b761210c565b336000908152602760205260408120601254600f549192916115d99190612b8e565b8254909150479060009083906115ef9084612ba5565b6115f99190612be2565b90506000811161164b5760405162461bcd60e51b815260206004820152601360248201527f4e4f5448494e4720544f2057495448445241570000000000000000000000000060448201526064016107d4565b835460125461165a9190612c55565b6012556000808555600185018190556040513391829184156108fc0291859190818181858888f19350505050158015611697573d6000803e3d6000fd5b506040518281527fba8f86526b8f4836c344cbbb8d752a5deb45d8d86c8fdcc0318124656ed1f16990602001610e15565b6116d06120b3565b6001546001600160a01b0316331461172a5760405162461bcd60e51b815260206004820152601160248201527f4e4f542050524553414c45204f574e455200000000000000000000000000000060448201526064016107d4565b600e5460ff161561177d5760405162461bcd60e51b815260206004820152601360248201527f47454e45524154494f4e20434f4d504c4554450000000000000000000000000060448201526064016107d4565b6117856114b0565b6002146117d45760405162461bcd60e51b815260206004820152600b60248201527f4e4f54205355434345535300000000000000000000000000000000000000000060448201526064016107d4565b602654600254602480546040517f8d8c70bb0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015290831691810191909152911690638d8c70bb90604401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b9190612c8a565b156118dc57600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790556040517ffc4635b457b81a81e44eab31da1d5a34dae08cffa83f63bde39685cf32ffd7e2906118cf906000815260200190565b60405180910390a1611dc3565b60006064602560009054906101000a90046001600160a01b03166001600160a01b031663fca19d276040518163ffffffff1660e01b8152600401602060405180830381865afa158015611933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119579190612b46565b600f546119649190612ba5565b61196e9190612be2565b90506000606460016007015483600e6001015461198b9190612b8e565b6119959190612ba5565b61199f9190612be2565b90506000670de0b6b3a7640000600160080154836119bd9190612ba5565b6119c79190612be2565b905060008111611a195760405162461bcd60e51b815260206004820152600b60248201527f5a45524f20546f6b656e7300000000000000000000000000000000000000000060448201526064016107d4565b600254602654611a36916001600160a01b0390811691168361230a565b602654602554604080517fdb28dbd100000000000000000000000000000000000000000000000000000000815290516001600160a01b039384169363443603b693879391169163db28dbd1916004808201926020929091908290030181865afa158015611aa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611acb9190612b46565b611ad59190612c55565b600254600a5460015460405160e086901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0393841660048201526024810189905260448101889052606481019290925291909116608482015260a4016000604051808303818588803b158015611b5557600080fd5b505af1158015611b69573d6000803e3d6000fd5b505050505060006064602560009054906101000a90046001600160a01b03166001600160a01b0316636159ae596040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be99190612b46565b601054611bf69190612ba5565b611c009190612be2565b601c546040519192506001600160a01b031690819086156108fc029087906000818181858888f19350505050158015611c3d573d6000803e3d6000fd5b50600254601d54611c5b916001600160a01b03908116911684612453565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190612b46565b601054909150811115611d1c57601054600090611cfe9083612b8e565b600254909150611d1a906001600160a01b031661dead83612453565b505b60015460405147916001600160a01b031690819083156108fc029084906000818181858888f19350505050158015611d58573d6000803e3d6000fd5b50600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556040519081527ffc4635b457b81a81e44eab31da1d5a34dae08cffa83f63bde39685cf32ffd7e29060200160405180910390a150505050505050505b610e2c6001600055565b600e5460ff16158015611de85750600e54610100900460ff16155b611df157600080fd5b602654600254602480546040517f8d8c70bb0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015290831691810191909152911690638d8c70bb90604401602060405180830381865afa158015611e64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e889190612c8a565b15610e2c57600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b611ec36120b3565b600e5460ff16611f155760405162461bcd60e51b815260206004820152601660248201527f4157414954494e47204c502047454e45524154494f4e0000000000000000000060448201526064016107d4565b336000908152602760205260408120601154601054919291611f379190612b8e565b60018301546002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529293506000928492916001600160a01b0316906370a0823190602401602060405180830381865afa158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc89190612b46565b611fd29190612ba5565b611fdc9190612be2565b90506000811161202e5760405162461bcd60e51b815260206004820152601360248201527f4e4f5448494e4720544f2057495448445241570000000000000000000000000060448201526064016107d4565b60018301546011546120409190612c55565b6011553360008181526027602052604081206001810182905555600254612073916001600160a01b039091169083612453565b6040518181527f6eb77a5c4ed3153e65b1a8804e82c2ffa0d2b39fd8dba4ae39b6476c7bf65f7e9060200160405180910390a1505050610e2c6001600055565b6002600054036121055760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107d4565b6002600055565b6001546001600160a01b031633146121665760405162461bcd60e51b815260206004820152601160248201527f4e4f542050524553414c45204f574e455200000000000000000000000000000060448201526064016107d4565b61216e6114b0565b6003146121bd5760405162461bcd60e51b815260206004820152601260248201527f4f6e6c79206661696c656420737461747573000000000000000000000000000060448201526064016107d4565b6002546001546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152612252926001600160a01b0390811692169082906370a0823190602401602060405180830381865afa158015612229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224d9190612b46565b612453565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527fba8f86526b8f4836c344cbbb8d752a5deb45d8d86c8fdcc0318124656ed1f169916001600160a01b0316906370a0823190602401602060405180830381865afa1580156122d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f79190612b46565b60405190815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916123949190612cac565b6000604051808303816000865af19150503d80600081146123d1576040519150601f19603f3d011682016040523d82523d6000602084013e6123d6565b606091505b50915091508180156124005750805115806124005750808060200190518101906124009190612c8a565b61244c5760405162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c4544000060448201526064016107d4565b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916124dd9190612cac565b6000604051808303816000865af19150503d806000811461251a576040519150601f19603f3d011682016040523d82523d6000602084013e61251f565b606091505b50915091508180156125495750805115806125495750808060200190518101906125499190612c8a565b61244c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c45440060448201526064016107d4565b8280546125a190612a59565b90600052602060002090601f0160209004810192826125c35760008555612609565b82601f106125dc57805160ff1916838001178555612609565b82800160010185558215612609579182015b828111156126095782518255916020019190600101906125ee565b50612615929150612619565b5090565b5b80821115612615576000815560010161261a565b60005b83811015612649578181015183820152602001612631565b83811115610f6f5750506000910152565b6000815180845261267281602086016020860161262e565b601f01601f19169290920160200192915050565b60a08152600061269960a083018861265a565b82810360208401526126ab818861265a565b905082810360408401526126bf818761265a565b905082810360608401526126d3818661265a565b905082810360808401526126e7818561265a565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101a0810167ffffffffffffffff81118282101715612746576127466126f3565b60405290565b60405160a0810167ffffffffffffffff81118282101715612746576127466126f3565b604051601f8201601f1916810167ffffffffffffffff81118282101715612798576127986126f3565b604052919050565b6001600160a01b03811681146127b557600080fd5b50565b80356127c3816127a0565b919050565b60006101a082840312156127db57600080fd5b6127e3612722565b6127ec836127b8565b81526127fa602084016127b8565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101008084013581830152506101208084013581830152506101408084013581830152506101608084013581830152506101808084013581830152508091505092915050565b600067ffffffffffffffff82111561289b5761289b6126f3565b50601f01601f191660200190565b600082601f8301126128ba57600080fd5b81356128cd6128c882612881565b61276f565b8181528460208386010111156128e257600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561291157600080fd5b813567ffffffffffffffff8082111561292957600080fd5b9083019060a0828603121561293d57600080fd5b61294561274c565b82358281111561295457600080fd5b612960878286016128a9565b82525060208301358281111561297557600080fd5b612981878286016128a9565b60208301525060408301358281111561299957600080fd5b6129a5878286016128a9565b6040830152506060830135828111156129bd57600080fd5b6129c9878286016128a9565b6060830152506080830135828111156129e157600080fd5b6129ed878286016128a9565b60808301525095945050505050565b600060208284031215612a0e57600080fd5b8135612a19816127a0565b9392505050565b608081526000612a33608083018761265a565b8281036020840152612a45818761265a565b604084019590955250506060015292915050565b600181811c90821680612a6d57607f821691505b602082108103612aa6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215612abe57600080fd5b815167ffffffffffffffff811115612ad557600080fd5b8201601f81018413612ae657600080fd5b8051612af46128c882612881565b818152856020838501011115612b0957600080fd5b612b1a82602083016020860161262e565b95945050505050565b600060208284031215612b3557600080fd5b815160ff81168114612a1957600080fd5b600060208284031215612b5857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015612ba057612ba0612b5f565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bdd57612bdd612b5f565b500290565b600082612c18577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612c4e57612c4e612b5f565b5060010190565b60008219821115612c6857612c68612b5f565b500190565b600060208284031215612c7f57600080fd5b8151612a19816127a0565b600060208284031215612c9c57600080fd5b81518015158114612a1957600080fd5b60008251612cbe81846020870161262e565b919091019291505056fea264697066735822122011d1bf2719e41079b73b6e11b8d9bb1863db4dc2904b9268bb4704446c0b218f64736f6c634300080d0033a2646970667358221220afb1b7b65e4bc63166bb2ea55eccde58f69259568e39b01b1d7a239c547108ef64736f6c634300080d0033
Deployed ByteCode
0x60806040526004361061001e5760003560e01c8063fd82b73a14610023575b600080fd5b610036610031366004610104565b61005f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60003485858585604051610072906100ce565b73ffffffffffffffffffffffffffffffffffffffff94851681529284166020840152908316604083015290911660608201526080016040518091039082f09050801580156100c4573d6000803e3d6000fd5b5095945050505050565b612ee68061015983390190565b803573ffffffffffffffffffffffffffffffffffffffff811681146100ff57600080fd5b919050565b6000806000806080858703121561011a57600080fd5b610123856100db565b9350610131602086016100db565b925061013f604086016100db565b915061014d606086016100db565b90509295919450925056fe608060405260405162002ee638038062002ee6833981016040819052620000269162000161565b6001600055602580546001600160a01b0319166001600160a01b0384169081179091556040805163db28dbd160e01b8152905163db28dbd1916004808201926020929091908290030181865afa15801562000085573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ab9190620001be565b341015620000ff5760405162461bcd60e51b815260206004820152601660248201527f42616c616e636520697320696e737566666963656e7400000000000000000000604482015260640160405180910390fd5b602380546001600160a01b03199081166001600160a01b03968716179091556024805482169486169490941790935560268054909316931692909217905550620001d8565b80516001600160a01b03811681146200015c57600080fd5b919050565b600080600080608085870312156200017857600080fd5b620001838562000144565b9350620001936020860162000144565b9250620001a36040860162000144565b9150620001b36060860162000144565b905092959194509250565b600060208284031215620001d157600080fd5b5051919050565b612cfe80620001e86000396000f3fe6080604052600436106101295760003560e01c806397a993aa116100a5578063c39e7dbb11610074578063e86e634011610059578063e86e63401461046a578063f0057eef1461047f578063fe8121de1461049f57600080fd5b8063c39e7dbb14610440578063e8078d941461045557600080fd5b806397a993aa1461039a5780639d1213a7146103e3578063ac34c96d14610408578063acfb23551461041d57600080fd5b806348146113116100fc5780638288f95c116100e15780638288f95c146102f057806383197ef01461036557806387d512591461037a57600080fd5b806348146113146102285780634d18b5e21461023057600080fd5b80631c4695f41461012e578063200d2ed21461015d5780633c6ec90f146101ce5780634650d20d146101f0575b600080fd5b34801561013a57600080fd5b506101436104b4565b604051610154959493929190612686565b60405180910390f35b34801561016957600080fd5b50600e54600f546010546011546012546013546101979560ff80821696610100909204169490939092909187565b6040805197151588529515156020880152948601939093526060850191909152608084015260a083015260c082015260e001610154565b3480156101da57600080fd5b506101ee6101e93660046127c8565b61077e565b005b3480156101fc57600080fd5b50602554610210906001600160a01b031681565b6040516001600160a01b039091168152602001610154565b6101ee610a6f565b34801561023c57600080fd5b50600154600254600354600454600554600654600754600854600954600a54600b54600c54600d546102839c6001600160a01b039081169c169a999897969594939291908d565b604080516001600160a01b039e8f1681529d909c1660208e01529a8c019990995260608b019790975260808a019590955260a089019390935260c088019190915260e08701526101008601526101208501526101408401526101608301526101808201526101a001610154565b3480156102fc57600080fd5b50601954601a54601b54601c54601d54601e54610329959493926001600160a01b03908116928116911686565b604080519687526020870195909552938501929092526001600160a01b03908116606085015290811660808401521660a082015260c001610154565b34801561037157600080fd5b506101ee610e2e565b34801561038657600080fd5b506101ee6103953660046128ff565b610e8e565b3480156103a657600080fd5b506103ce6103b53660046129fc565b6027602052600090815260409020805460019091015482565b60408051928352602083019190915201610154565b3480156103ef57600080fd5b506103f8610f75565b6040516101549493929190612a20565b34801561041457600080fd5b506101ee6110a1565b34801561042957600080fd5b506104326114b0565b604051908152602001610154565b34801561044c57600080fd5b506101ee61153e565b34801561046157600080fd5b506101ee6116c8565b34801561047657600080fd5b506101ee611dcd565b34801561048b57600080fd5b50602654610210906001600160a01b031681565b3480156104ab57600080fd5b506101ee611ebb565b6014805481906104c390612a59565b80601f01602080910402602001604051908101604052809291908181526020018280546104ef90612a59565b801561053c5780601f106105115761010080835404028352916020019161053c565b820191906000526020600020905b81548152906001019060200180831161051f57829003601f168201915b50505050509080600101805461055190612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461057d90612a59565b80156105ca5780601f1061059f576101008083540402835291602001916105ca565b820191906000526020600020905b8154815290600101906020018083116105ad57829003601f168201915b5050505050908060020180546105df90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461060b90612a59565b80156106585780601f1061062d57610100808354040283529160200191610658565b820191906000526020600020905b81548152906001019060200180831161063b57829003601f168201915b50505050509080600301805461066d90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461069990612a59565b80156106e65780601f106106bb576101008083540402835291602001916106e6565b820191906000526020600020905b8154815290600101906020018083116106c957829003601f168201915b5050505050908060040180546106fb90612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461072790612a59565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050905085565b6023546001600160a01b031633146107dd5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064015b60405180910390fd5b8051600180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b03938416179091556020830151600280549092169216918217905560408083015160035560608301516004908155608084015160055560a084015160065560c084015160075560e0840151600855610100840151600955610120840151600a55610140840151600b55610160840151600c55610180840151600d5581517f06fdde0300000000000000000000000000000000000000000000000000000000815291516306fdde039280830192600092918290030181865afa1580156108d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ff9190810190612aac565b805161091391601f91602090910190612595565b5080602001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015610956573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261097e9190810190612aac565b80516109909160209190820190612595565b5080602001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f79190612b23565b60ff16601f6003018190555080602001516001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a699190612b46565b60215550565b610a776120b3565b610a7f6114b0565b600114610ace5760405162461bcd60e51b815260206004820152600a60248201527f4e4f54204143544956450000000000000000000000000000000000000000000060448201526064016107d4565b600454341015610b205760405162461bcd60e51b815260206004820152601660248201527f62616c616e636520697320696e737566666963656e740000000000000000000060448201526064016107d4565b600554341115610b725760405162461bcd60e51b815260206004820152601360248201527f62616c616e636520697320746f6f206d7563680000000000000000000000000060448201526064016107d4565b3360009081526027602052604081208054600554919234929091610b9591612b8e565b600f54600654919250600091610bab9190612b8e565b9050808211610bba5781610bbc565b805b915081831115610bca578192505b600354600090670de0b6b3a764000090610be49086612ba5565b610bee9190612be2565b905060008111610c405760405162461bcd60e51b815260206004820152600b60248201527f5a45524f20544f4b454e5300000000000000000000000000000000000000000060448201526064016107d4565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc59190612b46565b811115610d145760405162461bcd60e51b815260206004820152601260248201527f546f6b656e207265616d696e206572726f72000000000000000000000000000060448201526064016107d4565b8454600003610d335760138054906000610d2d83612c1d565b91905055505b33600090815260276020526040902054610d4e908590612c55565b33600090815260276020526040902090815560010154610d6f908290612c55565b33600090815260276020526040902060010155600f54610d90908590612c55565b600f55601054610da1908290612c55565b60105534841015610de457336108fc610dba8634612b8e565b6040518115909202916000818181858888f19350505050158015610de2573d6000803e3d6000fd5b505b604080513381523460208201527f6800c78b31b30f29de1de17ff27c5e7c5a990802a69fd1216dd496bafd9c6e0191015b60405180910390a15050505050610e2c6001600055565b565b600e5460ff16610e805760405162461bcd60e51b815260206004820152601860248201527f6c702067656e65726174696f6e20696e636f6d706c657465000000000000000060448201526064016107d4565b6001546001600160a01b0316ff5b6023546001600160a01b03163314610ee85760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064016107d4565b805180518291601491610f02918391602090910190612595565b506020828101518051610f1b9260018501920190612595565b5060408201518051610f37916002840191602090910190612595565b5060608201518051610f53916003840191602090910190612595565b5060808201518051610f6f916004840191602090910190612595565b50505050565b601f80548190610f8490612a59565b80601f0160208091040260200160405190810160405280929190818152602001828054610fb090612a59565b8015610ffd5780601f10610fd257610100808354040283529160200191610ffd565b820191906000526020600020905b815481529060010190602001808311610fe057829003601f168201915b50505050509080600101805461101290612a59565b80601f016020809104026020016040519081016040528092919081815260200182805461103e90612a59565b801561108b5780601f106110605761010080835404028352916020019161108b565b820191906000526020600020905b81548152906001019060200180831161106e57829003601f168201915b5050505050908060020154908060030154905084565b6023546001600160a01b031633146110fb5760405162461bcd60e51b815260206004820181905260248201527f4f6e6c79206d616e616765206164647265737320697320617661696c61626c6560448201526064016107d4565b602560009054906101000a90046001600160a01b03166001600160a01b031663fca19d276040518163ffffffff1660e01b8152600401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111729190612b46565b601955602554604080517f6159ae5900000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691636159ae59916004808201926020929091908290030181865afa1580156111d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fc9190612b46565b601a55602554604080517fb25b298f00000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163b25b298f916004808201926020929091908290030181865afa158015611262573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112869190612b46565b601b55602554604080517f7480ba7f00000000000000000000000000000000000000000000000000000000815290516001600160a01b0390921691637480ba7f916004808201926020929091908290030181865afa1580156112ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113109190612c6d565b601c80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055602554604080517f89b23cff000000000000000000000000000000000000000000000000000000008152905191909216916389b23cff9160048083019260209291908290030181865afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190612c6d565b601d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03928316179055602554604080517f86c90a9f000000000000000000000000000000000000000000000000000000008152905191909216916386c90a9f9160048083019260209291908290030181865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190612c6d565b601e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600e54600090610100900460ff16156114c95750600390565b600c54421180156114dd5750600754600f54105b156114e85750600390565b600654600f54106114f95750600290565b600c544211801561150e5750600754600f5410155b156115195750600290565b600d54421080159061152d5750600c544211155b156115385750600190565b50600090565b6115466120b3565b61154e6114b0565b60031461159d5760405162461bcd60e51b815260206004820152600a60248201527f4e4f54204641494c45440000000000000000000000000000000000000000000060448201526064016107d4565b6001546001600160a01b031633036115b7576115b761210c565b336000908152602760205260408120601254600f549192916115d99190612b8e565b8254909150479060009083906115ef9084612ba5565b6115f99190612be2565b90506000811161164b5760405162461bcd60e51b815260206004820152601360248201527f4e4f5448494e4720544f2057495448445241570000000000000000000000000060448201526064016107d4565b835460125461165a9190612c55565b6012556000808555600185018190556040513391829184156108fc0291859190818181858888f19350505050158015611697573d6000803e3d6000fd5b506040518281527fba8f86526b8f4836c344cbbb8d752a5deb45d8d86c8fdcc0318124656ed1f16990602001610e15565b6116d06120b3565b6001546001600160a01b0316331461172a5760405162461bcd60e51b815260206004820152601160248201527f4e4f542050524553414c45204f574e455200000000000000000000000000000060448201526064016107d4565b600e5460ff161561177d5760405162461bcd60e51b815260206004820152601360248201527f47454e45524154494f4e20434f4d504c4554450000000000000000000000000060448201526064016107d4565b6117856114b0565b6002146117d45760405162461bcd60e51b815260206004820152600b60248201527f4e4f54205355434345535300000000000000000000000000000000000000000060448201526064016107d4565b602654600254602480546040517f8d8c70bb0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015290831691810191909152911690638d8c70bb90604401602060405180830381865afa158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b9190612c8a565b156118dc57600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790556040517ffc4635b457b81a81e44eab31da1d5a34dae08cffa83f63bde39685cf32ffd7e2906118cf906000815260200190565b60405180910390a1611dc3565b60006064602560009054906101000a90046001600160a01b03166001600160a01b031663fca19d276040518163ffffffff1660e01b8152600401602060405180830381865afa158015611933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119579190612b46565b600f546119649190612ba5565b61196e9190612be2565b90506000606460016007015483600e6001015461198b9190612b8e565b6119959190612ba5565b61199f9190612be2565b90506000670de0b6b3a7640000600160080154836119bd9190612ba5565b6119c79190612be2565b905060008111611a195760405162461bcd60e51b815260206004820152600b60248201527f5a45524f20546f6b656e7300000000000000000000000000000000000000000060448201526064016107d4565b600254602654611a36916001600160a01b0390811691168361230a565b602654602554604080517fdb28dbd100000000000000000000000000000000000000000000000000000000815290516001600160a01b039384169363443603b693879391169163db28dbd1916004808201926020929091908290030181865afa158015611aa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611acb9190612b46565b611ad59190612c55565b600254600a5460015460405160e086901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b0393841660048201526024810189905260448101889052606481019290925291909116608482015260a4016000604051808303818588803b158015611b5557600080fd5b505af1158015611b69573d6000803e3d6000fd5b505050505060006064602560009054906101000a90046001600160a01b03166001600160a01b0316636159ae596040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be99190612b46565b601054611bf69190612ba5565b611c009190612be2565b601c546040519192506001600160a01b031690819086156108fc029087906000818181858888f19350505050158015611c3d573d6000803e3d6000fd5b50600254601d54611c5b916001600160a01b03908116911684612453565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190612b46565b601054909150811115611d1c57601054600090611cfe9083612b8e565b600254909150611d1a906001600160a01b031661dead83612453565b505b60015460405147916001600160a01b031690819083156108fc029084906000818181858888f19350505050158015611d58573d6000803e3d6000fd5b50600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556040519081527ffc4635b457b81a81e44eab31da1d5a34dae08cffa83f63bde39685cf32ffd7e29060200160405180910390a150505050505050505b610e2c6001600055565b600e5460ff16158015611de85750600e54610100900460ff16155b611df157600080fd5b602654600254602480546040517f8d8c70bb0000000000000000000000000000000000000000000000000000000081526001600160a01b03938416600482015290831691810191909152911690638d8c70bb90604401602060405180830381865afa158015611e64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e889190612c8a565b15610e2c57600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b611ec36120b3565b600e5460ff16611f155760405162461bcd60e51b815260206004820152601660248201527f4157414954494e47204c502047454e45524154494f4e0000000000000000000060448201526064016107d4565b336000908152602760205260408120601154601054919291611f379190612b8e565b60018301546002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529293506000928492916001600160a01b0316906370a0823190602401602060405180830381865afa158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc89190612b46565b611fd29190612ba5565b611fdc9190612be2565b90506000811161202e5760405162461bcd60e51b815260206004820152601360248201527f4e4f5448494e4720544f2057495448445241570000000000000000000000000060448201526064016107d4565b60018301546011546120409190612c55565b6011553360008181526027602052604081206001810182905555600254612073916001600160a01b039091169083612453565b6040518181527f6eb77a5c4ed3153e65b1a8804e82c2ffa0d2b39fd8dba4ae39b6476c7bf65f7e9060200160405180910390a1505050610e2c6001600055565b6002600054036121055760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107d4565b6002600055565b6001546001600160a01b031633146121665760405162461bcd60e51b815260206004820152601160248201527f4e4f542050524553414c45204f574e455200000000000000000000000000000060448201526064016107d4565b61216e6114b0565b6003146121bd5760405162461bcd60e51b815260206004820152601260248201527f4f6e6c79206661696c656420737461747573000000000000000000000000000060448201526064016107d4565b6002546001546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152612252926001600160a01b0390811692169082906370a0823190602401602060405180830381865afa158015612229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224d9190612b46565b612453565b6002546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527fba8f86526b8f4836c344cbbb8d752a5deb45d8d86c8fdcc0318124656ed1f169916001600160a01b0316906370a0823190602401602060405180830381865afa1580156122d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122f79190612b46565b60405190815260200160405180910390a1565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916123949190612cac565b6000604051808303816000865af19150503d80600081146123d1576040519150601f19603f3d011682016040523d82523d6000602084013e6123d6565b606091505b50915091508180156124005750805115806124005750808060200190518101906124009190612c8a565b61244c5760405162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c4544000060448201526064016107d4565b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916124dd9190612cac565b6000604051808303816000865af19150503d806000811461251a576040519150601f19603f3d011682016040523d82523d6000602084013e61251f565b606091505b50915091508180156125495750805115806125495750808060200190518101906125499190612c8a565b61244c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c45440060448201526064016107d4565b8280546125a190612a59565b90600052602060002090601f0160209004810192826125c35760008555612609565b82601f106125dc57805160ff1916838001178555612609565b82800160010185558215612609579182015b828111156126095782518255916020019190600101906125ee565b50612615929150612619565b5090565b5b80821115612615576000815560010161261a565b60005b83811015612649578181015183820152602001612631565b83811115610f6f5750506000910152565b6000815180845261267281602086016020860161262e565b601f01601f19169290920160200192915050565b60a08152600061269960a083018861265a565b82810360208401526126ab818861265a565b905082810360408401526126bf818761265a565b905082810360608401526126d3818661265a565b905082810360808401526126e7818561265a565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101a0810167ffffffffffffffff81118282101715612746576127466126f3565b60405290565b60405160a0810167ffffffffffffffff81118282101715612746576127466126f3565b604051601f8201601f1916810167ffffffffffffffff81118282101715612798576127986126f3565b604052919050565b6001600160a01b03811681146127b557600080fd5b50565b80356127c3816127a0565b919050565b60006101a082840312156127db57600080fd5b6127e3612722565b6127ec836127b8565b81526127fa602084016127b8565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101008084013581830152506101208084013581830152506101408084013581830152506101608084013581830152506101808084013581830152508091505092915050565b600067ffffffffffffffff82111561289b5761289b6126f3565b50601f01601f191660200190565b600082601f8301126128ba57600080fd5b81356128cd6128c882612881565b61276f565b8181528460208386010111156128e257600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561291157600080fd5b813567ffffffffffffffff8082111561292957600080fd5b9083019060a0828603121561293d57600080fd5b61294561274c565b82358281111561295457600080fd5b612960878286016128a9565b82525060208301358281111561297557600080fd5b612981878286016128a9565b60208301525060408301358281111561299957600080fd5b6129a5878286016128a9565b6040830152506060830135828111156129bd57600080fd5b6129c9878286016128a9565b6060830152506080830135828111156129e157600080fd5b6129ed878286016128a9565b60808301525095945050505050565b600060208284031215612a0e57600080fd5b8135612a19816127a0565b9392505050565b608081526000612a33608083018761265a565b8281036020840152612a45818761265a565b604084019590955250506060015292915050565b600181811c90821680612a6d57607f821691505b602082108103612aa6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215612abe57600080fd5b815167ffffffffffffffff811115612ad557600080fd5b8201601f81018413612ae657600080fd5b8051612af46128c882612881565b818152856020838501011115612b0957600080fd5b612b1a82602083016020860161262e565b95945050505050565b600060208284031215612b3557600080fd5b815160ff81168114612a1957600080fd5b600060208284031215612b5857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015612ba057612ba0612b5f565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bdd57612bdd612b5f565b500290565b600082612c18577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612c4e57612c4e612b5f565b5060010190565b60008219821115612c6857612c68612b5f565b500190565b600060208284031215612c7f57600080fd5b8151612a19816127a0565b600060208284031215612c9c57600080fd5b81518015158114612a1957600080fd5b60008251612cbe81846020870161262e565b919091019291505056fea264697066735822122011d1bf2719e41079b73b6e11b8d9bb1863db4dc2904b9268bb4704446c0b218f64736f6c634300080d0033a2646970667358221220afb1b7b65e4bc63166bb2ea55eccde58f69259568e39b01b1d7a239c547108ef64736f6c634300080d0033