Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- AlphaKeysFactory
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2023-11-24T09:51:38.322061Z
contracts/AlphaKeysFactory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {ECDSAUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import {SafeMathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import {AddressUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import {BlockContext} from "./base/BlockContext.sol";
import {Multicall} from "./base/Multicall.sol";
import {IAlphaKeysFactory} from "./interfaces/IAlphaKeysFactory.sol";
import {AlphaKeysFactoryStorage} from "./storage/AlphaKeysFactoryStorage.sol";
import {IAlphaKeysToken} from "./interfaces/IAlphaKeysToken.sol";
import {IAlphaKeysVault} from "./interfaces/IAlphaKeysVault.sol";
import {NumberMath} from "./libraries/NumberMath.sol";
import {TokenTypes} from "./libraries/TokenTypes.sol";
import {ThreeThreeTypes} from "./libraries/ThreeThreeTypes.sol";
import {LimitOrderTypes} from "./libraries/LimitOrderTypes.sol";
import {WatchlistTypes} from "./libraries/WatchlistTypes.sol";
import {AlphaKeysTokenProxy} from "./AlphaKeysTokenProxy.sol";
import {TransferHelper} from "./libraries/TransferHelper.sol";
contract AlphaKeysFactory is
IAlphaKeysFactory,
BlockContext,
Multicall,
OwnableUpgradeable,
ReentrancyGuardUpgradeable,
AlphaKeysFactoryStorage
{
using SafeMathUpgradeable for uint256;
using NumberMath for uint256;
using AddressUpgradeable for address;
//
modifier onlyAdmin() {
require(_msgSender() == _admin, "AKF_NA");
_;
}
modifier onlyToken(address token) {
require(token != address(0), "AKF_TZ");
require(
(_keysPlayers[token] != address(0) || _keysTwitters[token] > 0),
"AKF_BT"
);
_;
}
modifier onlyPlayer(address player) {
require(player != address(0), "AKF_PZ");
require((_playerKeys[player] != address(0)), "AKF_BP");
_;
}
modifier onlyTwitterId(uint256 twitterId) {
require(twitterId > 0, "AKF_TZ");
require((_twitterKeys[twitterId] != address(0)), "AKF_BTI");
_;
}
modifier notContract() {
// caller is contract
require(!_msgSender().isContract(), "AKF_CIC");
_;
}
receive() external payable {}
function initialize() external initializer {
__Ownable_init();
__ReentrancyGuard_init();
//
_protocolFeeDestination = _msgSender();
_protocolFeeRatio = 50000;
_playerFeeRatio = 50000;
_admin = _msgSender();
}
function getAlphaKeysTokenImplementation()
external
view
override
returns (address)
{
return _playerShareTokenImplementation;
}
function setAlphaKeysTokenImplementation(
address playerShareTokenImplementationArg
) external onlyOwner {
_playerShareTokenImplementation = playerShareTokenImplementationArg;
}
function setAdmin(address admin) external onlyOwner {
_admin = admin;
}
function getAdmin() external view returns (address) {
return _admin;
}
function setBTC(address btc) external onlyOwner {
require(btc.isContract(), "AKF_BINC");
_btc = btc;
}
function getBTC() external view override returns (address) {
return _btc;
}
function setVault(address vault) external onlyOwner {
require(vault.isContract(), "AKF_VINC");
_vault = vault;
}
function getVault() external view override returns (address) {
return _vault;
}
function setBTCPrice(uint256 btcPrice) external onlyOwner {
_btcPrice = btcPrice;
}
function getBTCPrice() external view returns (uint256) {
return _btcPrice;
}
function getPlayerKeys(address player) public view returns (address) {
return _playerKeys[player];
}
function getKeysPlayer(address token) public view returns (address) {
return _keysPlayers[token];
}
function getTwitterKeys(uint256 twitterId) public view returns (address) {
return _twitterKeys[twitterId];
}
function getKeysTwitters(address token) public view returns (uint256) {
return _keysTwitters[token];
}
function setProtocolFeeRatio(uint24 protocolFeeRatio) external onlyOwner {
require(protocolFeeRatio < NumberMath.RATIO, "AKF_BR");
_protocolFeeRatio = protocolFeeRatio;
}
function getProtocolFeeRatio() external view returns (uint24) {
return _protocolFeeRatio;
}
function setPlayerFeeRatio(uint24 playerFeeRatio) external onlyOwner {
require(playerFeeRatio < NumberMath.RATIO, "AKF_BR");
_playerFeeRatio = playerFeeRatio;
}
function getPlayerFeeRatio() external view returns (uint24) {
return _playerFeeRatio;
}
function getProtocolFeeDestination()
external
view
override
returns (address)
{
return _protocolFeeDestination;
}
function setProtocolFeeDestination(
address protocolFeeDestination
) external onlyOwner {
_protocolFeeDestination = protocolFeeDestination;
}
function getTwitterIdByPlayer(
address player
) public view returns (uint256) {
return _keysTwitters[_playerKeys[player]];
}
function getPlayerByTwitterId(
uint256 twitterId
) public view returns (address) {
return _keysPlayers[_twitterKeys[twitterId]];
}
function setTCPrice(address token, uint256 price) external onlyOwner {
_tcPrices[token] = price;
}
function getTCPrice(address token) external view returns (uint256) {
return _tcPrices[token];
}
// for create token
function getCreateForTwitterMessageHash(
uint256 twitterId,
string calldata name,
string calldata symbol
) public view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return
keccak256(
abi.encode(address(this), chainId, twitterId, name, symbol)
);
}
function _verifyCreateTokenSigner(
uint256 twitterId,
string calldata name,
string calldata symbol,
bytes memory signature
) internal view returns (address, bytes32) {
bytes32 messageHash = getCreateForTwitterMessageHash(
twitterId,
name,
symbol
);
address signer = ECDSAUpgradeable.recover(
ECDSAUpgradeable.toEthSignedMessageHash(messageHash),
signature
);
// GP_NA: Signer Is Not ADmin
require(signer == _admin, "AKF_NA");
return (signer, messageHash);
}
function createAlphaKeysForV2(
uint256 twitterId,
address player,
string calldata name,
string calldata symbol
) external nonReentrant onlyAdmin {
require(twitterId > 0, "AKF_TZV");
require(_playerKeys[player] == address(0), "AKF_PNZA");
require(_twitterKeys[twitterId] == address(0), "AKF_TNZA");
//
IAlphaKeysToken token = IAlphaKeysToken(
address(new AlphaKeysTokenProxy())
);
token.initialize(address(this), player, name, symbol);
//
_playerKeys[player] = address(token);
_keysPlayers[address(token)] = player;
_twitterKeys[twitterId] = address(token);
_keysTwitters[address(token)] = twitterId;
//
emit AlphaKeysCreatedV2(player, address(token), twitterId);
}
function createAlphaKeysForTwitter(
uint256 twitterId,
string calldata name,
string calldata symbol,
bytes memory signature
) external notContract nonReentrant {
require(_twitterKeys[twitterId] == address(0), "AKF_TNZA");
_verifyCreateTokenSigner(twitterId, name, symbol, signature);
//
IAlphaKeysToken token = IAlphaKeysToken(
address(new AlphaKeysTokenProxy())
);
token.initialize(address(this), address(0), name, symbol);
_twitterKeys[twitterId] = address(token);
_keysTwitters[address(token)] = twitterId;
//
emit AlphaKeysCreatedForTwitter(address(0), address(token), twitterId);
}
function updateKeysPlayer(
address token,
address newPlayer
) external nonReentrant onlyAdmin {
// check user token
address oldToken = _playerKeys[newPlayer];
require(oldToken == address(0) || oldToken == token, "AKF_PNZA");
//
IAlphaKeysToken tokenIns = IAlphaKeysToken(token);
tokenIns.updateNewPlayer(newPlayer);
//
_keysPlayers[token] = newPlayer;
_playerKeys[newPlayer] = token;
}
// for migrate BTC
function refundTC(uint256 amount) external nonReentrant onlyOwner {
TransferHelper.safeTransferETH(owner(), amount);
}
function refundToken(
address token,
uint256 amount
) external nonReentrant onlyOwner {
TransferHelper.safeTransfer(token, owner(), amount);
}
function requestFund(
address token,
address from,
uint256 amount
) external onlyToken(_msgSender()) {
if (amount > 0) {
address vault = _vault;
if (from == address(this)) {
TransferHelper.safeTransfer(token, vault, amount);
} else if (from != vault) {
TransferHelper.safeTransferFrom(token, from, vault, amount);
}
}
}
function requestRefund(
address token,
address to,
uint256 amount
) external onlyToken(_msgSender()) {
if (amount > 0) {
address vault = _vault;
if (to != vault) {
TransferHelper.safeTransferFrom(token, vault, to, amount);
}
}
}
// for buy keys
function _buyKeysForV2ByToken(
address token,
address from,
uint256 amountX18,
uint256 buyPriceAfterFeeMax,
address recipient,
TokenTypes.OrderType orderType
) internal onlyToken(token) returns (uint256) {
uint256 buyPriceAfterFee = IAlphaKeysToken(token).getBuyPriceAfterFeeV2(
amountX18
);
require(buyPriceAfterFeeMax >= buyPriceAfterFee, "AKF_BBP");
//
IAlphaKeysToken(token).permitBuyKeysForV2(
from,
amountX18,
recipient,
orderType
);
return buyPriceAfterFee;
}
function _buyKeysForV2ByToken(
address token,
address from,
uint256 amountX18,
address recipient,
TokenTypes.OrderType orderType
) internal onlyToken(token) {
IAlphaKeysToken(token).permitBuyKeysForV2(
from,
amountX18,
recipient,
orderType
);
}
function _sellKeysForV2ByToken(
address token,
address from,
uint256 amountX18,
uint256 sellPriceAfterFeeMin,
address recipient,
TokenTypes.OrderType orderType
) internal onlyToken(token) {
require(
sellPriceAfterFeeMin <=
IAlphaKeysToken(token).getSellPriceAfterFeeV2(amountX18),
"AKF_BSP"
);
IAlphaKeysToken(token).permitSellKeysForV2(
from,
amountX18,
recipient,
orderType
);
}
function _sellKeysForV2ByToken(
address token,
address from,
uint256 amountX18,
address recipient,
TokenTypes.OrderType orderType
) internal onlyToken(token) {
IAlphaKeysToken(token).permitSellKeysForV2(
from,
amountX18,
recipient,
orderType
);
}
function buyKeysForV2ByTwitterId(
uint256 twitterId,
uint256 amountX18,
uint256 buyPriceAfterFeeMax,
address recipient
) external nonReentrant {
address token = _twitterKeys[twitterId];
_buyKeysForV2ByToken(
token,
_msgSender(),
amountX18,
buyPriceAfterFeeMax,
recipient,
TokenTypes.OrderType.SpotOrder
);
}
function buyKeysV2ByToken(
address token,
uint256 amountX18,
uint256 buyPriceAfterFeeMax
) external nonReentrant {
_buyKeysForV2ByToken(
token,
_msgSender(),
amountX18,
buyPriceAfterFeeMax,
_msgSender(),
TokenTypes.OrderType.SpotOrder
);
}
function buyKeysForV2ByToken(
address token,
uint256 amountX18,
uint256 buyPriceAfterFeeMax,
address recipient
) external nonReentrant {
_buyKeysForV2ByToken(
token,
_msgSender(),
amountX18,
buyPriceAfterFeeMax,
recipient,
TokenTypes.OrderType.SpotOrder
);
}
function sellKeysV2ByToken(
address token,
uint256 amountX18,
uint256 sellPriceAfterFeeMin
) external nonReentrant {
_sellKeysForV2ByToken(
token,
_msgSender(),
amountX18,
sellPriceAfterFeeMin,
_msgSender(),
TokenTypes.OrderType.SpotOrder
);
}
function sellKeysForV2ByToken(
address token,
uint256 amountX18,
uint256 sellPriceAfterFeeMin,
address recipient
) external nonReentrant {
_sellKeysForV2ByToken(
token,
_msgSender(),
amountX18,
sellPriceAfterFeeMin,
recipient,
TokenTypes.OrderType.SpotOrder
);
}
// for gas station
function getGasOrderMessageHash(
uint256 nonce,
address trader,
uint256 amountBTC,
uint256 rate,
uint256 deadline
) public view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return
keccak256(
abi.encode(
address(this),
chainId,
nonce,
trader,
amountBTC,
rate,
deadline
)
);
}
function getGasOrderMessageHashByToken(
uint256 nonce,
address trader,
address token,
uint256 amount,
uint256 rate,
uint256 deadline
) public view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return
keccak256(
abi.encode(
address(this),
chainId,
nonce,
trader,
token,
amount,
rate,
deadline
)
);
}
function _verifyGasOrderTrader(
uint256 nonce,
address trader,
uint256 amountBTC,
uint256 rate,
uint256 deadline,
bytes memory signature
) internal view returns (address, bytes32) {
bytes32 messageHash = getGasOrderMessageHash(
nonce,
trader,
amountBTC,
rate,
deadline
);
address signer = ECDSAUpgradeable.recover(
ECDSAUpgradeable.toEthSignedMessageHash(messageHash),
signature
);
// GP_NA: Signer Is Not ADmin
require(signer == trader, "AKF_NT");
return (signer, messageHash);
}
function _verifyGasOrderTraderByToken(
uint256 nonce,
address trader,
address token,
uint256 amount,
uint256 rate,
uint256 deadline,
bytes memory signature
) internal view returns (address, bytes32) {
bytes32 messageHash = getGasOrderMessageHashByToken(
nonce,
trader,
token,
amount,
rate,
deadline
);
address signer = ECDSAUpgradeable.recover(
ECDSAUpgradeable.toEthSignedMessageHash(messageHash),
signature
);
// GP_NA: Signer Is Not ADmin
require(signer == trader, "AKF_NT");
return (signer, messageHash);
}
function requestTC(
uint256 nonce,
address trader,
uint256 amountBTC,
uint256 rate,
uint256 deadline,
bytes memory signature
) external notContract nonReentrant {
require(amountBTC > 0 && amountBTC <= (0.00005 ether), "AKF_IA");
require(!_usedNonces[trader][nonce], "AKF_BN");
_usedNonces[trader][nonce] = true;
//
uint256 btcPrice = _btcPrice;
require(rate == btcPrice && btcPrice > 0, "AKF_BR");
//
require(deadline >= _blockTimestamp(), "AKF_BD");
//
_verifyGasOrderTrader(
nonce,
trader,
amountBTC,
rate,
deadline,
signature
);
address btc = _btc;
require(
IERC20Upgradeable(btc).balanceOf(trader) >= amountBTC,
"AKF_IBB"
);
//
uint256 amountTC = amountBTC.mulPrice(btcPrice);
//
TransferHelper.safeTransferFrom(btc, trader, address(this), amountBTC);
TransferHelper.safeTransferETH(trader, amountTC);
//
emit TCRequested(trader, nonce, amountBTC, amountTC);
}
function requestETH2TC(
uint256 nonce,
address trader,
uint256 amountETH,
uint256 rate,
uint256 deadline,
bytes memory signature
) external notContract nonReentrant {
require(amountETH > 0 && amountETH <= (0.0009 ether), "AKF_IA");
require(!_usedNonces[trader][nonce], "AKF_BN");
_usedNonces[trader][nonce] = true;
//
uint256 ethPrice = 145 ether;
require(rate == ethPrice && ethPrice > 0, "AKF_BR");
//
require(deadline >= _blockTimestamp(), "AKF_BD");
//
_verifyGasOrderTrader(
nonce,
trader,
amountETH,
rate,
deadline,
signature
);
//
address eth = 0x43bDa480DE297A14cec95bFb1C6A313615f809Ef;
require(
IERC20Upgradeable(eth).balanceOf(trader) >= amountETH,
"AKF_IBB"
);
//
uint256 amountTC = amountETH.mulPrice(ethPrice);
//
TransferHelper.safeTransferFrom(eth, trader, address(this), amountETH);
TransferHelper.safeTransferETH(trader, amountTC);
//
emit ETH2TCRequested(trader, nonce, amountETH, amountTC);
}
function requestToken2TC(
uint256 nonce,
address trader,
address token,
uint256 amountToken,
uint256 rate,
uint256 deadline,
bytes memory signature
) external notContract nonReentrant {
require(amountToken > 0, "AKF_IA");
require(!_usedNonces[trader][nonce], "AKF_BN");
_usedNonces[trader][nonce] = true;
//
uint256 tokenPrice = _tcPrices[token];
require(rate == tokenPrice && tokenPrice > 0, "AKF_BR");
//
require(deadline >= _blockTimestamp(), "AKF_BD");
//
_verifyGasOrderTraderByToken(
nonce,
trader,
token,
amountToken,
rate,
deadline,
signature
);
//
require(
IERC20Upgradeable(token).balanceOf(trader) >= amountToken,
"AKF_IBB"
);
//
uint256 amountTC = amountToken.mulPrice(tokenPrice);
//
TransferHelper.safeTransferFrom(
token,
trader,
address(this),
amountToken
);
TransferHelper.safeTransferETH(trader, amountTC);
//
emit Token2TCRequested(trader, token, nonce, amountToken, amountTC);
}
// for 3 3 order book
function createThreeThreeOrderId(
address tokenA,
address tokenB,
uint256 amount,
uint256 buyPriceBAfterFeeMax
) public view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return
keccak256(
abi.encode(
address(this),
chainId,
tokenA,
tokenB,
amount,
buyPriceBAfterFeeMax,
_blockNumber()
)
);
}
function getThreeThreeOrder(
bytes32 orderId
) public view returns (ThreeThreeTypes.Order memory order) {
return _threeThreeOrders[orderId];
}
function threeThreeRequest(
address tokenB,
uint256 amount,
uint256 buyPriceBAfterFeeMax
)
external
notContract
nonReentrant
onlyPlayer(_msgSender())
onlyToken(tokenB)
{
require(amount >= NumberMath.PRICE_UNIT, "AKF_ANV");
//
require(
buyPriceBAfterFeeMax >=
IAlphaKeysToken(tokenB).getBuyPriceAfterFeeV2(amount),
"AKF_BBPM"
);
//
address tokenA = _playerKeys[_msgSender()];
require(tokenA != tokenB, "AKF_NET");
//
address ownerA = IAlphaKeysToken(tokenA).getPlayer();
//
require(_msgSender() == ownerA, "AKF_NOA");
require(
IERC20Upgradeable(_btc).balanceOf(ownerA) >= buyPriceBAfterFeeMax,
"AKF_OANEB"
);
//
bytes32 orderId = createThreeThreeOrderId(
tokenA,
tokenB,
amount,
buyPriceBAfterFeeMax
);
//
require(_threeThreeOrders[orderId].tokenA == address(0), "AKF_BOI");
//
address ownerB = IAlphaKeysToken(tokenB).getPlayer();
//
_threeThreeOrders[orderId] = ThreeThreeTypes.Order({
status: ThreeThreeTypes.OrderStatus.Unfilled,
tokenA: tokenA,
ownerA: ownerA,
tokenB: tokenB,
ownerB: ownerB,
amount: amount,
buyPriceBAfterFeeMax: buyPriceBAfterFeeMax,
locked: true,
amountA: 0,
amountB: 0
});
//
TransferHelper.safeTransferFrom(
_btc,
ownerA,
_vault,
buyPriceBAfterFeeMax
);
//
emit ThreeThreeRequested(
orderId,
tokenA,
ownerA,
tokenB,
ownerB,
amount,
buyPriceBAfterFeeMax
);
}
function threeThreeTrade(
bytes32 orderId,
uint256 buyPriceAAfterFeeMax
) external notContract nonReentrant {
require(buyPriceAAfterFeeMax > 0, "AKF_BPNZ");
//
ThreeThreeTypes.Order storage order = _threeThreeOrders[orderId];
//
require(
order.status == ThreeThreeTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
require(order.locked, "AKF_ONL");
//
address tokenB = order.tokenB;
address ownerB = IAlphaKeysToken(tokenB).getPlayer();
//
require(_msgSender() == ownerB, "AKF_NOB");
// save ownerB
order.ownerB = ownerB;
order.status = ThreeThreeTypes.OrderStatus.Filled;
//
address ownerA = order.ownerA;
address tokenA = order.tokenA;
uint256 amount = order.amount;
uint256 buyPriceBAfterFeeMax = order.buyPriceBAfterFeeMax;
//
address vault = _vault;
//
uint256 buyPriceAfterFee = _buyKeysForV2ByToken(
tokenB,
vault,
amount,
buyPriceBAfterFeeMax,
ownerA,
TokenTypes.OrderType.ThreeThreeOrder
);
uint256 refundAmount = buyPriceBAfterFeeMax.sub(buyPriceAfterFee);
if (refundAmount > 0) {
TransferHelper.safeTransferFrom(_btc, vault, ownerA, refundAmount);
}
//
_buyKeysForV2ByToken(
tokenA,
ownerB,
amount,
buyPriceAfterFee,
ownerB,
TokenTypes.OrderType.ThreeThreeOrder
);
//
emit ThreeThreeTrade(orderId, tokenA, ownerA, tokenB, ownerB, amount);
//
IAlphaKeysToken(tokenA).permitLock30D(ownerB, amount);
IAlphaKeysToken(tokenB).permitLock30D(ownerA, amount);
}
function threeThreeRequestBTC(
address tokenB,
uint256 buyPriceBAfterFeeMax
)
external
notContract
nonReentrant
onlyPlayer(_msgSender())
onlyToken(tokenB)
{
require(buyPriceBAfterFeeMax > 0, "AKF_BPNZ");
//
address tokenA = _playerKeys[_msgSender()];
require(tokenA != tokenB, "AKF_NET");
//
require(
buyPriceBAfterFeeMax >=
IAlphaKeysToken(tokenA).getBuyPriceAfterFeeV2(
NumberMath.PRICE_UNIT
) &&
buyPriceBAfterFeeMax >=
IAlphaKeysToken(tokenB).getBuyPriceAfterFeeV2(
NumberMath.PRICE_UNIT
),
"AKF_BBPM"
);
//
address ownerA = IAlphaKeysToken(tokenA).getPlayer();
//
require(_msgSender() == ownerA, "AKF_NOA");
require(
IERC20Upgradeable(_btc).balanceOf(ownerA) >= buyPriceBAfterFeeMax,
"AKF_OANEB"
);
//
bytes32 orderId = createThreeThreeOrderId(
tokenA,
tokenB,
0,
buyPriceBAfterFeeMax
);
//
require(_threeThreeOrders[orderId].tokenA == address(0), "AKF_BOI");
//
address ownerB = IAlphaKeysToken(tokenB).getPlayer();
//
_threeThreeOrders[orderId] = ThreeThreeTypes.Order({
status: ThreeThreeTypes.OrderStatus.Unfilled,
tokenA: tokenA,
ownerA: ownerA,
tokenB: tokenB,
ownerB: ownerB,
amount: 0,
buyPriceBAfterFeeMax: buyPriceBAfterFeeMax,
locked: true,
amountA: 0,
amountB: 0
});
//
TransferHelper.safeTransferFrom(
_btc,
ownerA,
_vault,
buyPriceBAfterFeeMax
);
//
emit ThreeThreeRequested(
orderId,
tokenA,
ownerA,
tokenB,
ownerB,
0,
buyPriceBAfterFeeMax
);
}
function threeThreeTradeBTC(
bytes32 orderId
) external notContract nonReentrant {
ThreeThreeTypes.Order storage order = _threeThreeOrders[orderId];
//
require(
order.status == ThreeThreeTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
require(order.locked, "AKF_ONL");
require(order.amount == 0, "AKF_ONR");
//
address tokenB = order.tokenB;
address ownerB = IAlphaKeysToken(tokenB).getPlayer();
//
require(_msgSender() == ownerB, "AKF_NOB");
// save ownerB
order.ownerB = ownerB;
order.status = ThreeThreeTypes.OrderStatus.Filled;
//
address ownerA = order.ownerA;
address tokenA = order.tokenA;
uint256 buyPriceBAfterFeeMax = order.buyPriceBAfterFeeMax;
uint24 protocolFeeRatioA = IAlphaKeysToken(tokenA)
.getProtocolFeeRatio();
uint24 playerFeeRatioA = IAlphaKeysToken(tokenA).getPlayerFeeRatio();
uint256 amountA = NumberMath.getBuyAmountMaxWithCash(
protocolFeeRatioA,
playerFeeRatioA,
tokenA,
buyPriceBAfterFeeMax
);
uint24 protocolFeeRatioB = IAlphaKeysToken(tokenB)
.getProtocolFeeRatio();
uint24 playerFeeRatioB = IAlphaKeysToken(tokenB).getPlayerFeeRatio();
uint256 amountB = NumberMath.getBuyAmountMaxWithCash(
protocolFeeRatioB,
playerFeeRatioB,
tokenB,
buyPriceBAfterFeeMax
);
order.amountA = amountA;
order.amountB = amountB;
// AKF_BANM: buy amount not min
require(amountA > 0 && amountB > 0, "AKF_BANM");
//
address vault = _vault;
//
uint256 buyPriceAfterFee = _buyKeysForV2ByToken(
tokenB,
vault,
amountB,
buyPriceBAfterFeeMax,
ownerA,
TokenTypes.OrderType.ThreeThreeOrder
);
uint256 refundAmount = buyPriceBAfterFeeMax.sub(buyPriceAfterFee);
if (refundAmount > 0) {
TransferHelper.safeTransferFrom(_btc, vault, ownerA, refundAmount);
}
//
_buyKeysForV2ByToken(
tokenA,
ownerB,
amountA,
buyPriceBAfterFeeMax,
ownerB,
TokenTypes.OrderType.ThreeThreeOrder
);
//
emit ThreeThreeTradeBTC(
orderId,
tokenA,
ownerA,
tokenB,
ownerB,
amountA,
amountB
);
//
IAlphaKeysToken(tokenA).permitLock30D(ownerB, amountA);
IAlphaKeysToken(tokenB).permitLock30D(ownerA, amountB);
}
function threeThreeCancel(
bytes32 orderId
) external notContract nonReentrant {
ThreeThreeTypes.Order storage order = _threeThreeOrders[orderId];
//
require(
order.status == ThreeThreeTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
require(order.locked, "AKF_ONL");
//
address tokenA = order.tokenA;
require(tokenA != address(0), "AKF_ITA");
//
address ownerA = IAlphaKeysToken(tokenA).getPlayer();
require(_msgSender() == ownerA, "AKF_IOA");
//
order.status = ThreeThreeTypes.OrderStatus.Cancelled;
//
TransferHelper.safeTransferFrom(
_btc,
_vault,
ownerA,
order.buyPriceBAfterFeeMax
);
//
emit ThreeThreeCancelled(orderId, tokenA, ownerA);
}
function threeThreeReject(
bytes32 orderId
) external notContract nonReentrant {
ThreeThreeTypes.Order storage order = _threeThreeOrders[orderId];
//
require(
order.status == ThreeThreeTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
require(order.locked, "AKF_ONL");
//
address tokenB = order.tokenB;
require(tokenB != address(0), "AKF_ITB");
//
address ownerB = IAlphaKeysToken(tokenB).getPlayer();
require(_msgSender() == ownerB, "AKF_IOB");
//
address tokenA = order.tokenA;
require(tokenA != address(0), "AKF_ITA");
address ownerA = IAlphaKeysToken(tokenA).getPlayer();
//
order.status = ThreeThreeTypes.OrderStatus.Rejected;
//
TransferHelper.safeTransferFrom(
_btc,
_vault,
ownerA,
order.buyPriceBAfterFeeMax
);
//
emit ThreeThreeRejected(orderId, tokenB, ownerB);
}
// for limit order
function limitOrderCreate(
uint256 nonce,
address token,
bool isBuy,
uint256 amount,
uint256 triggerPrice,
uint256 buyPriceAfterFeeMax
) external notContract nonReentrant {
address trader = _msgSender();
LimitOrderTypes.Order storage order = _limitOrders[trader][nonce];
require(order.trader == address(0), "AKF_BT");
require(amount > 0 && buyPriceAfterFeeMax > 0, "AKF_BR");
//
order.trader = trader;
order.token = token;
order.isBuy = isBuy;
order.amount = amount;
order.triggerPrice = triggerPrice;
order.buyPriceAfterFeeMax = buyPriceAfterFeeMax;
order.status = LimitOrderTypes.OrderStatus.Unfilled;
//
if (isBuy) {
TransferHelper.safeTransferFrom(
_btc,
trader,
_vault,
buyPriceAfterFeeMax
);
}
//
emit LimitOrderCreated(
nonce,
trader,
token,
isBuy,
amount,
triggerPrice,
buyPriceAfterFeeMax
);
}
function limitOrderFill(
uint256 nonce,
address trader
) external notContract nonReentrant {
LimitOrderTypes.Order storage order = _limitOrders[trader][nonce];
require(order.trader == trader, "AKF_BT");
require(
order.status == LimitOrderTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
//
_limitOrders[trader][nonce].status = LimitOrderTypes.OrderStatus.Filled;
// fill order
address token = order.token;
uint256 triggerPrice = order.triggerPrice;
uint256 amount = order.amount;
bool isBuy = order.isBuy;
uint256 buyPriceAfterFeeMax = order.buyPriceAfterFeeMax;
//
if (isBuy) {
require(
IAlphaKeysToken(token).getBuyPriceV2(NumberMath.ONE_ETHER) <=
triggerPrice,
"AKF_BTBP"
);
// fill order
address vault = _vault;
uint256 buyPriceAfterFee = _buyKeysForV2ByToken(
token,
vault,
amount,
buyPriceAfterFeeMax,
trader,
TokenTypes.OrderType.LimitOrder
);
// refund
uint256 refundAmount = buyPriceAfterFeeMax.sub(buyPriceAfterFee);
if (refundAmount > 0) {
address btc = _btc;
TransferHelper.safeTransferFrom(
btc,
vault,
trader,
refundAmount
);
}
} else {
require(
IAlphaKeysToken(token).getBuyPriceV2(NumberMath.ONE_ETHER) >=
triggerPrice,
"AKF_BTSP"
);
_sellKeysForV2ByToken(
token,
trader,
amount,
trader,
TokenTypes.OrderType.LimitOrder
);
}
emit LimitOrderFilled(nonce, trader, token, isBuy, amount);
}
function limitOrderCancel(uint256 nonce) external notContract nonReentrant {
address trader = _msgSender();
LimitOrderTypes.Order storage order = _limitOrders[trader][nonce];
require(order.trader == trader, "AKF_BT");
require(
order.status == LimitOrderTypes.OrderStatus.Unfilled,
"AKF_BOS"
);
order.status = LimitOrderTypes.OrderStatus.Cancelled;
//
if (order.isBuy) {
TransferHelper.safeTransferFrom(
_btc,
_vault,
trader,
order.buyPriceAfterFeeMax
);
}
//
emit LimitOrderCancelled(nonce, trader);
}
// for watchlist
function getWatchlist(
uint256 twitterId,
uint256 watchTwitterId
) public view returns (WatchlistTypes.Watchlist memory) {
return _watchlists[twitterId][watchTwitterId];
}
function getWatchlistCopyTrade(
uint256 twitterId,
bytes32 orderId
) public view returns (bool) {
return _copyTrades[twitterId][orderId];
}
function addWatchlist(
uint256 watchTwitterId,
uint256 amountMax,
uint256 buyPriceMax
)
external
notContract
nonReentrant
onlyPlayer(_msgSender())
onlyTwitterId(watchTwitterId)
{
//
require(
amountMax <= (1024 ether) && buyPriceMax <= (10 ether),
"AKF_BR"
);
//
uint256 twitterId = getTwitterIdByPlayer(_msgSender());
// same twitterId
require(twitterId != watchTwitterId, "AKF_STI");
// update watchlist
WatchlistTypes.Watchlist storage watchlist = _watchlists[twitterId][
watchTwitterId
];
watchlist.enabled = true;
watchlist.amountMax = amountMax;
watchlist.buyPriceMax = buyPriceMax;
watchlist.validAt = _blockTimestamp();
//
emit WatchlistUpdated(
twitterId,
watchTwitterId,
true,
amountMax,
buyPriceMax,
_blockTimestamp()
);
}
function removeWatchlist(
uint256 watchTwitterId
)
external
notContract
nonReentrant
onlyPlayer(_msgSender())
onlyTwitterId(watchTwitterId)
{
uint256 twitterId = getTwitterIdByPlayer(_msgSender());
// update watchlist
WatchlistTypes.Watchlist storage watchlist = _watchlists[twitterId][
watchTwitterId
];
watchlist.enabled = false;
watchlist.amountMax = 0;
watchlist.buyPriceMax = 0;
//
emit WatchlistUpdated(
twitterId,
watchTwitterId,
false,
0,
0,
_blockTimestamp()
);
}
function buyWithWatchlist(
uint256 twitterId,
uint256 watchTwitterId,
address token,
bytes32 orderId
)
external
notContract
nonReentrant
onlyTwitterId(twitterId)
onlyTwitterId(watchTwitterId)
onlyToken(token)
{
// copy trade existed
require(_copyTrades[twitterId][orderId] == false, "AKF_CTE");
_copyTrades[twitterId][orderId] = true;
// update watchlist
WatchlistTypes.Watchlist storage watchlist = _watchlists[twitterId][
watchTwitterId
];
uint256 amountMax = watchlist.amountMax;
uint256 buyPriceMax = watchlist.buyPriceMax;
// not configure watchlist
require(
watchlist.enabled && amountMax > 0 && buyPriceMax > 0,
"AKF_NCW"
);
TokenTypes.TradeOrder memory watchOrder = IAlphaKeysToken(token)
.getTradeOrder(orderId);
// not match trade order
uint256 orderTwitterId = getTwitterIdByPlayer(watchOrder.trader);
require(
orderTwitterId == watchTwitterId &&
watchOrder.isBuy == true &&
watchOrder.orderType == TokenTypes.OrderType.SpotOrder &&
watchOrder.createdAt >= watchlist.validAt,
"AKF_NMTO"
);
//
address trader = getPlayerByTwitterId(twitterId);
// estimate and copy trade
uint24 protocolFeeRatioToken = IAlphaKeysToken(token)
.getProtocolFeeRatio();
uint24 palyerFeeRatioToken = IAlphaKeysToken(token).getPlayerFeeRatio();
uint256 amountBuy = NumberMath.getBuyAmountMaxWithConditions(
token,
protocolFeeRatioToken,
palyerFeeRatioToken,
amountMax,
buyPriceMax,
NumberMath.getPaymentMaxFor(_btc, trader, address(this))
);
require(amountBuy > 0, "AKF_ABIZ");
//
_buyKeysForV2ByToken(
token,
trader,
amountBuy,
trader,
TokenTypes.OrderType.WatchlistOrder
);
//
emit WatchlistCopyTrade(
twitterId,
watchTwitterId,
token,
amountBuy,
orderId
);
}
// for swap
function amountOutForSwapTokens(
address tokenIn,
address tokenOut,
uint256 amountIn
) external view returns (uint256) {
uint256 sellPriceAfterFeeIn = IAlphaKeysToken(tokenIn)
.getSellPriceAfterFeeForSwap(amountIn);
uint256 amountOut = IAlphaKeysToken(tokenOut)
.getBuyAmountAfterFeeForSwap(sellPriceAfterFeeIn);
return amountOut;
}
function amountInForSwapTokens(
address tokenIn,
address tokenOut,
uint256 amountOut
) external view returns (uint256) {
uint256 buyPriceAfterFeeOut = IAlphaKeysToken(tokenOut)
.getBuyPriceAfterFeeForSwap(amountOut);
uint256 amountIn = IAlphaKeysToken(tokenIn)
.getSellAmountAfterFeeForSwap(buyPriceAfterFeeOut);
return amountIn;
}
function swapTokens(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMin
) external notContract nonReentrant onlyToken(tokenIn) onlyToken(tokenOut) {
address trader = _msgSender();
// not same token
require(tokenIn != tokenOut, "AKF_NST");
//
uint256 sellPriceAfterFeeIn = IAlphaKeysToken(tokenIn)
.getSellPriceAfterFeeForSwap(amountIn);
uint256 amountOut = IAlphaKeysToken(tokenOut)
.getBuyAmountAfterFeeForSwap(sellPriceAfterFeeIn);
// not min amount
require(amountOut >= amountOutMin, "AKF_NMO");
//
_sellKeysForV2ByToken(
tokenIn,
trader,
amountIn,
trader,
TokenTypes.OrderType.SwapOrder
);
_buyKeysForV2ByToken(
tokenOut,
trader,
amountOut,
trader,
TokenTypes.OrderType.SwapOrder
);
//
emit Swap(trader, tokenIn, tokenOut, amountIn, amountOut);
}
// stakings
function stakingOpen(
uint24 ratio,
uint256 duration,
bool locked,
uint256 lockAmount,
uint256 buyPriceAfterFeeMax
) external notContract nonReentrant {
address creator = _msgSender();
address token = getPlayerKeys(creator);
//
lockAmount = lockAmount.roundMilliether();
//
if (ratio > 0) {
//
uint256 buyAmount = lockAmount.mulRatio(ratio);
//
uint256 buyPriceAfterFee = IAlphaKeysToken(token)
.getBuyPriceAfterFeeForStaking(buyAmount);
//
require(buyPriceAfterFeeMax >= buyPriceAfterFee, "AKF_NMO");
//
_buyKeysForV2ByToken(
token,
creator,
buyAmount,
creator,
TokenTypes.OrderType.StakingOrder
);
}
//
IAlphaKeysToken(token).permitStakingOpen(
creator,
ratio,
duration,
locked,
lockAmount
);
}
function stakingClose(
uint24 ratio,
uint256 duration,
bool locked
) external notContract nonReentrant {
address creator = _msgSender();
address token = getPlayerKeys(creator);
//
IAlphaKeysToken(token).permitStakingClose(
creator,
ratio,
duration,
locked
);
}
function stakingOrderCreate(
address token,
bytes32 orderId,
uint24 ratio,
uint256 duration,
bool locked,
uint256 amount
) external nonReentrant {
address trader = _msgSender();
//
IAlphaKeysToken(token).permitStakingOrderCreate(
orderId,
ratio,
duration,
locked,
trader,
amount
);
}
function stakingOrderClose(
address token,
bytes32 orderId
) external nonReentrant {
address caller = _msgSender();
//
IAlphaKeysToken(token).permitStakingOrderClose(orderId, caller);
}
function delegate(address token, address trader) external {
IAlphaKeysToken(token).permitDelegate(trader);
}
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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);
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
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 = MathUpgradeable.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 `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.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);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../StringsUpgradeable.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 ECDSAUpgradeable {
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 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @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", StringsUpgradeable.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 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}
@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
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) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 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 256, 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 << 3) < value ? 1 : 0);
}
}
}
@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 SafeMathUpgradeable {
/**
* @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;
}
}
}
@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
@openzeppelin/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
contracts/AlphaKeysTokenProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol";
import {IAlphaKeysFactoryImpl} from "./interfaces/IAlphaKeysFactoryImpl.sol";
/**
* @title AlphaKeysTokenProxy
* @author 0xkongamoto
*/
contract AlphaKeysTokenProxy is Proxy {
//
IAlphaKeysFactoryImpl public immutable factory;
// ======== Constructor =========
constructor() {
factory = IAlphaKeysFactoryImpl(msg.sender);
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation()
internal
view
virtual
override
returns (address impl)
{
return factory.getAlphaKeysTokenImplementation();
}
}
contracts/base/BlockContext.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
abstract contract BlockContext {
function _blockTimestamp() internal view virtual returns (uint256) {
// Reply from Arbitrum
// block.timestamp returns timestamp at the time at which the sequencer receives the tx.
// It may not actually correspond to a particular L1 block
return block.timestamp;
}
function _blockNumber() internal view virtual returns (uint256) {
return block.number;
}
}
contracts/base/Multicall.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >0.8.0;
/// @title Multicall
/// @notice Enables calling multiple methods in a single call to the contract
abstract contract Multicall {
function multicall(
bytes[] calldata data
) public payable returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(
data[i]
);
if (!success) {
// Next 5 lines from https://ethereum.stackexchange.com/a/83577
if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
revert(abi.decode(result, (string)));
}
results[i] = result;
}
}
}
contracts/interfaces/IAlphaKeysFactory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import {IAlphaKeysFactoryImpl} from "./IAlphaKeysFactoryImpl.sol";
interface IAlphaKeysFactory is IAlphaKeysFactoryImpl {
//
event AlphaKeysCreated(address indexed player, address indexed token);
event AlphaKeysCreatedV2(
address indexed player,
address indexed token,
uint256 indexed twitterId
);
event AlphaKeysCreatedForTwitter(
address indexed player,
address indexed token,
uint256 indexed twitterId
);
event TCRequested(
address indexed trader,
uint256 indexed nonce,
uint256 amountBTC,
uint256 amountTC
);
event ETH2TCRequested(
address indexed trader,
uint256 indexed nonce,
uint256 amountETH,
uint256 amountTC
);
event Token2TCRequested(
address indexed trader,
address indexed token,
uint256 indexed nonce,
uint256 amountToken,
uint256 amountTC
);
event ThreeThreeRequested(
bytes32 indexed orderId,
address indexed tokenA,
address ownerA,
address indexed tokenB,
address ownerB,
uint256 amount,
uint256 buyPriceBAfterFeeMax
);
event ThreeThreeTrade(
bytes32 indexed orderId,
address indexed tokenA,
address ownerA,
address indexed tokenB,
address ownerB,
uint256 amount
);
event ThreeThreeTradeBTC(
bytes32 indexed orderId,
address indexed tokenA,
address ownerA,
address indexed tokenB,
address ownerB,
uint256 amountA,
uint256 amountB
);
event ThreeThreeCancelled(
bytes32 indexed orderId,
address indexed tokenA,
address ownerA
);
event ThreeThreeRejected(
bytes32 indexed orderId,
address indexed tokenB,
address ownerB
);
event LimitOrderCreated(
uint256 indexed nonce,
address indexed trader,
address indexed token,
bool isBuy,
uint256 amount,
uint256 triggerPrice,
uint256 buyPriceAfterFeeMax
);
event LimitOrderFilled(
uint256 indexed nonce,
address indexed trader,
address indexed token,
bool isBuy,
uint256 amount
);
event LimitOrderCancelled(uint256 indexed nonce, address indexed trader);
event WatchlistUpdated(
uint256 indexed twitterId,
uint256 indexed watchTwitterId,
bool enabled,
uint256 amountMax,
uint256 buyPriceMax,
uint256 validAt
);
event WatchlistCopyTrade(
uint256 indexed twitterId,
uint256 indexed watchTwitterId,
address token,
uint256 amount,
bytes32 orderId
);
event Swap(
address indexed trader,
address indexed tokenIn,
address indexed tokenOut,
uint256 amountIn,
uint256 amountOut
);
//
function getBTC() external view returns (address);
function getVault() external view returns (address);
function getProtocolFeeRatio() external view returns (uint24);
function getPlayerFeeRatio() external view returns (uint24);
function getProtocolFeeDestination() external view returns (address);
function getPlayerKeys(address player) external view returns (address);
function getKeysPlayer(address token) external view returns (address);
function getPlayerByTwitterId(
uint256 twitterId
) external view returns (address);
function getTwitterKeys(uint256 twitterId) external view returns (address);
function requestFund(address token, address from, uint256 amount) external;
function requestRefund(address token, address to, uint256 amount) external;
}
contracts/interfaces/IAlphaKeysFactoryImpl.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
interface IAlphaKeysFactoryImpl {
function getAlphaKeysTokenImplementation()
external
view
returns (address);
}
contracts/interfaces/IAlphaKeysToken.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import {TokenTypes} from "../libraries/TokenTypes.sol";
import {StakingTypes} from "../libraries/StakingTypes.sol";
interface IAlphaKeysToken {
//
event Trade(
address trader,
address player,
bool isBuy,
uint256 shareAmount,
uint256 tcAmount,
uint256 protocolFeeAmount,
uint256 playerFeeAmount,
uint256 supply
);
event TradeV2(
address trader,
address player,
bool isBuy,
uint256 shareAmount,
uint256 tcAmount,
uint256 protocolFeeAmount,
uint256 playerFeeAmount,
uint256 supply
);
event TradeV3(
address trader,
address player,
bool isBuy,
uint256 shareAmount,
uint256 btcAmount,
uint256 protocolBtcFeeAmount,
uint256 playerBtcFeeAmount,
uint256 supply
);
event TradeV4(
address trader,
address player,
bool isBuy,
uint256 shareAmount,
uint256 btcAmount,
uint256 protocolBtcFeeAmount,
uint256 playerBtcFeeAmount,
uint256 supply,
TokenTypes.OrderType orderType,
bytes32 orderId
);
event PlayerUpdated(address indexed oldPlayer, address indexed newPlayer);
event BTCMigrated(uint256 amountTC, uint256 amountBTC);
event LockedTs(
address user,
uint256 amount,
uint256 duationTs,
uint256 expiredTs
);
event PlayerFeeRatioUpdated(uint24 playerFeeRatio);
event StakingUpdated(
StakingTypes.Status status,
uint24 ratio,
uint256 duration,
uint256 free,
uint256 total
);
event StakingUpdatedV2(
StakingTypes.Status status,
uint24 ratio,
uint256 duration,
bool locked,
uint256 free,
uint256 total
);
event StakingOrderCreated(
bytes32 orderId,
uint24 ratio,
uint256 duration,
address trader,
uint256 amount,
uint256 createdAt
);
event StakingOrderCreatedV2(
bytes32 orderId,
uint24 ratio,
uint256 duration,
bool locked,
address trader,
uint256 amount,
uint256 createdAt
);
event StakingOrderClosed(
bytes32 orderId,
uint24 ratio,
uint256 duration,
address trader,
uint256 amount,
uint256 interest,
StakingTypes.OrderStatus status,
uint256 closedAt
);
event StakingOrderClosedV2(
bytes32 orderId,
uint24 ratio,
uint256 duration,
bool locked,
address trader,
uint256 amount,
uint256 interest,
StakingTypes.OrderStatus status,
uint256 closedAt
);
//
function initialize(
address factory,
address manager,
string calldata name,
string calldata symbol
) external;
function getPlayer() external view returns (address);
function getProtocolFeeRatio() external view returns (uint24);
function getPlayerFeeRatio() external view returns (uint24);
function getBuyPriceAfterFeeV2(
uint256 amountX18
) external view returns (uint256);
function getBuyPriceV2(uint256 amountX18) external view returns (uint256);
function getSellPriceAfterFeeV2(
uint256 amountX18
) external view returns (uint256);
function updateNewPlayer(address newPlayer) external;
function permitBuyKeysForV2(
address from,
uint256 amountX18,
address recipient,
TokenTypes.OrderType orderType
) external;
function permitSellKeysForV2(
address from,
uint256 amountX18,
address recipient,
TokenTypes.OrderType orderType
) external;
function permitLock30D(address user, uint256 amount) external;
function getTradeOrder(
bytes32 tradeId
) external view returns (TokenTypes.TradeOrder memory);
function getSellPriceAfterFeeForSwap(
uint256 amountX18
) external view returns (uint256);
function getBuyPriceAfterFeeForSwap(
uint256 amountX18
) external view returns (uint256);
function getBuyAmountAfterFeeForSwap(
uint256 amountBTCAfterFee
) external view returns (uint256);
function getSellAmountAfterFeeForSwap(
uint256 amountBTCAfterFee
) external view returns (uint256);
function getBuyPriceAfterFeeForStaking(
uint256 amountX18
) external view returns (uint256);
function permitStakingOpen(
address creator,
uint24 ratio,
uint256 duration,
bool locked,
uint256 amount
) external;
function permitStakingClose(
address creator,
uint24 ratio,
uint256 duration,
bool locked
) external;
function permitStakingOrderCreate(
bytes32 orderId,
uint24 ratio,
uint256 duration,
bool locked,
address trader,
uint256 amount
) external;
function permitStakingOrderClose(bytes32 orderId, address caller) external;
function permitDelegate(address trader) external;
}
contracts/interfaces/IAlphaKeysVault.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
interface IAlphaKeysVault {}
contracts/libraries/LimitOrderTypes.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
library LimitOrderTypes {
enum OrderStatus {
Unfilled,
Filled,
CancelledNotRefund,
Cancelled
}
struct Order {
OrderStatus status;
address trader;
address token;
bool isBuy;
uint256 amount;
uint256 triggerPrice;
uint256 buyPriceAfterFeeMax;
}
}
contracts/libraries/NumberMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {SafeMathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {MathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
library NumberMath {
// CONST
uint256 internal constant RATIO = 1e6;
using SafeMathUpgradeable for uint256;
uint256 internal constant ONE_ETHER = 1 ether;
uint256 internal constant PRICE_UNIT = 0.000001 ether;
uint256 internal constant NUMBER_UNIT_PER_ONE_ETHER =
ONE_ETHER / PRICE_UNIT;
uint256 internal constant PRICE_BTC_PER_TC = 0.000416666666666667 ether; // 1 BTC = 2400 TC
uint256 internal constant PRICE_TC_PER_BTC = 2400 ether; // 1 BTC = 2400 TC
uint256 internal constant PRICE_KEYS_DENOMINATOR = 264000;
uint256 internal constant TS_30_DAYS = 30 days;
uint256 internal constant TS_180_DAYS = 180 days;
uint24 internal constant SWAP_PLATFORM_FEE_RATIO = 10000;
uint24 internal constant SWAP_CREATOR_FEE_RATIO = 40000;
//
uint24 internal constant DEFAULT_POOL_V3_FEE = 10000; // 1%
uint256 internal constant DEFAULT_PASS_TOKEN_SUPPLY = 21_000_000 ether; // 21M
uint256 internal constant DEFAULT_PASS_TOKEN_FUND_DURATION = 24 hours;
//
function mulRatio(
uint256 value,
uint24 ratio
) internal pure returns (uint256) {
return value.mul(ratio).div(RATIO);
}
function divRatio(
uint256 value,
uint24 ratio
) internal pure returns (uint256) {
return value.mul(RATIO).div(ratio);
}
function mulEther(uint256 value) internal pure returns (uint256) {
return value.mul(1 ether);
}
function divEther(uint256 value) internal pure returns (uint256) {
return value.div(1 ether);
}
function mulPrice(
uint256 value,
uint256 rate
) internal pure returns (uint256) {
return value.mul(rate).div(1 ether);
}
function roundMilliether(uint256 value) internal pure returns (uint256) {
return value.div(0.001 ether).mul(0.001 ether);
}
function roundEther(uint256 value) internal pure returns (uint256) {
return value.div(1 ether).mul(1 ether);
}
function getPriceV2(
uint256 supply,
uint256 amount
) internal pure returns (uint256) {
// invalid params
require(supply >= NUMBER_UNIT_PER_ONE_ETHER && amount >= 1, "NM_IP");
//
uint256 sum1 = ((supply - NUMBER_UNIT_PER_ONE_ETHER) *
supply *
(2 *
(supply - NUMBER_UNIT_PER_ONE_ETHER) +
NUMBER_UNIT_PER_ONE_ETHER)) / 6;
uint256 sum2 = ((supply - NUMBER_UNIT_PER_ONE_ETHER + amount) *
(supply + amount) *
(2 *
(supply - NUMBER_UNIT_PER_ONE_ETHER + amount) +
NUMBER_UNIT_PER_ONE_ETHER)) / 6;
uint256 summation = sum2 - sum1;
return
(summation * ONE_ETHER) /
PRICE_KEYS_DENOMINATOR /
(NUMBER_UNIT_PER_ONE_ETHER *
NUMBER_UNIT_PER_ONE_ETHER *
NUMBER_UNIT_PER_ONE_ETHER);
}
function getBuyPriceV2(
uint256 supply,
uint256 amountX18
) internal pure returns (uint256) {
return
getPriceV2(supply.div(PRICE_UNIT), amountX18.div(PRICE_UNIT)).add(
1
);
}
function getSellPriceV2(
uint256 supply,
uint256 amountX18
) internal pure returns (uint256) {
return
getPriceV2(
supply.div(PRICE_UNIT).sub(amountX18.div(PRICE_UNIT)),
amountX18.div(PRICE_UNIT)
);
}
function getBuyPriceV2AfterFee(
uint24 protocolFeeRatio,
uint24 playerFeeRatio,
uint256 supply,
uint256 amountX18
) internal pure returns (uint256) {
//
uint256 price = getBuyPriceV2(supply, amountX18);
uint256 protocolFee = mulRatio(price, protocolFeeRatio);
uint256 playerFee = mulRatio(price, playerFeeRatio);
return price.add(protocolFee).add(playerFee);
}
function getSellPriceV2AfterFee(
uint24 protocolFeeRatio,
uint24 playerFeeRatio,
uint256 supply,
uint256 amountX18
) internal pure returns (uint256) {
//
uint256 price = getSellPriceV2(supply, amountX18);
uint256 protocolFee = mulRatio(price, protocolFeeRatio);
uint256 playerFee = mulRatio(price, playerFeeRatio);
return price.sub(protocolFee).sub(playerFee);
}
function getBuyAmountMaxWithCash(
uint24 protocolFeeRatio,
uint24 playerFeeRatio,
address token,
uint256 buyPriceAfterFeeMax
) internal view returns (uint256) {
uint256 supply = IERC20Upgradeable(token).totalSupply();
uint256 amount = 0;
for (uint i = 0; i < 6; i++) {
uint256 delta = (ONE_ETHER / (10 ** i));
while (true) {
if (
getBuyPriceV2AfterFee(
protocolFeeRatio,
playerFeeRatio,
supply,
amount.add(delta)
) > buyPriceAfterFeeMax
) {
break;
}
amount = amount.add(delta);
}
}
return amount;
}
function getPaymentMaxFor(
address token,
address account,
address spender
) internal view returns (uint256) {
return
MathUpgradeable.min(
IERC20Upgradeable(token).balanceOf(account),
IERC20Upgradeable(token).allowance(account, spender)
);
}
function getBuyAmountMaxWithConditions(
address token,
uint24 protocolFeeRatio,
uint24 playerFeeRatio,
uint256 amountMax,
uint256 buyPriceAfterFeeMax,
uint256 amountBTC
) internal view returns (uint256) {
uint256 supply = IERC20Upgradeable(token).totalSupply();
uint256 amount = 0;
for (uint i = 0; i <= 6; i++) {
uint256 delta = (ONE_ETHER / (10 ** i));
while (true) {
if (
getBuyPriceV2AfterFee(
protocolFeeRatio,
playerFeeRatio,
supply.add(amount.add(delta)),
0.1 ether
).mul(10) >
buyPriceAfterFeeMax ||
amount.add(delta) > amountMax ||
getBuyPriceV2AfterFee(
protocolFeeRatio,
playerFeeRatio,
supply,
amount.add(delta)
) >
amountBTC
) {
break;
}
amount = amount.add(delta);
}
}
return amount;
}
function getSellAmountMaxWithConditions(
address token,
uint24 protocolFeeRatio,
uint24 playerFeeRatio,
uint256 amountMax,
uint256 sellPriceAfterFeeMax,
uint256 amountBTC
) internal view returns (uint256) {
uint256 supply = IERC20Upgradeable(token).totalSupply();
uint256 amount = 0;
for (uint i = 0; i <= 6; i++) {
uint256 delta = (ONE_ETHER / (10 ** i));
while (true) {
if (
getSellPriceV2AfterFee(
protocolFeeRatio,
playerFeeRatio,
supply.add(amount.add(delta)),
0.1 ether
).mul(10) >
sellPriceAfterFeeMax ||
amount.add(delta) > amountMax ||
getSellPriceV2AfterFee(
protocolFeeRatio,
playerFeeRatio,
supply,
amount.add(delta)
) >
amountBTC
) {
break;
}
amount = amount.add(delta);
}
}
if (amountBTC > 0) {
amount = amount.add(PRICE_UNIT);
}
return amount;
}
function getStakingId(
uint24 ratio,
uint256 duration,
bool locked
) internal pure returns (uint256) {
require(
ratio == (ratio / 100) * 100 && ratio >= 0 && ratio <= 15000000,
"NM_IR"
);
require(duration < ONE_ETHER, "NM_ID");
return
(uint256(locked ? 1 : 0).mul(ONE_ETHER).mul(ONE_ETHER)).add(
uint256(ratio).mul(ONE_ETHER).add(duration)
);
}
}
contracts/libraries/StakingTypes.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
library StakingTypes {
//
enum Status {
None,
Running,
Stopped
}
struct Staking {
Status status;
uint256 free;
uint256 total;
}
enum OrderStatus {
None,
Created,
Done,
Cancelled
}
struct Order {
OrderStatus status;
uint24 ratio;
uint256 duration;
address trader;
uint256 createdAt;
uint256 amount;
bool locked;
}
}
contracts/libraries/ThreeThreeTypes.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
library ThreeThreeTypes {
enum OrderStatus {
Unfilled,
Filled,
Cancelled,
Rejected
}
struct Order {
OrderStatus status;
address tokenA;
address ownerA;
address tokenB;
address ownerB;
uint256 amount;
uint256 buyPriceBAfterFeeMax;
bool locked;
uint256 amountA;
uint256 amountB;
}
}
contracts/libraries/TokenTypes.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
library TokenTypes {
enum OrderType {
SpotOrder,
ThreeThreeOrder,
LimitOrder,
WatchlistOrder,
SwapOrder,
StakingOrder
}
struct Locked {
uint256 amount;
uint256 expiredTs;
}
struct TradeOrder {
address trader;
bool isBuy;
uint256 createdAt;
uint256 amount;
OrderType orderType;
}
}
contracts/libraries/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
contracts/libraries/WatchlistTypes.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
library WatchlistTypes {
struct Watchlist {
bool enabled;
uint256 amountMax;
uint256 buyPriceMax;
uint256 validAt;
}
}
contracts/storage/AlphaKeysFactoryStorage.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import {ThreeThreeTypes} from "../libraries/ThreeThreeTypes.sol";
import {LimitOrderTypes} from "../libraries/LimitOrderTypes.sol";
import {WatchlistTypes} from "../libraries/WatchlistTypes.sol";
abstract contract AlphaKeysFactoryStorage {
//
address internal _playerShareTokenImplementation;
//
uint24 internal _protocolFeeRatio;
uint24 internal _playerFeeRatio;
address internal _protocolFeeDestination;
//
mapping(address => address) internal _playerKeys;
mapping(address => address) internal _keysPlayers;
mapping(uint256 => address) internal _twitterKeys;
mapping(address => uint256) internal _keysTwitters;
//
address internal _admin;
address internal _btc;
uint256 internal _btcPrice;
// for gas
mapping(address => mapping(uint256 => bool)) _usedNonces;
// three three model
mapping(bytes32 => ThreeThreeTypes.Order) _threeThreeOrders;
// vault address
address internal _vault;
address internal _swapRouter;
// limit orders
mapping(address => mapping(uint256 => LimitOrderTypes.Order)) _limitOrders;
// watchlist model : trader -> player
mapping(uint256 => mapping(uint256 => WatchlistTypes.Watchlist)) _watchlists;
mapping(uint256 => mapping(bytes32 => bool)) _copyTrades;
// request TC
mapping(address => uint256) internal _tcPrices;
}
Compiler Settings
{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"event","name":"AlphaKeysCreated","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"AlphaKeysCreatedForTwitter","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"twitterId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"AlphaKeysCreatedV2","inputs":[{"type":"address","name":"player","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"twitterId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ETH2TCRequested","inputs":[{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"uint256","name":"amountETH","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountTC","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"LimitOrderCancelled","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"address","name":"trader","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"LimitOrderCreated","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"bool","name":"isBuy","internalType":"bool","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"triggerPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LimitOrderFilled","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"bool","name":"isBuy","internalType":"bool","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Swap","inputs":[{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"address","name":"tokenIn","internalType":"address","indexed":true},{"type":"address","name":"tokenOut","internalType":"address","indexed":true},{"type":"uint256","name":"amountIn","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountOut","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TCRequested","inputs":[{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"uint256","name":"amountBTC","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountTC","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ThreeThreeCancelled","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"address","name":"tokenA","internalType":"address","indexed":true},{"type":"address","name":"ownerA","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ThreeThreeRejected","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"address","name":"tokenB","internalType":"address","indexed":true},{"type":"address","name":"ownerB","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ThreeThreeRequested","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"address","name":"tokenA","internalType":"address","indexed":true},{"type":"address","name":"ownerA","internalType":"address","indexed":false},{"type":"address","name":"tokenB","internalType":"address","indexed":true},{"type":"address","name":"ownerB","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"buyPriceBAfterFeeMax","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ThreeThreeTrade","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"address","name":"tokenA","internalType":"address","indexed":true},{"type":"address","name":"ownerA","internalType":"address","indexed":false},{"type":"address","name":"tokenB","internalType":"address","indexed":true},{"type":"address","name":"ownerB","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ThreeThreeTradeBTC","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"address","name":"tokenA","internalType":"address","indexed":true},{"type":"address","name":"ownerA","internalType":"address","indexed":false},{"type":"address","name":"tokenB","internalType":"address","indexed":true},{"type":"address","name":"ownerB","internalType":"address","indexed":false},{"type":"uint256","name":"amountA","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountB","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Token2TCRequested","inputs":[{"type":"address","name":"trader","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"nonce","internalType":"uint256","indexed":true},{"type":"uint256","name":"amountToken","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountTC","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WatchlistCopyTrade","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256","indexed":true},{"type":"uint256","name":"watchTwitterId","internalType":"uint256","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"WatchlistUpdated","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256","indexed":true},{"type":"uint256","name":"watchTwitterId","internalType":"uint256","indexed":true},{"type":"bool","name":"enabled","internalType":"bool","indexed":false},{"type":"uint256","name":"amountMax","internalType":"uint256","indexed":false},{"type":"uint256","name":"buyPriceMax","internalType":"uint256","indexed":false},{"type":"uint256","name":"validAt","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addWatchlist","inputs":[{"type":"uint256","name":"watchTwitterId","internalType":"uint256"},{"type":"uint256","name":"amountMax","internalType":"uint256"},{"type":"uint256","name":"buyPriceMax","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"amountInForSwapTokens","inputs":[{"type":"address","name":"tokenIn","internalType":"address"},{"type":"address","name":"tokenOut","internalType":"address"},{"type":"uint256","name":"amountOut","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"amountOutForSwapTokens","inputs":[{"type":"address","name":"tokenIn","internalType":"address"},{"type":"address","name":"tokenOut","internalType":"address"},{"type":"uint256","name":"amountIn","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyKeysForV2ByToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amountX18","internalType":"uint256"},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyKeysForV2ByTwitterId","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"uint256","name":"amountX18","internalType":"uint256"},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyKeysV2ByToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amountX18","internalType":"uint256"},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyWithWatchlist","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"uint256","name":"watchTwitterId","internalType":"uint256"},{"type":"address","name":"token","internalType":"address"},{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createAlphaKeysForTwitter","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createAlphaKeysForV2","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"address","name":"player","internalType":"address"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"createThreeThreeOrderId","inputs":[{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"buyPriceBAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegate","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"trader","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getAlphaKeysTokenImplementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getBTC","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBTCPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getCreateForTwitterMessageHash","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getGasOrderMessageHash","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"},{"type":"uint256","name":"amountBTC","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getGasOrderMessageHashByToken","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getKeysPlayer","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getKeysTwitters","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getPlayerByTwitterId","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint24","name":"","internalType":"uint24"}],"name":"getPlayerFeeRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getPlayerKeys","inputs":[{"type":"address","name":"player","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getProtocolFeeDestination","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint24","name":"","internalType":"uint24"}],"name":"getProtocolFeeRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTCPrice","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"order","internalType":"struct ThreeThreeTypes.Order","components":[{"type":"uint8","name":"status","internalType":"enum ThreeThreeTypes.OrderStatus"},{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"ownerA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"},{"type":"address","name":"ownerB","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"buyPriceBAfterFeeMax","internalType":"uint256"},{"type":"bool","name":"locked","internalType":"bool"},{"type":"uint256","name":"amountA","internalType":"uint256"},{"type":"uint256","name":"amountB","internalType":"uint256"}]}],"name":"getThreeThreeOrder","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTwitterIdByPlayer","inputs":[{"type":"address","name":"player","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getTwitterKeys","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getVault","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct WatchlistTypes.Watchlist","components":[{"type":"bool","name":"enabled","internalType":"bool"},{"type":"uint256","name":"amountMax","internalType":"uint256"},{"type":"uint256","name":"buyPriceMax","internalType":"uint256"},{"type":"uint256","name":"validAt","internalType":"uint256"}]}],"name":"getWatchlist","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"uint256","name":"watchTwitterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"getWatchlistCopyTrade","inputs":[{"type":"uint256","name":"twitterId","internalType":"uint256"},{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"limitOrderCancel","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"limitOrderCreate","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"token","internalType":"address"},{"type":"bool","name":"isBuy","internalType":"bool"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"triggerPrice","internalType":"uint256"},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"limitOrderFill","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes[]","name":"results","internalType":"bytes[]"}],"name":"multicall","inputs":[{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"refundTC","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"refundToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeWatchlist","inputs":[{"type":"uint256","name":"watchTwitterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestETH2TC","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"},{"type":"uint256","name":"amountETH","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestFund","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"from","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestRefund","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestTC","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"},{"type":"uint256","name":"amountBTC","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"requestToken2TC","inputs":[{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"address","name":"trader","internalType":"address"},{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amountToken","internalType":"uint256"},{"type":"uint256","name":"rate","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sellKeysForV2ByToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amountX18","internalType":"uint256"},{"type":"uint256","name":"sellPriceAfterFeeMin","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sellKeysV2ByToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amountX18","internalType":"uint256"},{"type":"uint256","name":"sellPriceAfterFeeMin","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdmin","inputs":[{"type":"address","name":"admin","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAlphaKeysTokenImplementation","inputs":[{"type":"address","name":"playerShareTokenImplementationArg","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBTC","inputs":[{"type":"address","name":"btc","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBTCPrice","inputs":[{"type":"uint256","name":"btcPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPlayerFeeRatio","inputs":[{"type":"uint24","name":"playerFeeRatio","internalType":"uint24"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProtocolFeeDestination","inputs":[{"type":"address","name":"protocolFeeDestination","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProtocolFeeRatio","inputs":[{"type":"uint24","name":"protocolFeeRatio","internalType":"uint24"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTCPrice","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVault","inputs":[{"type":"address","name":"vault","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakingClose","inputs":[{"type":"uint24","name":"ratio","internalType":"uint24"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakingOpen","inputs":[{"type":"uint24","name":"ratio","internalType":"uint24"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"bool","name":"locked","internalType":"bool"},{"type":"uint256","name":"lockAmount","internalType":"uint256"},{"type":"uint256","name":"buyPriceAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakingOrderClose","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakingOrderCreate","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"bytes32","name":"orderId","internalType":"bytes32"},{"type":"uint24","name":"ratio","internalType":"uint24"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"bool","name":"locked","internalType":"bool"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"swapTokens","inputs":[{"type":"address","name":"tokenIn","internalType":"address"},{"type":"address","name":"tokenOut","internalType":"address"},{"type":"uint256","name":"amountIn","internalType":"uint256"},{"type":"uint256","name":"amountOutMin","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeCancel","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeReject","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeRequest","inputs":[{"type":"address","name":"tokenB","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"buyPriceBAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeRequestBTC","inputs":[{"type":"address","name":"tokenB","internalType":"address"},{"type":"uint256","name":"buyPriceBAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeTrade","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"},{"type":"uint256","name":"buyPriceAAfterFeeMax","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"threeThreeTradeBTC","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateKeysPlayer","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"newPlayer","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60808060405234610017576170ee90816200001d8239f35b600080fdfe608060405260043610156200001d575b36156200001b57600080fd5b005b60003560e01c806309c7a25c146200051a5780631499274b1462000514578063284be215146200050e5780632b806fba14620005085780633908b9ae14620005025780633a99d04014620004fc5780633ce9853614620004f65780633f56699414620004f05780634ac69cd214620004ea57806357ed199a14620004e45780635b31588314620004de5780635bafc51114620004d857806363ce122a14620004d25780636645442114620004cc5780636817031b14620004c65780636e5bf35e14620004c05780636e9960c314620004ba5780636f056b9914620004b4578063704b6c0214620004ae578063715018a614620004a85780637150238214620004a25780637187f90f146200049c57806373538561146200049657806374567f0f146200049057806376c3b9fe146200048a5780637aabab0714620004845780637cf4626b146200047e5780638129fc1c1462000478578063826db8ac14620004725780638ab65686146200046c5780638b3aaecd14620004665780638b71c3cf14620004605780638c5dc1f6146200045a5780638d928af814620004545780638da5cb5b146200044e5780638db462fc14620004485780638e18cdfc14620004425780639020597a146200043c57806395c68fe9146200043657806396910b91146200043057806398464bca146200042a578063990ec18a1462000424578063a10786b0146200041e578063a43aa2361462000418578063a4bf9d061462000412578063a541daf6146200040c578063a8b8a55d1462000406578063aa0aebc81462000400578063ac9650d814620003fa578063ae4cd03514620003f4578063af7e1ff414620003ee578063b479b15e14620003e8578063b8a946e614620003e2578063bab1fbaa14620003dc578063c326dfb414620003d6578063c9fe49b414620003d0578063cce05ddf14620003ca578063cdb1e3ca14620003c4578063ced7a53914620003be578063d021a6e714620003b8578063d1ce35e314620003b2578063d39869f214620003ac578063d49ebf9814620003a6578063d590be2f14620003a0578063da6c8549146200039a578063dd0bcbe31462000394578063dd22db80146200038e578063e5f600be1462000388578063e62854c71462000382578063eeaf2b7d146200037c5763f2fde38b036200000f57620049cd565b6200493b565b62004910565b6200479b565b6200477b565b62004721565b620045eb565b6200445c565b620042a3565b62004282565b6200421f565b62004067565b62003eeb565b62003ceb565b62003bfb565b62003bb2565b62003a86565b62003979565b62003594565b62003321565b620030f6565b62002f90565b62002e6d565b62002ca8565b62002c7d565b62002859565b62002737565b62002635565b620025e8565b62002474565b620023cf565b6200238c565b620022d3565b6200226c565b6200206c565b6200200c565b62001fe1565b62001fb6565b62001b93565b62001b57565b62001b0a565b62001aa6565b62001a19565b62001924565b6200189f565b6200185d565b620017ad565b62001783565b62001742565b620016bb565b62001473565b620013e1565b62001394565b6200133b565b62001310565b620012cf565b6200124a565b62001217565b6200119d565b620010e2565b620010a1565b62000c98565b62000c06565b62000abc565b6200098f565b62000667565b6200060e565b620005cb565b620005a3565b62000556565b346200053f5760203660031901126200053f576200053762004a67565b600435609f55005b600080fd5b6001600160a01b038116036200053f57565b346200053f5760203660031901126200053f57600435620005778162000544565b60018060a01b031660005260a76020526020604060002054604051908152f35b60009103126200053f57565b346200053f5760003660031901126200053f57602062ffffff60975460a01c16604051908152f35b346200053f5760203660031901126200053f576020600435620005ee8162000544565b60018060a01b03809116600052609a825260406000205416604051908152f35b346200053f5760203660031901126200053f5760206200065f600435620006358162000544565b60018060a01b03809116600052609960205260406000205416600052609c60205260406000205490565b604051908152f35b346200053f5760403660031901126200053f576004356200068a333b1562004ec4565b6200069462004e6d565b620006a3602435151562005b72565b620006b88160005260a1602052604060002090565b90620006db620006c9835460ff1690565b620006d481620039c5565b1562005baa565b620006f4620006ee600684015460ff1690565b62005be1565b60028201546001600160a01b0316604051633308f42d60e01b8152909290916001600160a01b038085169190602085600481865afa948515620008e75760009562000925575b50806200074c84928716331462005c18565b6003850180546001600160a01b0319166001600160a01b038816179055845460ff1916600117855560018501546001600160a01b03168554909790620007e790889060081c6001600160a01b031692600560048a015499015490620007d3620007cb8d848d620007c360a25460018060a01b031690565b8096620051dc565b809362005c7d565b8c8162000904575b505050888285620051dc565b50604080516001600160a01b038a811682528916602082015290810187905291169283917f8f6a62b48692b31d8d8a14893dbfc67e0c466308c0a25c9ef4f7ddd533993d5590606090a4803b156200053f57604051630615077d60e41b8082526001600160a01b0395909516600482015260248101849052906000908290604490829084905af18015620008e757620008ed575b50803b156200053f576040519283526001600160a01b0390931660048301526024820152906000908290818381604481015b03925af18015620008e757620008c9575b6200001b6001606555565b80620008d9620008e09262002ff0565b8062000597565b38620008be565b62004def565b80620008d9620008fd9262002ff0565b386200087b565b609e546200091c93906001600160a01b031662006de9565b38808c620007db565b839195506200094e9060203d811162000956575b6200094581836200305a565b810190620059ad565b94906200073a565b503d62000939565b60609060031901126200053f57600435620009798162000544565b90602435620009888162000544565b9060443590565b346200053f57620009c7620009a4366200095e565b60405190630efe8bcb60e21b825281806020968793600483019190602083019252565b038160018060a01b038097165afa918215620008e757849262000a0f9260009162000a74575b50604051948580948193634bf78e2760e11b8352600483019190602083019252565b0392165afa908115620008e75762000a3c9260009262000a40575b50506040519081529081906020820190565b0390f35b62000a649250803d1062000a6c575b62000a5b81836200305a565b81019062005525565b388062000a2a565b503d62000a4f565b62000a8f9150843d861162000a6c5762000a5b81836200305a565b38620009ed565b60609060031901126200053f5760043562000ab18162000544565b906024359060443590565b346200053f5762000acd3662000a96565b9062000ad862004e6d565b6001600160a01b039283169062000af182151562005170565b600093828552609a6020526040852054161580159062000bf3575b62000b1790620051a6565b604051633a947e3560e11b815260048101829052602081602481865afa8015620008e757859462000b5392869262000bce575b50111562005577565b813b1562000bca57604051630b0a293f60e11b81523360048201819052602482019290925260448101919091526000606482015291908290818381608481015b03925af18015620008e75762000bb3575b5062000bb06001606555565b80f35b80620008d962000bc39262002ff0565b3862000ba4565b5050fd5b62000beb91925060203d811162000a6c5762000a5b81836200305a565b903862000b4a565b50609c6020526040842054151562000b0c565b346200053f576000604036600319011262000c95578060043562000c2a8162000544565b62000c3462004e6d565b6001600160a01b0316803b1562000c92578190604460405180948193630294a7a760e51b835260243560048401523360248401525af18015620008e75762000c80575b50600160655580f35b62000c8b9062002ff0565b3862000c77565b50fd5b80fd5b346200053f5762000ca93662000a96565b919062000cb8333b1562004ec4565b62000cc262004e6d565b62000ccf3315156200589b565b6000923384526020906099825260018060a01b039160409462000cf98487892054161515620058d1565b8381169562000d0a87151562005170565b868852609a83528481892054161580159062001090575b62000d2c90620051a6565b62000d3f64e8d4a5100087101562005907565b805163f2d9492f60e01b81526004810187905283816024818b5afa8015620008e75762000d78918a916200106e575b508510156200593e565b33600090815260996020526040902062000d9a905b546001600160a01b031690565b938585169662000dad8989141562005976565b825192633308f42d60e01b9788855286856004818d5afa948515620008e7578c956200104a575b5062000de48186163314620059c5565b609e5462000e099062000dfd906001600160a01b031681565b6001600160a01b031690565b82516370a0823160e01b81526001600160a01b0387166004820152999088908b9060249082905afa908115620008e75762000e9d8d938f62000e738962000e859f8f8f98908f918462000e6d918f9562000e95999162001028575b501015620059fc565b62005846565b9d8e60005260a1602052604060002090565b5460081c6001600160a01b031690565b161562005a35565b600484518094819382525afa958615620008e7577f1b88229ac738467a5b6ad4f608a992b440ec8757a7f6a0e987379e4d51e41f72988d92839862000fea575b5062000f83929162000f1262000f319262000fdc999a9b62000efe6200307c565b9586526001600160a01b0390911690850152565b6001600160a01b038916838601525b6001600160a01b03166060830152565b6001600160a01b03881660808201528360a08201528460c082015262000f5a60e0820160019052565b8c6101008201528c61012082015262000f7d8a60005260a1602052604060002090565b62005a86565b609e5462000fac9084906001600160a01b031660a25488906001600160a01b03165b9162006de9565b516001600160a01b0394851681529490931660208501526040840192909252606083019190915281906080820190565b0390a462000bb06001606555565b62000fdc9798509162000f1262000f31926200101a62000f8396958d803d1062000956576200094581836200305a565b9a9950925050919262000edd565b6200104391508d803d1062000a6c5762000a5b81836200305a565b3862000e64565b62001066919550873d891162000956576200094581836200305a565b933862000dd4565b620010899150853d871162000a6c5762000a5b81836200305a565b3862000d6e565b50609c835280882054151562000d21565b346200053f5760003660031901126200053f57602062ffffff60975460b81c16604051908152f35b62ffffff8116036200053f57565b801515036200053f57565b346200053f5760c03660031901126200053f57600435620011038162000544565b6044356200111181620010c9565b608435916200112083620010d7565b6200112a62004e6d565b6001600160a01b031690813b156200053f5760c462ffffff9160008094604051968795869463dcd330e560e01b8652602435600487015216602485015260643560448501521515606484015233608484015260a43560a48401525af18015620008e757620008c9576200001b6001606555565b346200053f5760203660031901126200053f57600435600052609b602052602060018060a01b038060406000205416600052609a825260406000205416604051908152f35b60809060031901126200053f57600435620011fd8162000544565b906024359060443590606435620012148162000544565b90565b346200053f57620012426200122c36620011e2565b926200123a92919262004e6d565b339062005309565b506001606555005b346200053f5760203660031901126200053f576004356200126b8162000544565b6200127562004a67565b803b156200129f5760a280546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b8152602060048201526008602482015267414b465f56494e4360c01b6044820152606490fd5b346200053f5760203660031901126200053f57600435620012f08162000544565b60018060a01b0316600052609c6020526020604060002054604051908152f35b346200053f5760003660031901126200053f57609d546040516001600160a01b039091168152602090f35b346200053f5760403660031901126200053f576200138d600435620013608162000544565b6200136a62004e6d565b6200137462004a67565b603354602435916001600160a01b039091169062006be3565b6001606555005b346200053f5760203660031901126200053f57600435620013b58162000544565b620013bf62004a67565b609d80546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760008060031936011262000c9557620013ff62004a67565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156200053f578235916001600160401b0383116200053f57602083818601950101116200053f57565b346200053f5760803660031901126200053f57602435600435620014978262000544565b6001600160401b03916044358381116200053f57620014bb90369060040162001443565b90916064358581116200053f57620014d890369060040162001443565b93620014e362004e6d565b609d546001600160a01b039490620014ff908616331462004d12565b6200150c87151562004d48565b6200153a856200153262000d8d8760018060a01b03166000526099602052604060002090565b161562004d7f565b620015626200155b62000dfd62000d8d8a600052609b602052604060002090565b1562004db7565b6040516101d5808201998a11828b1017620016b55762006ee4823980600099039089f0918215620008e7578589931696873b15620016b157620015bd90604051958694859463100b506960e11b865289306004880162004e3a565b038183885af18015620008e7576200169a575b506001600160a01b0381166000908152609960205260409020620016109084905b80546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b0383166000908152609a6020526040902062001635908290620015f1565b6200164f83620015f186600052609b602052604060002090565b6001600160a01b0383166000908152609c60205260409020849055167fc7e08e9d26d634e7a8c5a116d4312ad4ea4f5de2b728546828d8a3449ed8f6d48480a462000bb06001606555565b80620008d9620016aa9262002ff0565b38620015d0565b8380fd5b62002fda565b346200053f57620016cc366200095e565b90620016da33151562005170565b336000908152609a60205260409020546001600160a01b03908116158015906200172e575b6200170a90620051a6565b826200171257005b8060a2541680918316036200172357005b6200001b9362006de9565b50609c6020526040600020541515620016ff565b346200053f5760403660031901126200053f5760043560005260a66020526040600020602435600052602052602060ff604060002054166040519015158152f35b346200053f5762001242620017983662000a96565b90620017a362004e6d565b3392339062005309565b346200053f5760603660031901126200053f57600435620017ce81620010c9565b60443590620017dd82620010d7565b620017ea333b1562004ec4565b620017f462004e6d565b33600090815260996020526040812054909283916001600160a01b0316803b156200185957604051630a0c211160e11b815233600482015262ffffff909416602480860191909152356044850152901515606484015282908183816084810162000b93565b8280fd5b346200053f5760203660031901126200053f576200187a62004e6d565b6200188462004a67565b6033546200138d90600435906001600160a01b031662006e42565b346200053f5760203660031901126200053f57600435620018c08162000544565b620018ca62004a67565b803b15620018f457609e80546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b8152602060048201526008602482015267414b465f42494e4360c01b6044820152606490fd5b346200053f5760008060031936011262000c955780546200195f60ff8260081c16158092819362001a0a575b8115620019e7575b5062004b09565b8062001973600160ff196000541617600055565b620019cc575b6200198362004b6d565b6200198b5780f35b6200199c61ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a180f35b620019e161010061ff00196000541617600055565b62001979565b303b15915081620019fb575b503862001958565b6001915060ff161438620019f3565b600160ff821610915062001950565b346200053f5760203660031901126200053f5760043562001a3a81620010c9565b62001a4462004a67565b62001a59620f424062ffffff83161062004c56565b6097805462ffffff60b81b191660b89290921b62ffffff60b81b16919091179055005b60409060031901126200053f5760043562001a978162000544565b90602435620012148162000544565b346200053f5762001ab73662001a7c565b6001600160a01b0391821691823b156200053f576040516311bcf02b60e21b81529116600482015260009182908290602490829084905af18015620008e75762001aff575080f35b62000bb09062002ff0565b346200053f5760203660031901126200053f5760043562001b2b8162000544565b62001b3562004a67565b609780546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760a03660031901126200053f5760206200065f60243562001b7e8162000544565b608435906064359060443590600435620055ae565b346200053f5760803660031901126200053f5760443560243560043562001bba8362000544565b60643562001bca333b1562004ec4565b62001bd462004e6d565b62001be182151562005170565b600093828552602090609b825260018060a01b039260409062001c0b85838a205416151562005fc6565b62001c1887151562005170565b868852609b845262001c3185838a205416151562005fc6565b8483169462001c4286151562005170565b858952609a855282892054161580159062001fa5575b62001c6390620051a6565b62001ca262001c9b62001c948362001c858a60005260a6602052604060002090565b90600052602052604060002090565b5460ff1690565b1562006034565b62001ccd62001cc08262001c858960005260a6602052604060002090565b805460ff19166001179055565b62001ce78762001c858860005260a5602052604060002090565b9160018301549560028401549362001d00815460ff1690565b8062001f9b575b8062001f91575b62001d19906200606b565b82516331eb37bd60e11b8152600481018590529060a082602481865afa908115620008e75762001d86928d9262001f5a575b50815185908d9062001d66906001600160a01b031662000635565b14928362001f3f575b8362001f1a575b8362001f05575b5050506200611c565b62001dc162000d8d62001da762000d8d8b600052609b602052604060002090565b6001600160a01b03166000908152609a6020526040902090565b95825163284be21560e01b81528181600481865afa908115620008e75760049383918e9362001ee1575b508551635b31588360e01b815294859182905afa958615620008e7577f541cc56fb39c64a8c89a1436687f30dabc209b9b093ee3c592b82040c367dbeb9962001e9f9762001e7c958f9562001e65969262001ead575b5050609e5462001e5d906001600160a01b03168c30916200699b565b938a62006a90565b9562001e7387151562006154565b8681876200618c565b5193849384604091949392606082019560018060a01b0316825260208201520152565b0390a362000bb06001606555565b62001ed19250803d1062001ed9575b62001ec881836200305a565b81019062005cc2565b388062001e41565b503d62001ebc565b62001efd919350823d841162001ed95762001ec881836200305a565b913862001deb565b60039293500151910154111538848162001d7d565b9250608083015162001f2c816200556c565b62001f37816200556c565b159262001d76565b9250600162001f508b850151151590565b1515149262001d6f565b62001f8191925060a03d811162001f89575b62001f7881836200305a565b810190620060a2565b903862001d4b565b503d62001f6c565b5084151562001d0e565b5087151562001d07565b50609c845281882054151562001c58565b346200053f5760003660031901126200053f5760a2546040516001600160a01b039091168152602090f35b346200053f5760003660031901126200053f576033546040516001600160a01b039091168152602090f35b346200053f5760003660031901126200053f576098546040516001600160a01b039091168152602090f35b60809060031901126200053f57600435620020528162000544565b90602435620020618162000544565b906044359060643590565b346200053f576200207d3662002037565b9291906200208d333b1562004ec4565b6200209762004e6d565b6001600160a01b039280841692620020b184151562005170565b600095848752602091609a835260409087828a205416158015906200225b575b620020dc90620051a6565b87811697620020ed89151562005170565b888a52609a8552828a205416158015906200224a575b6200210e90620051a6565b6200211c888814156200637a565b8151630efe8bcb60e21b8152600481018790529484866024818b5afa958615620008e7576200216e9686918c9162002228575b50845180988192634bf78e2760e11b8352600483019190602083019252565b03818c5afa938415620008e7577fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460629662000fdc968c96620021ef575b5050620021da9291620021c4620021cf92871015620063b1565b883391339062005e5e565b833391339062006230565b51938452602084015233929081906040820190565b620021cf9296506200221b620021da95949282620021c493903d1062000a6c5762000a5b81836200305a565b96925081939450620021aa565b620022439150823d841162000a6c5762000a5b81836200305a565b386200214f565b50609c845281892054151562002103565b50609c8452818920541515620020d1565b346200053f5760603660031901126200053f576001600160401b036024358181116200053f57620022a290369060040162001443565b6044929192359182116200053f57602092620022c76200065f93369060040162001443565b92909160043562004cad565b346200053f576040806003193601126200053f578080606062000a3c9351620022fc8162003004565b600091818380935282602082015282858201520152600435815260a5602052818120602435825260205220906003815192620023388462003004565b60ff8154161515845260018101546020850152600281015483850152015460608301525191829182919091606080608083019480511515845260208101516020850152604081015160408501520151910152565b346200053f5760203660031901126200053f576020600435620023af8162000544565b60018060a01b038091166000526099825260406000205416604051908152f35b346200053f576200240a620023e4366200095e565b6040929192519063185fbc4160e31b825281806020968793600483019190602083019252565b038160018060a01b038097165afa918215620008e757849262000a0f9260009162002452575b50604051948580948193637a784e6760e01b8352600483019190602083019252565b6200246d9150843d861162000a6c5762000a5b81836200305a565b3862002430565b346200053f5760a03660031901126200053f576004356200249581620010c9565b60443590620024a482620010d7565b620024b1333b1562004ec4565b620024bb62004e6d565b336000908152609960205260409020620024d59062000d8d565b620024eb66038d7ea4c680006064350462006596565b9062ffffff83168062002554575b506001600160a01b0316803b156200053f5760405163459113fd60e01b815233600482015262ffffff9093166024808501919091523560448401529215156064830152608482015290600090829081838160a48101620008ad565b62002564620f4240918462006620565b6040516336c6b5db60e11b8152919004600482018190526020826024816001600160a01b0387165afa918215620008e757620025be92620025b491600091620025c5575b506084351015620063b1565b33903384620062da565b38620024f9565b620025e1915060203d811162000a6c5762000a5b81836200305a565b38620025a8565b346200053f5760203660031901126200053f57600435620026098162000544565b6200261362004a67565b609880546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760203660031901126200053f5760043562002658333b1562004ec4565b6200266262004e6d565b60009033825260a460205262002685816040842090600052602052604060002090565b8054620026b59060ff90620026a9600882901c6001600160a01b03163314620051a6565b16620006d481620039c5565b805460ff19166003178155600181015460a01c60ff1662002703575b5033907f34cf495316dbb07c8286e6c6b35542a47854aaf8050f2dd51ab0347b855582978380a362000bb06001606555565b609e546200273091906001600160a01b031660a2546004906001600160a01b031692015491339162006de9565b38620026d1565b346200053f57620027483662001a7c565b906200275362004e6d565b609d546001600160a01b03906200276e908216331462004d12565b620027a7816200279462000d8d8660018060a01b03166000526099602052604060002090565b1680159081156200284c575b5062004d7f565b811691823b156200053f5760405163033f2ed560e61b81526001600160a01b0382166004820152926000908490602490829084905af1908115620008e757620008be93620015f19262002835575b506001600160a01b0383166000908152609a602052604090206200281b908290620015f1565b6001600160a01b0316600090815260996020526040902090565b80620008d9620028459262002ff0565b38620027f5565b90508284161438620027a0565b346200053f576040806003193601126200053f5760048035916200287d8362000544565b602435926200288e333b1562004ec4565b6200289862004e6d565b620028a53315156200589b565b60009333855260206099815260018060a01b0392620028cb8486892054161515620058d1565b83811695620028dc87151562005170565b868852609a83528486892054161580159062002c6c575b620028fe90620051a6565b6200290b84151562005b72565b336000908152609960205260409020620029259062000d8d565b9385851696620029388989141562005976565b805163f2d9492f60e01b908181528681806200295f8882019064e8d4a51000602083019252565b03818d5afa908115620008e7578c9162002c4a575b508310158062002be6575b6200298b91506200593e565b805192633308f42d60e01b808552868583818d5afa948515620008e7578c9562002bc2575b50620029c08986163314620059c5565b609e54620029d99062000dfd906001600160a01b031681565b83516370a0823160e01b81526001600160a01b03871684820190815290929189918491908290819060200103915afa8015620008e7578562002a28918f948b959162002ba757501015620059fc565b62002a5362002a3986898c620057fc565b9a62000e9562000e858d60005260a1602052604060002090565b83519283918252818d5afa948515620008e7577f1b88229ac738467a5b6ad4f608a992b440ec8757a7f6a0e987379e4d51e41f72978c92839762002b69575b5062002b13929162002ab362002ac79262000fdc98999a62000efe6200307c565b6001600160a01b0388168386015262000f21565b6001600160a01b03871660808201528b60a08201528360c082015262002af060e0820160019052565b8b6101008201528b61012082015262000f7d8960005260a1602052604060002090565b609e5462002b3a9083906001600160a01b031660a25487906001600160a01b031662000fa5565b516001600160a01b03938416815293909216602084015260006040840152606083019190915281906080820190565b62000fdc9697509162002ab362002ac79262002b9962002b1396958c8d3d1062000956576200094581836200305a565b999850925050919262002a92565b620010439150853d871162000a6c5762000a5b81836200305a565b62002bde919550873d891162000956576200094581836200305a565b9338620029b0565b50815190815285818062002c058782019064e8d4a51000602083019252565b03818d5afa8015620008e7576200298b918c9162002c28575b508310156200297f565b62002c439150873d891162000a6c5762000a5b81836200305a565b3862002c1e565b62002c659150873d891162000a6c5762000a5b81836200305a565b3862002974565b50609c8352858820541515620028f3565b346200053f5760003660031901126200053f576097546040516001600160a01b039091168152602090f35b346200053f576020806003193601126200053f5760043562002ccc333b1562004ec4565b62002cd662004e6d565b62002ce33315156200589b565b600091338352609981527f39a770c63b28d70f6583dccc75052147017e4bdb315f7adc71d51f996d8da4e660018060a01b0360409062002d2a8183882054161515620058d1565b62002d3785151562005170565b848652609b845262002d50818388205416151562005fc6565b3386526099845281862054168552609c835260a581862054938487525284600262002d878684842090600052602052604060002090565b805460ff19168155600181018390550155516000808252602082018190526040820152426060820152806080810162001e9f565b60005b83811062002dcf5750506000910152565b818101518382015260200162002dbe565b9060209162002dfb8151809281855285808601910162002dbb565b601f01601f1916010190565b602080820190808352835180925260408301928160408460051b8301019501936000915b84831062002e3c5750505050505090565b909192939495848062002e5c600193603f198682030187528a5162002de0565b980193019301919493929062002e2b565b60203660031901126200053f57600480356001600160401b03918282116200053f57366023830112156200053f57818101359283116200053f57602490818301928236918660051b0101116200053f5762002ec88462006400565b9360005b81811062002ee4576040518062000a3c888262002e07565b60008062002ef483858962006478565b6040939162002f08855180938193620064c3565b0390305af49062002f18620064d1565b9182901562002f4f5750509062002f499162002f35828962006581565b5262002f42818862006581565b5062006452565b62002ecc565b8683879260448251106200053f578262002f8c938562002f76940151830101910162006506565b925162461bcd60e51b815292839283016200656e565b0390fd5b346200053f5760c03660031901126200053f5760206200065f60243562002fb78162000544565b60443562002fc58162000544565b60a435916084359160643591600435620055f5565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620016b557604052565b608081019081106001600160401b03821117620016b557604052565b61014081019081106001600160401b03821117620016b557604052565b61010081019081106001600160401b03821117620016b557604052565b90601f801991011681019081106001600160401b03821117620016b557604052565b604051906200308b8262003020565b565b6001600160401b038111620016b557601f01601f191660200190565b81601f820112156200053f57803590620030c3826200308d565b92620030d360405194856200305a565b828452602083830101116200053f57816000926020809301838601378301015290565b346200053f5760e03660031901126200053f576004356024356200311a8162000544565b60443590620031298262000544565b606435906084359060c43560a4356001600160401b0382116200053f576200315a62003224923690600401620030a9565b9062003168333b1562004ec4565b6200317262004e6d565b6200317f8615156200565c565b620031b7620031b1620031ad62001c948b62001c858960018060a01b031660005260a0602052604060002090565b1590565b62005692565b620031dd62001cc08962001c858760018060a01b031660005260a0602052604060002090565b6001600160a01b038716600090815260a76020526040902054948581148062003317575b6200320c9062004c56565b6200321a42831015620056c8565b8688868b620057dc565b50506040516370a0823160e01b81526001600160a01b03828116600483015285811695909291906020826024818a5afa918215620008e75786670de0b6b3a7640000620032b47f854f878df3d7ec53494040ed9be42b67dc6777ba5704d95ce469f1362930c8f698620032ad84620032e698620032bf97600091620032f4575b501015620056fe565b8362006620565b049285309162006de9565b620032cb818462006e42565b60405193849316958360209093929193604081019481520152565b0390a46200001b6001606555565b62003310915060203d811162000a6c5762000a5b81836200305a565b38620032a4565b5085151562003201565b346200053f5760403660031901126200053f57600435602435620033458162000544565b62003352333b1562004ec4565b6200335c62004e6d565b6001600160a01b038116600090815260a4602052604090206200338190839062001c85565b9182549160018060a01b03620033a860ff82841695620026a987858360081c1614620051a6565b620033ce62001cc08462001c858560018060a01b031660005260a4602052604060002090565b6001850154908116946003810154600460ff60028401549460a01c169201549382600014620034f557604051630f0acbd160e01b8152670de0b6b3a76400006004820152946020866024818c5afa908115620008e757620034638a9462003489937f7907d0bab36c44f1455bd336290d15ba6eeab66d9a59d0416b5fd857771df69999600091620034d2575b50111562005e26565b60a25462003482908490839089906001600160a01b0316809862005417565b9062005c7d565b9081620034b1575b5050505b60408051911515825260208201929092529081908101620032e6565b609e54620034c993906001600160a01b031662006de9565b38808062003491565b620034ee915060203d811162000a6c5762000a5b81836200305a565b386200345a565b604051630f0acbd160e01b8152670de0b6b3a764000060048201529194506020826024818b5afa918215620008e7577f7907d0bab36c44f1455bd336290d15ba6eeab66d9a59d0416b5fd857771df699956200356b93620035629260009162003571575b50101562005dee565b83818962005f21565b62003495565b6200358d915060203d811162000a6c5762000a5b81836200305a565b3862003559565b346200053f576020806003193601126200053f57620035b5333b1562004ec4565b620035bf62004e6d565b620035d660043560005260a1602052604060002090565b90620035e7620006c9835460ff1690565b620035fa620006ee600684015460ff1690565b6200360a60048301541562005c8b565b60028201546001600160a01b0316604051633308f42d60e01b8152916001600160a01b03828116918085600481865afa948515620008e75760009562003955575b506200365b828616331462005c18565b6003860180546001600160a01b0319166001600160a01b038716179055855460ff1916600117865560018601546001600160a01b0316865490969060081c6001600160a01b0316916005820154956040519663284be21560e01b9182895283896004818a8a165afa988915620008e75760009962003931575b50604051635b31588360e01b8082529985826004818b8d165afa918215620008e7576200370f9285928a926000926200390d575b506200666d565b9460405193845284846004818c5afa938415620008e757600094620038e9575b50604051998a52848a6004818c5afa938415620008e75783838d96620037689360089e620037c09a600093620038c5575b50506200666d565b99818760078d940155015584151580620038bb575b620037889062005cda565b620037ac620037a58c848c620007c360a25460018060a01b031690565b8362005c7d565b8b816200389a575b505050838286620051dc565b50604080516001600160a01b0389811682528816602082015290810182905260608101869052849084841690600435907fbf7251dfdcdaa7bf1bd728412bab243e14ae75865dd5516648e1c8a51ad2d72190608090a48282163b156200053f57604051630615077d60e41b8082526001600160a01b03979097166004820152602481019190915291600091839160449183918591165af18015620008e757620008ed5750803b156200053f576040519283526001600160a01b039093166004830152602482015290600090829081838160448101620008ad565b609e54620038b293906001600160a01b031662006de9565b38808b620037b4565b508815156200377d565b620038e0929350803d1062001ed95762001ec881836200305a565b90388062003760565b62003905919450853d871162001ed95762001ec881836200305a565b92386200372f565b62003929919250893d8b1162001ed95762001ec881836200305a565b903862003708565b6200394d919950843d861162001ed95762001ec881836200305a565b9738620036d4565b81620039719296503d871162000956576200094581836200305a565b93386200364b565b346200053f5760203660031901126200053f57600435600052609b602052602060018060a01b0360406000205416604051908152f35b634e487b7160e01b600052602160045260246000fd5b60041115620039d057565b620039af565b90620039e282620039c5565b52565b919091610140810192620039fb828251620039d6565b6020818101516001600160a01b0316908301526040818101516001600160a01b0316908301526060818101516001600160a01b0316908301526080818101516001600160a01b03169083015260a081015160a083015260c081015160c083015262003a6f60e082015160e084019015159052565b610100808201519083015261012080910151910152565b346200053f5760203660031901126200053f5762000a3c60405162003aab8162003020565b6000908181528160208201528160408201528160608201528160808201528160a08201528160c08201528160e0820152600860406101009380858501528061012080950152600435815260a16020522062003b056200307c565b9362003b2d825462003b1b60ff82168862005890565b841c6001600160a01b03166020870152565b60018201546001600160a01b0316604086015260028201546001600160a01b0316606086015260038201546001600160a01b03166080860152600482015460a0860152600582015460c086015262003b9662003b8d600684015460ff1690565b151560e0870152565b60078201549085015201549082015260405191829182620039e5565b346200053f5760403660031901126200053f5760043562003bd38162000544565b62003bdd62004a67565b6001600160a01b0316600090815260a7602052604090206024359055005b346200053f5762003c0c36620011e2565b62003c1662004e6d565b6001600160a01b0393841662003c2e81151562005170565b600094818652609a6020526040862054161580159062003cd8575b62003c5490620051a6565b604051633a947e3560e11b815260048101859052602081602481855afa8015620008e757869462003c8f92869262000bce5750111562005577565b803b156200185957604051630b0a293f60e11b815233600482015260248101949094526001600160a01b0390911660448401526000606484015282908183816084810162000b93565b50609c6020526040852054151562003c49565b346200053f5760803660031901126200053f576001600160401b036004356024358281116200053f5762003d2490369060040162001443565b6044358481116200053f5762003d3f90369060040162001443565b9290916064358681116200053f5762003d5d903690600401620030a9565b9162003d6b333b1562004ec4565b62003d7562004e6d565b62003db260018060a01b039362003da78562003d9f62000d8d8b600052609b602052604060002090565b161562004db7565b868685858b62004efb565b50506040516101d5808201988911828a1017620016b55762006ee4823980600098039088f0928315620008e75787931694853b15620016b15762003e0d90604051958694859463100b506960e11b8652306004870162004dfb565b038183865af18015620008e75762003e86575b5062003e3b81620015f184600052609b602052604060002090565b6001600160a01b0381166000908152609c60205260409020829055827f0fda88fcc31b35d80e62f303bc442eecd55f84ad381eef53826fd5bc48e5b7fe8180a462000bb06001606555565b80620008d962003e969262002ff0565b3862003e20565b9060c06003198301126200053f576004359160243562003ebd8162000544565b9160443591606435916084359160a435906001600160401b0382116200053f576200121491600401620030a9565b346200053f5762003fb762003f003662003e9d565b9062003f14969294939596333b1562004ec4565b62003f1e62004e6d565b8515158062004056575b62003f33906200565c565b62003f61620031b1620031ad62001c948a62001c858960018060a01b031660005260a0602052604060002090565b62003f8762001cc08862001c858760018060a01b031660005260a0602052604060002090565b609f5494858114806200404c575b62003fa09062004c56565b62003fae42831015620056c8565b8685896200576b565b5050609e546040516370a0823160e01b81526001600160a01b03838116600483015292918316602082602481845afa918215620008e75786670de0b6b3a7640000620032b47f05c966387bde83883f64200b4d9f73042dd5dbe77e737d0e39db4f391b54bb1f98620032ad846200403e98620032bf97600091620032f457501015620056fe565b0390a36200001b6001606555565b5085151562003f95565b50652d79883d200086111562003f28565b346200053f576020806003193601126200053f576004356200408b333b1562004ec4565b6200409562004e6d565b620040aa8160005260a1602052604060002090565b8054620040bf60ff8216620006d481620039c5565b620040d2620006ee600684015460ff1690565b60028201546001600160a01b0390811694909190620040f386151562005d80565b60405190633308f42d60e01b9384835281836004818b5afa928315620008e757600093620041fb575b5082936200412f82849516331462005db7565b60081c16936200414185151562005d12565b60046040518096819382525afa938415620008e7577fd3bb236a8c097c79eea15f66e43bf3984e6672bd5d434c74b4cb6b70c834508b946200403e94620041bf93600092620041d9575b5050815460ff19166003178255609e546001600160a01b03165b60a254600590930154926001600160a01b03169062006de9565b6040516001600160a01b0390911681529081906020820190565b620041f39250803d1062000956576200094581836200305a565b38806200418b565b8293506200421890833d851162000956576200094581836200305a565b926200411c565b346200053f5760203660031901126200053f576004356200424081620010c9565b6200424a62004a67565b6200425f620f424062ffffff83161062004c56565b6097805462ffffff60a01b191660a09290921b62ffffff60a01b16919091179055005b346200053f5760206200065f620042993662002037565b9291909162005846565b346200053f5762004372620042b83662003e9d565b91620042ca96939596333b1562004ec4565b620042d462004e6d565b851515806200444a575b620042e9906200565c565b62004317620031b1620031ad62001c948a62001c858a60018060a01b031660005260a0602052604060002090565b6200433d62001cc08862001c858860018060a01b031660005260a0602052604060002090565b6807dc477bc1cfa4000081148062004441575b6200435b9062004c56565b6200436942831015620056c8565b8585886200576b565b50506040516370a0823160e01b81526001600160a01b0382166004820152906020826024817343bda480de297a14cec95bfb1c6a313615f809ef5afa8015620008e75783620043ee917fd9b0c173394b95890274aa419defd8002b3d13721a7ad44282b4099abd7223a794600091620032f457501015620056fe565b670de0b6b3a7640000620044028462006601565b04906200441184308362006cdb565b6200441d828262006e42565b6040805194855260208501929092526001600160a01b03169290819081016200403e565b50600162004350565b506603328b944c4000861115620042de565b346200053f5760c03660031901126200053f57602435600435620044808262000544565b604435906200448f82620010d7565b7f43b998e47453d980655a7f5405259ce1526efb62b8777e639f7ad6dee421c3cb6064359360843590620032e660a435620044cc333b1562004ec4565b620044d662004e6d565b33600090815260a460205260409020620044f290879062001c85565b80546001600160a01b0395918991620045849190620045179060081c891615620051a6565b8b151580620045e1575b6200452c9062004c56565b805460018201805460ff60a01b86151560a01b166001600160a81b03199182166001600160a01b038c161717909155600283018e9055600383018690556004830187905516610100600160a81b033360081b16179055565b620045b3575b604051948594169833988590949392606092608083019615158352602083015260408201520152565b609e54620045db9083906001600160a01b031660a2546001600160a01b031690339062006de9565b6200458a565b5084151562004521565b346200053f5760203660031901126200053f576004356200460e333b1562004ec4565b6200461862004e6d565b6200462d8160005260a1602052604060002090565b908154916200464460ff8416620006d481620039c5565b62004657620006ee600683015460ff1690565b60018060a01b03809360081c16926200467284151562005d12565b604051633308f42d60e01b815290602082600481885afa8015620008e7577f0240ef67b9a39238db2f92fc057c26bce3d089137a6fbf3c728f4c6078258ddf936200403e93600092620046f4575b50620046d58293620041bf9316331462005d49565b805460ff19166002178155609e5483906001600160a01b0316620041a5565b620041bf925062004719620046d59160203d811162000956576200094581836200305a565b9250620046c0565b346200053f5760803660031901126200053f5762001242606435620047468162000544565b6200475062004e6d565b6004356000908152609b6020526040902054604435906024359033906001600160a01b031662005309565b346200053f5760003660031901126200053f576020609f54604051908152f35b346200053f5760603660031901126200053f57602435600435604435620047c4333b1562004ec4565b620047ce62004e6d565b620047db3315156200589b565b7f39a770c63b28d70f6583dccc75052147017e4bdb315f7adc71d51f996d8da4e660009333855260996020526200484860018060a01b0362004825816040892054161515620058d1565b6200483286151562005170565b858752609b602052604087205416151562005fc6565b683782dace9d9000000081111580620048fd575b620048679062004c56565b338552609960209081526040808720546001600160a01b03166000908152609c909252902054926200489c8585141562005ffd565b620048b68562001c858660005260a5602052604060002090565b805460ff1916600117815582600182015581600282015560034291015562001e9f604051928392429184606091949392608082019560018352602083015260408201520152565b50678ac7230489e800008311156200485c565b346200053f5760003660031901126200053f57609e546040516001600160a01b039091168152602090f35b346200053f576200494c366200095e565b906200495a33151562005170565b336000908152609a60205260409020546001600160a01b039190821615801590620049b9575b6200498b90620051a6565b826200499357005b60a2548216918116308103620049b05750506200001b9262006be3565b82036200172357005b50609c602052604060002054151562004980565b346200053f5760203660031901126200053f57600435620049ee8162000544565b620049f862004a67565b6001600160a01b0381161562004a13576200001b9062004ac0565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b6033546001600160a01b0316330362004a7c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b1562004b1157565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b62004b8b60ff60005460081c1662004b858162004bf5565b62004bf5565b62004b963362004ac0565b62004bae60ff60005460081c1662004b858162004bf5565b60016065556bffffffffffffffffffffffff60a01b33816098541617609855640c35000c3560a41b65ffffffffffff60a01b1960975416176097553390609d541617609d55565b1562004bfd57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b1562004c5e57565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa12960d11b6044820152606490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b939162004cff62004d0c9394929462004cea6040519687946020860199308b52466040880152606087015260a0608087015260c086019162004c8c565b90601f1994858584030160a086015262004c8c565b039081018352826200305a565b51902090565b1562004d1a57565b60405162461bcd60e51b8152602060048201526006602482015265414b465f4e4160d01b6044820152606490fd5b1562004d5057565b60405162461bcd60e51b815260206004820152600760248201526620a5a32faa2d2b60c91b6044820152606490fd5b1562004d8757565b60405162461bcd60e51b8152602060048201526008602482015267414b465f504e5a4160c01b6044820152606490fd5b1562004dbf57565b60405162461bcd60e51b8152602060048201526008602482015267414b465f544e5a4160c01b6044820152606490fd5b6040513d6000823e3d90fd5b939162001214959362004e2b9260018060a01b031686526000602087015260806040870152608086019162004c8c565b92606081850391015262004c8c565b9492909362001214969462004e2b9360018060a01b03809216885216602087015260806040870152608086019162004c8c565b60026065541462004e7f576002606555565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b1562004ecc57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f43494360c81b6044820152606490fd5b9262004f159262004f59959262004f509598979862004cad565b9362004f4a857f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b620050b0565b91909162004f84565b609d5462004f75906001600160a01b0383811691161462004d12565b9190565b60051115620039d057565b62004f8f8162004f79565b8062004f985750565b62004fa38162004f79565b6001810362004ff15760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b62004ffc8162004f79565b600281036200504a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b806200505860039262004f79565b146200506057565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b906041815114600014620050e157620050dd916020820151906060604084015193015160001a90620050eb565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311620051645791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15620008e75781516001600160a01b038116156200515e579190565b50600190565b50505050600090600390565b156200517857565b60405162461bcd60e51b815260206004820152600660248201526520a5a32faa2d60d11b6044820152606490fd5b15620051ae57565b60405162461bcd60e51b81526020600482015260066024820152651052d197d09560d21b6044820152606490fd5b9094936001600160a01b03929091831690620051fa82151562005170565b600093828552609a60205260408520541615801590620052f6575b6200522090620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620052cc575b50856200525d91101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b039788166004820152602481019190915295909116604486015260016064860152929391928290818381608481015b03925af18015620008e757620052bc575090565b80620008d9620012149262002ff0565b6200525d919650620052ee9060203d811162000a6c5762000a5b81836200305a565b95906200524e565b50609c6020526040842054151562005215565b9094936001600160a01b039290918316906200532782151562005170565b600093828552609a6020526040852054161580159062005404575b6200534d90620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620053da575b50856200538a91101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b03978816600482015260248101919091529590911660448601526000606486015292939192829081838160848101620052a8565b6200538a919650620053fc9060203d811162000a6c5762000a5b81836200305a565b95906200537b565b50609c6020526040842054151562005342565b9094936001600160a01b039290918316906200543582151562005170565b600093828552609a6020526040852054161580159062005512575b6200545b90620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620054e8575b50856200549891101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b03978816600482015260248101919091529590911660448601526002606486015292939192829081838160848101620052a8565b620054989196506200550a9060203d811162000a6c5762000a5b81836200305a565b959062005489565b50609c6020526040842054151562005450565b908160209103126200053f575190565b156200553d57565b60405162461bcd60e51b81526020600482015260076024820152660414b465f4242560cc1b6044820152606490fd5b60061115620039d057565b156200557f57565b60405162461bcd60e51b81526020600482015260076024820152660414b465f4253560cc1b6044820152606490fd5b9391929092604051936020850195308752466040870152606086015260018060a01b0316608085015260a084015260c083015260e082015260e0815262004d0c816200303d565b949290939193604051946020860196308852466040880152606087015260018060a01b0380921660808701521660a085015260c084015260e08301526101009081830152815261012081018181106001600160401b03821117620016b55760405251902090565b156200566457565b60405162461bcd60e51b8152602060048201526006602482015265414b465f494160d01b6044820152606490fd5b156200569a57565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa12760d11b6044820152606490fd5b15620056d057565b60405162461bcd60e51b81526020600482015260066024820152651052d197d09160d21b6044820152606490fd5b156200570657565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4a12160c91b6044820152606490fd5b156200573d57565b60405162461bcd60e51b81526020600482015260066024820152651052d197d39560d21b6044820152606490fd5b620057c89462004f75948394620057bf946200578a949a999a620055ae565b9562004f4a877f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b93909362004f84565b6001600160a01b0383811691161462005735565b9462004f75948294620057bf946200578a94620057c8999b9a9b620055f5565b909160405191602083019330855246604085015260018060a01b038092166060850152166080830152600060a083015260c08201524360e082015260e0815262004d0c816200303d565b9192909260405192602084019430865246604086015260018060a01b03809216606086015216608084015260a083015260c08201524360e082015260e0815262004d0c816200303d565b620039e282620039c5565b15620058a357565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa82d60d11b6044820152606490fd5b15620058d957565b60405162461bcd60e51b81526020600482015260066024820152650414b465f42560d41b6044820152606490fd5b156200590f57565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa0a72b60c91b6044820152606490fd5b156200594657565b60405162461bcd60e51b8152602060048201526008602482015267414b465f4242504d60c01b6044820152606490fd5b156200597e57565b60405162461bcd60e51b81526020600482015260076024820152661052d197d3915560ca1b6044820152606490fd5b908160209103126200053f5751620012148162000544565b15620059cd57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e4f4160c81b6044820152606490fd5b1562005a0457565b60405162461bcd60e51b815260206004820152600960248201526820a5a32fa7a0a722a160b91b6044820152606490fd5b1562005a3d57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f424f4960c81b6044820152606490fd5b9062005a7881620039c5565b60ff80198354169116179055565b9061012060089162005aa5815162005a9e81620039c5565b8562005a6c565b602081015162005ada906001600160a01b03168554610100600160a81b03191660089190911b610100600160a81b0316178555565b60408101516001850180546001600160a01b039283166001600160a01b0319918216179091556060830151600287018054918416918316919091179055608083015160038701805491909316911617905560a0810151600485015560c0810151600585015560e081015162005b60901515600686019060ff801983541691151516179055565b61010081015160078501550151910155565b1562005b7a57565b60405162461bcd60e51b815260206004820152600860248201526720a5a32fa128272d60c11b6044820152606490fd5b1562005bb257565b60405162461bcd60e51b8152602060048201526007602482015266414b465f424f5360c81b6044820152606490fd5b1562005be957565b60405162461bcd60e51b81526020600482015260076024820152661052d197d3d39360ca1b6044820152606490fd5b1562005c2057565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa727a160c91b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b620f423f1981019190821162005c7757565b62005c4f565b9190820391821162005c7757565b1562005c9357565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa7a72960c91b6044820152606490fd5b908160209103126200053f57516200121481620010c9565b1562005ce257565b60405162461bcd60e51b8152602060048201526008602482015267414b465f42414e4d60c01b6044820152606490fd5b1562005d1a57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f49544160c81b6044820152606490fd5b1562005d5157565b60405162461bcd60e51b8152602060048201526007602482015266414b465f494f4160c81b6044820152606490fd5b1562005d8857565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4aa2160c91b6044820152606490fd5b1562005dbf57565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4a7a160c91b6044820152606490fd5b1562005df657565b60405162461bcd60e51b81526020600482015260086024820152670414b465f425453560c41b6044820152606490fd5b1562005e2e57565b60405162461bcd60e51b81526020600482015260086024820152670414b465f425442560c41b6044820152606490fd5b9093926001600160a01b0392909183169062005e7c82151562005170565b600093828552609a6020526040852054161580159062005f0e575b62005ea290620051a6565b813b15620016b157604051630b0a293f60e11b81526001600160a01b039687166004808301919091526024820192909252929095166044830152606482019490945291928290818381608481015b03925af18015620008e75762005f035750565b6200308b9062002ff0565b50609c6020526040842054151562005e97565b9093926001600160a01b0392909183169062005f3f82151562005170565b600093828552609a6020526040852054161580159062005fb3575b62005f6590620051a6565b813b15620016b157604051630b0a293f60e11b81526001600160a01b039687166004820152602481019190915291909416604482015260026064820152919282908183816084810162005ef0565b50609c6020526040842054151562005f5a565b1562005fce57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f42544960c81b6044820152606490fd5b156200600557565b60405162461bcd60e51b8152602060048201526007602482015266414b465f53544960c81b6044820152606490fd5b156200603c57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f43544560c81b6044820152606490fd5b156200607357565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e435760c81b6044820152606490fd5b908160a09103126200053f576040519060a08201908282106001600160401b03831117620016b5576080916040528051620060dd8162000544565b83526020810151620060ef81620010d7565b60208401526040810151604084015260608101516060840152015160068110156200053f57608082015290565b156200612457565b60405162461bcd60e51b8152602060048201526008602482015267414b465f4e4d544f60c01b6044820152606490fd5b156200615c57565b60405162461bcd60e51b815260206004820152600860248201526720a5a32fa0a124ad60c11b6044820152606490fd5b9192916001600160a01b0391908216620061a881151562005170565b600093818552609a60205283604086205416158015906200621d575b620061cf90620051a6565b813b156200621957608492918486926040519889978896630f08f3ff60e11b88521660048701526024860152166044840152600360648401525af18015620008e75762005f035750565b8480fd5b50609c60205260408520541515620061c4565b9093926001600160a01b039290918316906200624e82151562005170565b600093828552609a60205260408520541615801590620062c7575b6200627490620051a6565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b0396871660048083019190915260248201929092529290951660448301526064820194909452919282908183816084810162005ef0565b50609c6020526040842054151562006269565b9192916001600160a01b0391908216620062f681151562005170565b600093818552609a602052836040862054161580159062006367575b6200631d90620051a6565b813b156200621957608492918486926040519889978896630f08f3ff60e11b88521660048701526024860152166044840152600560648401525af18015620008e75762005f035750565b50609c6020526040852054151562006312565b156200638257565b60405162461bcd60e51b81526020600482015260076024820152661052d197d394d560ca1b6044820152606490fd5b15620063b957565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e4d4f60c81b6044820152606490fd5b6001600160401b038111620016b55760051b60200190565b906200640c82620063e8565b6200641b60405191826200305a565b82815280926200642e601f1991620063e8565b019060005b8281106200644057505050565b80606060208093850101520162006433565b600019811462005c775760010190565b634e487b7160e01b600052603260045260246000fd5b9190811015620064bd5760051b81013590601e19813603018212156200053f5701908135916001600160401b0383116200053f5760200182360381136200053f579190565b62006462565b908092918237016000815290565b3d1562006501573d90620064e5826200308d565b91620064f560405193846200305a565b82523d6000602084013e565b606090565b6020818303126200053f578051906001600160401b0382116200053f570181601f820112156200053f5780516200653d816200308d565b926200654d60405194856200305a565b818452602082840101116200053f5762001214916020808501910162002dbb565b9060206200121492818152019062002de0565b8051821015620064bd5760209160051b010190565b9066038d7ea4c680009182810292818404149015171562005c7757565b600181901b91906001600160ff1b0381160362005c7757565b90670de0b6b3a76400009182810292818404149015171562005c7757565b90600a820291808304600a149015171562005c7757565b906807dc477bc1cfa400009182810292818404149015171562005c7757565b8181029291811591840414171562005c7757565b80156200664857670de0b6b3a76400000490565b634e487b7160e01b600052601260045260246000fd5b604d811162005c7757600a0a90565b6040516318160ddd60e01b815290939092602090849060049082906001600160a01b03165afa928315620008e7576000936200671c575b5060009384935b60068510620066bc57505050505090565b620066d3620066cd8697966200665e565b62006634565b945b83620066ef620066e6888462006772565b848887620068dd565b11620067075785620067019162006772565b620066d5565b956200671591955062006452565b93620066ab565b6200673991935060203d811162000a6c5762000a5b81836200305a565b9138620066a4565b906001820180921162005c7757565b90620f4240820180921162005c7757565b90620186a0820180921162005c7757565b9190820180921162005c7757565b909164e8d4a510009004620f4240928382101580620068d4575b15620068a7576200121493620068996200687b62006875620068676200685e6200685888620068526200680f620068166200680f620067e985620068a19f620067e39062005c65565b62006620565b6200680862006802620067fc8862005c65565b620065b3565b62006750565b9062006620565b6006900490565b926200680862006802620067fc6200683a6200684b620068406200683a8762005c65565b62006761565b620068088762006761565b9462005c65565b62005c7d565b620065cc565b62040740900490565b670de0b6b3a7640000900490565b62006741565b94826200688f62ffffff8093168862006620565b0493168562006620565b049262006772565b62006772565b60405162461bcd60e51b815260206004820152600560248201526404e4d5f49560dc1b6044820152606490fd5b5060016200679a565b64e8d4a51000938490049390920490620f424080831015806200698f575b15620068a757620068996200687b62006875620068676200685e62006858620012149a620068526200680f8b6200680862006802620067fc620068a19f6200680f6200695082620067e3620069639462005c65565b6200680862006802620067fc8962005c65565b96620068a1620069886200697c83620068a18962005c65565b62006808848962006772565b9562005c65565b506001851015620068fb565b6040516370a0823160e01b81526001600160a01b0383811660048301526020949216918482602481865afa928315620008e75762006a1394869360009562006a59575b50604051636eb1769f60e11b81526001600160a01b039182166004820152921660248301529093849190829081906044820190565b03915afa918215620008e757620012149360009362006a35575b505062006a7d565b62006a50929350803d1062000a6c5762000a5b81836200305a565b90388062006a2d565b62006a75919550843d861162000a6c5762000a5b81836200305a565b9338620069de565b908082101562006a8b575090565b905090565b6040516318160ddd60e01b815295929493929190602090879060049082906001600160a01b03165afa958615620008e75760009662006ba6575b5060009586955b600687111562006ae5575050505050505090565b9091929394959762006afb620066cd8a6200665e565b975b8762006b2b62006b2562006b1d62006b168d8662006772565b8862006772565b868962006780565b620065ea565b11801562006b91575b801562006b6f575b62006b53578862006b4d9162006772565b62006afd565b97509762006b68909695949392919662006452565b9562006ad1565b508562006b8a62006b818b8462006772565b868689620068dd565b1162006b3c565b508662006b9f8a8362006772565b1162006b34565b62006bc391965060203d811162000a6c5762000a5b81836200305a565b943862006aca565b908160209103126200053f57516200121481620010d7565b60405163a9059cbb60e01b602082019081526001600160a01b0390931660248201526044810193909352600092839290839062006c2e81606481015b03601f1981018352826200305a565b51925af162006c3c620064d1565b8162006ca7575b501562006c4c57565b60405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b6064820152608490fd5b805180159250821562006cbe575b50503862006c43565b62006cd3925060208091830101910162006bcb565b388062006cb5565b6040516323b872dd60e01b602082019081526001600160a01b0392831660248301529190921660448301526064820192909252600091829162006d22816084810162006c1f565b5190827343bda480de297a14cec95bfb1c6a313615f809ef5af162006d46620064d1565b8162006db5575b501562006d5657565b60405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604482015270185b9cd9995c919c9bdb4819985a5b1959607a1b6064820152608490fd5b805180159250821562006dcc575b50503862006d4d565b62006de1925060208091830101910162006bcb565b388062006dc3565b6040516323b872dd60e01b602082019081526001600160a01b039384166024830152939092166044830152606482019390935260009283929091839062006e34816084810162006c1f565b51925af162006d46620064d1565b60405160208101908082106001600160401b03831117620016b5576000938493848094938194604052525af162006e78620064d1565b501562006e8157565b60405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527308115512081d1c985b9cd9995c8819985a5b195960621b6064820152608490fdfe60a0806040523461002857336080526101a7908161002e823960805181818160410152608b0152f35b600080fdfe60806040526004361015610018575b3661007657610076565b6000803560e01c63c45a01551461002f575061000e565b346100735780600319360112610073577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b80fd5b60405163a8b8a55d60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610122576000916100ca575b5061012e565b60203d811161011b575b601f8101601f1916820167ffffffffffffffff81118382101761010757610101935060405281019061014d565b386100c4565b634e487b7160e01b84526041600452602484fd5b503d6100d4565b6040513d6000823e3d90fd5b6000808092368280378136915af43d82803e15610149573d90f35b3d90fd5b9081602091031261016c57516001600160a01b038116810361016c5790565b600080fdfea26469706673582212202144b141b34a6ae867daf0fa9374097fc97aacff3e58749d364914bfcd8836e664736f6c63430008130033a264697066735822122087371adabab4d014cf07d35c017722c92c14ef7bccaa4e13b86c3a4b5b35b15964736f6c63430008130033
Deployed ByteCode
0x608060405260043610156200001d575b36156200001b57600080fd5b005b60003560e01c806309c7a25c146200051a5780631499274b1462000514578063284be215146200050e5780632b806fba14620005085780633908b9ae14620005025780633a99d04014620004fc5780633ce9853614620004f65780633f56699414620004f05780634ac69cd214620004ea57806357ed199a14620004e45780635b31588314620004de5780635bafc51114620004d857806363ce122a14620004d25780636645442114620004cc5780636817031b14620004c65780636e5bf35e14620004c05780636e9960c314620004ba5780636f056b9914620004b4578063704b6c0214620004ae578063715018a614620004a85780637150238214620004a25780637187f90f146200049c57806373538561146200049657806374567f0f146200049057806376c3b9fe146200048a5780637aabab0714620004845780637cf4626b146200047e5780638129fc1c1462000478578063826db8ac14620004725780638ab65686146200046c5780638b3aaecd14620004665780638b71c3cf14620004605780638c5dc1f6146200045a5780638d928af814620004545780638da5cb5b146200044e5780638db462fc14620004485780638e18cdfc14620004425780639020597a146200043c57806395c68fe9146200043657806396910b91146200043057806398464bca146200042a578063990ec18a1462000424578063a10786b0146200041e578063a43aa2361462000418578063a4bf9d061462000412578063a541daf6146200040c578063a8b8a55d1462000406578063aa0aebc81462000400578063ac9650d814620003fa578063ae4cd03514620003f4578063af7e1ff414620003ee578063b479b15e14620003e8578063b8a946e614620003e2578063bab1fbaa14620003dc578063c326dfb414620003d6578063c9fe49b414620003d0578063cce05ddf14620003ca578063cdb1e3ca14620003c4578063ced7a53914620003be578063d021a6e714620003b8578063d1ce35e314620003b2578063d39869f214620003ac578063d49ebf9814620003a6578063d590be2f14620003a0578063da6c8549146200039a578063dd0bcbe31462000394578063dd22db80146200038e578063e5f600be1462000388578063e62854c71462000382578063eeaf2b7d146200037c5763f2fde38b036200000f57620049cd565b6200493b565b62004910565b6200479b565b6200477b565b62004721565b620045eb565b6200445c565b620042a3565b62004282565b6200421f565b62004067565b62003eeb565b62003ceb565b62003bfb565b62003bb2565b62003a86565b62003979565b62003594565b62003321565b620030f6565b62002f90565b62002e6d565b62002ca8565b62002c7d565b62002859565b62002737565b62002635565b620025e8565b62002474565b620023cf565b6200238c565b620022d3565b6200226c565b6200206c565b6200200c565b62001fe1565b62001fb6565b62001b93565b62001b57565b62001b0a565b62001aa6565b62001a19565b62001924565b6200189f565b6200185d565b620017ad565b62001783565b62001742565b620016bb565b62001473565b620013e1565b62001394565b6200133b565b62001310565b620012cf565b6200124a565b62001217565b6200119d565b620010e2565b620010a1565b62000c98565b62000c06565b62000abc565b6200098f565b62000667565b6200060e565b620005cb565b620005a3565b62000556565b346200053f5760203660031901126200053f576200053762004a67565b600435609f55005b600080fd5b6001600160a01b038116036200053f57565b346200053f5760203660031901126200053f57600435620005778162000544565b60018060a01b031660005260a76020526020604060002054604051908152f35b60009103126200053f57565b346200053f5760003660031901126200053f57602062ffffff60975460a01c16604051908152f35b346200053f5760203660031901126200053f576020600435620005ee8162000544565b60018060a01b03809116600052609a825260406000205416604051908152f35b346200053f5760203660031901126200053f5760206200065f600435620006358162000544565b60018060a01b03809116600052609960205260406000205416600052609c60205260406000205490565b604051908152f35b346200053f5760403660031901126200053f576004356200068a333b1562004ec4565b6200069462004e6d565b620006a3602435151562005b72565b620006b88160005260a1602052604060002090565b90620006db620006c9835460ff1690565b620006d481620039c5565b1562005baa565b620006f4620006ee600684015460ff1690565b62005be1565b60028201546001600160a01b0316604051633308f42d60e01b8152909290916001600160a01b038085169190602085600481865afa948515620008e75760009562000925575b50806200074c84928716331462005c18565b6003850180546001600160a01b0319166001600160a01b038816179055845460ff1916600117855560018501546001600160a01b03168554909790620007e790889060081c6001600160a01b031692600560048a015499015490620007d3620007cb8d848d620007c360a25460018060a01b031690565b8096620051dc565b809362005c7d565b8c8162000904575b505050888285620051dc565b50604080516001600160a01b038a811682528916602082015290810187905291169283917f8f6a62b48692b31d8d8a14893dbfc67e0c466308c0a25c9ef4f7ddd533993d5590606090a4803b156200053f57604051630615077d60e41b8082526001600160a01b0395909516600482015260248101849052906000908290604490829084905af18015620008e757620008ed575b50803b156200053f576040519283526001600160a01b0390931660048301526024820152906000908290818381604481015b03925af18015620008e757620008c9575b6200001b6001606555565b80620008d9620008e09262002ff0565b8062000597565b38620008be565b62004def565b80620008d9620008fd9262002ff0565b386200087b565b609e546200091c93906001600160a01b031662006de9565b38808c620007db565b839195506200094e9060203d811162000956575b6200094581836200305a565b810190620059ad565b94906200073a565b503d62000939565b60609060031901126200053f57600435620009798162000544565b90602435620009888162000544565b9060443590565b346200053f57620009c7620009a4366200095e565b60405190630efe8bcb60e21b825281806020968793600483019190602083019252565b038160018060a01b038097165afa918215620008e757849262000a0f9260009162000a74575b50604051948580948193634bf78e2760e11b8352600483019190602083019252565b0392165afa908115620008e75762000a3c9260009262000a40575b50506040519081529081906020820190565b0390f35b62000a649250803d1062000a6c575b62000a5b81836200305a565b81019062005525565b388062000a2a565b503d62000a4f565b62000a8f9150843d861162000a6c5762000a5b81836200305a565b38620009ed565b60609060031901126200053f5760043562000ab18162000544565b906024359060443590565b346200053f5762000acd3662000a96565b9062000ad862004e6d565b6001600160a01b039283169062000af182151562005170565b600093828552609a6020526040852054161580159062000bf3575b62000b1790620051a6565b604051633a947e3560e11b815260048101829052602081602481865afa8015620008e757859462000b5392869262000bce575b50111562005577565b813b1562000bca57604051630b0a293f60e11b81523360048201819052602482019290925260448101919091526000606482015291908290818381608481015b03925af18015620008e75762000bb3575b5062000bb06001606555565b80f35b80620008d962000bc39262002ff0565b3862000ba4565b5050fd5b62000beb91925060203d811162000a6c5762000a5b81836200305a565b903862000b4a565b50609c6020526040842054151562000b0c565b346200053f576000604036600319011262000c95578060043562000c2a8162000544565b62000c3462004e6d565b6001600160a01b0316803b1562000c92578190604460405180948193630294a7a760e51b835260243560048401523360248401525af18015620008e75762000c80575b50600160655580f35b62000c8b9062002ff0565b3862000c77565b50fd5b80fd5b346200053f5762000ca93662000a96565b919062000cb8333b1562004ec4565b62000cc262004e6d565b62000ccf3315156200589b565b6000923384526020906099825260018060a01b039160409462000cf98487892054161515620058d1565b8381169562000d0a87151562005170565b868852609a83528481892054161580159062001090575b62000d2c90620051a6565b62000d3f64e8d4a5100087101562005907565b805163f2d9492f60e01b81526004810187905283816024818b5afa8015620008e75762000d78918a916200106e575b508510156200593e565b33600090815260996020526040902062000d9a905b546001600160a01b031690565b938585169662000dad8989141562005976565b825192633308f42d60e01b9788855286856004818d5afa948515620008e7578c956200104a575b5062000de48186163314620059c5565b609e5462000e099062000dfd906001600160a01b031681565b6001600160a01b031690565b82516370a0823160e01b81526001600160a01b0387166004820152999088908b9060249082905afa908115620008e75762000e9d8d938f62000e738962000e859f8f8f98908f918462000e6d918f9562000e95999162001028575b501015620059fc565b62005846565b9d8e60005260a1602052604060002090565b5460081c6001600160a01b031690565b161562005a35565b600484518094819382525afa958615620008e7577f1b88229ac738467a5b6ad4f608a992b440ec8757a7f6a0e987379e4d51e41f72988d92839862000fea575b5062000f83929162000f1262000f319262000fdc999a9b62000efe6200307c565b9586526001600160a01b0390911690850152565b6001600160a01b038916838601525b6001600160a01b03166060830152565b6001600160a01b03881660808201528360a08201528460c082015262000f5a60e0820160019052565b8c6101008201528c61012082015262000f7d8a60005260a1602052604060002090565b62005a86565b609e5462000fac9084906001600160a01b031660a25488906001600160a01b03165b9162006de9565b516001600160a01b0394851681529490931660208501526040840192909252606083019190915281906080820190565b0390a462000bb06001606555565b62000fdc9798509162000f1262000f31926200101a62000f8396958d803d1062000956576200094581836200305a565b9a9950925050919262000edd565b6200104391508d803d1062000a6c5762000a5b81836200305a565b3862000e64565b62001066919550873d891162000956576200094581836200305a565b933862000dd4565b620010899150853d871162000a6c5762000a5b81836200305a565b3862000d6e565b50609c835280882054151562000d21565b346200053f5760003660031901126200053f57602062ffffff60975460b81c16604051908152f35b62ffffff8116036200053f57565b801515036200053f57565b346200053f5760c03660031901126200053f57600435620011038162000544565b6044356200111181620010c9565b608435916200112083620010d7565b6200112a62004e6d565b6001600160a01b031690813b156200053f5760c462ffffff9160008094604051968795869463dcd330e560e01b8652602435600487015216602485015260643560448501521515606484015233608484015260a43560a48401525af18015620008e757620008c9576200001b6001606555565b346200053f5760203660031901126200053f57600435600052609b602052602060018060a01b038060406000205416600052609a825260406000205416604051908152f35b60809060031901126200053f57600435620011fd8162000544565b906024359060443590606435620012148162000544565b90565b346200053f57620012426200122c36620011e2565b926200123a92919262004e6d565b339062005309565b506001606555005b346200053f5760203660031901126200053f576004356200126b8162000544565b6200127562004a67565b803b156200129f5760a280546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b8152602060048201526008602482015267414b465f56494e4360c01b6044820152606490fd5b346200053f5760203660031901126200053f57600435620012f08162000544565b60018060a01b0316600052609c6020526020604060002054604051908152f35b346200053f5760003660031901126200053f57609d546040516001600160a01b039091168152602090f35b346200053f5760403660031901126200053f576200138d600435620013608162000544565b6200136a62004e6d565b6200137462004a67565b603354602435916001600160a01b039091169062006be3565b6001606555005b346200053f5760203660031901126200053f57600435620013b58162000544565b620013bf62004a67565b609d80546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760008060031936011262000c9557620013ff62004a67565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156200053f578235916001600160401b0383116200053f57602083818601950101116200053f57565b346200053f5760803660031901126200053f57602435600435620014978262000544565b6001600160401b03916044358381116200053f57620014bb90369060040162001443565b90916064358581116200053f57620014d890369060040162001443565b93620014e362004e6d565b609d546001600160a01b039490620014ff908616331462004d12565b6200150c87151562004d48565b6200153a856200153262000d8d8760018060a01b03166000526099602052604060002090565b161562004d7f565b620015626200155b62000dfd62000d8d8a600052609b602052604060002090565b1562004db7565b6040516101d5808201998a11828b1017620016b55762006ee4823980600099039089f0918215620008e7578589931696873b15620016b157620015bd90604051958694859463100b506960e11b865289306004880162004e3a565b038183885af18015620008e7576200169a575b506001600160a01b0381166000908152609960205260409020620016109084905b80546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b0383166000908152609a6020526040902062001635908290620015f1565b6200164f83620015f186600052609b602052604060002090565b6001600160a01b0383166000908152609c60205260409020849055167fc7e08e9d26d634e7a8c5a116d4312ad4ea4f5de2b728546828d8a3449ed8f6d48480a462000bb06001606555565b80620008d9620016aa9262002ff0565b38620015d0565b8380fd5b62002fda565b346200053f57620016cc366200095e565b90620016da33151562005170565b336000908152609a60205260409020546001600160a01b03908116158015906200172e575b6200170a90620051a6565b826200171257005b8060a2541680918316036200172357005b6200001b9362006de9565b50609c6020526040600020541515620016ff565b346200053f5760403660031901126200053f5760043560005260a66020526040600020602435600052602052602060ff604060002054166040519015158152f35b346200053f5762001242620017983662000a96565b90620017a362004e6d565b3392339062005309565b346200053f5760603660031901126200053f57600435620017ce81620010c9565b60443590620017dd82620010d7565b620017ea333b1562004ec4565b620017f462004e6d565b33600090815260996020526040812054909283916001600160a01b0316803b156200185957604051630a0c211160e11b815233600482015262ffffff909416602480860191909152356044850152901515606484015282908183816084810162000b93565b8280fd5b346200053f5760203660031901126200053f576200187a62004e6d565b6200188462004a67565b6033546200138d90600435906001600160a01b031662006e42565b346200053f5760203660031901126200053f57600435620018c08162000544565b620018ca62004a67565b803b15620018f457609e80546001600160a01b0319166001600160a01b0392909216919091179055005b60405162461bcd60e51b8152602060048201526008602482015267414b465f42494e4360c01b6044820152606490fd5b346200053f5760008060031936011262000c955780546200195f60ff8260081c16158092819362001a0a575b8115620019e7575b5062004b09565b8062001973600160ff196000541617600055565b620019cc575b6200198362004b6d565b6200198b5780f35b6200199c61ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a180f35b620019e161010061ff00196000541617600055565b62001979565b303b15915081620019fb575b503862001958565b6001915060ff161438620019f3565b600160ff821610915062001950565b346200053f5760203660031901126200053f5760043562001a3a81620010c9565b62001a4462004a67565b62001a59620f424062ffffff83161062004c56565b6097805462ffffff60b81b191660b89290921b62ffffff60b81b16919091179055005b60409060031901126200053f5760043562001a978162000544565b90602435620012148162000544565b346200053f5762001ab73662001a7c565b6001600160a01b0391821691823b156200053f576040516311bcf02b60e21b81529116600482015260009182908290602490829084905af18015620008e75762001aff575080f35b62000bb09062002ff0565b346200053f5760203660031901126200053f5760043562001b2b8162000544565b62001b3562004a67565b609780546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760a03660031901126200053f5760206200065f60243562001b7e8162000544565b608435906064359060443590600435620055ae565b346200053f5760803660031901126200053f5760443560243560043562001bba8362000544565b60643562001bca333b1562004ec4565b62001bd462004e6d565b62001be182151562005170565b600093828552602090609b825260018060a01b039260409062001c0b85838a205416151562005fc6565b62001c1887151562005170565b868852609b845262001c3185838a205416151562005fc6565b8483169462001c4286151562005170565b858952609a855282892054161580159062001fa5575b62001c6390620051a6565b62001ca262001c9b62001c948362001c858a60005260a6602052604060002090565b90600052602052604060002090565b5460ff1690565b1562006034565b62001ccd62001cc08262001c858960005260a6602052604060002090565b805460ff19166001179055565b62001ce78762001c858860005260a5602052604060002090565b9160018301549560028401549362001d00815460ff1690565b8062001f9b575b8062001f91575b62001d19906200606b565b82516331eb37bd60e11b8152600481018590529060a082602481865afa908115620008e75762001d86928d9262001f5a575b50815185908d9062001d66906001600160a01b031662000635565b14928362001f3f575b8362001f1a575b8362001f05575b5050506200611c565b62001dc162000d8d62001da762000d8d8b600052609b602052604060002090565b6001600160a01b03166000908152609a6020526040902090565b95825163284be21560e01b81528181600481865afa908115620008e75760049383918e9362001ee1575b508551635b31588360e01b815294859182905afa958615620008e7577f541cc56fb39c64a8c89a1436687f30dabc209b9b093ee3c592b82040c367dbeb9962001e9f9762001e7c958f9562001e65969262001ead575b5050609e5462001e5d906001600160a01b03168c30916200699b565b938a62006a90565b9562001e7387151562006154565b8681876200618c565b5193849384604091949392606082019560018060a01b0316825260208201520152565b0390a362000bb06001606555565b62001ed19250803d1062001ed9575b62001ec881836200305a565b81019062005cc2565b388062001e41565b503d62001ebc565b62001efd919350823d841162001ed95762001ec881836200305a565b913862001deb565b60039293500151910154111538848162001d7d565b9250608083015162001f2c816200556c565b62001f37816200556c565b159262001d76565b9250600162001f508b850151151590565b1515149262001d6f565b62001f8191925060a03d811162001f89575b62001f7881836200305a565b810190620060a2565b903862001d4b565b503d62001f6c565b5084151562001d0e565b5087151562001d07565b50609c845281882054151562001c58565b346200053f5760003660031901126200053f5760a2546040516001600160a01b039091168152602090f35b346200053f5760003660031901126200053f576033546040516001600160a01b039091168152602090f35b346200053f5760003660031901126200053f576098546040516001600160a01b039091168152602090f35b60809060031901126200053f57600435620020528162000544565b90602435620020618162000544565b906044359060643590565b346200053f576200207d3662002037565b9291906200208d333b1562004ec4565b6200209762004e6d565b6001600160a01b039280841692620020b184151562005170565b600095848752602091609a835260409087828a205416158015906200225b575b620020dc90620051a6565b87811697620020ed89151562005170565b888a52609a8552828a205416158015906200224a575b6200210e90620051a6565b6200211c888814156200637a565b8151630efe8bcb60e21b8152600481018790529484866024818b5afa958615620008e7576200216e9686918c9162002228575b50845180988192634bf78e2760e11b8352600483019190602083019252565b03818c5afa938415620008e7577fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460629662000fdc968c96620021ef575b5050620021da9291620021c4620021cf92871015620063b1565b883391339062005e5e565b833391339062006230565b51938452602084015233929081906040820190565b620021cf9296506200221b620021da95949282620021c493903d1062000a6c5762000a5b81836200305a565b96925081939450620021aa565b620022439150823d841162000a6c5762000a5b81836200305a565b386200214f565b50609c845281892054151562002103565b50609c8452818920541515620020d1565b346200053f5760603660031901126200053f576001600160401b036024358181116200053f57620022a290369060040162001443565b6044929192359182116200053f57602092620022c76200065f93369060040162001443565b92909160043562004cad565b346200053f576040806003193601126200053f578080606062000a3c9351620022fc8162003004565b600091818380935282602082015282858201520152600435815260a5602052818120602435825260205220906003815192620023388462003004565b60ff8154161515845260018101546020850152600281015483850152015460608301525191829182919091606080608083019480511515845260208101516020850152604081015160408501520151910152565b346200053f5760203660031901126200053f576020600435620023af8162000544565b60018060a01b038091166000526099825260406000205416604051908152f35b346200053f576200240a620023e4366200095e565b6040929192519063185fbc4160e31b825281806020968793600483019190602083019252565b038160018060a01b038097165afa918215620008e757849262000a0f9260009162002452575b50604051948580948193637a784e6760e01b8352600483019190602083019252565b6200246d9150843d861162000a6c5762000a5b81836200305a565b3862002430565b346200053f5760a03660031901126200053f576004356200249581620010c9565b60443590620024a482620010d7565b620024b1333b1562004ec4565b620024bb62004e6d565b336000908152609960205260409020620024d59062000d8d565b620024eb66038d7ea4c680006064350462006596565b9062ffffff83168062002554575b506001600160a01b0316803b156200053f5760405163459113fd60e01b815233600482015262ffffff9093166024808501919091523560448401529215156064830152608482015290600090829081838160a48101620008ad565b62002564620f4240918462006620565b6040516336c6b5db60e11b8152919004600482018190526020826024816001600160a01b0387165afa918215620008e757620025be92620025b491600091620025c5575b506084351015620063b1565b33903384620062da565b38620024f9565b620025e1915060203d811162000a6c5762000a5b81836200305a565b38620025a8565b346200053f5760203660031901126200053f57600435620026098162000544565b6200261362004a67565b609880546001600160a01b0319166001600160a01b0392909216919091179055005b346200053f5760203660031901126200053f5760043562002658333b1562004ec4565b6200266262004e6d565b60009033825260a460205262002685816040842090600052602052604060002090565b8054620026b59060ff90620026a9600882901c6001600160a01b03163314620051a6565b16620006d481620039c5565b805460ff19166003178155600181015460a01c60ff1662002703575b5033907f34cf495316dbb07c8286e6c6b35542a47854aaf8050f2dd51ab0347b855582978380a362000bb06001606555565b609e546200273091906001600160a01b031660a2546004906001600160a01b031692015491339162006de9565b38620026d1565b346200053f57620027483662001a7c565b906200275362004e6d565b609d546001600160a01b03906200276e908216331462004d12565b620027a7816200279462000d8d8660018060a01b03166000526099602052604060002090565b1680159081156200284c575b5062004d7f565b811691823b156200053f5760405163033f2ed560e61b81526001600160a01b0382166004820152926000908490602490829084905af1908115620008e757620008be93620015f19262002835575b506001600160a01b0383166000908152609a602052604090206200281b908290620015f1565b6001600160a01b0316600090815260996020526040902090565b80620008d9620028459262002ff0565b38620027f5565b90508284161438620027a0565b346200053f576040806003193601126200053f5760048035916200287d8362000544565b602435926200288e333b1562004ec4565b6200289862004e6d565b620028a53315156200589b565b60009333855260206099815260018060a01b0392620028cb8486892054161515620058d1565b83811695620028dc87151562005170565b868852609a83528486892054161580159062002c6c575b620028fe90620051a6565b6200290b84151562005b72565b336000908152609960205260409020620029259062000d8d565b9385851696620029388989141562005976565b805163f2d9492f60e01b908181528681806200295f8882019064e8d4a51000602083019252565b03818d5afa908115620008e7578c9162002c4a575b508310158062002be6575b6200298b91506200593e565b805192633308f42d60e01b808552868583818d5afa948515620008e7578c9562002bc2575b50620029c08986163314620059c5565b609e54620029d99062000dfd906001600160a01b031681565b83516370a0823160e01b81526001600160a01b03871684820190815290929189918491908290819060200103915afa8015620008e7578562002a28918f948b959162002ba757501015620059fc565b62002a5362002a3986898c620057fc565b9a62000e9562000e858d60005260a1602052604060002090565b83519283918252818d5afa948515620008e7577f1b88229ac738467a5b6ad4f608a992b440ec8757a7f6a0e987379e4d51e41f72978c92839762002b69575b5062002b13929162002ab362002ac79262000fdc98999a62000efe6200307c565b6001600160a01b0388168386015262000f21565b6001600160a01b03871660808201528b60a08201528360c082015262002af060e0820160019052565b8b6101008201528b61012082015262000f7d8960005260a1602052604060002090565b609e5462002b3a9083906001600160a01b031660a25487906001600160a01b031662000fa5565b516001600160a01b03938416815293909216602084015260006040840152606083019190915281906080820190565b62000fdc9697509162002ab362002ac79262002b9962002b1396958c8d3d1062000956576200094581836200305a565b999850925050919262002a92565b620010439150853d871162000a6c5762000a5b81836200305a565b62002bde919550873d891162000956576200094581836200305a565b9338620029b0565b50815190815285818062002c058782019064e8d4a51000602083019252565b03818d5afa8015620008e7576200298b918c9162002c28575b508310156200297f565b62002c439150873d891162000a6c5762000a5b81836200305a565b3862002c1e565b62002c659150873d891162000a6c5762000a5b81836200305a565b3862002974565b50609c8352858820541515620028f3565b346200053f5760003660031901126200053f576097546040516001600160a01b039091168152602090f35b346200053f576020806003193601126200053f5760043562002ccc333b1562004ec4565b62002cd662004e6d565b62002ce33315156200589b565b600091338352609981527f39a770c63b28d70f6583dccc75052147017e4bdb315f7adc71d51f996d8da4e660018060a01b0360409062002d2a8183882054161515620058d1565b62002d3785151562005170565b848652609b845262002d50818388205416151562005fc6565b3386526099845281862054168552609c835260a581862054938487525284600262002d878684842090600052602052604060002090565b805460ff19168155600181018390550155516000808252602082018190526040820152426060820152806080810162001e9f565b60005b83811062002dcf5750506000910152565b818101518382015260200162002dbe565b9060209162002dfb8151809281855285808601910162002dbb565b601f01601f1916010190565b602080820190808352835180925260408301928160408460051b8301019501936000915b84831062002e3c5750505050505090565b909192939495848062002e5c600193603f198682030187528a5162002de0565b980193019301919493929062002e2b565b60203660031901126200053f57600480356001600160401b03918282116200053f57366023830112156200053f57818101359283116200053f57602490818301928236918660051b0101116200053f5762002ec88462006400565b9360005b81811062002ee4576040518062000a3c888262002e07565b60008062002ef483858962006478565b6040939162002f08855180938193620064c3565b0390305af49062002f18620064d1565b9182901562002f4f5750509062002f499162002f35828962006581565b5262002f42818862006581565b5062006452565b62002ecc565b8683879260448251106200053f578262002f8c938562002f76940151830101910162006506565b925162461bcd60e51b815292839283016200656e565b0390fd5b346200053f5760c03660031901126200053f5760206200065f60243562002fb78162000544565b60443562002fc58162000544565b60a435916084359160643591600435620055f5565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620016b557604052565b608081019081106001600160401b03821117620016b557604052565b61014081019081106001600160401b03821117620016b557604052565b61010081019081106001600160401b03821117620016b557604052565b90601f801991011681019081106001600160401b03821117620016b557604052565b604051906200308b8262003020565b565b6001600160401b038111620016b557601f01601f191660200190565b81601f820112156200053f57803590620030c3826200308d565b92620030d360405194856200305a565b828452602083830101116200053f57816000926020809301838601378301015290565b346200053f5760e03660031901126200053f576004356024356200311a8162000544565b60443590620031298262000544565b606435906084359060c43560a4356001600160401b0382116200053f576200315a62003224923690600401620030a9565b9062003168333b1562004ec4565b6200317262004e6d565b6200317f8615156200565c565b620031b7620031b1620031ad62001c948b62001c858960018060a01b031660005260a0602052604060002090565b1590565b62005692565b620031dd62001cc08962001c858760018060a01b031660005260a0602052604060002090565b6001600160a01b038716600090815260a76020526040902054948581148062003317575b6200320c9062004c56565b6200321a42831015620056c8565b8688868b620057dc565b50506040516370a0823160e01b81526001600160a01b03828116600483015285811695909291906020826024818a5afa918215620008e75786670de0b6b3a7640000620032b47f854f878df3d7ec53494040ed9be42b67dc6777ba5704d95ce469f1362930c8f698620032ad84620032e698620032bf97600091620032f4575b501015620056fe565b8362006620565b049285309162006de9565b620032cb818462006e42565b60405193849316958360209093929193604081019481520152565b0390a46200001b6001606555565b62003310915060203d811162000a6c5762000a5b81836200305a565b38620032a4565b5085151562003201565b346200053f5760403660031901126200053f57600435602435620033458162000544565b62003352333b1562004ec4565b6200335c62004e6d565b6001600160a01b038116600090815260a4602052604090206200338190839062001c85565b9182549160018060a01b03620033a860ff82841695620026a987858360081c1614620051a6565b620033ce62001cc08462001c858560018060a01b031660005260a4602052604060002090565b6001850154908116946003810154600460ff60028401549460a01c169201549382600014620034f557604051630f0acbd160e01b8152670de0b6b3a76400006004820152946020866024818c5afa908115620008e757620034638a9462003489937f7907d0bab36c44f1455bd336290d15ba6eeab66d9a59d0416b5fd857771df69999600091620034d2575b50111562005e26565b60a25462003482908490839089906001600160a01b0316809862005417565b9062005c7d565b9081620034b1575b5050505b60408051911515825260208201929092529081908101620032e6565b609e54620034c993906001600160a01b031662006de9565b38808062003491565b620034ee915060203d811162000a6c5762000a5b81836200305a565b386200345a565b604051630f0acbd160e01b8152670de0b6b3a764000060048201529194506020826024818b5afa918215620008e7577f7907d0bab36c44f1455bd336290d15ba6eeab66d9a59d0416b5fd857771df699956200356b93620035629260009162003571575b50101562005dee565b83818962005f21565b62003495565b6200358d915060203d811162000a6c5762000a5b81836200305a565b3862003559565b346200053f576020806003193601126200053f57620035b5333b1562004ec4565b620035bf62004e6d565b620035d660043560005260a1602052604060002090565b90620035e7620006c9835460ff1690565b620035fa620006ee600684015460ff1690565b6200360a60048301541562005c8b565b60028201546001600160a01b0316604051633308f42d60e01b8152916001600160a01b03828116918085600481865afa948515620008e75760009562003955575b506200365b828616331462005c18565b6003860180546001600160a01b0319166001600160a01b038716179055855460ff1916600117865560018601546001600160a01b0316865490969060081c6001600160a01b0316916005820154956040519663284be21560e01b9182895283896004818a8a165afa988915620008e75760009962003931575b50604051635b31588360e01b8082529985826004818b8d165afa918215620008e7576200370f9285928a926000926200390d575b506200666d565b9460405193845284846004818c5afa938415620008e757600094620038e9575b50604051998a52848a6004818c5afa938415620008e75783838d96620037689360089e620037c09a600093620038c5575b50506200666d565b99818760078d940155015584151580620038bb575b620037889062005cda565b620037ac620037a58c848c620007c360a25460018060a01b031690565b8362005c7d565b8b816200389a575b505050838286620051dc565b50604080516001600160a01b0389811682528816602082015290810182905260608101869052849084841690600435907fbf7251dfdcdaa7bf1bd728412bab243e14ae75865dd5516648e1c8a51ad2d72190608090a48282163b156200053f57604051630615077d60e41b8082526001600160a01b03979097166004820152602481019190915291600091839160449183918591165af18015620008e757620008ed5750803b156200053f576040519283526001600160a01b039093166004830152602482015290600090829081838160448101620008ad565b609e54620038b293906001600160a01b031662006de9565b38808b620037b4565b508815156200377d565b620038e0929350803d1062001ed95762001ec881836200305a565b90388062003760565b62003905919450853d871162001ed95762001ec881836200305a565b92386200372f565b62003929919250893d8b1162001ed95762001ec881836200305a565b903862003708565b6200394d919950843d861162001ed95762001ec881836200305a565b9738620036d4565b81620039719296503d871162000956576200094581836200305a565b93386200364b565b346200053f5760203660031901126200053f57600435600052609b602052602060018060a01b0360406000205416604051908152f35b634e487b7160e01b600052602160045260246000fd5b60041115620039d057565b620039af565b90620039e282620039c5565b52565b919091610140810192620039fb828251620039d6565b6020818101516001600160a01b0316908301526040818101516001600160a01b0316908301526060818101516001600160a01b0316908301526080818101516001600160a01b03169083015260a081015160a083015260c081015160c083015262003a6f60e082015160e084019015159052565b610100808201519083015261012080910151910152565b346200053f5760203660031901126200053f5762000a3c60405162003aab8162003020565b6000908181528160208201528160408201528160608201528160808201528160a08201528160c08201528160e0820152600860406101009380858501528061012080950152600435815260a16020522062003b056200307c565b9362003b2d825462003b1b60ff82168862005890565b841c6001600160a01b03166020870152565b60018201546001600160a01b0316604086015260028201546001600160a01b0316606086015260038201546001600160a01b03166080860152600482015460a0860152600582015460c086015262003b9662003b8d600684015460ff1690565b151560e0870152565b60078201549085015201549082015260405191829182620039e5565b346200053f5760403660031901126200053f5760043562003bd38162000544565b62003bdd62004a67565b6001600160a01b0316600090815260a7602052604090206024359055005b346200053f5762003c0c36620011e2565b62003c1662004e6d565b6001600160a01b0393841662003c2e81151562005170565b600094818652609a6020526040862054161580159062003cd8575b62003c5490620051a6565b604051633a947e3560e11b815260048101859052602081602481855afa8015620008e757869462003c8f92869262000bce5750111562005577565b803b156200185957604051630b0a293f60e11b815233600482015260248101949094526001600160a01b0390911660448401526000606484015282908183816084810162000b93565b50609c6020526040852054151562003c49565b346200053f5760803660031901126200053f576001600160401b036004356024358281116200053f5762003d2490369060040162001443565b6044358481116200053f5762003d3f90369060040162001443565b9290916064358681116200053f5762003d5d903690600401620030a9565b9162003d6b333b1562004ec4565b62003d7562004e6d565b62003db260018060a01b039362003da78562003d9f62000d8d8b600052609b602052604060002090565b161562004db7565b868685858b62004efb565b50506040516101d5808201988911828a1017620016b55762006ee4823980600098039088f0928315620008e75787931694853b15620016b15762003e0d90604051958694859463100b506960e11b8652306004870162004dfb565b038183865af18015620008e75762003e86575b5062003e3b81620015f184600052609b602052604060002090565b6001600160a01b0381166000908152609c60205260409020829055827f0fda88fcc31b35d80e62f303bc442eecd55f84ad381eef53826fd5bc48e5b7fe8180a462000bb06001606555565b80620008d962003e969262002ff0565b3862003e20565b9060c06003198301126200053f576004359160243562003ebd8162000544565b9160443591606435916084359160a435906001600160401b0382116200053f576200121491600401620030a9565b346200053f5762003fb762003f003662003e9d565b9062003f14969294939596333b1562004ec4565b62003f1e62004e6d565b8515158062004056575b62003f33906200565c565b62003f61620031b1620031ad62001c948a62001c858960018060a01b031660005260a0602052604060002090565b62003f8762001cc08862001c858760018060a01b031660005260a0602052604060002090565b609f5494858114806200404c575b62003fa09062004c56565b62003fae42831015620056c8565b8685896200576b565b5050609e546040516370a0823160e01b81526001600160a01b03838116600483015292918316602082602481845afa918215620008e75786670de0b6b3a7640000620032b47f05c966387bde83883f64200b4d9f73042dd5dbe77e737d0e39db4f391b54bb1f98620032ad846200403e98620032bf97600091620032f457501015620056fe565b0390a36200001b6001606555565b5085151562003f95565b50652d79883d200086111562003f28565b346200053f576020806003193601126200053f576004356200408b333b1562004ec4565b6200409562004e6d565b620040aa8160005260a1602052604060002090565b8054620040bf60ff8216620006d481620039c5565b620040d2620006ee600684015460ff1690565b60028201546001600160a01b0390811694909190620040f386151562005d80565b60405190633308f42d60e01b9384835281836004818b5afa928315620008e757600093620041fb575b5082936200412f82849516331462005db7565b60081c16936200414185151562005d12565b60046040518096819382525afa938415620008e7577fd3bb236a8c097c79eea15f66e43bf3984e6672bd5d434c74b4cb6b70c834508b946200403e94620041bf93600092620041d9575b5050815460ff19166003178255609e546001600160a01b03165b60a254600590930154926001600160a01b03169062006de9565b6040516001600160a01b0390911681529081906020820190565b620041f39250803d1062000956576200094581836200305a565b38806200418b565b8293506200421890833d851162000956576200094581836200305a565b926200411c565b346200053f5760203660031901126200053f576004356200424081620010c9565b6200424a62004a67565b6200425f620f424062ffffff83161062004c56565b6097805462ffffff60a01b191660a09290921b62ffffff60a01b16919091179055005b346200053f5760206200065f620042993662002037565b9291909162005846565b346200053f5762004372620042b83662003e9d565b91620042ca96939596333b1562004ec4565b620042d462004e6d565b851515806200444a575b620042e9906200565c565b62004317620031b1620031ad62001c948a62001c858a60018060a01b031660005260a0602052604060002090565b6200433d62001cc08862001c858860018060a01b031660005260a0602052604060002090565b6807dc477bc1cfa4000081148062004441575b6200435b9062004c56565b6200436942831015620056c8565b8585886200576b565b50506040516370a0823160e01b81526001600160a01b0382166004820152906020826024817343bda480de297a14cec95bfb1c6a313615f809ef5afa8015620008e75783620043ee917fd9b0c173394b95890274aa419defd8002b3d13721a7ad44282b4099abd7223a794600091620032f457501015620056fe565b670de0b6b3a7640000620044028462006601565b04906200441184308362006cdb565b6200441d828262006e42565b6040805194855260208501929092526001600160a01b03169290819081016200403e565b50600162004350565b506603328b944c4000861115620042de565b346200053f5760c03660031901126200053f57602435600435620044808262000544565b604435906200448f82620010d7565b7f43b998e47453d980655a7f5405259ce1526efb62b8777e639f7ad6dee421c3cb6064359360843590620032e660a435620044cc333b1562004ec4565b620044d662004e6d565b33600090815260a460205260409020620044f290879062001c85565b80546001600160a01b0395918991620045849190620045179060081c891615620051a6565b8b151580620045e1575b6200452c9062004c56565b805460018201805460ff60a01b86151560a01b166001600160a81b03199182166001600160a01b038c161717909155600283018e9055600383018690556004830187905516610100600160a81b033360081b16179055565b620045b3575b604051948594169833988590949392606092608083019615158352602083015260408201520152565b609e54620045db9083906001600160a01b031660a2546001600160a01b031690339062006de9565b6200458a565b5084151562004521565b346200053f5760203660031901126200053f576004356200460e333b1562004ec4565b6200461862004e6d565b6200462d8160005260a1602052604060002090565b908154916200464460ff8416620006d481620039c5565b62004657620006ee600683015460ff1690565b60018060a01b03809360081c16926200467284151562005d12565b604051633308f42d60e01b815290602082600481885afa8015620008e7577f0240ef67b9a39238db2f92fc057c26bce3d089137a6fbf3c728f4c6078258ddf936200403e93600092620046f4575b50620046d58293620041bf9316331462005d49565b805460ff19166002178155609e5483906001600160a01b0316620041a5565b620041bf925062004719620046d59160203d811162000956576200094581836200305a565b9250620046c0565b346200053f5760803660031901126200053f5762001242606435620047468162000544565b6200475062004e6d565b6004356000908152609b6020526040902054604435906024359033906001600160a01b031662005309565b346200053f5760003660031901126200053f576020609f54604051908152f35b346200053f5760603660031901126200053f57602435600435604435620047c4333b1562004ec4565b620047ce62004e6d565b620047db3315156200589b565b7f39a770c63b28d70f6583dccc75052147017e4bdb315f7adc71d51f996d8da4e660009333855260996020526200484860018060a01b0362004825816040892054161515620058d1565b6200483286151562005170565b858752609b602052604087205416151562005fc6565b683782dace9d9000000081111580620048fd575b620048679062004c56565b338552609960209081526040808720546001600160a01b03166000908152609c909252902054926200489c8585141562005ffd565b620048b68562001c858660005260a5602052604060002090565b805460ff1916600117815582600182015581600282015560034291015562001e9f604051928392429184606091949392608082019560018352602083015260408201520152565b50678ac7230489e800008311156200485c565b346200053f5760003660031901126200053f57609e546040516001600160a01b039091168152602090f35b346200053f576200494c366200095e565b906200495a33151562005170565b336000908152609a60205260409020546001600160a01b039190821615801590620049b9575b6200498b90620051a6565b826200499357005b60a2548216918116308103620049b05750506200001b9262006be3565b82036200172357005b50609c602052604060002054151562004980565b346200053f5760203660031901126200053f57600435620049ee8162000544565b620049f862004a67565b6001600160a01b0381161562004a13576200001b9062004ac0565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b6033546001600160a01b0316330362004a7c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b1562004b1157565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b62004b8b60ff60005460081c1662004b858162004bf5565b62004bf5565b62004b963362004ac0565b62004bae60ff60005460081c1662004b858162004bf5565b60016065556bffffffffffffffffffffffff60a01b33816098541617609855640c35000c3560a41b65ffffffffffff60a01b1960975416176097553390609d541617609d55565b1562004bfd57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b1562004c5e57565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa12960d11b6044820152606490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b939162004cff62004d0c9394929462004cea6040519687946020860199308b52466040880152606087015260a0608087015260c086019162004c8c565b90601f1994858584030160a086015262004c8c565b039081018352826200305a565b51902090565b1562004d1a57565b60405162461bcd60e51b8152602060048201526006602482015265414b465f4e4160d01b6044820152606490fd5b1562004d5057565b60405162461bcd60e51b815260206004820152600760248201526620a5a32faa2d2b60c91b6044820152606490fd5b1562004d8757565b60405162461bcd60e51b8152602060048201526008602482015267414b465f504e5a4160c01b6044820152606490fd5b1562004dbf57565b60405162461bcd60e51b8152602060048201526008602482015267414b465f544e5a4160c01b6044820152606490fd5b6040513d6000823e3d90fd5b939162001214959362004e2b9260018060a01b031686526000602087015260806040870152608086019162004c8c565b92606081850391015262004c8c565b9492909362001214969462004e2b9360018060a01b03809216885216602087015260806040870152608086019162004c8c565b60026065541462004e7f576002606555565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b1562004ecc57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f43494360c81b6044820152606490fd5b9262004f159262004f59959262004f509598979862004cad565b9362004f4a857f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b620050b0565b91909162004f84565b609d5462004f75906001600160a01b0383811691161462004d12565b9190565b60051115620039d057565b62004f8f8162004f79565b8062004f985750565b62004fa38162004f79565b6001810362004ff15760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b62004ffc8162004f79565b600281036200504a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b806200505860039262004f79565b146200506057565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b906041815114600014620050e157620050dd916020820151906060604084015193015160001a90620050eb565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311620051645791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15620008e75781516001600160a01b038116156200515e579190565b50600190565b50505050600090600390565b156200517857565b60405162461bcd60e51b815260206004820152600660248201526520a5a32faa2d60d11b6044820152606490fd5b15620051ae57565b60405162461bcd60e51b81526020600482015260066024820152651052d197d09560d21b6044820152606490fd5b9094936001600160a01b03929091831690620051fa82151562005170565b600093828552609a60205260408520541615801590620052f6575b6200522090620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620052cc575b50856200525d91101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b039788166004820152602481019190915295909116604486015260016064860152929391928290818381608481015b03925af18015620008e757620052bc575090565b80620008d9620012149262002ff0565b6200525d919650620052ee9060203d811162000a6c5762000a5b81836200305a565b95906200524e565b50609c6020526040842054151562005215565b9094936001600160a01b039290918316906200532782151562005170565b600093828552609a6020526040852054161580159062005404575b6200534d90620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620053da575b50856200538a91101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b03978816600482015260248101919091529590911660448601526000606486015292939192829081838160848101620052a8565b6200538a919650620053fc9060203d811162000a6c5762000a5b81836200305a565b95906200537b565b50609c6020526040842054151562005342565b9094936001600160a01b039290918316906200543582151562005170565b600093828552609a6020526040852054161580159062005512575b6200545b90620051a6565b60405163f2d9492f60e01b81526004810182905294602086602481865afa958615620008e7578596620054e8575b50856200549891101562005535565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b03978816600482015260248101919091529590911660448601526002606486015292939192829081838160848101620052a8565b620054989196506200550a9060203d811162000a6c5762000a5b81836200305a565b959062005489565b50609c6020526040842054151562005450565b908160209103126200053f575190565b156200553d57565b60405162461bcd60e51b81526020600482015260076024820152660414b465f4242560cc1b6044820152606490fd5b60061115620039d057565b156200557f57565b60405162461bcd60e51b81526020600482015260076024820152660414b465f4253560cc1b6044820152606490fd5b9391929092604051936020850195308752466040870152606086015260018060a01b0316608085015260a084015260c083015260e082015260e0815262004d0c816200303d565b949290939193604051946020860196308852466040880152606087015260018060a01b0380921660808701521660a085015260c084015260e08301526101009081830152815261012081018181106001600160401b03821117620016b55760405251902090565b156200566457565b60405162461bcd60e51b8152602060048201526006602482015265414b465f494160d01b6044820152606490fd5b156200569a57565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa12760d11b6044820152606490fd5b15620056d057565b60405162461bcd60e51b81526020600482015260066024820152651052d197d09160d21b6044820152606490fd5b156200570657565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4a12160c91b6044820152606490fd5b156200573d57565b60405162461bcd60e51b81526020600482015260066024820152651052d197d39560d21b6044820152606490fd5b620057c89462004f75948394620057bf946200578a949a999a620055ae565b9562004f4a877f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b93909362004f84565b6001600160a01b0383811691161462005735565b9462004f75948294620057bf946200578a94620057c8999b9a9b620055f5565b909160405191602083019330855246604085015260018060a01b038092166060850152166080830152600060a083015260c08201524360e082015260e0815262004d0c816200303d565b9192909260405192602084019430865246604086015260018060a01b03809216606086015216608084015260a083015260c08201524360e082015260e0815262004d0c816200303d565b620039e282620039c5565b15620058a357565b60405162461bcd60e51b815260206004820152600660248201526520a5a32fa82d60d11b6044820152606490fd5b15620058d957565b60405162461bcd60e51b81526020600482015260066024820152650414b465f42560d41b6044820152606490fd5b156200590f57565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa0a72b60c91b6044820152606490fd5b156200594657565b60405162461bcd60e51b8152602060048201526008602482015267414b465f4242504d60c01b6044820152606490fd5b156200597e57565b60405162461bcd60e51b81526020600482015260076024820152661052d197d3915560ca1b6044820152606490fd5b908160209103126200053f5751620012148162000544565b15620059cd57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e4f4160c81b6044820152606490fd5b1562005a0457565b60405162461bcd60e51b815260206004820152600960248201526820a5a32fa7a0a722a160b91b6044820152606490fd5b1562005a3d57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f424f4960c81b6044820152606490fd5b9062005a7881620039c5565b60ff80198354169116179055565b9061012060089162005aa5815162005a9e81620039c5565b8562005a6c565b602081015162005ada906001600160a01b03168554610100600160a81b03191660089190911b610100600160a81b0316178555565b60408101516001850180546001600160a01b039283166001600160a01b0319918216179091556060830151600287018054918416918316919091179055608083015160038701805491909316911617905560a0810151600485015560c0810151600585015560e081015162005b60901515600686019060ff801983541691151516179055565b61010081015160078501550151910155565b1562005b7a57565b60405162461bcd60e51b815260206004820152600860248201526720a5a32fa128272d60c11b6044820152606490fd5b1562005bb257565b60405162461bcd60e51b8152602060048201526007602482015266414b465f424f5360c81b6044820152606490fd5b1562005be957565b60405162461bcd60e51b81526020600482015260076024820152661052d197d3d39360ca1b6044820152606490fd5b1562005c2057565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa727a160c91b6044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b620f423f1981019190821162005c7757565b62005c4f565b9190820391821162005c7757565b1562005c9357565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa7a72960c91b6044820152606490fd5b908160209103126200053f57516200121481620010c9565b1562005ce257565b60405162461bcd60e51b8152602060048201526008602482015267414b465f42414e4d60c01b6044820152606490fd5b1562005d1a57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f49544160c81b6044820152606490fd5b1562005d5157565b60405162461bcd60e51b8152602060048201526007602482015266414b465f494f4160c81b6044820152606490fd5b1562005d8857565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4aa2160c91b6044820152606490fd5b1562005dbf57565b60405162461bcd60e51b815260206004820152600760248201526620a5a32fa4a7a160c91b6044820152606490fd5b1562005df657565b60405162461bcd60e51b81526020600482015260086024820152670414b465f425453560c41b6044820152606490fd5b1562005e2e57565b60405162461bcd60e51b81526020600482015260086024820152670414b465f425442560c41b6044820152606490fd5b9093926001600160a01b0392909183169062005e7c82151562005170565b600093828552609a6020526040852054161580159062005f0e575b62005ea290620051a6565b813b15620016b157604051630b0a293f60e11b81526001600160a01b039687166004808301919091526024820192909252929095166044830152606482019490945291928290818381608481015b03925af18015620008e75762005f035750565b6200308b9062002ff0565b50609c6020526040842054151562005e97565b9093926001600160a01b0392909183169062005f3f82151562005170565b600093828552609a6020526040852054161580159062005fb3575b62005f6590620051a6565b813b15620016b157604051630b0a293f60e11b81526001600160a01b039687166004820152602481019190915291909416604482015260026064820152919282908183816084810162005ef0565b50609c6020526040842054151562005f5a565b1562005fce57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f42544960c81b6044820152606490fd5b156200600557565b60405162461bcd60e51b8152602060048201526007602482015266414b465f53544960c81b6044820152606490fd5b156200603c57565b60405162461bcd60e51b8152602060048201526007602482015266414b465f43544560c81b6044820152606490fd5b156200607357565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e435760c81b6044820152606490fd5b908160a09103126200053f576040519060a08201908282106001600160401b03831117620016b5576080916040528051620060dd8162000544565b83526020810151620060ef81620010d7565b60208401526040810151604084015260608101516060840152015160068110156200053f57608082015290565b156200612457565b60405162461bcd60e51b8152602060048201526008602482015267414b465f4e4d544f60c01b6044820152606490fd5b156200615c57565b60405162461bcd60e51b815260206004820152600860248201526720a5a32fa0a124ad60c11b6044820152606490fd5b9192916001600160a01b0391908216620061a881151562005170565b600093818552609a60205283604086205416158015906200621d575b620061cf90620051a6565b813b156200621957608492918486926040519889978896630f08f3ff60e11b88521660048701526024860152166044840152600360648401525af18015620008e75762005f035750565b8480fd5b50609c60205260408520541515620061c4565b9093926001600160a01b039290918316906200624e82151562005170565b600093828552609a60205260408520541615801590620062c7575b6200627490620051a6565b813b15620016b157604051630f08f3ff60e11b81526001600160a01b0396871660048083019190915260248201929092529290951660448301526064820194909452919282908183816084810162005ef0565b50609c6020526040842054151562006269565b9192916001600160a01b0391908216620062f681151562005170565b600093818552609a602052836040862054161580159062006367575b6200631d90620051a6565b813b156200621957608492918486926040519889978896630f08f3ff60e11b88521660048701526024860152166044840152600560648401525af18015620008e75762005f035750565b50609c6020526040852054151562006312565b156200638257565b60405162461bcd60e51b81526020600482015260076024820152661052d197d394d560ca1b6044820152606490fd5b15620063b957565b60405162461bcd60e51b8152602060048201526007602482015266414b465f4e4d4f60c81b6044820152606490fd5b6001600160401b038111620016b55760051b60200190565b906200640c82620063e8565b6200641b60405191826200305a565b82815280926200642e601f1991620063e8565b019060005b8281106200644057505050565b80606060208093850101520162006433565b600019811462005c775760010190565b634e487b7160e01b600052603260045260246000fd5b9190811015620064bd5760051b81013590601e19813603018212156200053f5701908135916001600160401b0383116200053f5760200182360381136200053f579190565b62006462565b908092918237016000815290565b3d1562006501573d90620064e5826200308d565b91620064f560405193846200305a565b82523d6000602084013e565b606090565b6020818303126200053f578051906001600160401b0382116200053f570181601f820112156200053f5780516200653d816200308d565b926200654d60405194856200305a565b818452602082840101116200053f5762001214916020808501910162002dbb565b9060206200121492818152019062002de0565b8051821015620064bd5760209160051b010190565b9066038d7ea4c680009182810292818404149015171562005c7757565b600181901b91906001600160ff1b0381160362005c7757565b90670de0b6b3a76400009182810292818404149015171562005c7757565b90600a820291808304600a149015171562005c7757565b906807dc477bc1cfa400009182810292818404149015171562005c7757565b8181029291811591840414171562005c7757565b80156200664857670de0b6b3a76400000490565b634e487b7160e01b600052601260045260246000fd5b604d811162005c7757600a0a90565b6040516318160ddd60e01b815290939092602090849060049082906001600160a01b03165afa928315620008e7576000936200671c575b5060009384935b60068510620066bc57505050505090565b620066d3620066cd8697966200665e565b62006634565b945b83620066ef620066e6888462006772565b848887620068dd565b11620067075785620067019162006772565b620066d5565b956200671591955062006452565b93620066ab565b6200673991935060203d811162000a6c5762000a5b81836200305a565b9138620066a4565b906001820180921162005c7757565b90620f4240820180921162005c7757565b90620186a0820180921162005c7757565b9190820180921162005c7757565b909164e8d4a510009004620f4240928382101580620068d4575b15620068a7576200121493620068996200687b62006875620068676200685e6200685888620068526200680f620068166200680f620067e985620068a19f620067e39062005c65565b62006620565b6200680862006802620067fc8862005c65565b620065b3565b62006750565b9062006620565b6006900490565b926200680862006802620067fc6200683a6200684b620068406200683a8762005c65565b62006761565b620068088762006761565b9462005c65565b62005c7d565b620065cc565b62040740900490565b670de0b6b3a7640000900490565b62006741565b94826200688f62ffffff8093168862006620565b0493168562006620565b049262006772565b62006772565b60405162461bcd60e51b815260206004820152600560248201526404e4d5f49560dc1b6044820152606490fd5b5060016200679a565b64e8d4a51000938490049390920490620f424080831015806200698f575b15620068a757620068996200687b62006875620068676200685e62006858620012149a620068526200680f8b6200680862006802620067fc620068a19f6200680f6200695082620067e3620069639462005c65565b6200680862006802620067fc8962005c65565b96620068a1620069886200697c83620068a18962005c65565b62006808848962006772565b9562005c65565b506001851015620068fb565b6040516370a0823160e01b81526001600160a01b0383811660048301526020949216918482602481865afa928315620008e75762006a1394869360009562006a59575b50604051636eb1769f60e11b81526001600160a01b039182166004820152921660248301529093849190829081906044820190565b03915afa918215620008e757620012149360009362006a35575b505062006a7d565b62006a50929350803d1062000a6c5762000a5b81836200305a565b90388062006a2d565b62006a75919550843d861162000a6c5762000a5b81836200305a565b9338620069de565b908082101562006a8b575090565b905090565b6040516318160ddd60e01b815295929493929190602090879060049082906001600160a01b03165afa958615620008e75760009662006ba6575b5060009586955b600687111562006ae5575050505050505090565b9091929394959762006afb620066cd8a6200665e565b975b8762006b2b62006b2562006b1d62006b168d8662006772565b8862006772565b868962006780565b620065ea565b11801562006b91575b801562006b6f575b62006b53578862006b4d9162006772565b62006afd565b97509762006b68909695949392919662006452565b9562006ad1565b508562006b8a62006b818b8462006772565b868689620068dd565b1162006b3c565b508662006b9f8a8362006772565b1162006b34565b62006bc391965060203d811162000a6c5762000a5b81836200305a565b943862006aca565b908160209103126200053f57516200121481620010d7565b60405163a9059cbb60e01b602082019081526001600160a01b0390931660248201526044810193909352600092839290839062006c2e81606481015b03601f1981018352826200305a565b51925af162006c3c620064d1565b8162006ca7575b501562006c4c57565b60405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201526c185b9cd9995c8819985a5b1959609a1b6064820152608490fd5b805180159250821562006cbe575b50503862006c43565b62006cd3925060208091830101910162006bcb565b388062006cb5565b6040516323b872dd60e01b602082019081526001600160a01b0392831660248301529190921660448301526064820192909252600091829162006d22816084810162006c1f565b5190827343bda480de297a14cec95bfb1c6a313615f809ef5af162006d46620064d1565b8162006db5575b501562006d5657565b60405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604482015270185b9cd9995c919c9bdb4819985a5b1959607a1b6064820152608490fd5b805180159250821562006dcc575b50503862006d4d565b62006de1925060208091830101910162006bcb565b388062006dc3565b6040516323b872dd60e01b602082019081526001600160a01b039384166024830152939092166044830152606482019390935260009283929091839062006e34816084810162006c1f565b51925af162006d46620064d1565b60405160208101908082106001600160401b03831117620016b5576000938493848094938194604052525af162006e78620064d1565b501562006e8157565b60405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527308115512081d1c985b9cd9995c8819985a5b195960621b6064820152608490fdfe60a0806040523461002857336080526101a7908161002e823960805181818160410152608b0152f35b600080fdfe60806040526004361015610018575b3661007657610076565b6000803560e01c63c45a01551461002f575061000e565b346100735780600319360112610073577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b80fd5b60405163a8b8a55d60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610122576000916100ca575b5061012e565b60203d811161011b575b601f8101601f1916820167ffffffffffffffff81118382101761010757610101935060405281019061014d565b386100c4565b634e487b7160e01b84526041600452602484fd5b503d6100d4565b6040513d6000823e3d90fd5b6000808092368280378136915af43d82803e15610149573d90f35b3d90fd5b9081602091031261016c57516001600160a01b038116810361016c5790565b600080fdfea26469706673582212202144b141b34a6ae867daf0fa9374097fc97aacff3e58749d364914bfcd8836e664736f6c63430008130033a264697066735822122087371adabab4d014cf07d35c017722c92c14ef7bccaa4e13b86c3a4b5b35b15964736f6c63430008130033