ERC-20
Overview
Max Total Supply
54,522,428.879397848 SSH
Holders
146
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 9 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
SuperStake
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 50 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** * SuperStake: Hex * * https://superstake.win */ //SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.15; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@uniswap/v2-core/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol"; import "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./DPT/TokenDividendTracker.sol"; import "./SimpleStakingImpl.sol"; import "./IMultisend.sol"; import "./ArbUtils.sol"; // Seriously if you audit this and ping it for "no safemath used" you're gonna out yourself as an idiot // SafeMath is by default included in solidity 0.8, I've only included it for the transferFrom contract SuperStake is Context, IERC20, Ownable, IERC20Permit, IMultisend { /** START OF EIP2612/EIP712 VARS */ using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /** END OF EIP2612/EIP712 VARS */ event ArbitragedPools(uint256 amount, bool wasUsdcLower); event Bought(address indexed buyer, uint256 amount); event Sold(address indexed seller, uint256 amount); event Minted(uint256 amount); event Burned(uint256 amount); using SafeMath for uint256; // Constants string private constant _name = "SuperStake: Hex"; string private constant _symbol = "SSH"; string private constant _max = "SSH: MAX"; string private constant _reinit = "SSH: REINIT"; // Standard decimals uint8 private constant _decimals = 9; // 55.55m uint256 private constant initialSupply = 55550000 * 10**9; // The actual current supply uint256 public currentSupply; // USDC address private _usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address private constant _dead = 0x000000000000000000000000000000000000dEaD; address private _wnative; // Mappings mapping(address => uint256) private tokensOwned; mapping(address => mapping(address => uint256)) private _allowances; struct mappingStructs { bool _isExcludedFromFee; bool _bots; uint32 _lastTxBuy; uint32 _lastTxSell; uint32 botBlock; bool isLPPair; bool isInitialLP; } struct LaggedLPData { address lpAddr; uint112 reserve0; uint112 reserve1; uint256 laggedBurnAmt; } mapping(address => mappingStructs) private mappedAddresses; mapping(address => uint256) private airdropTokens; // Arrays address[] private airdropPrivateList; address[] private lpPairs; address[] private initialLPPairs; // Global variables uint256 private laggedBurnAmt; LaggedLPData private laggedLP; uint256 public currentChainId; // Block address public dividendTracker; // Default uint32 private gasForProcessing = 300000; uint32 private hexStakingRatio = 2500; bool private disableAddToBlocklist = false; bool private removedLimits = false; // 8 bits remaining // Block of 256 bits uint32 private openBlock; uint32 private pair1Pct = 50; // Storage block closed // Block of 256 bits address public stakingImpl; // Tax distribution ratios uint32 private hexRewardRatio = 5000; // 64 bits remaining // Storage block closed // Block of 256 bits // This is Hex address private rewardToken = 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39; uint32 private pair2Pct = 50; uint32 private buyInfl = 7500; uint32 private sellDefl = 9000; // Storage block closed // Block of 256 bits // 160 bits free bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private arbEnabled = true; // 8 bits free // Storage block closed IUniswapV2Router02 private uniswapV2Router; constructor(address router) { uniswapV2Router = IUniswapV2Router02(router); // Set up EIP712 bytes32 hashedName = keccak256(bytes(_name)); bytes32 hashedVersion = keccak256(bytes("1")); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; tokensOwned[_msgSender()] = initialSupply; currentSupply = initialSupply; // Set up the dividends TokenDividendTracker tracker = new TokenDividendTracker(rewardToken, 1000000000); dividendTracker = address(tracker); // Create the SimpleStakingImpl // This addr is Hedron SimpleStakingImpl staker = new SimpleStakingImpl(rewardToken, 60, dividendTracker, address(0x3819f64f282bf135d62168C1e513280dAF905e06), router); stakingImpl = address(staker); tracker.setStakingImpl(stakingImpl); // Handle exclusion from dividends tracker.excludeFromDividends(dividendTracker); tracker.excludeFromDividends(address(this)); tracker.excludeFromDividends(owner()); tracker.excludeFromDividends(_dead); // Save chain ID currentChainId = block.chainid; // Create the staking contract // Set the struct values mappedAddresses[_msgSender()] = mappingStructs({ _isExcludedFromFee: true, _bots: false, _lastTxBuy: 0, _lastTxSell: 0, botBlock: 0, isLPPair: false, isInitialLP: false }); mappedAddresses[address(this)] = mappingStructs({ _isExcludedFromFee: true, _bots: false, _lastTxBuy: 0, _lastTxSell: 0, botBlock: 0, isLPPair: false, isInitialLP: false }); mappedAddresses[dividendTracker] = mappingStructs({ _isExcludedFromFee: true, _bots: false, _lastTxBuy: 0, _lastTxSell: 0, botBlock: 0, isLPPair: false, isInitialLP: false }); emit Transfer(address(0), _msgSender(), initialSupply); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return currentSupply; } function balanceOf(address account) public view override returns (uint256) { return tokensOwned[account]; } // These functions are to inflate/deflate supply on buys/sells as per the tokenomics function _increaseSupply(uint256 amt) internal { currentSupply += amt; tokensOwned[address(this)] += amt; emit Transfer(address(0), address(this), amt); emit Minted(amt); } function _decreaseSupply(uint256 amt, address lpToBurn) internal { currentSupply -= amt; tokensOwned[lpToBurn] -= amt; IUniswapV2Pair(lpToBurn).sync(); emit Transfer(lpToBurn, address(0), amt); emit Burned(amt); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } /// @notice Starts trading. Only callable by owner. function openTrading(address nativeWrapped) public onlyOwner { require(!tradingOpen, "OPEN"); _wnative = nativeWrapped; // Exclude the router from dividends TokenDividendTracker(dividendTracker).excludeFromDividends(address(uniswapV2Router)); _approve(address(this), address(uniswapV2Router), type(uint256).max); address uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .createPair(address(this), _wnative); // Create a USDC pair - this is to provide a second pool to process taxes through address uniswapV2Pair2 = IUniswapV2Factory(uniswapV2Router.factory()) .createPair( address(this), _usdc ); // Exclude both pairs TokenDividendTracker(dividendTracker).excludeFromDividends(address(uniswapV2Pair)); TokenDividendTracker(dividendTracker).excludeFromDividends(address(uniswapV2Pair2)); // Add Pair1Pct of the eth and LP to the first (ETH) pair uint256 pair1TAmt = (balanceOf(address(this)) * pair1Pct) / 100; uint256 pair2TAmt = (balanceOf(address(this)) * pair2Pct) / 100; uint256 pair1EAmt = (address(this).balance); //uint256 pair2EAmt = (address(this).balance * pair2Pct) / 100; uniswapV2Router.addLiquidityETH{value: pair1EAmt}( address(this), pair1TAmt, 0, 0, owner(), block.timestamp ); // Swap the pair2Pct eth amount for USDC /*address[] memory path = new address[](2); path[0] = _wnative; path[1] = _usdc; uniswapV2Router.swapExactETHForTokens{value: pair2EAmt}( 0, path, address(this), block.timestamp );*/ // Approve the USDC spend IERC20 usdc = IERC20(_usdc); // Actually get our balance uint256 pair2UAmt = usdc.balanceOf(address(this)); usdc.approve(address(uniswapV2Router), pair2UAmt); // Create a token/usdc pool uniswapV2Router.addLiquidity( _usdc, address(this), pair2UAmt, pair2TAmt, 0, 0, owner(), block.timestamp ); swapEnabled = true; tradingOpen = true; openBlock = uint32(block.number); IERC20(uniswapV2Pair).approve( address(uniswapV2Router), type(uint256).max ); IERC20(uniswapV2Pair2).approve( address(uniswapV2Router), type(uint256).max ); // Add the pairs to the list mappedAddresses[uniswapV2Pair] = mappingStructs({ _isExcludedFromFee: false, _bots: false, _lastTxBuy: 0, _lastTxSell: 0, botBlock: 0, isLPPair: true, isInitialLP: true }); mappedAddresses[uniswapV2Pair2] = mappingStructs({ _isExcludedFromFee: false, _bots: false, _lastTxBuy: 0, _lastTxSell: 0, botBlock: 0, isLPPair: true, isInitialLP: true }); // Add to LP pair list lpPairs.push(uniswapV2Pair); lpPairs.push(uniswapV2Pair2); // Add to initial LP pair list initialLPPairs.push(uniswapV2Pair); initialLPPairs.push(uniswapV2Pair2); } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint32 _flAmt; bool isSell = false; if ( from != owner() && to != owner() && from != address(this) && !mappedAddresses[to]._isExcludedFromFee && !mappedAddresses[from]._isExcludedFromFee ) { require( !mappedAddresses[to]._bots && !mappedAddresses[from]._bots, "SSH: Blocklisted." ); if (mappedAddresses[from].isLPPair) { // buy, or LP remove // Make a distinction between the two IUniswapV2Pair lpPair = IUniswapV2Pair(from); if(lpPair.token0() == address(this)) { // Token1 is other pair IERC20 otherTok = IERC20(lpPair.token1()); (, uint112 reserve1,) = lpPair.getReserves(); if(otherTok.balanceOf(from) > reserve1) { // Means balance is going up of the other token - this must be a buy _flAmt = buyInfl; // Only allow one type of operation - buy, or sell, per tx require(mappedAddresses[to]._lastTxSell != uint32(block.number), "SSH: SWCH"); mappedAddresses[to]._lastTxBuy = uint32(block.number); } else { // Either balance is going down of the other token, hasn't been sent yet (never true for a buy, but definitely the case if we're token0 on a LP removal) - if we get here, this is a LP removal _flAmt = 0; } } else { // Token0 is the other token IERC20 otherTok = IERC20(lpPair.token0()); (uint112 reserve0, ,) = lpPair.getReserves(); if(otherTok.balanceOf(from) > reserve0) { // Balance going up on other token - must be a buy _flAmt = buyInfl; // Only allow one type of operation - buy, or sell, per tx require(mappedAddresses[to]._lastTxSell != uint32(block.number), "SSH: SWCH"); mappedAddresses[to]._lastTxBuy = uint32(block.number); } else { // Either balance is going down of the other token or hasn't been sent yet (never true for a buy or if SSH is token1) - if we get here, this is a LP removal _flAmt = 0; } } } else if (mappedAddresses[to].isLPPair) { // Sell, or LP add // Checks if it's either forkController or chain ID matches isSell = true; _flAmt = sellDefl; // Only allow one type of operation - buy, or sell, per tx require(mappedAddresses[from]._lastTxBuy != uint32(block.number), "SSH: SWCH"); mappedAddresses[from]._lastTxSell = uint32(block.number); } else { // No inflation/deflation on transfers _flAmt = 0; // Check if this is going to become a new LP uint8 lpType = isNewLP(to); require(lpType != 2, "SSH: No v3 LP."); if(lpType == 1) { // V2 LP, so add the "to" address to the LP list for tracking mappedAddresses[to].isLPPair = true; lpPairs.push(to); TokenDividendTracker(dividendTracker).excludeFromDividends(to); } else { // All good } } } else { // Only make it here if it's from or to owner, contract address, or something excluded from inflation/deflation - so inflation amt is 0 and no fork restrictions _flAmt = 0; } _tokenTransfer(from, to, amount, _flAmt, isSell); } function doTaxes(uint256 tokenAmount, bool useEthPair) private { // Reentrancy guard/stop infinite tax sells mainly inSwap = true; if(_allowances[address(this)][address(uniswapV2Router)] < tokenAmount) { // Our approvals run low, redo it _approve(address(this), address(uniswapV2Router), type(uint256).max); } uint256 sellAmt = tokenAmount; if (useEthPair) { address[] memory path = new address[](3); path[0] = address(this); path[1] = _wnative; path[2] = rewardToken; // Swap direct to Hex uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens( sellAmt, 0, path, address(this), block.timestamp ); } else { // Use a 3 point path to run the sells via the USDC pools address[] memory path = new address[](4); path[0] = address(this); // USDC path[1] = _usdc; path[2] = _wnative; path[3] = rewardToken; // Swap our tokens to WETH using the this->USDC->WETH path uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens( sellAmt, 0, path, address(this), block.timestamp ); } // This fixes gas reprice issues - reentrancy is not an issue as the fee wallets are trusted. // Using a uint64 prevents an edge case where these uint32's could overflow and cause failure // burnRatio and lp rationot here as they don't make it to ETH uint64 divisor = hexRewardRatio + hexStakingRatio; IERC20 hexToken = IERC20(rewardToken); uint256 hexAmount = hexToken.balanceOf(address(this)); // Send them, split as required hexToken.transfer(stakingImpl, (hexAmount * hexStakingRatio) / divisor); SimpleStakingImpl(stakingImpl).afterReceivedHex(); hexToken.transfer(dividendTracker, (hexAmount * hexRewardRatio) / divisor); TokenDividendTracker(dividendTracker).afterReceivedHex((hexAmount * hexRewardRatio) / divisor); inSwap = false; } receive() external payable {} /// @notice Sets if arb is enabled or not. Only callable by owner. /// @param enabled if arb is enabled or not. function setArbEnabled(bool enabled) external onlyOwner { arbEnabled = enabled; } function doLaggedBurn(bool isSell, address sender) internal { if(laggedBurnAmt > 0) { // Need to determine if last "sell" was actually a LP add, and if so, discard { // Determine which token we are in the LP IUniswapV2Pair lpPair = IUniswapV2Pair(laggedLP.lpAddr); (uint112 reserve0, uint112 reserve1,) = lpPair.getReserves(); if(laggedLP.reserve0 < reserve0 && laggedLP.reserve1 < reserve1) { // Reserve0 went up and so did reserve1 - surely the only case this can occur on is a lp add, so wipe the burn if(laggedBurnAmt <= laggedLP.laggedBurnAmt) { laggedBurnAmt = 0; } else { laggedBurnAmt -= laggedLP.laggedBurnAmt; } delete(laggedLP); return; } } // Determine the best pool to burn from if(isSell) { uint8 best = 0; uint256 lastBal; for(uint8 i = 0; i < lpPairs.length; i++) { // Only add pools with a balance of our tokens for burn if(lpPairs[i] != sender && tokensOwned[(lpPairs[i])] > 0) { if(lastBal == 0) { lastBal = tokensOwned[(lpPairs[i])]; best = i; } else { if(lastBal < tokensOwned[lpPairs[i]]) { best = i; lastBal = tokensOwned[lpPairs[i]]; } } } } // Unset laggedLP if it's set delete(laggedLP); if(lastBal < laggedBurnAmt) { // Don't burn if there's too many tokens to burn scheduled - they'll get caught up later on. return; } else { _decreaseSupply(laggedBurnAmt, lpPairs[best]); // Unset the lagged burn amount - no gas cost to unset and then re-set vs just re-setting, and a gas refund if it's a buy laggedBurnAmt = 0; } } else { uint8 best = 0; uint256 lastBal; for(uint8 i = 0; i < lpPairs.length; i++) { if(lpPairs[i] != sender && tokensOwned[(lpPairs[i])] > 0) { if(lastBal == 0) { best = i; lastBal = tokensOwned[lpPairs[i]]; } else { if(lastBal < tokensOwned[lpPairs[i]]) { best = i; lastBal = tokensOwned[lpPairs[i]]; } } } } // Unset laggedLP if it's set delete(laggedLP); if(tokensOwned[lpPairs[best]] < laggedBurnAmt) { // Don't burn if there's too many tokens to burn scheduled - they'll get caught up later on. return; } else { _decreaseSupply(laggedBurnAmt, lpPairs[best]); // Unset the lagged burn amount - no gas cost to unset and then re-set vs just re-setting, and a gas refund if it's a buy laggedBurnAmt = 0; } } } } // Underlying transfer functions go here function _tokenTransfer( address sender, address recipient, uint256 amount, uint32 _flAmt, bool isSell ) private { doLaggedBurn(isSell, sender); // Do the normal tax setup uint256 taxAmount = calculateTaxesFee(amount, _flAmt); if(isSell) { TokenDividendTracker(dividendTracker).process(gasForProcessing); if (taxAmount > 0) { // Add tokens to burn queue laggedBurnAmt += taxAmount; // Save old data to be monitored on next tx { IUniswapV2Pair lpPair = IUniswapV2Pair(recipient); (uint112 reserve0, uint112 reserve1, ) = lpPair.getReserves(); laggedLP = LaggedLPData(recipient, reserve0, reserve1, amount); } if(arbEnabled) { internalArb(true); } } emit Sold(sender, amount); } else { if (taxAmount > 0) { // Emit tokens to us _increaseSupply(taxAmount); // Sell the tokens - work out what pool is being used as the trade pool address uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()) .getPair(address(this), _wnative); // Work out where tokens are going to bool useWETH; if(sender == uniswapV2Pair) { useWETH = false; } else if (recipient == uniswapV2Pair) { useWETH = false; } else { useWETH = true; } doTaxes(taxAmount, useWETH); } emit Bought(recipient, amount); } // Actually send tokens tokensOwned[sender] = tokensOwned[sender] - amount; tokensOwned[recipient] = tokensOwned[recipient] + amount; // Do the dividendtracking try TokenDividendTracker(dividendTracker).setBalance(payable(sender), tokensOwned[sender]) {} catch {} try TokenDividendTracker(dividendTracker).setBalance(payable(recipient), tokensOwned[recipient]) {} catch {} // Emit transfers, because the specs say to emit Transfer(sender, recipient, amount); } function internalArb(bool automatic) internal { address uniswapV2PairW = IUniswapV2Factory(uniswapV2Router.factory()).getPair(address(this), _wnative); address uniswapV2PairU = IUniswapV2Factory(uniswapV2Router.factory()).getPair(address(this), _usdc); // Determine if we should do arb - is it out of alignment address[] memory path = new address[](2); path[0] = _usdc; path[1] = _wnative; // Get a quote for USDC pool value in WETH uint256[] memory quoteOut = uniswapV2Router.getAmountsOut(IERC20(_usdc).balanceOf(uniswapV2PairU), path); // The price of a token (without decimals), in wei, in the USDC pool uint256 usdcPoolTokenWeiPrice = quoteOut[1]/tokensOwned[uniswapV2PairU]; // The price of a token (without decimals), in wei, in the WETH pool uint256 wethPoolTokenWeiPrice = IERC20(_wnative).balanceOf(uniswapV2PairW)/tokensOwned[uniswapV2PairW]; // Check if the wethPoolPrice is more than 15% above the usdcPoolPrice, or if the usdcPoolPrice is more than 15% above the wethPoolPrice if(!automatic || wethPoolTokenWeiPrice >= (usdcPoolTokenWeiPrice*23/20) || usdcPoolTokenWeiPrice >= (wethPoolTokenWeiPrice*23/20)) { // Calculate the arb to do (uint256 amountTokens, bool isUsdcLower) = ArbUtils.calculateArbitrage(_wnative, uniswapV2PairU, uniswapV2PairW, address(this), quoteOut[1], usdcPoolTokenWeiPrice, wethPoolTokenWeiPrice); if(isUsdcLower) { // Take tokens from the USDC pair // Make sure there's enough tokens to move if(tokensOwned[uniswapV2PairU] > amountTokens) { tokensOwned[uniswapV2PairU] = tokensOwned[uniswapV2PairU] - amountTokens; tokensOwned[uniswapV2PairW] = tokensOwned[uniswapV2PairW] + amountTokens; } else { // Error condition, we shouldn't see this - but using the second x from the quadratic seems to do it. } } else { // Take tokens from the WETH pair // Make sure there's enough tokens to move if(tokensOwned[uniswapV2PairW] > amountTokens) { tokensOwned[uniswapV2PairW] = tokensOwned[uniswapV2PairW] - amountTokens; tokensOwned[uniswapV2PairU] = tokensOwned[uniswapV2PairU] + amountTokens; } else { // Error condition, we shouldn't see this - but using the second x from the quadratic seems to do it. } } // Sync the pairs IUniswapV2Pair(uniswapV2PairU).sync(); IUniswapV2Pair(uniswapV2PairW).sync(); emit ArbitragedPools(amountTokens, isUsdcLower); } } function updateGasForProcessing(uint32 newValue) external onlyOwner { require(newValue >= 200000 && newValue <= 500000, "200,000 < GFP < 500,000"); require(newValue != gasForProcessing, "Same"); gasForProcessing = newValue; } function updateClaimWait(uint256 claimWait) external onlyOwner { TokenDividendTracker(dividendTracker).updateClaimWait(claimWait); } function excludeFromDividends(address account) external onlyOwner{ TokenDividendTracker(dividendTracker).excludeFromDividends(account); } function processDividendTracker(uint256 gas) external { TokenDividendTracker(dividendTracker).process(gas); } function claim() external { TokenDividendTracker(dividendTracker).processAccount(payable(msg.sender), false); } function calculateTaxesFee(uint256 _amount, uint32 _flAmt) private pure returns (uint256 tax) { tax = (_amount * _flAmt) / 100000; } /// @notice Allows new pairs to be added to the "watcher" code /// @param pair the address to add as the liquidity pair function addNewLPPair(address pair) external onlyOwner { mappedAddresses[pair].isLPPair = true; lpPairs.push(pair); } /// @notice Irreversibly disables blocklist additions after launch has settled. /// @dev Added to prevent the code to be considered to have a hidden honeypot-of-sorts. function disableBlocklistAdd() external onlyOwner { disableAddToBlocklist = true; } function isNewLP(address acc) internal view returns (uint8) { /** * The process of a LP being created is as follows: * The router calls a low-level _addLiquidity function * This function checks if a LP pair exists and if not, creates one * After that, it checks the ratio and if none, sets to desired, otherwise gets optimal * The rest doesn't matter * So our transfer is called after the creation of the contract, meaning we can identify it is a contract * */ if(Address.isContract(acc)) { /** * The next step of identifying if this is a LP is to attempt to probe the liquidity pair for its type * We may not want a v3 liquidity being created, for example, and could revert the transfer */ IUniswapV2Pair testPair = IUniswapV2Pair(acc); try testPair.getReserves() { return 1; } catch { // Not v2 liq // v3 has "fee()" request IUniswapV3PoolImmutables test3Pair = IUniswapV3PoolImmutables(acc); try test3Pair.fee() { return 2; } catch { // Unknown contract type, not v2 or v3 return 0; } } } else { return 0; } } /// @notice Sets an account exclusion or inclusion from fees. /// @param account the account to change state on /// @param isExcluded the boolean to set it to function setExcludedFromFee(address account, bool isExcluded) external onlyOwner { mappedAddresses[account]._isExcludedFromFee = isExcluded; } /// @notice Sets the buy tax, out of 100000. Only callable by owner. Max of 20000. /// @param amount the tax out of 100000. function setBuyInfl(uint32 amount) external onlyOwner { require(amount <= 20000, "SSH: Max 20%."); buyInfl = amount; } /// @notice Sets the sell tax, out of 100000. Only callable by owner. Max of 20000. /// @param amount the tax out of 100000. function setSellDefl(uint32 amount) external onlyOwner { require(amount <= 20000, "SSH: Max 20%."); sellDefl = amount; } /// @notice Sets the staking ratio. Only callable by owner. /// @param amount staking ratio to set function setStakingRatio(uint32 amount) external onlyOwner { hexStakingRatio = amount; } /// @notice Sets the reward ratio. Only callable by owner. /// @param amount rward ratio to set function setRewardRatio(uint32 amount) external onlyOwner { hexRewardRatio = amount; } /// @notice Changes bot flag. Only callable by owner. Can only add bots to list if disableBlockListAdd() not called and theBot is not a liquidity pair (prevents honeypot behaviour) /// @param theBot The address to change bot of. /// @param toSet The value to set. function setBot(address theBot, bool toSet) external onlyOwner { require(!mappedAddresses[theBot].isLPPair, "SSH: FORBIDDEN"); if(toSet) { require(!disableAddToBlocklist, "SSH: DISABLED"); } mappedAddresses[theBot]._bots = toSet; } /// @notice Allows a multi-send to save on gas /// @param addr array of addresses to send to /// @param val array of values to go with addresses function multisend(address[] calldata addr, uint256[] calldata val) external override { require(addr.length == val.length, "SSH: MISMATCH"); for(uint i = 0; i < addr.length; i++) { // There's gas savings to be had to do this - we bypass top-level checks _tokenTransfer(_msgSender(), addr[i], val[i], 0, false); } } /// @notice Allows a multi-send to save on gas on behalf of someone - need approvals /// @param sender sender to use - must be approved to spend /// @param addrRecipients array of addresses to send to /// @param vals array of values to go with addresses function multisendFrom(address sender, address[] calldata addrRecipients, uint256[] calldata vals) external override { require(addrRecipients.length == vals.length, "SSH: MISMATCH"); for(uint i = 0; i < addrRecipients.length; i++) { // More gas savings as we bypass top-level checks - we have to do approval subs tho _tokenTransfer(sender, addrRecipients[i], vals[i], 0, false); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(vals[i],"ERC20: transfer amount exceeds allowance")); } } function checkBot(address bot) external view returns(bool) { return mappedAddresses[bot]._bots; } /// @notice Returns if an account is excluded from fees. /// @param account the account to check function isExcludedFromFee(address account) external view returns (bool) { return mappedAddresses[account]._isExcludedFromFee; } /// @dev debug code to get the LP pairs function getLPPairs() external view returns (address[] memory lps) { lps = lpPairs; } /** START OF EIP2612/EIP712 FUNCTIONS */ // These need to be here so it can access _approve, lol /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } /** END OF EIP2612/EIP712 FUNCTIONS */ }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); }
pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); 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(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; }
pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint 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 (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint 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 (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); 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 (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
pragma solidity >=0.5.0; interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
/** * A bunch of arbitrage math utilities, some shamelessly borrowed from https://github.com/paco0x/amm-arbitrageur/ (specifically the quadratic and sqrt) * Some also cooked up by my insane mind * SPDX-License-Identifier: WTFPL * Licensed as per the amm-arbitrageur license, because it's really just a clone of that */ import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@uniswap/v2-core/contracts/interfaces/IERC20.sol"; pragma solidity ^0.8.15; library ArbUtils { // USDC function calculateArbitrage(address _weth, address usdcP, address wethP, address token, uint256 quote, uint256 uptwp, uint256 wptwp) internal view returns (uint256 amount, bool isUsdcLower) { // We need to work out the "cheaper" of the two, with respect for the fact the USDC/WETH pool is needed { int256 a1; int256 b1; int256 a2; int256 b2; if(uptwp < wptwp) { // USDC price is under WETH price // Calculate a1,b2,a2,b2 a1 = (int256) (quote); b1 = (int256) (IERC20(token).balanceOf(usdcP)); a2 = (int256) (IERC20(_weth).balanceOf(wethP)); b2 = (int256) (IERC20(token).balanceOf(wethP)); isUsdcLower = true; } else { // WETH price is under USDC price // Calculate a1,b2,a2,b2 a2 = (int256) (quote); b2 = (int256) (IERC20(token).balanceOf(usdcP)); a1 = (int256) (IERC20(_weth).balanceOf(wethP)); b1 = (int256) (IERC20(token).balanceOf(wethP)); isUsdcLower = false; } // Divide a, b, and c by a big number and then multiply it back out // the divisor is 9 (decimals of token) + 18 (eth decimals) int256 a = (a1 * b1 - a2 * b2)/(10**27); int256 b = (2 * b1 * b2 * (a1 + a2))/(10**27); int256 c = (b1 * b2 * (a1 * b2 - a2 * b1))/(10**27); (int256 x1,) = calcSolutionForQuadratic(a, b, c); // This calculates the amount required to get the two into sync - not maximum profit. amount = uint256(x1) * 2; } } /// @dev find solution of quadratic equation: ax^2 + bx + c = 0, only return the positive solution function calcSolutionForQuadratic( int256 a, int256 b, int256 c ) public pure returns (int256 x1, int256 x2) { int256 m = b**2 - 4 * a * c; // m < 0 leads to complex number require(m > 0, 'ArbUtils: COMPLEX'); int256 sqrtM = int256(sqrt(uint256(m))); x1 = (-b + sqrtM) / (2 * a); x2 = (-b - sqrtM) / (2 * a); } /// @dev Newton’s method for caculating square root of n function sqrt(uint256 n) internal pure returns (uint256 res) { assert(n > 1); // The scale factor is a crude way to turn everything into integer calcs. // Actually do (n * 10 ^ 4) ^ (1/2) uint256 _n = n * 10**6; uint256 c = _n; res = _n; uint256 xi; while (true) { xi = (res + c / res) / 2; // don't need be too precise to save gas if (res - xi < 1000) { break; } res = xi; } res = res / 10**3; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.15; import "@uniswap/v2-core/contracts/interfaces/IERC20.sol"; import "./DividendPayingTokenInterface.sol"; import "./DividendPayingTokenOptionalInterface.sol"; import "./math/SafeMathUint.sol"; import "./math/SafeMathInt.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /// @title Dividend-Paying Token /// @author Roger Wu (https://github.com/roger-wu) /// @dev A mintable ERC20 token that allows anyone to pay and distribute tokens /// to token holders as dividends and allows token holders to withdraw their dividends. /// Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code abstract contract DividendPayingToken is Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface { using SafeMath for uint256; using SafeMathUint for uint256; using SafeMathInt for int256; address public REWARD_TOKEN; address public stakingImpl; // With `magnitude`, we can properly distribute dividends even if the amount of received ether is small. // For more discussion about choosing the value of `magnitude`, // see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728 uint256 internal constant magnitude = 2 ** 128; uint256 internal magnifiedDividendPerShare; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; magnifiedDividendCorrections[account] = magnifiedDividendCorrections[ account ].sub((magnifiedDividendPerShare.mul(amount)).toInt256Safe()); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; magnifiedDividendCorrections[account] = magnifiedDividendCorrections[ account ].add((magnifiedDividendPerShare.mul(amount)).toInt256Safe()); } modifier onlySSHex() { require(_msgSender() == owner() || _msgSender() == stakingImpl, "Only senders."); _; } // About dividendCorrection: // If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with: // `dividendOf(_user) = dividendPerShare * balanceOf(_user)`. // When `balanceOf(_user)` is changed (via minting/burning/transferring tokens), // `dividendOf(_user)` should not be changed, // but the computed value of `dividendPerShare * balanceOf(_user)` is changed. // To keep the `dividendOf(_user)` unchanged, we add a correction term: // `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`, // where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed: // `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`. // So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed. mapping(address => int256) internal magnifiedDividendCorrections; mapping(address => uint256) internal withdrawnDividends; uint256 public totalDividendsDistributed; constructor( address _rewardTokenAddress ) { REWARD_TOKEN = _rewardTokenAddress; } function setStakingImpl(address impl) public onlyOwner { stakingImpl = impl; } function afterReceivedHex(uint256 amount) public onlySSHex { if (_totalSupply > 0 && amount > 0) { magnifiedDividendPerShare = magnifiedDividendPerShare.add( (amount).mul(magnitude) / _totalSupply ); emit DividendsDistributed(msg.sender, amount); totalDividendsDistributed = totalDividendsDistributed.add(amount); } } /// @notice Withdraws the ether distributed to the sender. /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. function withdrawDividend() public virtual override { _withdrawDividendOfUser(payable(msg.sender)); } /// @notice Withdraws the ether distributed to the sender. /// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. function _withdrawDividendOfUser( address payable user ) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user); if (_withdrawableDividend > 0) { withdrawnDividends[user] = withdrawnDividends[user].add( _withdrawableDividend ); emit DividendWithdrawn(user, _withdrawableDividend); bool success = IERC20(REWARD_TOKEN).transfer( user, _withdrawableDividend ); if (!success) { withdrawnDividends[user] = withdrawnDividends[user].sub( _withdrawableDividend ); return 0; } return _withdrawableDividend; } return 0; } /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function dividendOf(address _owner) public view override returns (uint256) { return withdrawableDividendOf(_owner); } /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function withdrawableDividendOf( address _owner ) public view override returns (uint256) { return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]); } /// @notice View the amount of dividend in wei that an address has withdrawn. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has withdrawn. function withdrawnDividendOf( address _owner ) public view override returns (uint256) { return withdrawnDividends[_owner]; } /// @notice View the amount of dividend in wei that an address has earned in total. /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner) /// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has earned in total. function accumulativeDividendOf( address _owner ) public view override returns (uint256) { return magnifiedDividendPerShare .mul(_balances[_owner]) .toInt256Safe() .add(magnifiedDividendCorrections[_owner]) .toUint256Safe() / magnitude; } /// @dev Internal function that transfer tokens from one address to another. /// Update magnifiedDividendCorrections to keep dividends unchanged. /// @param from The address to transfer from. /// @param to The address to transfer to. /// @param value The amount to be transferred. function _transfer( address from, address to, uint256 value ) internal virtual { require(false); int256 _magCorrection = magnifiedDividendPerShare .mul(value) .toInt256Safe(); magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from] .add(_magCorrection); magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub( _magCorrection ); } function _setBalance(address account, uint256 newBalance) internal { uint256 currentBalance = _balances[account]; if (newBalance > currentBalance) { uint256 mintAmount = newBalance.sub(currentBalance); _mint(account, mintAmount); } else if (newBalance < currentBalance) { uint256 burnAmount = currentBalance.sub(newBalance); _burn(account, burnAmount); } } }
pragma solidity ^0.8.15; // SPDX-License-Identifier: UNLICENSED /// @title Dividend-Paying Token Interface /// @author Roger Wu (https://github.com/roger-wu) /// @dev An interface for a dividend-paying token contract. interface DividendPayingTokenInterface { /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function dividendOf(address _owner) external view returns(uint256); /// @notice Distributes ether to token holders as dividends. /// @dev SHOULD distribute the paid ether to token holders as dividends. /// SHOULD NOT directly transfer ether to token holders in this function. /// MUST emit a `DividendsDistributed` event when the amount of distributed ether is greater than 0. function distributeDividends() external payable; /// @notice Withdraws the ether distributed to the sender. /// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer. /// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0. function withdrawDividend() external; /// @dev This event MUST emit when ether is distributed to token holders. /// @param from The address which sends ether to this contract. /// @param weiAmount The amount of distributed ether in wei. event DividendsDistributed( address indexed from, uint256 weiAmount ); /// @dev This event MUST emit when an address withdraws their dividend. /// @param to The address which withdraws ether from this contract. /// @param weiAmount The amount of withdrawn ether in wei. event DividendWithdrawn( address indexed to, uint256 weiAmount ); }
pragma solidity ^0.8.15; // SPDX-License-Identifier: UNLICENSED /// @title Dividend-Paying Token Optional Interface /// @author Roger Wu (https://github.com/roger-wu) /// @dev OPTIONAL functions for a dividend-paying token contract. interface DividendPayingTokenOptionalInterface { /// @notice View the amount of dividend in wei that an address can withdraw. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` can withdraw. function withdrawableDividendOf(address _owner) external view returns(uint256); /// @notice View the amount of dividend in wei that an address has withdrawn. /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has withdrawn. function withdrawnDividendOf(address _owner) external view returns(uint256); /// @notice View the amount of dividend in wei that an address has earned in total. /// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner) /// @param _owner The address of a token holder. /// @return The amount of dividend in wei that `_owner` has earned in total. function accumulativeDividendOf(address _owner) external view returns(uint256); }
pragma solidity ^0.8.15; // SPDX-License-Identifier: UNLICENSED /** * @title SafeMathInt * @dev Math operations with safety checks that revert on error * @dev SafeMath adapted for int256 * Based on code of https://github.com/RequestNetwork/requestNetwork/blob/master/packages/requestNetworkSmartContracts/contracts/base/math/SafeMathInt.sol */ library SafeMathInt { function mul(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when multiplying INT256_MIN with -1 // https://github.com/RequestNetwork/requestNetwork/issues/43 require(!(a == - 2**255 && b == -1) && !(b == - 2**255 && a == -1)); int256 c = a * b; require((b == 0) || (c / b == a)); return c; } function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing INT256_MIN by -1 // https://github.com/RequestNetwork/requestNetwork/issues/43 require(!(a == - 2**255 && b == -1) && (b > 0)); return a / b; } function sub(int256 a, int256 b) internal pure returns (int256) { require((b >= 0 && a - b <= a) || (b < 0 && a - b > a)); return a - b; } function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; } function toUint256Safe(int256 a) internal pure returns (uint256) { require(a >= 0); return uint256(a); } }
pragma solidity ^0.8.15; // SPDX-License-Identifier: UNLICENSED /** * @title SafeMathUint * @dev Math operations with safety checks that revert on error */ library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { int256 b = int256(a); require(b >= 0); return b; } }
import "./DividendPayingToken.sol"; // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.15; contract TokenDividendTracker is Ownable, DividendPayingToken { using SafeMath for uint256; using SafeMathInt for int256; struct MAP { address[] keys; mapping(address => uint) values; mapping(address => uint) indexOf; mapping(address => bool) inserted; } MAP private tokenHoldersMap; uint256 public lastProcessedIndex; mapping(address => bool) public excludedFromDividends; mapping(address => uint256) public lastClaimTimes; uint256 public claimWait; uint256 public minimumTokenBalanceForDividends; event ExcludeFromDividends(address indexed account); event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue); event Claim( address indexed account, uint256 amount, bool indexed automatic ); constructor( address _rewardTokenAddress, uint256 _minimumTokenBalanceForDividends ) DividendPayingToken( _rewardTokenAddress ) { claimWait = 3600; minimumTokenBalanceForDividends = _minimumTokenBalanceForDividends; } function _transfer( address, address, uint256 ) internal pure override { require(false, "DT: FORBIDDEN"); } function withdrawDividend() public pure override { require( false, "DT: CLAIM." ); } function setMinimumTokenBalanceForDividends(uint256 val) external onlyOwner { minimumTokenBalanceForDividends = val; } function excludeFromDividends(address account) external onlyOwner { require(!excludedFromDividends[account]); excludedFromDividends[account] = true; _setBalance(account, 0); MAPRemove(account); emit ExcludeFromDividends(account); } function updateClaimWait(uint256 newClaimWait) external onlyOwner { require( newClaimWait >= 3600 && newClaimWait <= 86400, "DT: 1 < claimWait < 24" ); require( newClaimWait != claimWait, "DT: Same" ); emit ClaimWaitUpdated(newClaimWait, claimWait); claimWait = newClaimWait; } function getLastProcessedIndex() external view returns (uint256) { return lastProcessedIndex; } function getNumberOfTokenHolders() external view returns (uint256) { return tokenHoldersMap.keys.length; } function isExcludedFromDividends(address account) public view returns (bool) { return excludedFromDividends[account]; } function getAccount(address _account) public view returns ( address account, int256 index, int256 iterationsUntilProcessed, uint256 withdrawableDividends, uint256 totalDividends, uint256 lastClaimTime, uint256 nextClaimTime, uint256 secondsUntilAutoClaimAvailable ) { account = _account; index = MAPGetIndexOfKey(account); iterationsUntilProcessed = -1; if (index >= 0) { if (uint256(index) > lastProcessedIndex) { iterationsUntilProcessed = index.sub( int256(lastProcessedIndex) ); } else { uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ? tokenHoldersMap.keys.length.sub(lastProcessedIndex) : 0; iterationsUntilProcessed = index.add( int256(processesUntilEndOfArray) ); } } withdrawableDividends = withdrawableDividendOf(account); totalDividends = accumulativeDividendOf(account); lastClaimTime = lastClaimTimes[account]; nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0; secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime.sub(block.timestamp) : 0; } function getAccountAtIndex(uint256 index) public view returns ( address, int256, int256, uint256, uint256, uint256, uint256, uint256 ) { if (index >= MAPSize()) { return ( 0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0 ); } address account = MAPGetKeyAtIndex(index); return getAccount(account); } function canAutoClaim(uint256 lastClaimTime) private view returns (bool) { if (lastClaimTime > block.timestamp) { return false; } return block.timestamp.sub(lastClaimTime) >= claimWait; } function setBalance(address payable account, uint256 newBalance) external onlyOwner { if (excludedFromDividends[account]) { return; } if (newBalance >= minimumTokenBalanceForDividends) { _setBalance(account, newBalance); MAPSet(account, newBalance); } else { _setBalance(account, 0); MAPRemove(account); } processAccount(account, true); } function process(uint256 gas) public returns ( uint256, uint256, uint256 ) { uint256 numberOfTokenHolders = tokenHoldersMap.keys.length; if (numberOfTokenHolders == 0) { return (0, 0, lastProcessedIndex); } uint256 _lastProcessedIndex = lastProcessedIndex; uint256 gasUsed = 0; uint256 gasLeft = gasleft(); uint256 iterations = 0; uint256 claims = 0; while (gasUsed < gas && iterations < numberOfTokenHolders) { _lastProcessedIndex++; if (_lastProcessedIndex >= tokenHoldersMap.keys.length) { _lastProcessedIndex = 0; } address account = tokenHoldersMap.keys[_lastProcessedIndex]; if (canAutoClaim(lastClaimTimes[account])) { if (processAccount(payable(account), true)) { claims++; } } iterations++; uint256 newGasLeft = gasleft(); if (gasLeft > newGasLeft) { gasUsed = gasUsed.add(gasLeft.sub(newGasLeft)); } gasLeft = newGasLeft; } lastProcessedIndex = _lastProcessedIndex; return (iterations, claims, lastProcessedIndex); } function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) { uint256 amount = _withdrawDividendOfUser(account); if (amount > 0) { lastClaimTimes[account] = block.timestamp; emit Claim(account, amount, automatic); return true; } return false; } function MAPGet(address key) public view returns (uint) { return tokenHoldersMap.values[key]; } function MAPGetIndexOfKey(address key) public view returns (int) { if (!tokenHoldersMap.inserted[key]) { return -1; } return int(tokenHoldersMap.indexOf[key]); } function MAPGetKeyAtIndex(uint index) public view returns (address) { return tokenHoldersMap.keys[index]; } function MAPSize() public view returns (uint) { return tokenHoldersMap.keys.length; } function MAPSet(address key, uint val) internal { if (tokenHoldersMap.inserted[key]) { tokenHoldersMap.values[key] = val; } else { tokenHoldersMap.inserted[key] = true; tokenHoldersMap.values[key] = val; tokenHoldersMap.indexOf[key] = tokenHoldersMap.keys.length; tokenHoldersMap.keys.push(key); } } function MAPRemove(address key) internal { if (!tokenHoldersMap.inserted[key]) { return; } delete tokenHoldersMap.inserted[key]; delete tokenHoldersMap.values[key]; uint index = tokenHoldersMap.indexOf[key]; uint lastIndex = tokenHoldersMap.keys.length - 1; address lastKey = tokenHoldersMap.keys[lastIndex]; tokenHoldersMap.indexOf[lastKey] = index; delete tokenHoldersMap.indexOf[key]; tokenHoldersMap.keys[index] = lastKey; tokenHoldersMap.keys.pop(); } function distributeDividends() external payable override {} }
/** * Hex token interface * Isn't Hex itself, only allows us to interface. * SPDX-License-Identifier: BSD-3-Clause */ pragma solidity ^0.8.15; interface IHex { event StakeStart( uint256 data0, address indexed stakerAddr, uint40 indexed stakeId ); event StakeGoodAccounting( uint256 data0, uint256 data1, address indexed stakerAddr, uint40 indexed stakeId, address indexed senderAddr ); event StakeEnd( uint256 data0, uint256 data1, address indexed stakerAddr, uint40 indexed stakeId ); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function stakeLists(address, uint256) view external returns(uint40 stakeId, uint72 stakedHearts, uint72 stakeShares, uint16 lockedDay, uint16 stakedDays, uint16 unlockedDay, bool isAutoStake); /** * @dev PUBLIC FACING: Optionally update daily data for a smaller * range to reduce gas cost for a subsequent operation * @param beforeDay Only update days before this day number (optional; 0 for current day) */ function dailyDataUpdate(uint256 beforeDay) external; /** * @dev PUBLIC FACING: External helper to return multiple values of daily data with * a single call. Ugly implementation due to limitations of the standard ABI encoder. * @param beginDay First day of data range * @param endDay Last day (non-inclusive) of data range * @return list Fixed array of packed values */ function dailyDataRange(uint256 beginDay, uint256 endDay) external view returns (uint256[] memory list); /** * @dev PUBLIC FACING: External helper to return most global info with a single call. * Ugly implementation due to limitations of the standard ABI encoder. * @return Fixed array of values */ function globalInfo() external view returns (uint256[13] memory); /** * @dev PUBLIC FACING: External helper for the current day number since launch time * @return Current day number (zero-based) */ function currentDay() external view returns (uint256); /** * @dev PUBLIC FACING: Open a stake. * @param newStakedHearts Number of Hearts to stake * @param newStakedDays Number of days to stake */ function stakeStart(uint256 newStakedHearts, uint256 newStakedDays) external; /** * @dev PUBLIC FACING: Unlocks a completed stake, distributing the proceeds of any penalty * immediately. The staker must still call stakeEnd() to retrieve their stake return (if any). * @param stakerAddr Address of staker * @param stakeIndex Index of stake within stake list * @param stakeIdParam The stake's id */ function stakeGoodAccounting(address stakerAddr, uint256 stakeIndex, uint40 stakeIdParam) external; /** * @dev PUBLIC FACING: Closes a stake. The order of the stake list can change so * a stake id is used to reject stale indexes. * @param stakeIndex Index of stake within stake list * @param stakeIdParam The stake's id */ function stakeEnd(uint256 stakeIndex, uint40 stakeIdParam) external; /** * @dev PUBLIC FACING: Return the current stake count for a staker address * @param stakerAddr Address of staker */ function stakeCount(address stakerAddr) external view returns (uint256); }
/** * A Multisend interface * SPDX-License-Identifier: MIT */ pragma solidity ^0.8.15; interface IMultisend { /// @notice Allows a multi-send to save on gas /// @param addr array of addresses to send to /// @param val array of values to go with addresses function multisend(address[] calldata addr, uint256[] calldata val) external; /// @notice Allows a multi-send to save on gas on behalf of someone - need approvals /// @param sender sender to use - must be approved to spend /// @param addrRecipients array of addresses to send to /// @param vals array of values to go with addresses function multisendFrom(address sender, address[] calldata addrRecipients, uint256[] calldata vals) external; }
/** * SimpleStakingImpl * Handles staking, unstaking, collecting rewards and re-staking Hex * Holds the Hex pending staking in itself */ pragma solidity ^0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; import "./IHex.sol"; //import "./IHedron.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "./DPT/TokenDividendTracker.sol"; contract SimpleStakingImpl is Ownable { // Block of 256 bits address public token; uint32 public stakingDays; uint64 public lastStakedStart; // Closed // Block of 256 bits address public dividendTracker; // Closed address public hedron; address public router; uint64 public launchTime; constructor( address stakingToken, uint32 daysToStake, address dividendTrackerToken, address hdrn, address rtr ) { token = stakingToken; stakingDays = daysToStake; lastStakedStart = uint64(IHex(token).currentDay()); dividendTracker = dividendTrackerToken; hedron = hdrn; router = rtr; launchTime = uint64(block.timestamp) + 86400; } function updateFork(address newRtr) external onlyOwner { // Update router router = newRtr; } function afterReceivedHex() external onlyOwner { // Called after Hex has been received // We only ever have one stake in the list, but we get stakeCount anyway IHex stakingContract = IHex(token); // We check if there's a stake to resolve uint256 stakeNumber = stakingContract.stakeCount(address(this)); if (stakeNumber > 0) { // Something was staked last time so it's time to unstake it // Unstake all of the stakes present, if there's more than one (there shouldn't be, but we have to assume) uint256 currentDay = stakingContract.currentDay(); // Total stake output to accumulate uint256 stakeRewards = 0; for (uint i = 0; i < stakeNumber; i++) { // Get the pre-unlock balance of tokens uint256 oldBal = stakingContract.balanceOf(address(this)); // Grab the stakeId from the stakeLists (uint40 stakeId, , , uint16 lockedDay, uint16 stakedDays, , ) = stakingContract.stakeLists( address(this), i ); // If this is true, the stake is ready for unlock if(currentDay >= lockedDay + stakedDays) { // Run the "good" stake unlocker to not be penalised stakingContract.stakeGoodAccounting(address(this), i, stakeId); // Get the tokens back stakingContract.stakeEnd(i, stakeId); // Accumulate the stake rewards stakeRewards = stakeRewards + (stakingContract.balanceOf(address(this)) - oldBal); } } if(stakeRewards > 0) { // Pay out 1% of the stake output to the dividend tracker stakingContract.transfer(dividendTracker, stakeRewards / 100); // Tell it there's some tokens to calculate TokenDividendTracker(dividendTracker).afterReceivedHex(stakeRewards / 100); // Now need to restake our holdings uint256 stakeAmt = stakingContract.balanceOf(address(this)); stakingContract.stakeStart(stakeAmt, stakingDays); } } else { // Give a day to fill pool if(block.timestamp > launchTime) { uint256 stakeAmt = stakingContract.balanceOf(address(this)); stakingContract.stakeStart(stakeAmt, stakingDays); } } } }
{ "optimizer": { "enabled": true, "runs": 50 }, "viaIR": false, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"wasUsdcLower","type":"bool"}],"name":"ArbitragedPools","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Bought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Sold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"}],"name":"addNewLPPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bot","type":"address"}],"name":"checkBot","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"disableBlocklistAdd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dividendTracker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"excludeFromDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getLPPairs","outputs":[{"internalType":"address[]","name":"lps","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isExcludedFromFee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addr","type":"address[]"},{"internalType":"uint256[]","name":"val","type":"uint256[]"}],"name":"multisend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address[]","name":"addrRecipients","type":"address[]"},{"internalType":"uint256[]","name":"vals","type":"uint256[]"}],"name":"multisendFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nativeWrapped","type":"address"}],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gas","type":"uint256"}],"name":"processDividendTracker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setArbEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"theBot","type":"address"},{"internalType":"bool","name":"toSet","type":"bool"}],"name":"setBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setBuyInfl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"setExcludedFromFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setRewardRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setSellDefl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"amount","type":"uint32"}],"name":"setStakingRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingImpl","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimWait","type":"uint256"}],"name":"updateClaimWait","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newValue","type":"uint32"}],"name":"updateGasForProcessing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610140604052600380546001600160a01b03191673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4817905560118054600160a01b600160f01b031916644e2000249f60a51b179055601280547d13880000000000000000000000000000000000000000000000320000000067ffffffff00000001600160e01b039091161790557d232800001d4c000000322b591e99afe9f32eaa6214f7b7629768c40eeb396013556014805463ffffff0019166301000000179055348015620000c257600080fd5b506040516200872138038062008721833981016040819052620000e59162000a98565b620000f03362000a1d565b60148054600160201b600160c01b0319166401000000006001600160a01b03841602179055604080518082018252600f81526e0a6eae0cae4a6e8c2d6ca744090caf608b1b602091820152815180830190925260018252603160f81b9101527fc2e5f07951faa96d2fb4ac9ba1b219cb7aadebe4d3af9c94be53dc004ce2d4c560e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620002118184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c0526101208190523360009081526005602052604080822066c55a6e4145e0009081905560025560135490516001600160a01b0390911690633b9aca00906200025f9062000a7c565b6001600160a01b0390921682526020820152604001604051809103906000f08015801562000291573d6000803e3d6000fd5b50601180546001600160a01b0319166001600160a01b03838116918217909255601354604051939450600093921691603c9190733819f64f282bf135d62168c1e513280daf905e06908a90620002e79062000a8a565b6001600160a01b03958616815263ffffffff909416602085015291841660408401528316606083015291909116608082015260a001604051809103906000f08015801562000339573d6000803e3d6000fd5b5060128054600160401b600160e01b031916680100000000000000006001600160a01b03848116820292909217928390556040516301ae994760e21b8152920481166004830152919250908316906306ba651c90602401600060405180830381600087803b158015620003ab57600080fd5b505af1158015620003c0573d6000803e3d6000fd5b505060115460405163031e79db60e41b81526001600160a01b03918216600482015290851692506331e79db09150602401600060405180830381600087803b1580156200040c57600080fd5b505af115801562000421573d6000803e3d6000fd5b505060405163031e79db60e41b81523060048201526001600160a01b03851692506331e79db09150602401600060405180830381600087803b1580156200046757600080fd5b505af11580156200047c573d6000803e3d6000fd5b50505050816001600160a01b03166331e79db06200049f62000a6d60201b60201c565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015620004e157600080fd5b505af1158015620004f6573d6000803e3d6000fd5b505060405163031e79db60e41b815261dead60048201526001600160a01b03851692506331e79db09150602401600060405180830381600087803b1580156200053e57600080fd5b505af115801562000553573d6000803e3d6000fd5b50504660105550506040805160e08101825260018152600060208201819052918101829052606081018290526080810182905260a0810182905260c0810182905290600790336001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff0219169083151502179055509050506040518060e00160405280600115158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016000151581526020016000151581525060076000306001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff0219169083151502179055509050506040518060e00160405280600115158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016000151581526020016000151581525060076000601160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff021916908315150217905550905050620009b862000a1960201b60201c565b6001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef66c55a6e4145e00060405162000a0591815260200190565b60405180910390a350505050505062000aca565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031690565b6119178062005f8c83390190565b610e7e80620078a383390190565b60006020828403121562000aab57600080fd5b81516001600160a01b038116811462000ac357600080fd5b9392505050565b60805160a05160c05160e051610100516101205161547262000b1a60003960006127ed0152600061283c01526000612817015260006127700152600061279a015260006127c401526154726000f3fe6080604052600436106101f45760003560e01c806376b3617b1161010e578063ca72a4e71161009b578063ca72a4e7146105e3578063d505accf14610603578063dbf6ad8114610623578063dd62ed3e14610643578063e4056a6b14610689578063e98030c7146106a9578063e9cb414f146106c9578063f200e29d146106e9578063f206bbb71461070b578063f2fde38b1461072b57600080fd5b806376b3617b14610487578063771282f6146104a75780637ecebe00146104bd5780638da5cb5b146104dd57806395d89b41146104f2578063a9059cbb1461051e578063aad41a411461053e578063b1a4e0dc1461055e578063b4113cc81461059c578063c21c989b146105c357600080fd5b80633644e5151161018c5780633644e515146103645780634e71d92d146103795780635342acb41461038e5780636612e66f146103c75780636cbadbfa146103e7578063700bb191146103fd57806370a082311461041d57806370bfdd9d1461043d578063715018a61461045257806373ae740e1461046757600080fd5b806306fdde0314610200578063095ea7b31461024a57806318160ddd1461027a5780631aa7daff1461029957806323b872dd146102bb5780632c1f5216146102db578063313ce5671461030857806331e79db014610324578063342aa8b51461034457600080fd5b366101fb57005b600080fd5b34801561020c57600080fd5b5060408051808201909152600f81526e0a6eae0cae4a6e8c2d6ca744090caf608b1b60208201525b6040516102419190614a1a565b60405180910390f35b34801561025657600080fd5b5061026a610265366004614a7d565b61074b565b6040519015158152602001610241565b34801561028657600080fd5b506002545b604051908152602001610241565b3480156102a557600080fd5b506102b96102b4366004614abb565b610762565b005b3480156102c757600080fd5b5061026a6102d6366004614ad8565b6107c0565b3480156102e757600080fd5b506011546102fb906001600160a01b031681565b6040516102419190614b19565b34801561031457600080fd5b5060405160098152602001610241565b34801561033057600080fd5b506102b961033f366004614b2d565b61083a565b34801561035057600080fd5b506102b961035f366004614b58565b6108a7565b34801561037057600080fd5b5061028b610991565b34801561038557600080fd5b506102b96109a0565b34801561039a57600080fd5b5061026a6103a9366004614b2d565b6001600160a01b031660009081526007602052604090205460ff1690565b3480156103d357600080fd5b506102b96103e2366004614b58565b610a18565b3480156103f357600080fd5b5061028b60105481565b34801561040957600080fd5b506102b9610418366004614b91565b610a4b565b34801561042957600080fd5b5061028b610438366004614b2d565b610ac3565b34801561044957600080fd5b506102b9610ade565b34801561045e57600080fd5b506102b9610afb565b34801561047357600080fd5b506102b9610482366004614bf5565b610b0f565b34801561049357600080fd5b506102b96104a2366004614abb565b610bf8565b3480156104b357600080fd5b5061028b60025481565b3480156104c957600080fd5b5061028b6104d8366004614b2d565b610cd9565b3480156104e957600080fd5b506102fb610cf7565b3480156104fe57600080fd5b506040805180820190915260038152620a6a6960eb1b6020820152610234565b34801561052a57600080fd5b5061026a610539366004614a7d565b610d06565b34801561054a57600080fd5b506102b9610559366004614c77565b610d13565b34801561056a57600080fd5b5061026a610579366004614b2d565b6001600160a01b0316600090815260076020526040902054610100900460ff1690565b3480156105a857600080fd5b506012546102fb90600160401b90046001600160a01b031681565b3480156105cf57600080fd5b506102b96105de366004614abb565b610d65565b3480156105ef57600080fd5b506102b96105fe366004614b2d565b610d93565b34801561060f57600080fd5b506102b961061e366004614ce2565b61193f565b34801561062f57600080fd5b506102b961063e366004614abb565b611ac2565b34801561064f57600080fd5b5061028b61065e366004614d59565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b34801561069557600080fd5b506102b96106a4366004614abb565b611aef565b3480156106b557600080fd5b506102b96106c4366004614b91565b611b45565b3480156106d557600080fd5b506102b96106e4366004614b2d565b611b7e565b3480156106f557600080fd5b506106fe611bef565b6040516102419190614dcb565b34801561071757600080fd5b506102b9610726366004614dde565b611c51565b34801561073757600080fd5b506102b9610746366004614b2d565b611c77565b6000610758338484611ced565b5060015b92915050565b61076a611e11565b614e208163ffffffff16111561079b5760405162461bcd60e51b815260040161079290614dfb565b60405180910390fd5b6013805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b60006107cd848484611e70565b610830843361082b856040518060600160405280602881526020016153f5602891396001600160a01b038a16600090815260066020526040812090335b6001600160a01b031681526020810191909152604001600020549190612737565b611ced565b5060019392505050565b610842611e11565b60115460405163031e79db60e41b81526001600160a01b03909116906331e79db090610872908490600401614b19565b600060405180830381600087803b15801561088c57600080fd5b505af11580156108a0573d6000803e3d6000fd5b5050505050565b6108af611e11565b6001600160a01b038216600090815260076020526040902054600160701b900460ff16156109105760405162461bcd60e51b815260206004820152600e60248201526d29a9a41d102327a92124a22222a760911b6044820152606401610792565b801561096057601154600160e01b900460ff16156109605760405162461bcd60e51b815260206004820152600d60248201526c14d4d20e88111254d050931151609a1b6044820152606401610792565b6001600160a01b03909116600090815260076020526040902080549115156101000261ff0019909216919091179055565b600061099b612763565b905090565b60115460405163bc4c4b3760e01b8152336004820152600060248201526001600160a01b039091169063bc4c4b37906044016020604051808303816000875af11580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190614e22565b50565b610a20611e11565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6011546040516001624d3b8760e01b03198152600481018390526001600160a01b039091169063ffb2c479906024016060604051808303816000875af1158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190614e3f565b50505050565b6001600160a01b031660009081526005602052604090205490565b610ae6611e11565b6011805460ff60e01b1916600160e01b179055565b610b03611e11565b610b0d600061288a565b565b828114610b2e5760405162461bcd60e51b815260040161079290614e6d565b60005b83811015610bf057610b8586868684818110610b4f57610b4f614e94565b9050602002016020810190610b649190614b2d565b858585818110610b7657610b76614e94565b905060200201356000806128da565b610bde863361082b868686818110610b9f57610b9f614e94565b905060200201356040518060600160405280602881526020016153f5602891396001600160a01b038c166000908152600660205260408120903361080a565b80610be881614ec0565b915050610b31565b505050505050565b610c00611e11565b62030d408163ffffffff1610158015610c2257506207a1208163ffffffff1611155b610c685760405162461bcd60e51b815260206004820152601760248201527603230302c303030203c20474650203c203530302c30303604c1b6044820152606401610792565b60115463ffffffff600160a01b909104811690821603610cb35760405162461bcd60e51b81526004016107929060208082526004908201526353616d6560e01b604082015260600190565b6011805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b6001600160a01b03811660009081526001602052604081205461075c565b6000546001600160a01b031690565b6000610758338484611e70565b828114610d325760405162461bcd60e51b815260040161079290614e6d565b60005b838110156108a057610d5333868684818110610b4f57610b4f614e94565b80610d5d81614ec0565b915050610d35565b610d6d611e11565b6011805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b610d9b611e11565b60145460ff1615610dd75760405162461bcd60e51b81526004016107929060208082526004908201526327a822a760e11b604082015260600190565b600480546001600160a01b0319166001600160a01b0383811691909117825560115460145460405163031e79db60e41b8152918316936331e79db093610e2793600160201b909304169101614b19565b600060405180830381600087803b158015610e4157600080fd5b505af1158015610e55573d6000803e3d6000fd5b5050601454610e7a9250309150600160201b90046001600160a01b0316600019611ced565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef39190614ed9565b600480546040516364e329cb60e11b81526001600160a01b039384169363c9c6539693610f2593309392169101614ef6565b6020604051808303816000875af1158015610f44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f689190614ed9565b90506000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe39190614ed9565b6003546040516364e329cb60e11b81526001600160a01b039283169263c9c653969261101792309290911690600401614ef6565b6020604051808303816000875af1158015611036573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105a9190614ed9565b60115460405163031e79db60e41b81529192506001600160a01b0316906331e79db09061108b908590600401614b19565b600060405180830381600087803b1580156110a557600080fd5b505af11580156110b9573d6000803e3d6000fd5b505060115460405163031e79db60e41b81526001600160a01b0390911692506331e79db091506110ed908490600401614b19565b600060405180830381600087803b15801561110757600080fd5b505af115801561111b573d6000803e3d6000fd5b50506012546000925060649150600160201b900463ffffffff1661113e30610ac3565b6111489190614f10565b6111529190614f3d565b601354909150600090606490600160a01b900463ffffffff1661117430610ac3565b61117e9190614f10565b6111889190614f3d565b6014549091504790600160201b90046001600160a01b031663f305d7198230866000806111b3610cf7565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561121b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112409190614e3f565b50506003546040516370a0823160e01b81526001600160a01b03909116915060009082906370a0823190611278903090600401614b19565b602060405180830381865afa158015611295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b99190614f51565b60145460405163095ea7b360e01b81529192506001600160a01b038085169263095ea7b3926112f692600160201b90910416908590600401614f6a565b6020604051808303816000875af1158015611315573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113399190614e22565b506014546003546001600160a01b03600160201b90920482169163e8e337009116308488600080611368610cf7565b60405160e089901b6001600160e01b03191681526001600160a01b039788166004820152958716602487015260448601949094526064850192909252608484015260a483015290911660c48201524260e4820152610104016060604051808303816000875af11580156113df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114039190614e3f565b50506014805462ff00ff19166201000117908190556012805463ffffffff19164363ffffffff1617905560405163095ea7b360e01b81526001600160a01b038a8116935063095ea7b39261146992600160201b9091049091169060001990600401614f6a565b6020604051808303816000875af1158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190614e22565b5060145460405163095ea7b360e01b81526001600160a01b038089169263095ea7b3926114eb92600160201b9092049091169060001990600401614f6a565b6020604051808303816000875af115801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e9190614e22565b506040518060e00160405280600015158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016001151581526020016001151581525060076000896001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff0219169083151502179055509050506040518060e00160405280600015158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016001151581526020016001151581525060076000886001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff021916908315150217905550905050600a879080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b879080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055505050505050505050565b8342111561198f5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610792565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886119dd8c6001600160a01b031660009081526001602081905260409091208054918201905590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611a3882612df2565b90506000611a4882878787612e40565b9050896001600160a01b0316816001600160a01b031614611aab5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610792565b611ab68a8a8a611ced565b50505050505050505050565b611aca611e11565b6012805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b611af7611e11565b614e208163ffffffff161115611b1f5760405162461bcd60e51b815260040161079290614dfb565b6013805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b611b4d611e11565b60115460405163e98030c760e01b8152600481018390526001600160a01b039091169063e98030c790602401610872565b611b86611e11565b6001600160a01b03166000818152600760205260408120805460ff60701b1916600160701b179055600a805460018101825591527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319169091179055565b6060600a805480602002602001604051908101604052809291908181526020018280548015611c4757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c29575b5050505050905090565b611c59611e11565b6014805491151563010000000263ff00000019909216919091179055565b611c7f611e11565b6001600160a01b038116611ce45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610792565b610a158161288a565b6001600160a01b038316611d4f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610792565b6001600160a01b038216611db05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610792565b6001600160a01b0383811660008181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b33611e1a610cf7565b6001600160a01b031614610b0d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610792565b6001600160a01b038316611ed45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610792565b6001600160a01b038216611f365760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610792565b60008111611f985760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610792565b600080611fa3610cf7565b6001600160a01b0316856001600160a01b031614158015611fdd5750611fc7610cf7565b6001600160a01b0316846001600160a01b031614155b8015611ff257506001600160a01b0385163014155b801561201757506001600160a01b03841660009081526007602052604090205460ff16155b801561203c57506001600160a01b03851660009081526007602052604090205460ff16155b15612725576001600160a01b038416600090815260076020526040902054610100900460ff1615801561208d57506001600160a01b038516600090815260076020526040902054610100900460ff16155b6120cd5760405162461bcd60e51b815260206004820152601160248201527029a9a41d10213637b1b5b634b9ba32b21760791b6044820152606401610792565b6001600160a01b038516600090815260076020526040902054600160701b900460ff1615612540576000859050306001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121669190614ed9565b6001600160a01b031603612359576000816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d89190614ed9565b90506000826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561221a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223e9190614f9a565b50915050806001600160701b0316826001600160a01b03166370a082318a6040518263ffffffff1660e01b81526004016122789190614b19565b602060405180830381865afa158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b99190614f51565b111561234d576013546001600160a01b038816600090815260076020526040902054600160c01b90910463ffffffff9081169650438116600160301b90920416036123165760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0387166000908152600760205260409020805465ffffffff00001916620100004363ffffffff1602179055612352565b600094505b505061253a565b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123bd9190614ed9565b90506000826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156123ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124239190614f9a565b50509050806001600160701b0316826001600160a01b03166370a082318a6040518263ffffffff1660e01b815260040161245d9190614b19565b602060405180830381865afa15801561247a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249e9190614f51565b1115612532576013546001600160a01b038816600090815260076020526040902054600160c01b90910463ffffffff9081169650438116600160301b90920416036124fb5760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0387166000908152600760205260409020805465ffffffff00001916620100004363ffffffff1602179055612537565b600094505b50505b5061272a565b6001600160a01b038416600090815260076020526040902054600160701b900460ff16156125fb5750506013546001600160a01b038416600090815260076020526040902054600160e01b90910463ffffffff908116916001914381166201000090920416036125c25760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0385166000908152600760205260409020805463ffffffff60301b1916600160301b4363ffffffff160217905561272a565b60009150600061260a85612e68565b90508060ff166002036126505760405162461bcd60e51b815260206004820152600e60248201526d29a9a41d102737903b199026281760911b6044820152606401610792565b8060ff1660010361253a576001600160a01b03808616600081815260076020526040808220805460ff60701b1916600160701b179055600a805460018101825592527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890910180546001600160a01b031916909217909155601154905163031e79db60e41b81529116906331e79db0906126ee908890600401614b19565b600060405180830381600087803b15801561270857600080fd5b505af115801561271c573d6000803e3d6000fd5b5050505061253a565b600091505b6108a085858585856128da565b6000818484111561275b5760405162461bcd60e51b81526004016107929190614a1a565b505050900390565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156127bc57507f000000000000000000000000000000000000000000000000000000000000000046145b156127e657507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6128e48186612f6e565b60006128f0848461348e565b90508115612adb576011546040516001624d3b8760e01b03198152600160a01b820463ffffffff1660048201526001600160a01b039091169063ffb2c479906024016060604051808303816000875af1158015612951573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129759190614e3f565b505081159050612a935780600c60008282546129919190615004565b925050819055506000859050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156129de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a029190614f9a565b50604080516080810182526001600160a01b038c168082526001600160701b0394851660208301819052949093169181018290526060018a9052600d80546001600160a01b031916909217909155600e8054600160701b9092026001600160e01b0319909216909217179055505050600f84905560145460ff63010000009091041615612a9357612a9360016134b5565b856001600160a01b03167fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a85604051612ace91815260200190565b60405180910390a2612c71565b8015612c2d57612aea81613b80565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b639190614ed9565b6004805460405163e6a4390560e01b81526001600160a01b039384169363e6a4390593612b9593309392169101614ef6565b602060405180830381865afa158015612bb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd69190614ed9565b90506000816001600160a01b0316886001600160a01b031603612bfb57506000612c20565b816001600160a01b0316876001600160a01b031603612c1c57506000612c20565b5060015b612c2a8382613c17565b50505b846001600160a01b03167fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d6785604051612c6891815260200190565b60405180910390a25b6001600160a01b038616600090815260056020526040902054612c95908590615017565b6001600160a01b038088166000908152600560205260408082209390935590871681522054612cc5908590615004565b6001600160a01b03808716600090815260056020526040808220939093556011548983168252908390205492516338c110ef60e21b815291169163e30443bc91612d13918a91600401614f6a565b600060405180830381600087803b158015612d2d57600080fd5b505af1925050508015612d3e575060015b506011546001600160a01b03868116600090815260056020526040908190205490516338c110ef60e21b8152919092169163e30443bc91612d83918991600401614f6a565b600060405180830381600087803b158015612d9d57600080fd5b505af1925050508015612dae575060015b50846001600160a01b0316866001600160a01b031660008051602061541d83398151915286604051612de291815260200190565b60405180910390a3505050505050565b600061075c612dff612763565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000612e5187878787614203565b91509150612e5e816142bd565b5095945050505050565b60006001600160a01b0382163b15612f61576000829050806001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa925050508015612ed9575060408051601f3d908101601f19168201909252612ed691810190614f9a565b60015b612f55576000839050806001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612f3c575060408051601f3d908101601f19168201909252612f399181019061502a565b60015b612f4a575060009392505050565b506002949350505050565b50600195945050505050565b506000919050565b919050565b600c541561348a57600d5460408051630240bc6b60e21b815290516001600160a01b039092169160009182918491630902f1ac9160048083019260609291908290030181865afa158015612fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fea9190614f9a565b50600e5491935091506001600160701b0380841691161080156130215750600e546001600160701b03808316600160701b90920416105b1561308257600f54600c541161303b576000600c55613056565b600f54600c8054600090613050908490615017565b90915550505b5050600d80546001600160a01b03191690555050600e80546001600160e01b0319169055506000600f55565b505050811561328957600080805b600a5460ff8216101561321257836001600160a01b0316600a8260ff16815481106130bd576130bd614e94565b6000918252602090912001546001600160a01b03161480159061311e5750600060056000600a8460ff16815481106130f7576130f7614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561320057816000036131755760056000600a8360ff168154811061314557613145614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054909250905081613200565b60056000600a8360ff168154811061318f5761318f614e94565b60009182526020808320909101546001600160a01b031683528201929092526040019020548210156132005780925060056000600a8360ff16815481106131d8576131d8614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491505b8061320a8161504f565b915050613090565b50600d80546001600160a01b0319169055600e80546001600160e01b03191690556000600f55600c548110156132485750505050565b61327e600c54600a8460ff168154811061326457613264614e94565b6000918252602090912001546001600160a01b0316614402565b6000600c5550505050565b600080805b600a5460ff8216101561340f57836001600160a01b0316600a8260ff16815481106132bb576132bb614e94565b6000918252602090912001546001600160a01b03161480159061331c5750600060056000600a8460ff16815481106132f5576132f5614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156133fd57816000036133725780925060056000600a8360ff168154811061334657613346614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491506133fd565b60056000600a8360ff168154811061338c5761338c614e94565b60009182526020808320909101546001600160a01b031683528201929092526040019020548210156133fd5780925060056000600a8360ff16815481106133d5576133d5614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491505b806134078161504f565b91505061328e565b50600d80546001600160a01b0319169055600e80546001600160e01b03191690556000600f819055600c54600a8054919260059290919060ff871690811061345957613459614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205410156132485750505050565b5050565b6000620186a06134a463ffffffff841685614f10565b6134ae9190614f3d565b9392505050565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561350a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061352e9190614ed9565b6004805460405163e6a4390560e01b81526001600160a01b039384169363e6a439059361356093309392169101614ef6565b602060405180830381865afa15801561357d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a19190614ed9565b90506000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361c9190614ed9565b60035460405163e6a4390560e01b81526001600160a01b039283169263e6a439059261365092309290911690600401614ef6565b602060405180830381865afa15801561366d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136919190614ed9565b6040805160028082526060820183529293506000929091602083019080368337505060035482519293506001600160a01b0316918391506000906136d7576136d7614e94565b6001600160a01b03928316602091820292909201015260045482519116908290600190811061370857613708614e94565b6001600160a01b0392831660209182029290920101526014546003546040516370a0823160e01b8152600093600160201b90930483169263d06ca61f9216906370a082319061375b908890600401614b19565b602060405180830381865afa158015613778573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379c9190614f51565b846040518363ffffffff1660e01b81526004016137ba929190615084565b600060405180830381865afa1580156137d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526137ff91908101906150a5565b6001600160a01b038416600090815260056020526040812054825192935090918390600190811061383257613832614e94565b60200260200101516138449190614f3d565b6001600160a01b03808716600090815260056020526040808220546004805492516370a0823160e01b81529596509294909391909116916370a082319161388d918b9101614b19565b602060405180830381865afa1580156138aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ce9190614f51565b6138d89190614f3d565b90508615806138fd575060146138ef836017614f10565b6138f99190614f3d565b8110155b8061391e57506014613910826017614f10565b61391a9190614f3d565b8210155b15613b7757600080613964600460009054906101000a90046001600160a01b0316888a308960018151811061395557613955614e94565b60200260200101518989614501565b915091508015613a05576001600160a01b038716600090815260056020526040902054821015613a00576001600160a01b0387166000908152600560205260409020546139b2908390615017565b6001600160a01b0380891660009081526005602052604080822093909355908a16815220546139e2908390615004565b6001600160a01b038916600090815260056020526040902055613a93565b613a93565b6001600160a01b038816600090815260056020526040902054821015613a93576001600160a01b038816600090815260056020526040902054613a49908390615017565b6001600160a01b03808a166000908152600560205260408082209390935590891681522054613a79908390615004565b6001600160a01b0388166000908152600560205260409020555b866001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613ace57600080fd5b505af1158015613ae2573d6000803e3d6000fd5b50505050876001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613b2157600080fd5b505af1158015613b35573d6000803e3d6000fd5b50506040805185815284151560208201527fc0d2cbff9eb511672403883070dc0720aca13a206999a4fe3e48d1a1e4642e27935001905060405180910390a150505b50505050505050565b8060026000828254613b929190615004565b90915550503060009081526005602052604081208054839290613bb6908490615004565b9091555050604051818152309060009060008051602061541d8339815191529060200160405180910390a36040518181527f176b02bb2d12439ff7a20b59f402cca16c76f50508b13ef3166a600eb719354a9060200160405180910390a150565b6014805461ff0019166101001790819055306000908152600660209081526040808320600160201b9094046001600160a01b031683529290522054821115613c7a57601454613c7a903090600160201b90046001600160a01b0316600019611ced565b818115613da15760408051600380825260808201909252600091602082016060803683370190505090503081600081518110613cb857613cb8614e94565b6001600160a01b039283166020918202929092010152600454825191169082906001908110613ce957613ce9614e94565b6001600160a01b039283166020918202929092010152601354825191169082906002908110613d1a57613d1a614e94565b6001600160a01b039283166020918202929092010152601454604051635c11d79560e01b8152600160201b90910490911690635c11d79590613d69908590600090869030904290600401615162565b600060405180830381600087803b158015613d8357600080fd5b505af1158015613d97573d6000803e3d6000fd5b5050505050613eee565b60408051600480825260a08201909252600091602082016080803683370190505090503081600081518110613dd857613dd8614e94565b6001600160a01b039283166020918202929092010152600354825191169082906001908110613e0957613e09614e94565b6001600160a01b039283166020918202929092010152600454825191169082906002908110613e3a57613e3a614e94565b6001600160a01b039283166020918202929092010152601354825191169082906003908110613e6b57613e6b614e94565b6001600160a01b039283166020918202929092010152601454604051635c11d79560e01b8152600160201b90910490911690635c11d79590613eba908590600090869030904290600401615162565b600060405180830381600087803b158015613ed457600080fd5b505af1158015613ee8573d6000803e3d6000fd5b50505050505b601154601254600091613f199163ffffffff600160c01b909204821691600160e01b9091041661519e565b6013546040516370a0823160e01b815263ffffffff9290921692506001600160a01b03169060009082906370a0823190613f57903090600401614b19565b602060405180830381865afa158015613f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f989190614f51565b6012546011549192506001600160a01b038481169263a9059cbb92600160401b9004909116906001600160401b03871690613fe090600160c01b900463ffffffff1686614f10565b613fea9190614f3d565b6040518363ffffffff1660e01b8152600401614007929190614f6a565b6020604051808303816000875af1158015614026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061404a9190614e22565b50601260089054906101000a90046001600160a01b03166001600160a01b03166327bf17586040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561409b57600080fd5b505af11580156140af573d6000803e3d6000fd5b50506011546012546001600160a01b03868116945063a9059cbb9350909116906001600160401b038716906140f190600160e01b900463ffffffff1686614f10565b6140fb9190614f3d565b6040518363ffffffff1660e01b8152600401614118929190614f6a565b6020604051808303816000875af1158015614137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061415b9190614e22565b506011546012546001600160a01b03909116906305910bee906001600160401b0386169061419690600160e01b900463ffffffff1685614f10565b6141a09190614f3d565b6040518263ffffffff1660e01b81526004016141be91815260200190565b600060405180830381600087803b1580156141d857600080fd5b505af11580156141ec573d6000803e3d6000fd5b50506014805461ff00191690555050505050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561423057506000905060036142b4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614284573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166142ad576000600192509250506142b4565b9150600090505b94509492505050565b60008160048111156142d1576142d16151c2565b036142d95750565b60018160048111156142ed576142ed6151c2565b036143355760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610792565b6002816004811115614349576143496151c2565b036143965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610792565b60038160048111156143aa576143aa6151c2565b03610a155760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610792565b81600260008282546144149190615017565b90915550506001600160a01b03811660009081526005602052604081208054849290614441908490615017565b92505081905550806001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561448357600080fd5b505af1158015614497573d6000803e3d6000fd5b5050604051848152600092506001600160a01b038416915060008051602061541d8339815191529060200160405180910390a36040518281527fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e9060200160405180910390a15050565b6000806000806000808688101561466d576040516370a0823160e01b81528994506001600160a01b038b16906370a0823190614541908f90600401614b19565b602060405180830381865afa15801561455e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145829190614f51565b6040516370a0823160e01b81529093506001600160a01b038e16906370a08231906145b1908e90600401614b19565b602060405180830381865afa1580156145ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145f29190614f51565b6040516370a0823160e01b81529092506001600160a01b038b16906370a0823190614621908e90600401614b19565b602060405180830381865afa15801561463e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146629190614f51565b9050600194506147c4565b6040516370a0823160e01b81528992506001600160a01b038b16906370a082319061469c908f90600401614b19565b602060405180830381865afa1580156146b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146dd9190614f51565b6040516370a0823160e01b81529091506001600160a01b038e16906370a082319061470c908e90600401614b19565b602060405180830381865afa158015614729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061474d9190614f51565b6040516370a0823160e01b81529094506001600160a01b038b16906370a082319061477c908e90600401614b19565b602060405180830381865afa158015614799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147bd9190614f51565b9250600094505b6000676765c793fa10079d601b1b6147dc83856151d8565b6147e686886151d8565b6147f09190615208565b6147fa9190615228565b90506000676765c793fa10079d601b1b6148148588615256565b846148208860026151d8565b61482a91906151d8565b61483491906151d8565b61483e9190615228565b90506000676765c793fa10079d601b1b61485887876151d8565b614862868a6151d8565b61486c9190615208565b61487686896151d8565b61488091906151d8565b61488a9190615228565b905060006148998484846148bd565b5090506148a7816002614f10565b9950505050505050505097509795505050505050565b60008080836148cd8760046151d8565b6148d791906151d8565b6148e26002876153b3565b6148ec9190615208565b9050600081136149325760405162461bcd60e51b8152602060048201526011602482015270082e4c4aae8d2d8e67440869e9aa0988ab607b1b6044820152606401610792565b600061493d8261499f565b905061494a8760026151d8565b81614954886153c2565b61495e9190615256565b6149689190615228565b93506149758760026151d8565b8161497f886153c2565b6149899190615208565b6149939190615228565b92505050935093915050565b6000600182116149b1576149b16153de565b60006149c083620f4240614f10565b91508190508060005b60026149d58584614f3d565b6149df9086615004565b6149e99190614f3d565b90506103e86149f88286615017565b10614a05578093506149c9565b614a116103e885614f3d565b95945050505050565b600060208083528351808285015260005b81811015614a4757858101830151858201604001528201614a2b565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610a1557600080fd5b60008060408385031215614a9057600080fd5b8235614a9b81614a68565b946020939093013593505050565b63ffffffff81168114610a1557600080fd5b600060208284031215614acd57600080fd5b81356134ae81614aa9565b600080600060608486031215614aed57600080fd5b8335614af881614a68565b92506020840135614b0881614a68565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b600060208284031215614b3f57600080fd5b81356134ae81614a68565b8015158114610a1557600080fd5b60008060408385031215614b6b57600080fd5b8235614b7681614a68565b91506020830135614b8681614b4a565b809150509250929050565b600060208284031215614ba357600080fd5b5035919050565b60008083601f840112614bbc57600080fd5b5081356001600160401b03811115614bd357600080fd5b6020830191508360208260051b8501011115614bee57600080fd5b9250929050565b600080600080600060608688031215614c0d57600080fd5b8535614c1881614a68565b945060208601356001600160401b0380821115614c3457600080fd5b614c4089838a01614baa565b90965094506040880135915080821115614c5957600080fd5b50614c6688828901614baa565b969995985093965092949392505050565b60008060008060408587031215614c8d57600080fd5b84356001600160401b0380821115614ca457600080fd5b614cb088838901614baa565b90965094506020870135915080821115614cc957600080fd5b50614cd687828801614baa565b95989497509550505050565b600080600080600080600060e0888a031215614cfd57600080fd5b8735614d0881614a68565b96506020880135614d1881614a68565b95506040880135945060608801359350608088013560ff81168114614d3c57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614d6c57600080fd5b8235614d7781614a68565b91506020830135614b8681614a68565b600081518084526020808501945080840160005b83811015614dc05781516001600160a01b031687529582019590820190600101614d9b565b509495945050505050565b6020815260006134ae6020830184614d87565b600060208284031215614df057600080fd5b81356134ae81614b4a565b6020808252600d908201526c29a9a41d1026b0bc101918129760991b604082015260600190565b600060208284031215614e3457600080fd5b81516134ae81614b4a565b600080600060608486031215614e5457600080fd5b8351925060208401519150604084015190509250925092565b6020808252600d908201526c0a6a69074409a92a69a82a8869609b1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201614ed257614ed2614eaa565b5060010190565b600060208284031215614eeb57600080fd5b81516134ae81614a68565b6001600160a01b0392831681529116602082015260400190565b808202811582820484141761075c5761075c614eaa565b634e487b7160e01b600052601260045260246000fd5b600082614f4c57614f4c614f27565b500490565b600060208284031215614f6357600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b80516001600160701b0381168114612f6957600080fd5b600080600060608486031215614faf57600080fd5b614fb884614f83565b9250614fc660208501614f83565b91506040840151614fd681614aa9565b809150509250925092565b6020808252600990820152680a6a6907440a6ae86960bb1b604082015260600190565b8082018082111561075c5761075c614eaa565b8181038181111561075c5761075c614eaa565b60006020828403121561503c57600080fd5b815162ffffff811681146134ae57600080fd5b600060ff821660ff810361506557615065614eaa565b60010192915050565b634e487b7160e01b600052604160045260246000fd5b82815260406020820152600061509d6040830184614d87565b949350505050565b600060208083850312156150b857600080fd5b82516001600160401b03808211156150cf57600080fd5b818501915085601f8301126150e357600080fd5b8151818111156150f5576150f561506e565b8060051b604051601f19603f8301168101818110858211171561511a5761511a61506e565b60405291825284820192508381018501918883111561513857600080fd5b938501935b828510156151565784518452938501939285019261513d565b98975050505050505050565b85815284602082015260a06040820152600061518160a0830186614d87565b6001600160a01b0394909416606083015250608001529392505050565b63ffffffff8181168382160190808211156151bb576151bb614eaa565b5092915050565b634e487b7160e01b600052602160045260246000fd5b80820260008212600160ff1b841416156151f4576151f4614eaa565b818105831482151761075c5761075c614eaa565b81810360008312801583831316838312821617156151bb576151bb614eaa565b60008261523757615237614f27565b600160ff1b82146000198414161561525157615251614eaa565b500590565b808201828112600083128015821682158216171561527657615276614eaa565b505092915050565b80825b600180861161529057506152c3565b6001600160ff1b038290048211156152aa576152aa614eaa565b808616156152b757918102915b9490941c938002615281565b935093915050565b60008280156152e157600181146152eb576152f4565b600191505061075c565b8291505061075c565b50816153025750600061075c565b5060016000821380821461531b57801561533a57615354565b6001600160ff1b0383900483111561533557615335614eaa565b615354565b6001600160ff1b0383900583121561535457615354614eaa565b50808316156153605750805b6153708360011c8384028361527e565b600082136001600160ff1b038290048311161561538f5761538f614eaa565b60008212600160ff1b829005831216156153ab576153ab614eaa565b029392505050565b60006134ae60ff8416836152cb565b6000600160ff1b82016153d7576153d7614eaa565b5060000390565b634e487b7160e01b600052600160045260246000fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220d7583eb756217e6c5cc9a10071dafdf85293405fb56629953a2921c4bc60385b64736f6c63430008120033608060405234801561001057600080fd5b5060405161191738038061191783398101604081905261002f916100b8565b8161003933610068565b600180546001600160a01b0319166001600160a01b0392909216919091179055610e10601155601255506100f2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100cb57600080fd5b82516001600160a01b03811681146100e257600080fd5b6020939093015192949293505050565b611816806101016000396000f3fe6080604052600436106101b95760003560e01c80638da5cb5b116100ed578063bc4c4b3711610090578063bc4c4b371461051b578063be10b6141461053b578063c705c56914610551578063e30443bc1461058a578063e7841ec0146105aa578063e98030c7146105bf578063f2fde38b146105df578063fbcbc0f1146105ff578063ffb2c4791461061f57600080fd5b80638da5cb5b1461043057806391b89fba1461044557806399248ea714610465578063a3395cb414610485578063a8b9d240146104a5578063aafd847a146104c5578063b1181e5514610200578063b4113cc8146104fb57600080fd5b806331e79db01161016057806331e79db0146102bf5780634e7b827f146102df5780635183d6fd1461031f578063556cafb0146103845780635ebf4db9146103ba5780636a474002146103da5780636f2789ec146103ef578063715018a61461040557806385a6b3ae1461041a57600080fd5b806303c83302146101be57806305910bee146101c057806306ba651c146101e057806309bbedde1461020057806310a8c46b14610224578063226cfa3d1461025c57806327ce0147146102895780633009a609146102a9575b600080fd5b005b3480156101cc57600080fd5b506101be6101db366004611603565b61065c565b3480156101ec57600080fd5b506101be6101fb366004611631565b610762565b34801561020c57600080fd5b50600a545b6040519081526020015b60405180910390f35b34801561023057600080fd5b5061024461023f366004611603565b61078c565b6040516001600160a01b03909116815260200161021b565b34801561026857600080fd5b50610211610277366004611631565b60106020526000908152604090205481565b34801561029557600080fd5b506102116102a4366004611631565b6107bf565b3480156102b557600080fd5b50610211600e5481565b3480156102cb57600080fd5b506101be6102da366004611631565b610822565b3480156102eb57600080fd5b5061030f6102fa366004611631565b600f6020526000908152604090205460ff1681565b604051901515815260200161021b565b34801561032b57600080fd5b5061033f61033a366004611603565b6108be565b604080516001600160a01b0390991689526020890197909752958701949094526060860192909252608085015260a084015260c083015260e08201526101000161021b565b34801561039057600080fd5b5061021161039f366004611631565b6001600160a01b03166000908152600b602052604090205490565b3480156103c657600080fd5b506101be6103d5366004611603565b61092b565b3480156103e657600080fd5b506101be610938565b3480156103fb57600080fd5b5061021160115481565b34801561041157600080fd5b506101be61096d565b34801561042657600080fd5b5061021160095481565b34801561043c57600080fd5b5061024461097f565b34801561045157600080fd5b50610211610460366004611631565b61098e565b34801561047157600080fd5b50600154610244906001600160a01b031681565b34801561049157600080fd5b506102116104a0366004611631565b610999565b3480156104b157600080fd5b506102116104c0366004611631565b6109de565b3480156104d157600080fd5b506102116104e0366004611631565b6001600160a01b031660009081526008602052604090205490565b34801561050757600080fd5b50600254610244906001600160a01b031681565b34801561052757600080fd5b5061030f61053636600461165c565b610a0a565b34801561054757600080fd5b5061021160125481565b34801561055d57600080fd5b5061030f61056c366004611631565b6001600160a01b03166000908152600f602052604090205460ff1690565b34801561059657600080fd5b506101be6105a5366004611695565b610a95565b3480156105b657600080fd5b50600e54610211565b3480156105cb57600080fd5b506101be6105da366004611603565b610b04565b3480156105eb57600080fd5b506101be6105fa366004611631565b610bd5565b34801561060b57600080fd5b5061033f61061a366004611631565b610c4b565b34801561062b57600080fd5b5061063f61063a366004611603565b610d32565b6040805193845260208401929092529082015260600161021b565b565b61066461097f565b6001600160a01b0316336001600160a01b0316148061069657506002546001600160a01b0316336001600160a01b0316145b6106d75760405162461bcd60e51b815260206004820152600d60248201526c27b7363c9039b2b73232b9399760991b60448201526064015b60405180910390fd5b60006006541180156106e95750600081115b1561075f576006546107169061070383600160801b610e4f565b61070d91906116d7565b60035490610e62565b60035560405181815233907fa493a9229478c3fcd73f66d2cdeb7f94fd0f341da924d1054236d784541165119060200160405180910390a260095461075b9082610e62565b6009555b50565b61076a610e6e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000600a60000182815481106107a4576107a46116f9565b6000918252602090912001546001600160a01b031692915050565b6001600160a01b0381166000908152600760209081526040808320546004909252822054600354600160801b926108129261080d92610807916108029190610e4f565b610ecd565b90610edd565b610f1b565b61081c91906116d7565b92915050565b61082a610e6e565b6001600160a01b0381166000908152600f602052604090205460ff161561085057600080fd5b6001600160a01b0381166000908152600f60205260408120805460ff1916600117905561087e908290610f2e565b61088781610f93565b6040516001600160a01b038216907fa878b31040b2e6d0a9a3d3361209db3908ba62014b0dca52adbaee451d128b2590600090a250565b6000806000806000806000806108d3600a5490565b89106108f8575060009650600019955085945086935083925082915081905080610920565b60006109038a61078c565b905061090e81610c4b565b98509850985098509850985098509850505b919395975091939597565b610933610e6e565b601255565b60405162461bcd60e51b815260206004820152600a602482015269222a1d1021a620a4a69760b11b60448201526064016106ce565b610975610e6e565b61065a60006110c6565b6000546001600160a01b031690565b600061081c826109de565b6001600160a01b0381166000908152600d602052604081205460ff166109c25750600019919050565b506001600160a01b03166000908152600c602052604090205490565b6001600160a01b03811660009081526008602052604081205461081c90610a04846107bf565b90611116565b6000610a14610e6e565b6000610a1f84611122565b90508015610a8b576001600160a01b038416600081815260106020526040908190204290555184151591907fa2c38e2d2fb7e3e1912d937fd1ca11ed6d51864dee4cfa7a7bf02becd7acf09290610a799085815260200190565b60405180910390a3600191505061081c565b5060009392505050565b610a9d610e6e565b6001600160a01b0382166000908152600f602052604090205460ff16610b00576012548110610adf57610ad08282610f2e565b610ada8282611287565b610af3565b610aea826000610f2e565b610af382610f93565b610afe826001610a0a565b505b5050565b610b0c610e6e565b610e108110158015610b215750620151808111155b610b665760405162461bcd60e51b815260206004820152601660248201527511150e880c480f0818db185a5b55d85a5d080f080c8d60521b60448201526064016106ce565b6011548103610ba25760405162461bcd60e51b815260206004820152600860248201526744543a2053616d6560c01b60448201526064016106ce565b60115460405182907f474ea64804364a1e29a4487ddb63c3342a2dd826ccd8acf48825e680a0e6f20f90600090a3601155565b610bdd610e6e565b6001600160a01b038116610c425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ce565b61075f816110c6565b806000808080808080610c5d88610999565b9650600019955060008712610cbf57600e54871115610c8b57600e54610c84908890611345565b9550610cbf565b600e54600a5460009110610ca0576000610caf565b600e54600a54610caf91611116565b9050610cbb8882610edd565b9650505b610cc8886109de565b9450610cd3886107bf565b6001600160a01b038916600090815260106020526040902054909450925082610cfd576000610d0b565b601154610d0b908490610e62565b9150428211610d1b576000610d25565b610d258242611116565b9050919395975091939597565b600a5460009081908190808203610d54575050600e5460009250829150610e48565b600e546000805a90506000805b8984108015610d6f57508582105b15610e375784610d7e8161170f565b600a5490965086109050610d9157600094505b6000600a6000018681548110610da957610da96116f9565b60009182526020808320909101546001600160a01b03168083526010909152604090912054909150610dda90611391565b15610dfd57610dea816001610a0a565b15610dfd5781610df98161170f565b9250505b82610e078161170f565b93505060005a905080851115610e2e57610e2b610e248683611116565b8790610e62565b95505b9350610d619050565b600e85905590975095509193505050505b9193909250565b6000610e5b8284611728565b9392505050565b6000610e5b828461173f565b33610e7761097f565b6001600160a01b03161461065a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ce565b6000818181121561081c57600080fd5b600080610eea8385611752565b905060008312158015610efd5750838112155b80610f125750600083128015610f1257508381125b610e5b57600080fd5b600080821215610f2a57600080fd5b5090565b6001600160a01b03821660009081526004602052604090205480821115610f6d576000610f5b8383611116565b9050610f6784826113b8565b50610afe565b80821015610afe576000610f818284611116565b9050610f8d84826114a6565b50505050565b6001600160a01b0381166000908152600d602052604090205460ff16610fb65750565b6001600160a01b0381166000908152600d60209081526040808320805460ff19169055600b8252808320839055600c909152812054600a54909190610ffd9060019061177a565b90506000600a6000018281548110611017576110176116f9565b60009182526020808320909101546001600160a01b03908116808452600c90925260408084208790559087168352822091909155600a8054919250829185908110611064576110646116f9565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055600a80548061109e5761109e61178d565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e5b828461177a565b60008061112e836109de565b9050801561127e576001600160a01b0383166000908152600860205260409020546111599082610e62565b6001600160a01b038416600081815260086020526040908190209290925590517fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d906111a89084815260200190565b60405180910390a260015460405163a9059cbb60e01b81526001600160a01b03858116600483015260248201849052600092169063a9059cbb906044016020604051808303816000875af1158015611204573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122891906117a3565b905080611277576001600160a01b0384166000908152600860205260409020546112529083611116565b6001600160a01b03909416600090815260086020526040812094909455509192915050565b5092915050565b50600092915050565b6001600160a01b0382166000908152600d602052604090205460ff16156112c5576001600160a01b03919091166000908152600b6020526040902055565b6001600160a01b0382166000818152600d60209081526040808320805460ff19166001908117909155600b8352818420869055600a8054600c909452918420839055820181559091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b03191690911790555050565b600080821215801561136057508261135d83826117c0565b13155b8061137e575060008212801561137e57508261137c83826117c0565b135b61138757600080fd5b610e5b82846117c0565b6000428211156113a357506000919050565b6011546113b04284611116565b101592915050565b6001600160a01b03821661140e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016106ce565b8060066000828254611420919061173f565b90915550506001600160a01b0382166000908152600460205260408120805483929061144d90849061173f565b909155505060035461148690611467906108029084610e4f565b6001600160a01b03841660009081526007602052604090205490611345565b6001600160a01b0390921660009081526007602052604090209190915550565b6001600160a01b0382166115065760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016106ce565b6001600160a01b0382166000908152600460205260409020548181101561157a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016106ce565b6001600160a01b03831660009081526004602052604081208383039055600680548492906115a990849061177a565b90915550506003546115e2906115c3906108029085610e4f565b6001600160a01b03851660009081526007602052604090205490610edd565b6001600160a01b039093166000908152600760205260409020929092555050565b60006020828403121561161557600080fd5b5035919050565b6001600160a01b038116811461075f57600080fd5b60006020828403121561164357600080fd5b8135610e5b8161161c565b801515811461075f57600080fd5b6000806040838503121561166f57600080fd5b823561167a8161161c565b9150602083013561168a8161164e565b809150509250929050565b600080604083850312156116a857600080fd5b82356116b38161161c565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b6000826116f457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060018201611721576117216116c1565b5060010190565b808202811582820484141761081c5761081c6116c1565b8082018082111561081c5761081c6116c1565b8082018281126000831280158216821582161715611772576117726116c1565b505092915050565b8181038181111561081c5761081c6116c1565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156117b557600080fd5b8151610e5b8161164e565b8181036000831280158383131683831282161715611277576112776116c156fea2646970667358221220d8e01e364f403110c88a9b2a9b3c095d8ce89c5b04afa59b8a57a6fe259f838864736f6c6343000812003360806040523480156200001157600080fd5b5060405162000e7e38038062000e7e8339810160408190526200003491620001e8565b6200003f336200017b565b600180546001600160a01b038781166001600160c01b031990921691909117600160a01b63ffffffff881602179182905560408051635c9302c960e01b815290519290911691635c9302c9916004808201926020929091908290030181865afa158015620000b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d7919062000262565b600180546001600160401b0392909216600160c01b026001600160c01b03909216919091179055600280546001600160a01b038086166001600160a01b0319928316179092556003805485841690831617905560048054928416929091169190911790556200014a42620151806200027c565b600460146101000a8154816001600160401b0302191690836001600160401b031602179055505050505050620002b2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001e357600080fd5b919050565b600080600080600060a086880312156200020157600080fd5b6200020c86620001cb565b9450602086015163ffffffff811681146200022657600080fd5b93506200023660408701620001cb565b92506200024660608701620001cb565b91506200025660808701620001cb565b90509295509295909350565b6000602082840312156200027557600080fd5b5051919050565b6001600160401b03818116838216019080821115620002ab57634e487b7160e01b600052601160045260246000fd5b5092915050565b610bbc80620002c26000396000f3fe608060405234801561001057600080fd5b50600436106100a45760003560e01c806312c54dba146100a957806327bf1758146100be5780632c1f5216146100c6578063715018a6146100ef578063790ca413146100f757806383179428146101295780638875427b146101435780638da5cb5b14610156578063c72ade2a14610167578063f2fde38b14610193578063f887ea40146101a6578063fc0c546a146101b9575b600080fd5b6100bc6100b7366004610984565b6101cc565b005b6100bc6101f6565b6002546100d9906001600160a01b031681565b6040516100e691906109b4565b60405180910390f35b6100bc610848565b60045461011190600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016100e6565b60015461011190600160c01b90046001600160401b031681565b6003546100d9906001600160a01b031681565b6000546001600160a01b03166100d9565b60015461017e90600160a01b900463ffffffff1681565b60405163ffffffff90911681526020016100e6565b6100bc6101a1366004610984565b61085c565b6004546100d9906001600160a01b031681565b6001546100d9906001600160a01b031681565b6101d46108da565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6101fe6108da565b60015460405163033060d960e41b81526001600160a01b039091169060009082906333060d90906102339030906004016109b4565b602060405180830381865afa158015610250573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027491906109c8565b90508015610745576000826001600160a01b0316635c9302c96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e091906109c8565b90506000805b83811015610565576040516370a0823160e01b81526000906001600160a01b038716906370a082319061031d9030906004016109b4565b602060405180830381865afa15801561033a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035e91906109c8565b90506000806000886001600160a01b0316632607443b30876040518363ffffffff1660e01b81526004016103939291906109e1565b60e060405180830381865afa1580156103b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d49190610a3a565b5050945094505050925080826103ea9190610ae2565b61ffff16871061054e576040516332e7b8d960e11b81523060048201526024810186905264ffffffffff841660448201526001600160a01b038a16906365cf71b290606401600060405180830381600087803b15801561044957600080fd5b505af115801561045d573d6000803e3d6000fd5b5050604051631a1804d160e11b81526004810188905264ffffffffff861660248201526001600160a01b038c16925063343009a29150604401600060405180830381600087803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b50506040516370a0823160e01b81528692506001600160a01b038c1691506370a08231906104f69030906004016109b4565b602060405180830381865afa158015610513573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053791906109c8565b6105419190610b04565b61054b9087610b1d565b95505b50505050808061055d90610b30565b9150506102e6565b50801561073f576002546001600160a01b038086169163a9059cbb911661058d606485610b49565b6040518363ffffffff1660e01b81526004016105aa9291906109e1565b6020604051808303816000875af11580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190610b6b565b506002546001600160a01b03166305910bee61060a606484610b49565b6040518263ffffffff1660e01b815260040161062891815260200190565b600060405180830381600087803b15801561064257600080fd5b505af1158015610656573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03871691506370a08231906106899030906004016109b4565b602060405180830381865afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca91906109c8565b600154604051630a54871760e31b815260048101839052600160a01b90910463ffffffff1660248201529091506001600160a01b038616906352a438b890604401600060405180830381600087803b15801561072557600080fd5b505af1158015610739573d6000803e3d6000fd5b50505050505b50505050565b600454600160a01b90046001600160401b0316421115610844576040516370a0823160e01b81526000906001600160a01b038416906370a082319061078e9030906004016109b4565b602060405180830381865afa1580156107ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cf91906109c8565b600154604051630a54871760e31b815260048101839052600160a01b90910463ffffffff1660248201529091506001600160a01b038416906352a438b890604401600060405180830381600087803b15801561082a57600080fd5b505af115801561083e573d6000803e3d6000fd5b50505050505b5050565b6108506108da565b61085a6000610934565b565b6108646108da565b6001600160a01b0381166108ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6108d781610934565b50565b6000546001600160a01b0316331461085a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108c5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561099657600080fd5b81356001600160a01b03811681146109ad57600080fd5b9392505050565b6001600160a01b0391909116815260200190565b6000602082840312156109da57600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b805168ffffffffffffffffff81168114610a1357600080fd5b919050565b805161ffff81168114610a1357600080fd5b80518015158114610a1357600080fd5b600080600080600080600060e0888a031215610a5557600080fd5b875164ffffffffff81168114610a6a57600080fd5b9650610a78602089016109fa565b9550610a86604089016109fa565b9450610a9460608901610a18565b9350610aa260808901610a18565b9250610ab060a08901610a18565b9150610abe60c08901610a2a565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610afd57610afd610acc565b5092915050565b81810381811115610b1757610b17610acc565b92915050565b80820180821115610b1757610b17610acc565b600060018201610b4257610b42610acc565b5060010190565b600082610b6657634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610b7d57600080fd5b6109ad82610a2a56fea2646970667358221220240dcaf8a71b08fc98c3924e6dd212d50aaa88dc9bf8f2f22ae75eb50738829364736f6c634300081200330000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Deployed Bytecode
0x6080604052600436106101f45760003560e01c806376b3617b1161010e578063ca72a4e71161009b578063ca72a4e7146105e3578063d505accf14610603578063dbf6ad8114610623578063dd62ed3e14610643578063e4056a6b14610689578063e98030c7146106a9578063e9cb414f146106c9578063f200e29d146106e9578063f206bbb71461070b578063f2fde38b1461072b57600080fd5b806376b3617b14610487578063771282f6146104a75780637ecebe00146104bd5780638da5cb5b146104dd57806395d89b41146104f2578063a9059cbb1461051e578063aad41a411461053e578063b1a4e0dc1461055e578063b4113cc81461059c578063c21c989b146105c357600080fd5b80633644e5151161018c5780633644e515146103645780634e71d92d146103795780635342acb41461038e5780636612e66f146103c75780636cbadbfa146103e7578063700bb191146103fd57806370a082311461041d57806370bfdd9d1461043d578063715018a61461045257806373ae740e1461046757600080fd5b806306fdde0314610200578063095ea7b31461024a57806318160ddd1461027a5780631aa7daff1461029957806323b872dd146102bb5780632c1f5216146102db578063313ce5671461030857806331e79db014610324578063342aa8b51461034457600080fd5b366101fb57005b600080fd5b34801561020c57600080fd5b5060408051808201909152600f81526e0a6eae0cae4a6e8c2d6ca744090caf608b1b60208201525b6040516102419190614a1a565b60405180910390f35b34801561025657600080fd5b5061026a610265366004614a7d565b61074b565b6040519015158152602001610241565b34801561028657600080fd5b506002545b604051908152602001610241565b3480156102a557600080fd5b506102b96102b4366004614abb565b610762565b005b3480156102c757600080fd5b5061026a6102d6366004614ad8565b6107c0565b3480156102e757600080fd5b506011546102fb906001600160a01b031681565b6040516102419190614b19565b34801561031457600080fd5b5060405160098152602001610241565b34801561033057600080fd5b506102b961033f366004614b2d565b61083a565b34801561035057600080fd5b506102b961035f366004614b58565b6108a7565b34801561037057600080fd5b5061028b610991565b34801561038557600080fd5b506102b96109a0565b34801561039a57600080fd5b5061026a6103a9366004614b2d565b6001600160a01b031660009081526007602052604090205460ff1690565b3480156103d357600080fd5b506102b96103e2366004614b58565b610a18565b3480156103f357600080fd5b5061028b60105481565b34801561040957600080fd5b506102b9610418366004614b91565b610a4b565b34801561042957600080fd5b5061028b610438366004614b2d565b610ac3565b34801561044957600080fd5b506102b9610ade565b34801561045e57600080fd5b506102b9610afb565b34801561047357600080fd5b506102b9610482366004614bf5565b610b0f565b34801561049357600080fd5b506102b96104a2366004614abb565b610bf8565b3480156104b357600080fd5b5061028b60025481565b3480156104c957600080fd5b5061028b6104d8366004614b2d565b610cd9565b3480156104e957600080fd5b506102fb610cf7565b3480156104fe57600080fd5b506040805180820190915260038152620a6a6960eb1b6020820152610234565b34801561052a57600080fd5b5061026a610539366004614a7d565b610d06565b34801561054a57600080fd5b506102b9610559366004614c77565b610d13565b34801561056a57600080fd5b5061026a610579366004614b2d565b6001600160a01b0316600090815260076020526040902054610100900460ff1690565b3480156105a857600080fd5b506012546102fb90600160401b90046001600160a01b031681565b3480156105cf57600080fd5b506102b96105de366004614abb565b610d65565b3480156105ef57600080fd5b506102b96105fe366004614b2d565b610d93565b34801561060f57600080fd5b506102b961061e366004614ce2565b61193f565b34801561062f57600080fd5b506102b961063e366004614abb565b611ac2565b34801561064f57600080fd5b5061028b61065e366004614d59565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b34801561069557600080fd5b506102b96106a4366004614abb565b611aef565b3480156106b557600080fd5b506102b96106c4366004614b91565b611b45565b3480156106d557600080fd5b506102b96106e4366004614b2d565b611b7e565b3480156106f557600080fd5b506106fe611bef565b6040516102419190614dcb565b34801561071757600080fd5b506102b9610726366004614dde565b611c51565b34801561073757600080fd5b506102b9610746366004614b2d565b611c77565b6000610758338484611ced565b5060015b92915050565b61076a611e11565b614e208163ffffffff16111561079b5760405162461bcd60e51b815260040161079290614dfb565b60405180910390fd5b6013805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b60006107cd848484611e70565b610830843361082b856040518060600160405280602881526020016153f5602891396001600160a01b038a16600090815260066020526040812090335b6001600160a01b031681526020810191909152604001600020549190612737565b611ced565b5060019392505050565b610842611e11565b60115460405163031e79db60e41b81526001600160a01b03909116906331e79db090610872908490600401614b19565b600060405180830381600087803b15801561088c57600080fd5b505af11580156108a0573d6000803e3d6000fd5b5050505050565b6108af611e11565b6001600160a01b038216600090815260076020526040902054600160701b900460ff16156109105760405162461bcd60e51b815260206004820152600e60248201526d29a9a41d102327a92124a22222a760911b6044820152606401610792565b801561096057601154600160e01b900460ff16156109605760405162461bcd60e51b815260206004820152600d60248201526c14d4d20e88111254d050931151609a1b6044820152606401610792565b6001600160a01b03909116600090815260076020526040902080549115156101000261ff0019909216919091179055565b600061099b612763565b905090565b60115460405163bc4c4b3760e01b8152336004820152600060248201526001600160a01b039091169063bc4c4b37906044016020604051808303816000875af11580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a159190614e22565b50565b610a20611e11565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6011546040516001624d3b8760e01b03198152600481018390526001600160a01b039091169063ffb2c479906024016060604051808303816000875af1158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190614e3f565b50505050565b6001600160a01b031660009081526005602052604090205490565b610ae6611e11565b6011805460ff60e01b1916600160e01b179055565b610b03611e11565b610b0d600061288a565b565b828114610b2e5760405162461bcd60e51b815260040161079290614e6d565b60005b83811015610bf057610b8586868684818110610b4f57610b4f614e94565b9050602002016020810190610b649190614b2d565b858585818110610b7657610b76614e94565b905060200201356000806128da565b610bde863361082b868686818110610b9f57610b9f614e94565b905060200201356040518060600160405280602881526020016153f5602891396001600160a01b038c166000908152600660205260408120903361080a565b80610be881614ec0565b915050610b31565b505050505050565b610c00611e11565b62030d408163ffffffff1610158015610c2257506207a1208163ffffffff1611155b610c685760405162461bcd60e51b815260206004820152601760248201527603230302c303030203c20474650203c203530302c30303604c1b6044820152606401610792565b60115463ffffffff600160a01b909104811690821603610cb35760405162461bcd60e51b81526004016107929060208082526004908201526353616d6560e01b604082015260600190565b6011805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b6001600160a01b03811660009081526001602052604081205461075c565b6000546001600160a01b031690565b6000610758338484611e70565b828114610d325760405162461bcd60e51b815260040161079290614e6d565b60005b838110156108a057610d5333868684818110610b4f57610b4f614e94565b80610d5d81614ec0565b915050610d35565b610d6d611e11565b6011805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b610d9b611e11565b60145460ff1615610dd75760405162461bcd60e51b81526004016107929060208082526004908201526327a822a760e11b604082015260600190565b600480546001600160a01b0319166001600160a01b0383811691909117825560115460145460405163031e79db60e41b8152918316936331e79db093610e2793600160201b909304169101614b19565b600060405180830381600087803b158015610e4157600080fd5b505af1158015610e55573d6000803e3d6000fd5b5050601454610e7a9250309150600160201b90046001600160a01b0316600019611ced565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef39190614ed9565b600480546040516364e329cb60e11b81526001600160a01b039384169363c9c6539693610f2593309392169101614ef6565b6020604051808303816000875af1158015610f44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f689190614ed9565b90506000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe39190614ed9565b6003546040516364e329cb60e11b81526001600160a01b039283169263c9c653969261101792309290911690600401614ef6565b6020604051808303816000875af1158015611036573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105a9190614ed9565b60115460405163031e79db60e41b81529192506001600160a01b0316906331e79db09061108b908590600401614b19565b600060405180830381600087803b1580156110a557600080fd5b505af11580156110b9573d6000803e3d6000fd5b505060115460405163031e79db60e41b81526001600160a01b0390911692506331e79db091506110ed908490600401614b19565b600060405180830381600087803b15801561110757600080fd5b505af115801561111b573d6000803e3d6000fd5b50506012546000925060649150600160201b900463ffffffff1661113e30610ac3565b6111489190614f10565b6111529190614f3d565b601354909150600090606490600160a01b900463ffffffff1661117430610ac3565b61117e9190614f10565b6111889190614f3d565b6014549091504790600160201b90046001600160a01b031663f305d7198230866000806111b3610cf7565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561121b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112409190614e3f565b50506003546040516370a0823160e01b81526001600160a01b03909116915060009082906370a0823190611278903090600401614b19565b602060405180830381865afa158015611295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b99190614f51565b60145460405163095ea7b360e01b81529192506001600160a01b038085169263095ea7b3926112f692600160201b90910416908590600401614f6a565b6020604051808303816000875af1158015611315573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113399190614e22565b506014546003546001600160a01b03600160201b90920482169163e8e337009116308488600080611368610cf7565b60405160e089901b6001600160e01b03191681526001600160a01b039788166004820152958716602487015260448601949094526064850192909252608484015260a483015290911660c48201524260e4820152610104016060604051808303816000875af11580156113df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114039190614e3f565b50506014805462ff00ff19166201000117908190556012805463ffffffff19164363ffffffff1617905560405163095ea7b360e01b81526001600160a01b038a8116935063095ea7b39261146992600160201b9091049091169060001990600401614f6a565b6020604051808303816000875af1158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190614e22565b5060145460405163095ea7b360e01b81526001600160a01b038089169263095ea7b3926114eb92600160201b9092049091169060001990600401614f6a565b6020604051808303816000875af115801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e9190614e22565b506040518060e00160405280600015158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016001151581526020016001151581525060076000896001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff0219169083151502179055509050506040518060e00160405280600015158152602001600015158152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020016001151581526020016001151581525060076000886001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160066101000a81548163ffffffff021916908363ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001600e6101000a81548160ff02191690831515021790555060c082015181600001600f6101000a81548160ff021916908315150217905550905050600a879080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b879080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b869080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055505050505050505050565b8342111561198f5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610792565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886119dd8c6001600160a01b031660009081526001602081905260409091208054918201905590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000611a3882612df2565b90506000611a4882878787612e40565b9050896001600160a01b0316816001600160a01b031614611aab5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610792565b611ab68a8a8a611ced565b50505050505050505050565b611aca611e11565b6012805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b611af7611e11565b614e208163ffffffff161115611b1f5760405162461bcd60e51b815260040161079290614dfb565b6013805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b611b4d611e11565b60115460405163e98030c760e01b8152600481018390526001600160a01b039091169063e98030c790602401610872565b611b86611e11565b6001600160a01b03166000818152600760205260408120805460ff60701b1916600160701b179055600a805460018101825591527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319169091179055565b6060600a805480602002602001604051908101604052809291908181526020018280548015611c4757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c29575b5050505050905090565b611c59611e11565b6014805491151563010000000263ff00000019909216919091179055565b611c7f611e11565b6001600160a01b038116611ce45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610792565b610a158161288a565b6001600160a01b038316611d4f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610792565b6001600160a01b038216611db05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610792565b6001600160a01b0383811660008181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b33611e1a610cf7565b6001600160a01b031614610b0d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610792565b6001600160a01b038316611ed45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610792565b6001600160a01b038216611f365760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610792565b60008111611f985760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610792565b600080611fa3610cf7565b6001600160a01b0316856001600160a01b031614158015611fdd5750611fc7610cf7565b6001600160a01b0316846001600160a01b031614155b8015611ff257506001600160a01b0385163014155b801561201757506001600160a01b03841660009081526007602052604090205460ff16155b801561203c57506001600160a01b03851660009081526007602052604090205460ff16155b15612725576001600160a01b038416600090815260076020526040902054610100900460ff1615801561208d57506001600160a01b038516600090815260076020526040902054610100900460ff16155b6120cd5760405162461bcd60e51b815260206004820152601160248201527029a9a41d10213637b1b5b634b9ba32b21760791b6044820152606401610792565b6001600160a01b038516600090815260076020526040902054600160701b900460ff1615612540576000859050306001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121669190614ed9565b6001600160a01b031603612359576000816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d89190614ed9565b90506000826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561221a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223e9190614f9a565b50915050806001600160701b0316826001600160a01b03166370a082318a6040518263ffffffff1660e01b81526004016122789190614b19565b602060405180830381865afa158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b99190614f51565b111561234d576013546001600160a01b038816600090815260076020526040902054600160c01b90910463ffffffff9081169650438116600160301b90920416036123165760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0387166000908152600760205260409020805465ffffffff00001916620100004363ffffffff1602179055612352565b600094505b505061253a565b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123bd9190614ed9565b90506000826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156123ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124239190614f9a565b50509050806001600160701b0316826001600160a01b03166370a082318a6040518263ffffffff1660e01b815260040161245d9190614b19565b602060405180830381865afa15801561247a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249e9190614f51565b1115612532576013546001600160a01b038816600090815260076020526040902054600160c01b90910463ffffffff9081169650438116600160301b90920416036124fb5760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0387166000908152600760205260409020805465ffffffff00001916620100004363ffffffff1602179055612537565b600094505b50505b5061272a565b6001600160a01b038416600090815260076020526040902054600160701b900460ff16156125fb5750506013546001600160a01b038416600090815260076020526040902054600160e01b90910463ffffffff908116916001914381166201000090920416036125c25760405162461bcd60e51b815260040161079290614fe1565b6001600160a01b0385166000908152600760205260409020805463ffffffff60301b1916600160301b4363ffffffff160217905561272a565b60009150600061260a85612e68565b90508060ff166002036126505760405162461bcd60e51b815260206004820152600e60248201526d29a9a41d102737903b199026281760911b6044820152606401610792565b8060ff1660010361253a576001600160a01b03808616600081815260076020526040808220805460ff60701b1916600160701b179055600a805460018101825592527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890910180546001600160a01b031916909217909155601154905163031e79db60e41b81529116906331e79db0906126ee908890600401614b19565b600060405180830381600087803b15801561270857600080fd5b505af115801561271c573d6000803e3d6000fd5b5050505061253a565b600091505b6108a085858585856128da565b6000818484111561275b5760405162461bcd60e51b81526004016107929190614a1a565b505050900390565b6000306001600160a01b037f00000000000000000000000007445312db273589dcb0fd2bd57aa815a5afb8cc161480156127bc57507f000000000000000000000000000000000000000000000000000000000000000146145b156127e657507f82a7b2977ff3250615e0ac6726643a7ef616203545b93db04cf57a6df6ee1b8d90565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fc2e5f07951faa96d2fb4ac9ba1b219cb7aadebe4d3af9c94be53dc004ce2d4c5828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6128e48186612f6e565b60006128f0848461348e565b90508115612adb576011546040516001624d3b8760e01b03198152600160a01b820463ffffffff1660048201526001600160a01b039091169063ffb2c479906024016060604051808303816000875af1158015612951573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129759190614e3f565b505081159050612a935780600c60008282546129919190615004565b925050819055506000859050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156129de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a029190614f9a565b50604080516080810182526001600160a01b038c168082526001600160701b0394851660208301819052949093169181018290526060018a9052600d80546001600160a01b031916909217909155600e8054600160701b9092026001600160e01b0319909216909217179055505050600f84905560145460ff63010000009091041615612a9357612a9360016134b5565b856001600160a01b03167fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a85604051612ace91815260200190565b60405180910390a2612c71565b8015612c2d57612aea81613b80565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b639190614ed9565b6004805460405163e6a4390560e01b81526001600160a01b039384169363e6a4390593612b9593309392169101614ef6565b602060405180830381865afa158015612bb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd69190614ed9565b90506000816001600160a01b0316886001600160a01b031603612bfb57506000612c20565b816001600160a01b0316876001600160a01b031603612c1c57506000612c20565b5060015b612c2a8382613c17565b50505b846001600160a01b03167fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d6785604051612c6891815260200190565b60405180910390a25b6001600160a01b038616600090815260056020526040902054612c95908590615017565b6001600160a01b038088166000908152600560205260408082209390935590871681522054612cc5908590615004565b6001600160a01b03808716600090815260056020526040808220939093556011548983168252908390205492516338c110ef60e21b815291169163e30443bc91612d13918a91600401614f6a565b600060405180830381600087803b158015612d2d57600080fd5b505af1925050508015612d3e575060015b506011546001600160a01b03868116600090815260056020526040908190205490516338c110ef60e21b8152919092169163e30443bc91612d83918991600401614f6a565b600060405180830381600087803b158015612d9d57600080fd5b505af1925050508015612dae575060015b50846001600160a01b0316866001600160a01b031660008051602061541d83398151915286604051612de291815260200190565b60405180910390a3505050505050565b600061075c612dff612763565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000612e5187878787614203565b91509150612e5e816142bd565b5095945050505050565b60006001600160a01b0382163b15612f61576000829050806001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa925050508015612ed9575060408051601f3d908101601f19168201909252612ed691810190614f9a565b60015b612f55576000839050806001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612f3c575060408051601f3d908101601f19168201909252612f399181019061502a565b60015b612f4a575060009392505050565b506002949350505050565b50600195945050505050565b506000919050565b919050565b600c541561348a57600d5460408051630240bc6b60e21b815290516001600160a01b039092169160009182918491630902f1ac9160048083019260609291908290030181865afa158015612fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fea9190614f9a565b50600e5491935091506001600160701b0380841691161080156130215750600e546001600160701b03808316600160701b90920416105b1561308257600f54600c541161303b576000600c55613056565b600f54600c8054600090613050908490615017565b90915550505b5050600d80546001600160a01b03191690555050600e80546001600160e01b0319169055506000600f55565b505050811561328957600080805b600a5460ff8216101561321257836001600160a01b0316600a8260ff16815481106130bd576130bd614e94565b6000918252602090912001546001600160a01b03161480159061311e5750600060056000600a8460ff16815481106130f7576130f7614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561320057816000036131755760056000600a8360ff168154811061314557613145614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054909250905081613200565b60056000600a8360ff168154811061318f5761318f614e94565b60009182526020808320909101546001600160a01b031683528201929092526040019020548210156132005780925060056000600a8360ff16815481106131d8576131d8614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491505b8061320a8161504f565b915050613090565b50600d80546001600160a01b0319169055600e80546001600160e01b03191690556000600f55600c548110156132485750505050565b61327e600c54600a8460ff168154811061326457613264614e94565b6000918252602090912001546001600160a01b0316614402565b6000600c5550505050565b600080805b600a5460ff8216101561340f57836001600160a01b0316600a8260ff16815481106132bb576132bb614e94565b6000918252602090912001546001600160a01b03161480159061331c5750600060056000600a8460ff16815481106132f5576132f5614e94565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156133fd57816000036133725780925060056000600a8360ff168154811061334657613346614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491506133fd565b60056000600a8360ff168154811061338c5761338c614e94565b60009182526020808320909101546001600160a01b031683528201929092526040019020548210156133fd5780925060056000600a8360ff16815481106133d5576133d5614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205491505b806134078161504f565b91505061328e565b50600d80546001600160a01b0319169055600e80546001600160e01b03191690556000600f819055600c54600a8054919260059290919060ff871690811061345957613459614e94565b60009182526020808320909101546001600160a01b0316835282019290925260400190205410156132485750505050565b5050565b6000620186a06134a463ffffffff841685614f10565b6134ae9190614f3d565b9392505050565b6000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561350a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061352e9190614ed9565b6004805460405163e6a4390560e01b81526001600160a01b039384169363e6a439059361356093309392169101614ef6565b602060405180830381865afa15801561357d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a19190614ed9565b90506000601460049054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361c9190614ed9565b60035460405163e6a4390560e01b81526001600160a01b039283169263e6a439059261365092309290911690600401614ef6565b602060405180830381865afa15801561366d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136919190614ed9565b6040805160028082526060820183529293506000929091602083019080368337505060035482519293506001600160a01b0316918391506000906136d7576136d7614e94565b6001600160a01b03928316602091820292909201015260045482519116908290600190811061370857613708614e94565b6001600160a01b0392831660209182029290920101526014546003546040516370a0823160e01b8152600093600160201b90930483169263d06ca61f9216906370a082319061375b908890600401614b19565b602060405180830381865afa158015613778573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379c9190614f51565b846040518363ffffffff1660e01b81526004016137ba929190615084565b600060405180830381865afa1580156137d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526137ff91908101906150a5565b6001600160a01b038416600090815260056020526040812054825192935090918390600190811061383257613832614e94565b60200260200101516138449190614f3d565b6001600160a01b03808716600090815260056020526040808220546004805492516370a0823160e01b81529596509294909391909116916370a082319161388d918b9101614b19565b602060405180830381865afa1580156138aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ce9190614f51565b6138d89190614f3d565b90508615806138fd575060146138ef836017614f10565b6138f99190614f3d565b8110155b8061391e57506014613910826017614f10565b61391a9190614f3d565b8210155b15613b7757600080613964600460009054906101000a90046001600160a01b0316888a308960018151811061395557613955614e94565b60200260200101518989614501565b915091508015613a05576001600160a01b038716600090815260056020526040902054821015613a00576001600160a01b0387166000908152600560205260409020546139b2908390615017565b6001600160a01b0380891660009081526005602052604080822093909355908a16815220546139e2908390615004565b6001600160a01b038916600090815260056020526040902055613a93565b613a93565b6001600160a01b038816600090815260056020526040902054821015613a93576001600160a01b038816600090815260056020526040902054613a49908390615017565b6001600160a01b03808a166000908152600560205260408082209390935590891681522054613a79908390615004565b6001600160a01b0388166000908152600560205260409020555b866001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613ace57600080fd5b505af1158015613ae2573d6000803e3d6000fd5b50505050876001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613b2157600080fd5b505af1158015613b35573d6000803e3d6000fd5b50506040805185815284151560208201527fc0d2cbff9eb511672403883070dc0720aca13a206999a4fe3e48d1a1e4642e27935001905060405180910390a150505b50505050505050565b8060026000828254613b929190615004565b90915550503060009081526005602052604081208054839290613bb6908490615004565b9091555050604051818152309060009060008051602061541d8339815191529060200160405180910390a36040518181527f176b02bb2d12439ff7a20b59f402cca16c76f50508b13ef3166a600eb719354a9060200160405180910390a150565b6014805461ff0019166101001790819055306000908152600660209081526040808320600160201b9094046001600160a01b031683529290522054821115613c7a57601454613c7a903090600160201b90046001600160a01b0316600019611ced565b818115613da15760408051600380825260808201909252600091602082016060803683370190505090503081600081518110613cb857613cb8614e94565b6001600160a01b039283166020918202929092010152600454825191169082906001908110613ce957613ce9614e94565b6001600160a01b039283166020918202929092010152601354825191169082906002908110613d1a57613d1a614e94565b6001600160a01b039283166020918202929092010152601454604051635c11d79560e01b8152600160201b90910490911690635c11d79590613d69908590600090869030904290600401615162565b600060405180830381600087803b158015613d8357600080fd5b505af1158015613d97573d6000803e3d6000fd5b5050505050613eee565b60408051600480825260a08201909252600091602082016080803683370190505090503081600081518110613dd857613dd8614e94565b6001600160a01b039283166020918202929092010152600354825191169082906001908110613e0957613e09614e94565b6001600160a01b039283166020918202929092010152600454825191169082906002908110613e3a57613e3a614e94565b6001600160a01b039283166020918202929092010152601354825191169082906003908110613e6b57613e6b614e94565b6001600160a01b039283166020918202929092010152601454604051635c11d79560e01b8152600160201b90910490911690635c11d79590613eba908590600090869030904290600401615162565b600060405180830381600087803b158015613ed457600080fd5b505af1158015613ee8573d6000803e3d6000fd5b50505050505b601154601254600091613f199163ffffffff600160c01b909204821691600160e01b9091041661519e565b6013546040516370a0823160e01b815263ffffffff9290921692506001600160a01b03169060009082906370a0823190613f57903090600401614b19565b602060405180830381865afa158015613f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f989190614f51565b6012546011549192506001600160a01b038481169263a9059cbb92600160401b9004909116906001600160401b03871690613fe090600160c01b900463ffffffff1686614f10565b613fea9190614f3d565b6040518363ffffffff1660e01b8152600401614007929190614f6a565b6020604051808303816000875af1158015614026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061404a9190614e22565b50601260089054906101000a90046001600160a01b03166001600160a01b03166327bf17586040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561409b57600080fd5b505af11580156140af573d6000803e3d6000fd5b50506011546012546001600160a01b03868116945063a9059cbb9350909116906001600160401b038716906140f190600160e01b900463ffffffff1686614f10565b6140fb9190614f3d565b6040518363ffffffff1660e01b8152600401614118929190614f6a565b6020604051808303816000875af1158015614137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061415b9190614e22565b506011546012546001600160a01b03909116906305910bee906001600160401b0386169061419690600160e01b900463ffffffff1685614f10565b6141a09190614f3d565b6040518263ffffffff1660e01b81526004016141be91815260200190565b600060405180830381600087803b1580156141d857600080fd5b505af11580156141ec573d6000803e3d6000fd5b50506014805461ff00191690555050505050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561423057506000905060036142b4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614284573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166142ad576000600192509250506142b4565b9150600090505b94509492505050565b60008160048111156142d1576142d16151c2565b036142d95750565b60018160048111156142ed576142ed6151c2565b036143355760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610792565b6002816004811115614349576143496151c2565b036143965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610792565b60038160048111156143aa576143aa6151c2565b03610a155760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610792565b81600260008282546144149190615017565b90915550506001600160a01b03811660009081526005602052604081208054849290614441908490615017565b92505081905550806001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561448357600080fd5b505af1158015614497573d6000803e3d6000fd5b5050604051848152600092506001600160a01b038416915060008051602061541d8339815191529060200160405180910390a36040518281527fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e9060200160405180910390a15050565b6000806000806000808688101561466d576040516370a0823160e01b81528994506001600160a01b038b16906370a0823190614541908f90600401614b19565b602060405180830381865afa15801561455e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145829190614f51565b6040516370a0823160e01b81529093506001600160a01b038e16906370a08231906145b1908e90600401614b19565b602060405180830381865afa1580156145ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145f29190614f51565b6040516370a0823160e01b81529092506001600160a01b038b16906370a0823190614621908e90600401614b19565b602060405180830381865afa15801561463e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146629190614f51565b9050600194506147c4565b6040516370a0823160e01b81528992506001600160a01b038b16906370a082319061469c908f90600401614b19565b602060405180830381865afa1580156146b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146dd9190614f51565b6040516370a0823160e01b81529091506001600160a01b038e16906370a082319061470c908e90600401614b19565b602060405180830381865afa158015614729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061474d9190614f51565b6040516370a0823160e01b81529094506001600160a01b038b16906370a082319061477c908e90600401614b19565b602060405180830381865afa158015614799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147bd9190614f51565b9250600094505b6000676765c793fa10079d601b1b6147dc83856151d8565b6147e686886151d8565b6147f09190615208565b6147fa9190615228565b90506000676765c793fa10079d601b1b6148148588615256565b846148208860026151d8565b61482a91906151d8565b61483491906151d8565b61483e9190615228565b90506000676765c793fa10079d601b1b61485887876151d8565b614862868a6151d8565b61486c9190615208565b61487686896151d8565b61488091906151d8565b61488a9190615228565b905060006148998484846148bd565b5090506148a7816002614f10565b9950505050505050505097509795505050505050565b60008080836148cd8760046151d8565b6148d791906151d8565b6148e26002876153b3565b6148ec9190615208565b9050600081136149325760405162461bcd60e51b8152602060048201526011602482015270082e4c4aae8d2d8e67440869e9aa0988ab607b1b6044820152606401610792565b600061493d8261499f565b905061494a8760026151d8565b81614954886153c2565b61495e9190615256565b6149689190615228565b93506149758760026151d8565b8161497f886153c2565b6149899190615208565b6149939190615228565b92505050935093915050565b6000600182116149b1576149b16153de565b60006149c083620f4240614f10565b91508190508060005b60026149d58584614f3d565b6149df9086615004565b6149e99190614f3d565b90506103e86149f88286615017565b10614a05578093506149c9565b614a116103e885614f3d565b95945050505050565b600060208083528351808285015260005b81811015614a4757858101830151858201604001528201614a2b565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610a1557600080fd5b60008060408385031215614a9057600080fd5b8235614a9b81614a68565b946020939093013593505050565b63ffffffff81168114610a1557600080fd5b600060208284031215614acd57600080fd5b81356134ae81614aa9565b600080600060608486031215614aed57600080fd5b8335614af881614a68565b92506020840135614b0881614a68565b929592945050506040919091013590565b6001600160a01b0391909116815260200190565b600060208284031215614b3f57600080fd5b81356134ae81614a68565b8015158114610a1557600080fd5b60008060408385031215614b6b57600080fd5b8235614b7681614a68565b91506020830135614b8681614b4a565b809150509250929050565b600060208284031215614ba357600080fd5b5035919050565b60008083601f840112614bbc57600080fd5b5081356001600160401b03811115614bd357600080fd5b6020830191508360208260051b8501011115614bee57600080fd5b9250929050565b600080600080600060608688031215614c0d57600080fd5b8535614c1881614a68565b945060208601356001600160401b0380821115614c3457600080fd5b614c4089838a01614baa565b90965094506040880135915080821115614c5957600080fd5b50614c6688828901614baa565b969995985093965092949392505050565b60008060008060408587031215614c8d57600080fd5b84356001600160401b0380821115614ca457600080fd5b614cb088838901614baa565b90965094506020870135915080821115614cc957600080fd5b50614cd687828801614baa565b95989497509550505050565b600080600080600080600060e0888a031215614cfd57600080fd5b8735614d0881614a68565b96506020880135614d1881614a68565b95506040880135945060608801359350608088013560ff81168114614d3c57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614d6c57600080fd5b8235614d7781614a68565b91506020830135614b8681614a68565b600081518084526020808501945080840160005b83811015614dc05781516001600160a01b031687529582019590820190600101614d9b565b509495945050505050565b6020815260006134ae6020830184614d87565b600060208284031215614df057600080fd5b81356134ae81614b4a565b6020808252600d908201526c29a9a41d1026b0bc101918129760991b604082015260600190565b600060208284031215614e3457600080fd5b81516134ae81614b4a565b600080600060608486031215614e5457600080fd5b8351925060208401519150604084015190509250925092565b6020808252600d908201526c0a6a69074409a92a69a82a8869609b1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201614ed257614ed2614eaa565b5060010190565b600060208284031215614eeb57600080fd5b81516134ae81614a68565b6001600160a01b0392831681529116602082015260400190565b808202811582820484141761075c5761075c614eaa565b634e487b7160e01b600052601260045260246000fd5b600082614f4c57614f4c614f27565b500490565b600060208284031215614f6357600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b80516001600160701b0381168114612f6957600080fd5b600080600060608486031215614faf57600080fd5b614fb884614f83565b9250614fc660208501614f83565b91506040840151614fd681614aa9565b809150509250925092565b6020808252600990820152680a6a6907440a6ae86960bb1b604082015260600190565b8082018082111561075c5761075c614eaa565b8181038181111561075c5761075c614eaa565b60006020828403121561503c57600080fd5b815162ffffff811681146134ae57600080fd5b600060ff821660ff810361506557615065614eaa565b60010192915050565b634e487b7160e01b600052604160045260246000fd5b82815260406020820152600061509d6040830184614d87565b949350505050565b600060208083850312156150b857600080fd5b82516001600160401b03808211156150cf57600080fd5b818501915085601f8301126150e357600080fd5b8151818111156150f5576150f561506e565b8060051b604051601f19603f8301168101818110858211171561511a5761511a61506e565b60405291825284820192508381018501918883111561513857600080fd5b938501935b828510156151565784518452938501939285019261513d565b98975050505050505050565b85815284602082015260a06040820152600061518160a0830186614d87565b6001600160a01b0394909416606083015250608001529392505050565b63ffffffff8181168382160190808211156151bb576151bb614eaa565b5092915050565b634e487b7160e01b600052602160045260246000fd5b80820260008212600160ff1b841416156151f4576151f4614eaa565b818105831482151761075c5761075c614eaa565b81810360008312801583831316838312821617156151bb576151bb614eaa565b60008261523757615237614f27565b600160ff1b82146000198414161561525157615251614eaa565b500590565b808201828112600083128015821682158216171561527657615276614eaa565b505092915050565b80825b600180861161529057506152c3565b6001600160ff1b038290048211156152aa576152aa614eaa565b808616156152b757918102915b9490941c938002615281565b935093915050565b60008280156152e157600181146152eb576152f4565b600191505061075c565b8291505061075c565b50816153025750600061075c565b5060016000821380821461531b57801561533a57615354565b6001600160ff1b0383900483111561533557615335614eaa565b615354565b6001600160ff1b0383900583121561535457615354614eaa565b50808316156153605750805b6153708360011c8384028361527e565b600082136001600160ff1b038290048311161561538f5761538f614eaa565b60008212600160ff1b829005831216156153ab576153ab614eaa565b029392505050565b60006134ae60ff8416836152cb565b6000600160ff1b82016153d7576153d7614eaa565b5060000390565b634e487b7160e01b600052600160045260246000fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220d7583eb756217e6c5cc9a10071dafdf85293405fb56629953a2921c4bc60385b64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
-----Decoded View---------------
Arg [0] : router (address): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.