Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- StreamingRewardsV3
- Optimization enabled
- true
- Compiler version
- v0.8.30+commit.73712a01
- Optimization runs
- 70
- EVM Version
- shanghai
- Verified at
- 2026-02-11T20:41:16.206767Z
Constructor Arguments
464154414c3a2041646d696e20726f6c65206772616e74206661696c65640000000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf7100000000000000000000000017e7b189982d8df2539d059b46467a09a7bcb91d000000000000000000000000ff27fbf6fd7d68af82473f68ebc665d2eacceaec
Arg [0] (address) : 0x20726f6c65206772616e74206661696c65640000
Arg [1] (address) : 0x644f10df242b43f3de45fcb3f6ef8526fb5fdf71
Arg [2] (address) : 0x17e7b189982d8df2539d059b46467a09a7bcb91d
contracts/AER/streamingrewardsv3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/**
* @title StreamingRewardsV2 - Bulletproof Edition
* @notice Auto-distributes streaming rewards with KEY boost mechanics
* @dev Oracle pays all gas fees for seamless UX
*
* HARDCODED POOLS (10 tokens):
* - AER, KEY, SINEZ, EQ, WPLS, PHEX, PLSX, INC, PTGC, UFO
*
* DEPLOYMENT: Only 3 parameters needed
* - _keyToken: 0x644F10dF242b43F3de45FCb3f6Ef8526fb5fdF71
* - _oracleSigner: Your Oracle wallet
* - _noExpectationsAddress: Treasury for 3% tax
*
* msg.sender automatically becomes admin - cannot fail!
*/
contract StreamingRewardsV3 is ReentrancyGuard, AccessControl, Pausable {
using SafeERC20 for IERC20;
using ECDSA for bytes32;
// ============ ROLES ============
bytes32 public constant ORACLE_ROLE = keccak256("ORACLE_ROLE");
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant EMERGENCY_ROLE = keccak256("EMERGENCY_ROLE");
// ============ STATE VARIABLES ============
IERC20 public immutable keyToken;
address public oracleSigner;
address public noExpectationsAddress;
// BULLETPROOF: Deployment info
address public immutable DEPLOYER;
address public immutable CONFIRMED_ADMIN;
uint256 public immutable DEPLOYMENT_BLOCK;
uint256 public immutable DEPLOYMENT_TIME;
// Security controls
uint256 public constant MAX_TOKEN_POOLS = 50;
uint256 public constant MAX_DISTRIBUTION_PER_ROUND = 1000000 * 10**18;
uint256 public constant MAX_USERS_PER_DISTRIBUTION = 200;
bool public emergencyPaused = false;
// Scaling constants
uint8 public constant CALCULATION_DECIMALS = 8;
// Nonce tracking
mapping(address => uint256) public userNonces;
mapping(bytes32 => bool) public usedSignatures;
struct TokenPool {
uint256 balance;
uint256 totalDeposited;
uint256 totalDistributed;
uint256 totalTaxPaid;
uint256 lastDistributionAmount;
uint256 distributionRate;
uint256 minDistributionRate;
uint256 maxDistributionRate;
uint256 balanceWeight;
uint256 demandScore;
bool isActive;
uint256 lastDistributionTime;
uint8 decimals;
}
struct UserStats {
uint256 totalReceived;
uint256 lastReceiveTime;
address preferredToken;
uint256 keyBalanceSnapshot;
uint256 totalStreamingTime;
uint256 lastStreamingSession;
uint256 consecutiveStreamDays;
bool isActiveStreamer;
uint256 lastNonceUsed;
}
struct DistributionRound {
uint256 timestamp;
uint256 totalDistributed;
uint256 totalTaxPaid;
uint256 participantCount;
uint256 keySupplySnapshot;
bool isUserTriggered;
address triggeredBy;
uint256 averageKeyBalance;
uint256 totalStreamingTime;
}
struct DistributionSummary {
uint256 totalUsers;
uint256 totalRewards;
uint256 totalTax;
uint256 totalStreamingTime;
uint256 totalKeyBalance;
}
// ============ MAPPINGS ============
mapping(address => TokenPool) public tokenPools;
mapping(address => bool) public supportedTokens;
mapping(address => UserStats) public userStats;
mapping(address => bool) public streamingStates;
mapping(uint256 => DistributionRound) public distributionHistory;
mapping(address => uint256) public userLastDistribution;
mapping(address => mapping(address => uint256)) public userTokenPreference;
address[] public tokenList;
// ============ CONFIGURATION ============
uint256 public noExpectationsTaxPercentage = 300; // 3%
// KEY boost parameters
uint256 public minKeyRequired = 145000000; // 1.45 KEY (8 decimals)
uint256 public maxBoostPercentage = 145; // 145% max boost
uint256 public boostDenominator = 145;
uint256 public streamingTimeMultiplier = 100;
uint256 public consecutiveDayBonus = 10;
// Distribution parameters
uint256 public constant DEFAULT_DISTRIBUTION_RATE = 500; // 5%
uint256 public constant ABSOLUTE_MIN_RATE = 100; // 1%
uint256 public constant ABSOLUTE_MAX_RATE = 2000; // 20%
uint256 public constant BALANCED_POOL_WEIGHT = 10000;
// System status
uint256 public currentRound;
uint256 public lastGlobalDistribution;
uint256 public totalActiveStreamers;
uint256 public autoDistributionCount;
bool public migrationEnabled = false;
address public migrationTarget;
mapping(address => bool) public tokensMigrated;
// ============ EVENTS ============
event RewardsAutoDistributed(
address indexed user,
address indexed token,
uint256 amount,
uint256 taxAmount,
uint256 keyBalance,
uint256 keyBoost,
uint256 streamingTime,
uint256 poolWeight
);
event BalancedDistributionExecuted(
uint256 round,
uint256 totalUsers,
uint256 totalRewards,
uint256 averageKeyBalance,
uint256 totalStreamingTime
);
event StreamingTimeAuthenticated(
address indexed user,
uint256 sessionTime,
uint256 totalTime,
bool consecutiveDay
);
event PoolRebalanced(
address indexed token,
uint256 oldWeight,
uint256 newWeight,
uint256 demandScore
);
event TokenPoolInitialized(
address indexed token,
uint256 distributionRate,
uint256 minRate,
uint256 maxRate
);
event NoExpectationsDistribution(address indexed token, uint256 amount);
event StreamingStateChanged(address indexed user, bool isStreaming);
event TokenPoolReplenished(address indexed token, uint256 amount, uint256 newBalance);
event PoolStatusChanged(address indexed token, bool isActive);
event EmergencyPauseToggled(bool paused, address triggeredBy);
event OracleChanged(address indexed oldOracle, address indexed newOracle);
event SecurityAlert(string alertType, address indexed user, uint256 value);
event AdminRolesGranted(address indexed admin, address indexed grantedBy);
// ============ MODIFIERS ============
modifier whenNotEmergencyPaused() {
require(!emergencyPaused, "Emergency pause active");
_;
}
modifier onlyOracle() {
require(hasRole(ORACLE_ROLE, msg.sender), "Only oracle");
_;
}
// ============ CONSTRUCTOR ============
constructor(
address _keyToken,
address _oracleSigner,
address _noExpectationsAddress
) {
// BULLETPROOF VALIDATION
require(msg.sender != address(0), "Impossible: msg.sender is zero");
require(_keyToken != address(0), "Invalid KEY token");
require(_keyToken.code.length > 0, "KEY token must be contract");
require(_oracleSigner != address(0), "Invalid oracle signer");
require(_noExpectationsAddress != address(0), "Invalid treasury address");
keyToken = IERC20(_keyToken);
oracleSigner = _oracleSigner;
noExpectationsAddress = _noExpectationsAddress;
// Store deployment info
DEPLOYER = msg.sender;
CONFIRMED_ADMIN = msg.sender;
DEPLOYMENT_BLOCK = block.number;
DEPLOYMENT_TIME = block.timestamp;
// Grant ALL roles to msg.sender (guaranteed non-zero)
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(ADMIN_ROLE, msg.sender);
_grantRole(EMERGENCY_ROLE, msg.sender);
_grantRole(ORACLE_ROLE, _oracleSigner);
emit AdminRolesGranted(msg.sender, msg.sender);
// Verify roles were granted
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "FATAL: Admin role grant failed");
require(hasRole(ADMIN_ROLE, msg.sender), "FATAL: Admin role grant failed");
require(hasRole(EMERGENCY_ROLE, msg.sender), "FATAL: Emergency role grant failed");
require(hasRole(ORACLE_ROLE, _oracleSigner), "FATAL: Oracle role grant failed");
// Initialize 10 hardcoded pools
_initializeHardcodedPools();
lastGlobalDistribution = block.timestamp;
// Verify pool count
require(tokenList.length == 10, "Pool initialization failed");
}
// ============ HARDCODED POOLS (10 TOKENS) ============
function _initializeHardcodedPools() internal {
// AER - 8 decimals
_addTokenPool(0x92337f43FB462163869342E72538744E030EAF55, 8);
// KEY - 8 decimals
_addTokenPool(0x644F10dF242b43F3de45FCb3f6Ef8526fb5fdF71, 8);
// SINEZ - 18 decimals
_addTokenPool(0x9A28F76c18eE03E65EA6703AbAec77c1b99ddF31, 18);
// EQ - 8 decimals
_addTokenPool(0x584CA8ac0e6cc966775B429610Be0Caa4AE182f0, 8);
// WPLS - 18 decimals
_addTokenPool(0xA1077a294dDE1B09bB078844df40758a5D0f9a27, 18);
// PHEX - 8 decimals
_addTokenPool(0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39, 8);
// PLSX - 18 decimals
_addTokenPool(0x95B303987A60C71504D99Aa1b13B4DA07b0790ab, 18);
// INC - 18 decimals
_addTokenPool(0x2fa878Ab3F87CC1C9737Fc071108F904c0B0C95d, 18);
// PTGC - 18 decimals
_addTokenPool(0x94534EeEe131840b1c0F61847c572228bdfDDE93, 18);
// UFO - 18 decimals
_addTokenPool(0x456548A9B56eFBbD89Ca0309edd17a9E20b04018, 18);
}
function _addTokenPool(address tokenAddress, uint8 decimals) internal {
require(tokenAddress != address(0), "Invalid token address");
require(!supportedTokens[tokenAddress], "Token already exists");
require(tokenList.length < MAX_TOKEN_POOLS, "Too many token pools");
tokenPools[tokenAddress] = TokenPool({
balance: 0,
totalDeposited: 0,
totalDistributed: 0,
totalTaxPaid: 0,
lastDistributionAmount: 0,
distributionRate: DEFAULT_DISTRIBUTION_RATE,
minDistributionRate: ABSOLUTE_MIN_RATE,
maxDistributionRate: ABSOLUTE_MAX_RATE,
balanceWeight: BALANCED_POOL_WEIGHT,
demandScore: 0,
isActive: false,
lastDistributionTime: block.timestamp,
decimals: decimals
});
supportedTokens[tokenAddress] = true;
tokenList.push(tokenAddress);
emit TokenPoolInitialized(tokenAddress, DEFAULT_DISTRIBUTION_RATE, ABSOLUTE_MIN_RATE, ABSOLUTE_MAX_RATE);
}
// ============ DEPLOYMENT VERIFICATION ============
function verifyDeployment() external view returns (
address deployerAddress,
bool deployerIsAdmin,
bool oracleIsSet,
uint256 poolCount,
uint256 blockNumber
) {
deployerAddress = DEPLOYER;
deployerIsAdmin = hasRole(DEFAULT_ADMIN_ROLE, DEPLOYER) &&
hasRole(ADMIN_ROLE, DEPLOYER) &&
hasRole(EMERGENCY_ROLE, DEPLOYER);
oracleIsSet = hasRole(ORACLE_ROLE, oracleSigner);
poolCount = tokenList.length;
blockNumber = DEPLOYMENT_BLOCK;
}
function getDeploymentInfo() external view returns (
address deployer,
address confirmedAdmin,
address oracle,
address treasury,
uint256 deployedAtBlock,
uint256 deployedAtTime,
uint256 pools
) {
return (
DEPLOYER,
CONFIRMED_ADMIN,
oracleSigner,
noExpectationsAddress,
DEPLOYMENT_BLOCK,
DEPLOYMENT_TIME,
tokenList.length
);
}
function isAdmin(address account) external view returns (bool) {
return hasRole(ADMIN_ROLE, account) || hasRole(DEFAULT_ADMIN_ROLE, account);
}
function getGuaranteedAdmin() external view returns (address) {
return DEPLOYER;
}
// ============ SCALING FUNCTIONS ============
function _scaleForCalculation(uint256 amount, uint8 decimals) internal pure returns (uint256) {
if (decimals <= CALCULATION_DECIMALS) {
return amount;
}
uint8 scaleFactor = decimals - CALCULATION_DECIMALS;
return amount / (10 ** uint256(scaleFactor));
}
function _scaleBackForTransfer(uint256 scaledAmount, uint8 decimals) internal pure returns (uint256) {
if (decimals <= CALCULATION_DECIMALS) {
return scaledAmount;
}
uint8 scaleFactor = decimals - CALCULATION_DECIMALS;
return scaledAmount * (10 ** uint256(scaleFactor));
}
// ============ AUTO DISTRIBUTION ============
function autoDistributeRewardsBalanced(
address[] calldata users,
uint256[] calldata streamingTimes,
address[] calldata preferredTokens,
uint256[] calldata nonces,
bytes calldata signature
) external nonReentrant onlyOracle whenNotPaused whenNotEmergencyPaused {
require(!migrationEnabled, "Auto-distribution disabled during migration");
_validateDistributionInput(users, streamingTimes, preferredTokens, nonces);
_verifyDistributionSignature(users, streamingTimes, preferredTokens, nonces, signature);
_verifyAndUpdateNonces(users, nonces);
uint256 totalDistributionValue = _preDistributionValidation(users, streamingTimes, preferredTokens);
_autoSyncBeforeDistribution();
_updatePoolWeights();
_executeBalancedDistribution(users, streamingTimes, preferredTokens, totalDistributionValue);
}
function _validateDistributionInput(
address[] calldata users,
uint256[] calldata streamingTimes,
address[] calldata preferredTokens,
uint256[] calldata nonces
) internal pure {
require(users.length == streamingTimes.length, "Array length mismatch");
require(streamingTimes.length == preferredTokens.length, "Array length mismatch");
require(preferredTokens.length == nonces.length, "Array length mismatch");
require(users.length <= MAX_USERS_PER_DISTRIBUTION, "Batch too large");
}
function _verifyDistributionSignature(
address[] calldata users,
uint256[] calldata streamingTimes,
address[] calldata preferredTokens,
uint256[] calldata nonces,
bytes calldata signature
) internal {
bytes32 messageHash = keccak256(abi.encode(
users,
streamingTimes,
preferredTokens,
nonces,
block.timestamp / 300
));
require(!usedSignatures[messageHash], "Signature already used");
usedSignatures[messageHash] = true;
bytes32 ethSignedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", messageHash));
require(ethSignedHash.recover(signature) == oracleSigner, "Invalid signature");
}
function _verifyAndUpdateNonces(
address[] calldata users,
uint256[] calldata nonces
) internal {
for (uint i = 0; i < users.length; i++) {
require(nonces[i] == userNonces[users[i]] + 1, "Invalid nonce");
userNonces[users[i]] = nonces[i];
userStats[users[i]].lastNonceUsed = nonces[i];
}
}
function _preDistributionValidation(
address[] calldata users,
uint256[] calldata streamingTimes,
address[] calldata preferredTokens
) internal view returns (uint256 totalValue) {
uint256 totalNetworkWeight = _calculateTotalNetworkWeight(users, streamingTimes);
require(totalNetworkWeight > 0, "No eligible users");
for (uint i = 0; i < users.length; i++) {
if (streamingTimes[i] > 0) {
(uint256 reward,) = _calculateBalancedReward(
users[i],
streamingTimes[i],
preferredTokens[i],
totalNetworkWeight
);
totalValue = totalValue + reward;
}
}
require(totalValue <= MAX_DISTRIBUTION_PER_ROUND, "Distribution exceeds safety limit");
}
function _executeBalancedDistribution(
address[] calldata users,
uint256[] calldata streamingTimes,
address[] calldata preferredTokens,
uint256 totalDistributionValue
) internal {
require(users.length <= MAX_USERS_PER_DISTRIBUTION, "Too many users");
require(totalDistributionValue <= MAX_DISTRIBUTION_PER_ROUND, "Distribution too large");
uint256 totalNetworkWeight = _calculateTotalNetworkWeight(users, streamingTimes);
DistributionSummary memory summary;
for (uint i = 0; i < users.length; i++) {
_processUserDistribution(
users[i],
streamingTimes[i],
preferredTokens[i],
totalNetworkWeight,
summary
);
}
_finalizeBalancedDistribution(
summary.totalUsers,
summary.totalRewards,
summary.totalTax,
summary.totalStreamingTime,
summary.totalKeyBalance
);
}
function _processUserDistribution(
address user,
uint256 streamingTime,
address preferredToken,
uint256 totalNetworkWeight,
DistributionSummary memory summary
) internal {
if (streamingTime == 0) return;
_authenticateStreamingTime(user, streamingTime);
(uint256 reward, uint256 tax) = _calculateBalancedReward(
user,
streamingTime,
preferredToken,
totalNetworkWeight
);
if (reward > 0) {
require(tokenPools[preferredToken].balance >= reward + tax, "Insufficient pool balance");
_distributeReward(user, preferredToken, reward, tax);
summary.totalUsers = summary.totalUsers + 1;
summary.totalRewards = summary.totalRewards + reward;
summary.totalTax = summary.totalTax + tax;
summary.totalStreamingTime = summary.totalStreamingTime + streamingTime;
summary.totalKeyBalance = summary.totalKeyBalance + userStats[user].keyBalanceSnapshot;
emit RewardsAutoDistributed(
user,
preferredToken,
reward,
tax,
userStats[user].keyBalanceSnapshot,
_getKeyBoostPercentage(user),
streamingTime,
tokenPools[preferredToken].balanceWeight
);
}
}
function _calculateBalancedReward(
address user,
uint256 streamingTime,
address preferredToken,
uint256 totalNetworkWeight
) internal view returns (uint256 reward, uint256 tax) {
(, uint256 userKeyBalance, bool hasEnoughKey) = calculateKeyBoost(user);
if (!hasEnoughKey) return (0, 0);
if (!tokenPools[preferredToken].isActive || tokenPools[preferredToken].balance == 0) {
return (0, 0);
}
uint256 userWeight = _calculateUserWeightSafe(user, streamingTime, userKeyBalance);
return _calculateRewardFromWeight(preferredToken, userWeight, totalNetworkWeight);
}
function _calculateRewardFromWeight(
address preferredToken,
uint256 userWeight,
uint256 totalNetworkWeight
) internal view returns (uint256 reward, uint256 tax) {
TokenPool memory pool = tokenPools[preferredToken];
uint256 poolDistribution = (pool.balance * pool.distributionRate) / 10000;
uint256 scaledDistribution = _scaleForCalculation(poolDistribution, pool.decimals);
uint256 scaledWeightedDistribution = (scaledDistribution * pool.balanceWeight) / BALANCED_POOL_WEIGHT;
if (totalNetworkWeight > 0) {
uint256 scaledReward = (scaledWeightedDistribution * userWeight) / totalNetworkWeight;
reward = _scaleBackForTransfer(scaledReward, pool.decimals);
tax = (reward * noExpectationsTaxPercentage) / 10000;
uint256 totalCost = reward + tax;
if (totalCost > pool.balance) {
uint256 adjustmentFactor = (pool.balance * 10000) / totalCost;
reward = (reward * adjustmentFactor) / 10000;
tax = (tax * adjustmentFactor) / 10000;
}
}
}
function _calculateUserWeightSafe(
address user,
uint256 streamingTime,
uint256 keyBalance
) internal view returns (uint256) {
require(streamingTime <= type(uint256).max / streamingTimeMultiplier, "Streaming time overflow");
uint256 baseWeight = streamingTime * streamingTimeMultiplier;
uint256 keySupply = keyToken.totalSupply();
uint256 keyWeight = 0;
if (keyBalance > 0 && keySupply > 0) {
uint256 keyPercentage = (keyBalance * 10000) / keySupply;
keyWeight = _sqrt(keyPercentage * 1000);
}
uint256 boostPercentage = _getKeyBoostPercentage(user);
uint256 boostMultiplier = 10000 + (boostPercentage * 100);
uint256 consecutiveBonus = userStats[user].consecutiveStreamDays * consecutiveDayBonus;
consecutiveBonus = consecutiveBonus > 50 ? 50 : consecutiveBonus;
uint256 totalWeight = baseWeight + keyWeight;
require(totalWeight <= type(uint256).max / boostMultiplier, "Weight calculation overflow");
totalWeight = (totalWeight * boostMultiplier) / 10000;
uint256 consecutiveMultiplier = 10000 + (consecutiveBonus * 100);
require(totalWeight <= type(uint256).max / consecutiveMultiplier, "Consecutive bonus overflow");
totalWeight = (totalWeight * consecutiveMultiplier) / 10000;
return totalWeight;
}
function _calculateTotalNetworkWeight(
address[] calldata users,
uint256[] calldata streamingTimes
) internal view returns (uint256 totalWeight) {
for (uint i = 0; i < users.length; i++) {
if (streamingTimes[i] > 0) {
uint256 keyBalance = keyToken.balanceOf(users[i]);
uint256 userWeight = _calculateUserWeightSafe(users[i], streamingTimes[i], keyBalance);
totalWeight = totalWeight + userWeight;
}
}
}
function _authenticateStreamingTime(address user, uint256 sessionTime) internal {
UserStats storage stats = userStats[user];
require(stats.totalStreamingTime <= type(uint256).max - sessionTime, "Total streaming time overflow");
stats.totalStreamingTime = stats.totalStreamingTime + sessionTime;
stats.lastStreamingSession = block.timestamp;
stats.keyBalanceSnapshot = keyToken.balanceOf(user);
bool consecutiveDay = false;
if (stats.lastReceiveTime > 0) {
uint256 daysSinceLastReward = (block.timestamp - stats.lastReceiveTime) / 86400;
if (daysSinceLastReward == 1) {
stats.consecutiveStreamDays = stats.consecutiveStreamDays >= 5 ? 5 : stats.consecutiveStreamDays + 1;
consecutiveDay = true;
} else if (daysSinceLastReward > 1) {
stats.consecutiveStreamDays = 1;
}
} else {
stats.consecutiveStreamDays = 1;
}
emit StreamingTimeAuthenticated(user, sessionTime, stats.totalStreamingTime, consecutiveDay);
}
function _updatePoolWeights() internal {
for (uint i = 0; i < tokenList.length && i < MAX_TOKEN_POOLS; i++) {
address token = tokenList[i];
TokenPool storage pool = tokenPools[token];
if (!pool.isActive) continue;
uint256 timeSinceLastDistribution = block.timestamp - pool.lastDistributionTime;
uint256 demandDecay = timeSinceLastDistribution > 86400 ? 86400 : timeSinceLastDistribution;
pool.demandScore = pool.demandScore > demandDecay ? pool.demandScore - demandDecay : 0;
uint256 oldWeight = pool.balanceWeight;
uint256 balanceFactor = pool.balance > 0 ? (pool.balance * 1000) / (pool.balance + pool.totalDistributed) : 0;
uint256 demandFactor = pool.demandScore > 1000 ? 1000 : pool.demandScore;
pool.balanceWeight = BALANCED_POOL_WEIGHT + balanceFactor + demandFactor;
if (oldWeight != pool.balanceWeight) {
emit PoolRebalanced(token, oldWeight, pool.balanceWeight, pool.demandScore);
}
}
}
function _distributeReward(
address user,
address token,
uint256 amount,
uint256 tax
) internal {
TokenPool storage pool = tokenPools[token];
uint256 totalCost = amount + tax;
require(pool.balance >= totalCost, "Insufficient pool balance");
pool.balance = pool.balance - totalCost;
pool.totalDistributed = pool.totalDistributed + amount;
pool.totalTaxPaid = pool.totalTaxPaid + tax;
pool.lastDistributionAmount = amount;
pool.lastDistributionTime = block.timestamp;
pool.demandScore = pool.demandScore + 100;
UserStats storage stats = userStats[user];
stats.totalReceived = stats.totalReceived + amount;
stats.lastReceiveTime = block.timestamp;
stats.preferredToken = token;
IERC20(token).safeTransfer(user, amount);
if (tax > 0) {
IERC20(token).safeTransfer(noExpectationsAddress, tax);
emit NoExpectationsDistribution(token, tax);
}
userTokenPreference[user][token] = userTokenPreference[user][token] + 10;
}
function _finalizeBalancedDistribution(
uint256 totalUsers,
uint256 totalRewards,
uint256 totalTax,
uint256 totalStreamingTime,
uint256 totalKeyBalance
) internal {
currentRound = currentRound + 1;
DistributionRound storage round = distributionHistory[currentRound];
round.timestamp = block.timestamp;
round.totalDistributed = totalRewards;
round.totalTaxPaid = totalTax;
round.participantCount = totalUsers;
round.keySupplySnapshot = keyToken.totalSupply();
round.isUserTriggered = false;
round.triggeredBy = oracleSigner;
round.averageKeyBalance = totalUsers > 0 ? totalKeyBalance / totalUsers : 0;
round.totalStreamingTime = totalStreamingTime;
lastGlobalDistribution = block.timestamp;
autoDistributionCount = autoDistributionCount + 1;
emit BalancedDistributionExecuted(
currentRound,
totalUsers,
totalRewards,
round.averageKeyBalance,
totalStreamingTime
);
}
// ============ POOL MANAGEMENT ============
function fundPool(address token, uint256 amount) external nonReentrant whenNotPaused {
require(supportedTokens[token], "Token not supported");
require(amount > 0, "Amount must be greater than 0");
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
TokenPool storage pool = tokenPools[token];
pool.balance = pool.balance + amount;
pool.totalDeposited = pool.totalDeposited + amount;
if (!pool.isActive) {
pool.isActive = true;
emit PoolStatusChanged(token, true);
}
emit TokenPoolReplenished(token, amount, pool.balance);
}
function getDistributionAmount(address token) public view returns (uint256) {
TokenPool memory pool = tokenPools[token];
if (!pool.isActive || pool.balance == 0) return 0;
return (pool.balance * pool.distributionRate) / 10000;
}
function _autoSyncBeforeDistribution() internal {
for (uint i = 0; i < tokenList.length && i < MAX_TOKEN_POOLS; i++) {
address token = tokenList[i];
if (!migrationEnabled || !tokensMigrated[token]) {
uint256 actualBalance = IERC20(token).balanceOf(address(this));
uint256 expectedBalance = tokenPools[token].balance;
if (actualBalance > expectedBalance) {
uint256 increase = actualBalance - expectedBalance;
TokenPool storage pool = tokenPools[token];
pool.balance = actualBalance;
pool.totalDeposited = pool.totalDeposited + increase;
if (!pool.isActive) {
pool.isActive = true;
emit PoolStatusChanged(token, true);
}
emit TokenPoolReplenished(token, increase, pool.balance);
}
}
}
}
// ============ KEY BOOST ============
function calculateKeyBoost(address user) public view returns (uint256, uint256, bool) {
uint256 userKeyBalance = keyToken.balanceOf(user);
uint256 totalSupply = keyToken.totalSupply();
if (userKeyBalance < minKeyRequired || totalSupply == 0) {
return (0, userKeyBalance, false);
}
uint256 supplyPercentage = (userKeyBalance * 10000) / totalSupply;
uint256 boostPercentage = 100;
if (supplyPercentage >= boostDenominator) {
boostPercentage = maxBoostPercentage;
} else {
uint256 boostRange = maxBoostPercentage - 100;
boostPercentage = 100 + ((boostRange * supplyPercentage) / boostDenominator);
}
return (boostPercentage, userKeyBalance, true);
}
function _getKeyBoostPercentage(address user) internal view returns (uint256) {
(uint256 boostPercentage, , bool hasEnoughKey) = calculateKeyBoost(user);
return hasEnoughKey ? boostPercentage : 100;
}
function _sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 z = (x + 1) / 2;
uint256 y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
return y;
}
// ============ VIEW FUNCTIONS ============
function getUserRewardEstimate(address user, uint256 streamingTime) external view returns (
uint256 estimatedReward,
address recommendedToken,
uint256 userWeight,
uint256 boostPercentage
) {
uint256 keyBalance = keyToken.balanceOf(user);
userWeight = _calculateUserWeightSafe(user, streamingTime, keyBalance);
boostPercentage = _getKeyBoostPercentage(user);
recommendedToken = _getBestTokenForUser(user);
if (tokenPools[recommendedToken].isActive && tokenPools[recommendedToken].balance > 0) {
uint256 poolDistribution = getDistributionAmount(recommendedToken);
estimatedReward = (poolDistribution * userWeight) / (userWeight + 1000000);
}
}
function _getBestTokenForUser(address user) internal view returns (address bestToken) {
uint256 bestScore = 0;
bestToken = tokenList.length > 0 ? tokenList[0] : address(0);
for (uint i = 0; i < tokenList.length && i < MAX_TOKEN_POOLS; i++) {
address token = tokenList[i];
if (!tokenPools[token].isActive) continue;
uint256 score = userTokenPreference[user][token] + tokenPools[token].balanceWeight;
if (score > bestScore) {
bestScore = score;
bestToken = token;
}
}
}
function getSystemStatus() external view returns (
uint256 totalPools,
uint256 activePools,
uint256 totalRewardsDistributed,
uint256 currentRoundNumber,
uint256 lastDistributionTime,
uint256 totalStreamers
) {
totalPools = tokenList.length;
currentRoundNumber = currentRound;
lastDistributionTime = lastGlobalDistribution;
totalStreamers = totalActiveStreamers;
for (uint i = 0; i < tokenList.length && i < MAX_TOKEN_POOLS; i++) {
if (tokenPools[tokenList[i]].isActive) {
activePools = activePools + 1;
}
totalRewardsDistributed = totalRewardsDistributed + tokenPools[tokenList[i]].totalDistributed;
}
}
function getPoolInfo(address token) external view returns (
uint256 balance,
uint256 totalDeposited,
uint256 totalDistributed,
uint256 distributionRate,
bool isActive,
uint256 nextDistribution,
uint8 decimals
) {
TokenPool memory pool = tokenPools[token];
return (
pool.balance,
pool.totalDeposited,
pool.totalDistributed,
pool.distributionRate,
pool.isActive,
getDistributionAmount(token),
pool.decimals
);
}
function getUserStats(address user) external view returns (
uint256 totalReceived,
uint256 lastReceiveTime,
address preferredToken,
uint256 totalStreamingTime,
uint256 consecutiveStreamDays,
uint256 currentNonce
) {
UserStats memory stats = userStats[user];
return (
stats.totalReceived,
stats.lastReceiveTime,
stats.preferredToken,
stats.totalStreamingTime,
stats.consecutiveStreamDays,
userNonces[user]
);
}
function getAllSupportedTokens() external view returns (address[] memory) {
return tokenList;
}
function getTokenPoolCount() external view returns (uint256) {
return tokenList.length;
}
function isTokenSupported(address tokenAddress) external view returns (bool) {
return supportedTokens[tokenAddress];
}
// ============ ADMIN POOL MANAGEMENT ============
function addNewTokenPool(
address tokenAddress,
uint8 decimals,
uint256 distributionRate
) external onlyRole(ADMIN_ROLE) {
require(tokenAddress != address(0), "Invalid token address");
require(!supportedTokens[tokenAddress], "Token already exists");
require(tokenList.length < MAX_TOKEN_POOLS, "Too many token pools");
require(distributionRate >= ABSOLUTE_MIN_RATE && distributionRate <= ABSOLUTE_MAX_RATE, "Invalid rate");
tokenPools[tokenAddress] = TokenPool({
balance: 0,
totalDeposited: 0,
totalDistributed: 0,
totalTaxPaid: 0,
lastDistributionAmount: 0,
distributionRate: distributionRate,
minDistributionRate: ABSOLUTE_MIN_RATE,
maxDistributionRate: ABSOLUTE_MAX_RATE,
balanceWeight: BALANCED_POOL_WEIGHT,
demandScore: 0,
isActive: false,
lastDistributionTime: block.timestamp,
decimals: decimals
});
supportedTokens[tokenAddress] = true;
tokenList.push(tokenAddress);
emit TokenPoolInitialized(tokenAddress, distributionRate, ABSOLUTE_MIN_RATE, ABSOLUTE_MAX_RATE);
}
function removeTokenPool(address tokenAddress) external onlyRole(ADMIN_ROLE) {
require(supportedTokens[tokenAddress], "Token not found");
require(tokenPools[tokenAddress].balance == 0, "Pool must be empty");
supportedTokens[tokenAddress] = false;
for (uint i = 0; i < tokenList.length; i++) {
if (tokenList[i] == tokenAddress) {
tokenList[i] = tokenList[tokenList.length - 1];
tokenList.pop();
break;
}
}
delete tokenPools[tokenAddress];
emit PoolStatusChanged(tokenAddress, false);
}
function updatePoolDistributionRate(
address tokenAddress,
uint256 newRate
) external onlyRole(ADMIN_ROLE) {
require(supportedTokens[tokenAddress], "Token not found");
require(newRate >= ABSOLUTE_MIN_RATE && newRate <= ABSOLUTE_MAX_RATE, "Invalid rate");
tokenPools[tokenAddress].distributionRate = newRate;
emit TokenPoolInitialized(tokenAddress, newRate, ABSOLUTE_MIN_RATE, ABSOLUTE_MAX_RATE);
}
function syncAllPoolBalances() external onlyRole(ADMIN_ROLE) {
for (uint i = 0; i < tokenList.length; i++) {
_syncPoolBalance(tokenList[i]);
}
}
function _syncPoolBalance(address tokenAddress) internal {
if (!supportedTokens[tokenAddress]) return;
uint256 actualBalance = IERC20(tokenAddress).balanceOf(address(this));
uint256 trackedBalance = tokenPools[tokenAddress].balance;
if (actualBalance > trackedBalance) {
uint256 newDeposits = actualBalance - trackedBalance;
TokenPool storage pool = tokenPools[tokenAddress];
pool.balance = actualBalance;
pool.totalDeposited = pool.totalDeposited + newDeposits;
if (!pool.isActive) {
pool.isActive = true;
emit PoolStatusChanged(tokenAddress, true);
}
emit TokenPoolReplenished(tokenAddress, newDeposits, pool.balance);
}
}
// ============ ADMIN FUNCTIONS ============
function setNoExpectationsTaxPercentage(uint256 _taxPercentage) external onlyRole(ADMIN_ROLE) {
require(_taxPercentage <= 1000, "Tax cannot exceed 10%");
noExpectationsTaxPercentage = _taxPercentage;
}
function setStreamingState(address user, bool isStreaming) external onlyOracle {
streamingStates[user] = isStreaming;
userStats[user].isActiveStreamer = isStreaming;
emit StreamingStateChanged(user, isStreaming);
}
function updateKeyParameters(
uint256 _minKeyRequired,
uint256 _maxBoostPercentage,
uint256 _boostDenominator
) external onlyRole(ADMIN_ROLE) {
require(_maxBoostPercentage >= 100 && _maxBoostPercentage <= 500, "Invalid boost percentage");
require(_boostDenominator > 0 && _boostDenominator <= 1000, "Invalid boost denominator");
minKeyRequired = _minKeyRequired;
maxBoostPercentage = _maxBoostPercentage;
boostDenominator = _boostDenominator;
}
function setOracleSigner(address newOracle) external onlyRole(ADMIN_ROLE) {
require(newOracle != address(0), "Invalid oracle address");
address oldOracle = oracleSigner;
_revokeRole(ORACLE_ROLE, oldOracle);
_grantRole(ORACLE_ROLE, newOracle);
oracleSigner = newOracle;
emit OracleChanged(oldOracle, newOracle);
}
function setNoExpectationsAddress(address newTreasury) external onlyRole(ADMIN_ROLE) {
require(newTreasury != address(0), "Invalid treasury address");
noExpectationsAddress = newTreasury;
}
// ============ SECURITY FUNCTIONS ============
function emergencyPause() external onlyRole(EMERGENCY_ROLE) {
emergencyPaused = true;
emit EmergencyPauseToggled(true, msg.sender);
emit SecurityAlert("EMERGENCY_PAUSE", msg.sender, block.timestamp);
}
function emergencyUnpause() external onlyRole(ADMIN_ROLE) {
emergencyPaused = false;
emit EmergencyPauseToggled(false, msg.sender);
}
function pause() external onlyRole(ADMIN_ROLE) {
_pause();
}
function unpause() external onlyRole(ADMIN_ROLE) {
_unpause();
}
// ============ EMERGENCY FUNCTIONS ============
function emergencyWithdraw(address token, uint256 amount) external onlyRole(EMERGENCY_ROLE) {
require(emergencyPaused, "Emergency not active");
IERC20(token).safeTransfer(msg.sender, amount);
if (supportedTokens[token]) {
TokenPool storage pool = tokenPools[token];
pool.balance = pool.balance >= amount ? pool.balance - amount : 0;
}
emit SecurityAlert("EMERGENCY_WITHDRAWAL", msg.sender, amount);
}
function emergencyDisablePool(address token) external onlyRole(EMERGENCY_ROLE) {
tokenPools[token].isActive = false;
emit PoolStatusChanged(token, false);
emit SecurityAlert("POOL_EMERGENCY_DISABLED", token, 0);
}
function emergencyResetUserNonce(address user, uint256 newNonce) external onlyRole(EMERGENCY_ROLE) {
require(emergencyPaused, "Emergency not active");
userNonces[user] = newNonce;
emit SecurityAlert("NONCE_RESET", user, newNonce);
}
// ============ MIGRATION FUNCTIONS ============
function enableMigration(address _migrationTarget) external onlyRole(ADMIN_ROLE) {
require(_migrationTarget != address(0), "Invalid address");
migrationEnabled = true;
migrationTarget = _migrationTarget;
emit SecurityAlert("MIGRATION_ENABLED", _migrationTarget, 0);
}
function disableMigration() external onlyRole(ADMIN_ROLE) {
migrationEnabled = false;
migrationTarget = address(0);
emit SecurityAlert("MIGRATION_DISABLED", address(0), 0);
}
function migrateTokens(address[] calldata tokens) external onlyRole(ADMIN_ROLE) {
require(migrationEnabled, "Migration not enabled");
require(migrationTarget != address(0), "Migration target not set");
for (uint i = 0; i < tokens.length; i++) {
address token = tokens[i];
if (!tokensMigrated[token]) {
uint256 balance = IERC20(token).balanceOf(address(this));
if (balance > 0) {
IERC20(token).safeTransfer(migrationTarget, balance);
tokensMigrated[token] = true;
if (supportedTokens[token]) {
tokenPools[token].balance = 0;
}
emit SecurityAlert("TOKEN_MIGRATED", token, balance);
}
}
}
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";
/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}
/ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile 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 {MessageHashUtils-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]
*/
function tryRecover(
bytes32 hash,
bytes memory signature
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
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.
assembly ("memory-safe") {
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, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
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[ERC-2098 short signatures]
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
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.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
// 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, s);
}
// 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, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @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, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)
pragma solidity >=0.8.4;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted to signal this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}
/ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":70,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"shanghai","compilationTarget":{"contracts/AER/streamingrewardsv3.sol":"StreamingRewardsV3"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_keyToken","internalType":"address"},{"type":"address","name":"_oracleSigner","internalType":"address"},{"type":"address","name":"_noExpectationsAddress","internalType":"address"}]},{"type":"error","name":"AccessControlBadConfirmation","inputs":[]},{"type":"error","name":"AccessControlUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"neededRole","internalType":"bytes32"}]},{"type":"error","name":"ECDSAInvalidSignature","inputs":[]},{"type":"error","name":"ECDSAInvalidSignatureLength","inputs":[{"type":"uint256","name":"length","internalType":"uint256"}]},{"type":"error","name":"ECDSAInvalidSignatureS","inputs":[{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"error","name":"SafeERC20FailedOperation","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"event","name":"AdminRolesGranted","inputs":[{"type":"address","name":"admin","internalType":"address","indexed":true},{"type":"address","name":"grantedBy","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BalancedDistributionExecuted","inputs":[{"type":"uint256","name":"round","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalUsers","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalRewards","internalType":"uint256","indexed":false},{"type":"uint256","name":"averageKeyBalance","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalStreamingTime","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EmergencyPauseToggled","inputs":[{"type":"bool","name":"paused","internalType":"bool","indexed":false},{"type":"address","name":"triggeredBy","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"NoExpectationsDistribution","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OracleChanged","inputs":[{"type":"address","name":"oldOracle","internalType":"address","indexed":true},{"type":"address","name":"newOracle","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PoolRebalanced","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"oldWeight","internalType":"uint256","indexed":false},{"type":"uint256","name":"newWeight","internalType":"uint256","indexed":false},{"type":"uint256","name":"demandScore","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"PoolStatusChanged","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"bool","name":"isActive","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"RewardsAutoDistributed","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"taxAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"keyBalance","internalType":"uint256","indexed":false},{"type":"uint256","name":"keyBoost","internalType":"uint256","indexed":false},{"type":"uint256","name":"streamingTime","internalType":"uint256","indexed":false},{"type":"uint256","name":"poolWeight","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SecurityAlert","inputs":[{"type":"string","name":"alertType","internalType":"string","indexed":false},{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StreamingStateChanged","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"bool","name":"isStreaming","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"StreamingTimeAuthenticated","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"sessionTime","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalTime","internalType":"uint256","indexed":false},{"type":"bool","name":"consecutiveDay","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"TokenPoolInitialized","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"distributionRate","internalType":"uint256","indexed":false},{"type":"uint256","name":"minRate","internalType":"uint256","indexed":false},{"type":"uint256","name":"maxRate","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenPoolReplenished","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"newBalance","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"ABSOLUTE_MAX_RATE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"ABSOLUTE_MIN_RATE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BALANCED_POOL_WEIGHT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"CALCULATION_DECIMALS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"CONFIRMED_ADMIN","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DEFAULT_DISTRIBUTION_RATE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"DEPLOYER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DEPLOYMENT_BLOCK","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DEPLOYMENT_TIME","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"EMERGENCY_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_DISTRIBUTION_PER_ROUND","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_TOKEN_POOLS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_USERS_PER_DISTRIBUTION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ORACLE_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addNewTokenPool","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint8","name":"decimals","internalType":"uint8"},{"type":"uint256","name":"distributionRate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"autoDistributeRewardsBalanced","inputs":[{"type":"address[]","name":"users","internalType":"address[]"},{"type":"uint256[]","name":"streamingTimes","internalType":"uint256[]"},{"type":"address[]","name":"preferredTokens","internalType":"address[]"},{"type":"uint256[]","name":"nonces","internalType":"uint256[]"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"autoDistributionCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"boostDenominator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bool","name":"","internalType":"bool"}],"name":"calculateKeyBoost","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"consecutiveDayBonus","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentRound","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableMigration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"uint256","name":"totalDistributed","internalType":"uint256"},{"type":"uint256","name":"totalTaxPaid","internalType":"uint256"},{"type":"uint256","name":"participantCount","internalType":"uint256"},{"type":"uint256","name":"keySupplySnapshot","internalType":"uint256"},{"type":"bool","name":"isUserTriggered","internalType":"bool"},{"type":"address","name":"triggeredBy","internalType":"address"},{"type":"uint256","name":"averageKeyBalance","internalType":"uint256"},{"type":"uint256","name":"totalStreamingTime","internalType":"uint256"}],"name":"distributionHistory","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyDisablePool","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyPause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"emergencyPaused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyResetUserNonce","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"newNonce","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyUnpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableMigration","inputs":[{"type":"address","name":"_migrationTarget","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"fundPool","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getAllSupportedTokens","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"deployer","internalType":"address"},{"type":"address","name":"confirmedAdmin","internalType":"address"},{"type":"address","name":"oracle","internalType":"address"},{"type":"address","name":"treasury","internalType":"address"},{"type":"uint256","name":"deployedAtBlock","internalType":"uint256"},{"type":"uint256","name":"deployedAtTime","internalType":"uint256"},{"type":"uint256","name":"pools","internalType":"uint256"}],"name":"getDeploymentInfo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDistributionAmount","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getGuaranteedAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"totalDeposited","internalType":"uint256"},{"type":"uint256","name":"totalDistributed","internalType":"uint256"},{"type":"uint256","name":"distributionRate","internalType":"uint256"},{"type":"bool","name":"isActive","internalType":"bool"},{"type":"uint256","name":"nextDistribution","internalType":"uint256"},{"type":"uint8","name":"decimals","internalType":"uint8"}],"name":"getPoolInfo","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalPools","internalType":"uint256"},{"type":"uint256","name":"activePools","internalType":"uint256"},{"type":"uint256","name":"totalRewardsDistributed","internalType":"uint256"},{"type":"uint256","name":"currentRoundNumber","internalType":"uint256"},{"type":"uint256","name":"lastDistributionTime","internalType":"uint256"},{"type":"uint256","name":"totalStreamers","internalType":"uint256"}],"name":"getSystemStatus","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenPoolCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"estimatedReward","internalType":"uint256"},{"type":"address","name":"recommendedToken","internalType":"address"},{"type":"uint256","name":"userWeight","internalType":"uint256"},{"type":"uint256","name":"boostPercentage","internalType":"uint256"}],"name":"getUserRewardEstimate","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"streamingTime","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalReceived","internalType":"uint256"},{"type":"uint256","name":"lastReceiveTime","internalType":"uint256"},{"type":"address","name":"preferredToken","internalType":"address"},{"type":"uint256","name":"totalStreamingTime","internalType":"uint256"},{"type":"uint256","name":"consecutiveStreamDays","internalType":"uint256"},{"type":"uint256","name":"currentNonce","internalType":"uint256"}],"name":"getUserStats","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTokenSupported","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"keyToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastGlobalDistribution","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxBoostPercentage","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"migrateTokens","inputs":[{"type":"address[]","name":"tokens","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"migrationEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"migrationTarget","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minKeyRequired","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"noExpectationsAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"noExpectationsTaxPercentage","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oracleSigner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeTokenPool","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"callerConfirmation","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNoExpectationsAddress","inputs":[{"type":"address","name":"newTreasury","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNoExpectationsTaxPercentage","inputs":[{"type":"uint256","name":"_taxPercentage","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOracleSigner","inputs":[{"type":"address","name":"newOracle","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStreamingState","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"bool","name":"isStreaming","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"streamingStates","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"streamingTimeMultiplier","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportedTokens","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"syncAllPoolBalances","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenList","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"totalDeposited","internalType":"uint256"},{"type":"uint256","name":"totalDistributed","internalType":"uint256"},{"type":"uint256","name":"totalTaxPaid","internalType":"uint256"},{"type":"uint256","name":"lastDistributionAmount","internalType":"uint256"},{"type":"uint256","name":"distributionRate","internalType":"uint256"},{"type":"uint256","name":"minDistributionRate","internalType":"uint256"},{"type":"uint256","name":"maxDistributionRate","internalType":"uint256"},{"type":"uint256","name":"balanceWeight","internalType":"uint256"},{"type":"uint256","name":"demandScore","internalType":"uint256"},{"type":"bool","name":"isActive","internalType":"bool"},{"type":"uint256","name":"lastDistributionTime","internalType":"uint256"},{"type":"uint8","name":"decimals","internalType":"uint8"}],"name":"tokenPools","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"tokensMigrated","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalActiveStreamers","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateKeyParameters","inputs":[{"type":"uint256","name":"_minKeyRequired","internalType":"uint256"},{"type":"uint256","name":"_maxBoostPercentage","internalType":"uint256"},{"type":"uint256","name":"_boostDenominator","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePoolDistributionRate","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"newRate","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"usedSignatures","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userLastDistribution","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userNonces","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"totalReceived","internalType":"uint256"},{"type":"uint256","name":"lastReceiveTime","internalType":"uint256"},{"type":"address","name":"preferredToken","internalType":"address"},{"type":"uint256","name":"keyBalanceSnapshot","internalType":"uint256"},{"type":"uint256","name":"totalStreamingTime","internalType":"uint256"},{"type":"uint256","name":"lastStreamingSession","internalType":"uint256"},{"type":"uint256","name":"consecutiveStreamDays","internalType":"uint256"},{"type":"bool","name":"isActiveStreamer","internalType":"bool"},{"type":"uint256","name":"lastNonceUsed","internalType":"uint256"}],"name":"userStats","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userTokenPreference","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"deployerAddress","internalType":"address"},{"type":"bool","name":"deployerIsAdmin","internalType":"bool"},{"type":"bool","name":"oracleIsSet","internalType":"bool"},{"type":"uint256","name":"poolCount","internalType":"uint256"},{"type":"uint256","name":"blockNumber","internalType":"uint256"}],"name":"verifyDeployment","inputs":[]}]
Contract Creation Code
0x6101206040526003805460ff60a01b1916905561012c600e556308a48640600f55609160108190556011556064601255600a6013556018805460ff19169055348015610049575f5ffd5b5060405161609f38038061609f83398101604081905261006891610a7e565b60015f556002805460ff19169055336100c85760405162461bcd60e51b815260206004820152601e60248201527f496d706f737369626c653a206d73672e73656e646572206973207a65726f000060448201526064015b60405180910390fd5b6001600160a01b0383166101125760405162461bcd60e51b815260206004820152601160248201527024b73b30b634b21025a2ac903a37b5b2b760791b60448201526064016100bf565b5f836001600160a01b03163b1161016b5760405162461bcd60e51b815260206004820152601a60248201527f4b455920746f6b656e206d75737420626520636f6e747261637400000000000060448201526064016100bf565b6001600160a01b0382166101c15760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206f7261636c65207369676e6572000000000000000000000060448201526064016100bf565b6001600160a01b0381166102175760405162461bcd60e51b815260206004820152601860248201527f496e76616c69642074726561737572792061646472657373000000000000000060448201526064016100bf565b6001600160a01b0383811660805260028054610100600160a81b031916610100858416810291909117909155600380546001600160a01b031916928416929092179091553360a081905260c08190524360e05242909152610279905f9061056f565b506102a47fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753361056f565b506102cf7fbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b263361056f565b506102fa7f68e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef18361056f565b50604051339081907ff4e5a0535ca1b773cc65460b8d0a0c4b3f84e26eb57f674733145ced837d6d1a905f90a3335f9081527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49602052604090205460ff166103915760405162461bcd60e51b815260206004820152601e60248201525f51602061607f5f395f51905f5260448201526064016100bf565b335f9081527f50efbde2d46c37e9785f1791697f77e94bb7b701e19f1930a668820722d37694602052604090205460ff166103fb5760405162461bcd60e51b815260206004820152601e60248201525f51602061607f5f395f51905f5260448201526064016100bf565b335f9081527f1614b4e5e0f135c54873c4dcd295a7b40f93a8d877405affc188cfd7b4f40ed2602052604090205460ff166104835760405162461bcd60e51b815260206004820152602260248201527f464154414c3a20456d657267656e637920726f6c65206772616e74206661696c604482015261195960f21b60648201526084016100bf565b6001600160a01b0382165f9081527ff7c11a6d0ec535894a90c88b42cba2ccb348cb15b5e3ad22a710d1d4ac632819602052604090205460ff166105095760405162461bcd60e51b815260206004820152601f60248201527f464154414c3a204f7261636c6520726f6c65206772616e74206661696c65640060448201526064016100bf565b610511610601565b42601555600d54600a146105675760405162461bcd60e51b815260206004820152601a60248201527f506f6f6c20696e697469616c697a6174696f6e206661696c656400000000000060448201526064016100bf565b505050610abe565b5f8281526001602090815260408083206001600160a01b038516845290915281205460ff166105f8575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45060016105fb565b505f5b92915050565b6106207392337f43fb462163869342e72538744e030eaf556008610739565b61063f73644f10df242b43f3de45fcb3f6ef8526fb5fdf716008610739565b61065e739a28f76c18ee03e65ea6703abaec77c1b99ddf316012610739565b61067d73584ca8ac0e6cc966775b429610be0caa4ae182f06008610739565b61069c73a1077a294dde1b09bb078844df40758a5d0f9a276012610739565b6106bb732b591e99afe9f32eaa6214f7b7629768c40eeb396008610739565b6106da7395b303987a60c71504d99aa1b13b4da07b0790ab6012610739565b6106f9732fa878ab3f87cc1c9737fc071108f904c0b0c95d6012610739565b6107187394534eeee131840b1c0f61847c572228bdfdde936012610739565b61073773456548a9b56efbbd89ca0309edd17a9e20b040186012610739565b565b6001600160a01b03821661078f5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e2061646472657373000000000000000000000060448201526064016100bf565b6001600160a01b0382165f9081526007602052604090205460ff16156107f75760405162461bcd60e51b815260206004820152601460248201527f546f6b656e20616c72656164792065786973747300000000000000000000000060448201526064016100bf565b600d546032116108495760405162461bcd60e51b815260206004820152601460248201527f546f6f206d616e7920746f6b656e20706f6f6c7300000000000000000000000060448201526064016100bf565b604051806101a001604052805f81526020015f81526020015f81526020015f81526020015f81526020016101f48152602001606481526020016107d0815260200161271081526020015f81526020015f151581526020014281526020018260ff1681525060065f846001600160a01b03166001600160a01b031681526020019081526020015f205f820151815f01556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015f6101000a81548160ff02191690831515021790555061016082015181600b015561018082015181600c015f6101000a81548160ff021916908360ff160217905550905050600160075f846001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff021916908315150217905550600d82908060018154018082558091505060019003905f5260205f20015f9091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b03167f0667ebf166f2e070e9507737efb78c89e4b4c34097b2f7fd0525696187a775336101f460646107d0604051610a57939291909283526020830191909152604082015260600190565b60405180910390a25050565b80516001600160a01b0381168114610a79575f5ffd5b919050565b5f5f5f60608486031215610a90575f5ffd5b610a9984610a63565b9250610aa760208501610a63565b9150610ab560408501610a63565b90509250925092565b60805160a05160c05160e05161010051615514610b6b5f395f8181610b7f0152610df901525f8181610b5d01528181610dbf01526120bc01525f81816106630152610b2801525f818161090101528181610b0601528181610c9a01528181611fd70152818161201e015261205c01525f81816105e201528181611698015281816125850152818161261301528181613a3101528181613ed601528181614269015261481701526155145ff3fe608060405234801561000f575f5ffd5b5060043610610423575f3560e01c80636f5f50f611610227578063ae4983101161012d578063c3d2c3c1116100bb578063c3d2c3c114610cc5578063cea64a8c14610da7578063d4d5887814610dba578063d547741f14610de1578063e84721cb14610df4578063f0360bad14610e1b578063f0e74bd214610ecd578063f32c8e9e14610ee0578063f5b9626514610ee9578063f978fd6114610ef2578063ff4ea29e14610f14575f5ffd5b8063ae49831014610ae5578063aeefffad14610af8578063b075381414610beb578063b0c67d9714610bfe578063b4f3df3114610c20578063b57328e014610c50578063b7fba9f614610c7a578063c0128a8814610c8d578063c1b8411a14610c95578063c2a44cf314610cbc575f5ffd5b80638a65d874116101b55780638a65d8741461096c5780638dbde93a14610a2557806391d1485414610a2e5780639457c1dc14610a4157806395ccea6714610a545780639d5ccea114610a675780639e7e0dc114610a7a5780639ead722214610aba578063a217fddf14610acd578063a4b6c17614610ad4578063adf5e30c14610add575f5ffd5b80636f5f50f6146108a457806375151b63146108b757806375b238fc146108e257806376fc5700146108f65780637ab46f1c146108ff5780637c5b4805146109255780637e2ecccb1461093f57806382fb0f3d146109525780638456cb591461095b5780638a19c8bc14610963575f5ffd5b80633564fe381161032c5780634a4e3bd5116102ba5780634a4e3bd5146107055780634c3fb3b51461070d5780634e43603a1461072c57806350299b411461081157806350c1d19d1461082457806351858e271461083e5780635b51acff146108465780635c975abb1461085e5780635ce521361461086957806368c4ac261461087157806368f2881c14610893575f5ffd5b80633564fe381461063657806335b944bf1461063e57806336568abe1461064b5780633ba825741461065e5780633be2b335146106855780633c18910b146106c05780633f4ba83a146106c957806341d384d9146106d157806344abc68c146106da57806348e74045146106e3575f5ffd5b806320df4359116103b457806320df435914610548578063248a9ca31461055c57806324d7806c1461057f578063259e50eb1461059257806327c830a91461059b57806328bff9db146105af5780632aa76bfa146105c25780632bfd5146146105ca5780632f076bf8146105dd5780632f2ff15d146106045780632f7801f414610617575f5ffd5b80630107e4721461042757806301ffc9a7146104455780630574ebac1461046857806306bfa9381461047d57806307e2cea5146104ca57806312cac02d146104ec57806315294f66146104f55780631709a61b146105085780631d7314411461052d5780631fb3402b14610535575b5f5ffd5b61042f610f27565b60405161043c9190614c56565b60405180910390f35b610458610453366004614ca1565b610f87565b604051901515815260200161043c565b61047b610476366004614ce3565b610fbd565b005b61049061048b366004614ce3565b61104d565b6040805197885260208801969096529486019390935260608501919091521515608084015260a083015260ff1660c082015260e00161043c565b6104de5f51602061545f5f395f51905f5281565b60405190815260200161043c565b6104de60135481565b61047b610503366004614cfc565b611138565b6002546105209061010090046001600160a01b031681565b60405161043c9190614d13565b6104de603281565b61047b610543366004614dab565b61119f565b6104de5f51602061543f5f395f51905f5281565b6104de61056a366004614cfc565b5f908152600160208190526040909120015490565b61045861058d366004614ce3565b611310565b6104de600e5481565b60035461045890600160a01b900460ff1681565b61047b6105bd366004614ce3565b611338565b6104de60c881565b61047b6105d8366004614ea6565b611437565b6105207f000000000000000000000000000000000000000000000000000000000000000081565b61047b610612366004614ece565b6115d4565b6104de610625366004614ce3565b60046020525f908152604090205481565b61047b6115ff565b6018546104589060ff1681565b61047b610659366004614ece565b611659565b6105207f000000000000000000000000000000000000000000000000000000000000000081565b610698610693366004614ea6565b611691565b604080519485526001600160a01b03909316602085015291830152606082015260800161043c565b6104de600f5481565b61047b6117c7565b6104de60175481565b6104de6101f481565b6104586106f1366004614ce3565b60096020525f908152604090205460ff1681565b61047b6117e9565b6104de61071b366004614ce3565b600b6020525f908152604090205481565b6107d661073a366004614ce3565b6001600160a01b039081165f8181526008602081815260408084208151610120810183528154808252600183015482860181905260028401549099168285018190526003840154606084015260048085015460808501819052600586015460a0860152600686015460c08601819052600787015460ff16151560e087015295909801546101009094019390935297875293529320549095919291565b6040805196875260208701959095526001600160a01b03909316938501939093526060840152608083019190915260a082015260c00161043c565b600354610520906001600160a01b031681565b61082c61184a565b60405161043c96959493929190614ef8565b61047b61192b565b6018546105209061010090046001600160a01b031681565b60025460ff16610458565b600d546104de565b61045861087f366004614ce3565b60076020525f908152604090205460ff1681565b6104de69d3c21bcecceda100000081565b61047b6108b2366004614ea6565b6119de565b6104586108c5366004614ce3565b6001600160a01b03165f9081526007602052604090205460ff1690565b6104de5f51602061549f5f395f51905f5281565b6104de60105481565b7f0000000000000000000000000000000000000000000000000000000000000000610520565b61092d600881565b60405160ff909116815260200161043c565b61047b61094d366004614ce3565b611a83565b6104de60115481565b61047b611ce0565b6104de60145481565b6109d361097a366004614ce3565b600860208190525f9182526040909120805460018201546002830154600384015460048501546005860154600687015460078801549790980154959794966001600160a01b039094169592949193909260ff9091169089565b60408051998a5260208a01989098526001600160a01b03909616968801969096526060870193909352608086019190915260a085015260c084015290151560e08301526101008201526101200161043c565b6104de61271081565b610458610a3c366004614ece565b611cff565b61047b610a4f366004614ce3565b611d29565b61047b610a62366004614ea6565b611dfc565b61047b610a75366004614ea6565b611ef3565b610a82611fd5565b604080516001600160a01b0390961686529315156020860152911515928401929092526060830191909152608082015260a00161043c565b610520610ac8366004614cfc565b6120e1565b6104de5f81565b6104de60155481565b61047b612109565b61047b610af3366004614ce3565b61217b565b610ba2600254600354600d547f0000000000000000000000000000000000000000000000000000000000000000937f00000000000000000000000000000000000000000000000000000000000000009361010090046001600160a01b039081169316917f0000000000000000000000000000000000000000000000000000000000000000917f00000000000000000000000000000000000000000000000000000000000000009190565b604080516001600160a01b039889168152968816602088015294871694860194909452949091166060840152608083015260a082019290925260c081019190915260e00161043c565b61047b610bf9366004614f20565b61222b565b610458610c0c366004614ce3565b60196020525f908152604090205460ff1681565b610c33610c2e366004614ce3565b61257f565b60408051938452602084019290925215159082015260600161043c565b6104de610c5e366004614f61565b600c60209081525f928352604080842090915290825290205481565b6104de610c88366004614ce3565b612730565b6104de606481565b6105207f000000000000000000000000000000000000000000000000000000000000000081565b6104de6107d081565b610d40610cd3366004614ce3565b600660208190525f918252604090912080546001820154600283015460038401546004850154600586015496860154600787015460088801546009890154600a8a0154600b8b0154600c909b0154999b989a9799969895979596949593949293919260ff9182169291168d565b604080519d8e5260208e019c909c529a8c019990995260608b019790975260808a019590955260a089019390935260c088019190915260e0870152610100860152610120850152151561014084015261016083015260ff166101808201526101a00161043c565b61047b610db5366004614f89565b61281e565b6104de7f000000000000000000000000000000000000000000000000000000000000000081565b61047b610def366004614ece565b6128f7565b6104de7f000000000000000000000000000000000000000000000000000000000000000081565b610e7e610e29366004614cfc565b600a6020525f9081526040902080546001820154600283015460038401546004850154600586015460068701546007909701549596949593949293919260ff8216926101009092046001600160a01b03169189565b60408051998a5260208a01989098529688019590955260608701939093526080860191909152151560a08501526001600160a01b031660c084015260e08301526101008201526101200161043c565b61047b610edb366004614fb2565b61291c565b6104de60125481565b6104de60165481565b610458610f00366004614cfc565b60056020525f908152604090205460ff1681565b61047b610f22366004614feb565b6129ba565b6060600d805480602002602001604051908101604052809291908181526020018280548015610f7d57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610f5f575b5050505050905090565b5f6001600160e01b03198216637965db0b60e01b1480610fb757506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f51602061549f5f395f51905f52610fd481612c0e565b6001600160a01b03821661102a5760405162461bcd60e51b8152602060048201526018602482015277496e76616c6964207472656173757279206164647265737360401b60448201526064015b60405180910390fd5b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381165f90815260066020818152604080842081516101a0810183528154808252600183015494820185905260028301549382018490526003830154606083015260048301546080830152600583015460a083018190529583015460c0830152600783015460e083015260088301546101008301526009830154610120830152600a83015460ff90811615156101408401819052600b850154610160850152600c909401541661018083015286958695869586958695869590949093929161111b8e612730565b61018090960151949e939d50919b50995097509195509350915050565b5f51602061549f5f395f51905f5261114f81612c0e565b6103e88211156111995760405162461bcd60e51b81526020600482015260156024820152745461782063616e6e6f74206578636565642031302560581b6044820152606401611021565b50600e55565b6111a7612c18565b6111be5f51602061545f5f395f51905f5233611cff565b6111da5760405162461bcd60e51b815260040161102190615029565b6111e2612c6f565b600354600160a01b900460ff16156112355760405162461bcd60e51b8152602060048201526016602482015275456d657267656e63792070617573652061637469766560501b6044820152606401611021565b60185460ff161561129c5760405162461bcd60e51b815260206004820152602b60248201527f4175746f2d646973747269627574696f6e2064697361626c656420647572696e60448201526a339036b4b3b930ba34b7b760a91b6064820152608401611021565b6112ac8a8a8a8a8a8a8a8a612cb7565b6112be8a8a8a8a8a8a8a8a8a8a612d61565b6112ca8a8a8686612f10565b5f6112d98b8b8b8b8b8b613088565b90506112e36131ff565b6112eb6133dc565b6112fa8b8b8b8b8b8b87613582565b5061130460015f55565b50505050505050505050565b5f6113285f51602061549f5f395f51905f5283611cff565b80610fb75750610fb75f83611cff565b5f51602061549f5f395f51905f5261134f81612c0e565b6001600160a01b03821661139e5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206f7261636c65206164647265737360501b6044820152606401611021565b60025461010090046001600160a01b03166113c65f51602061545f5f395f51905f5282613702565b506113de5f51602061545f5f395f51905f5284613774565b5060028054610100600160a81b0319166101006001600160a01b0386811691820292909217909255604051908316907f05cd89403c6bdeac21c2ff33de395121a31fa1bc2bf3adf4825f1f86e79969dd905f90a3505050565b61143f612c18565b611447612c6f565b6001600160a01b0382165f9081526007602052604090205460ff166114a45760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b6044820152606401611021565b5f81116114f35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401611021565b6115086001600160a01b0383163330846137e3565b6001600160a01b0382165f908152600660205260409020805461152c908390615062565b8155600181015461153e908390615062565b6001820155600a81015460ff1661158d57600a8101805460ff191660019081179091556040519081526001600160a01b038416905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038516915f51602061541f5f395f51905f52916115be91868252602082015260400190565b60405180910390a2506115d060015f55565b5050565b5f82815260016020819052604090912001546115ef81612c0e565b6115f98383613774565b50505050565b5f51602061549f5f395f51905f5261161681612c0e565b5f5b600d548110156115d057611651600d828154811061163857611638615075565b5f918252602090912001546001600160a01b031661384a565b600101611618565b6001600160a01b03811633146116825760405163334bd91960e11b815260040160405180910390fd5b61168c8282613702565b505050565b5f5f5f5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231886040518263ffffffff1660e01b81526004016116e29190614d13565b602060405180830381865afa1580156116fd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117219190615089565b905061172e8787836139c4565b925061173987613c74565b915061174487613c9b565b6001600160a01b0381165f908152600660205260409020600a015490945060ff16801561178757506001600160a01b0384165f9081526006602052604090205415155b156117bd575f61179685612730565b90506117a584620f4240615062565b6117af85836150a0565b6117b991906150b7565b9550505b5092959194509250565b5f51602061549f5f395f51905f526117de81612c0e565b6117e6613da6565b50565b5f51602061549f5f395f51905f5261180081612c0e565b6003805460ff60a01b191690556040517f81fb10540499dac6157b25576349c719be885b5774e4a0dda606c2f33947d51f9061183f905f9033906150d6565b60405180910390a150565b600d546014546015546016545f9283929091835b600d548110801561186f5750603281105b156119225760065f600d838154811061188a5761188a615075565b5f9182526020808320909101546001600160a01b031683528201929092526040019020600a015460ff16156118c7576118c4866001615062565b95505b60065f600d83815481106118dd576118dd615075565b5f9182526020808320909101546001600160a01b0316835282019290925260400190206002015461190e9086615062565b94508061191a816150ef565b91505061185e565b50909192939495565b5f51602061543f5f395f51905f5261194281612c0e565b6003805460ff60a01b1916600160a01b1790556040517f81fb10540499dac6157b25576349c719be885b5774e4a0dda606c2f33947d51f906119889060019033906150d6565b60405180910390a160408051818152600f918101919091526e454d455247454e43595f504155534560881b606082015242602082015233905f51602061547f5f395f51905f52906080015b60405180910390a250565b5f51602061543f5f395f51905f526119f581612c0e565b600354600160a01b900460ff16611a1e5760405162461bcd60e51b815260040161102190615107565b6001600160a01b0383165f818152600460209081526040918290208590558151828152600b928101929092526a1393d390d157d49154d15560aa1b606083015281018490525f51602061547f5f395f51905f52906080015b60405180910390a2505050565b5f51602061549f5f395f51905f52611a9a81612c0e565b6001600160a01b0382165f9081526007602052604090205460ff16611ad15760405162461bcd60e51b815260040161102190615135565b6001600160a01b0382165f9081526006602052604090205415611b2b5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c206d75737420626520656d70747960701b6044820152606401611021565b6001600160a01b0382165f908152600760205260408120805460ff191690555b600d54811015611c3f57826001600160a01b0316600d8281548110611b7257611b72615075565b5f918252602090912001546001600160a01b031603611c3757600d8054611b9b9060019061515e565b81548110611bab57611bab615075565b5f91825260209091200154600d80546001600160a01b039092169183908110611bd657611bd6615075565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550600d805480611c1257611c12615171565b5f8281526020902081015f1990810180546001600160a01b0319169055019055611c3f565b600101611b4b565b506001600160a01b0382165f8181526006602081815260408084208481556001810185905560028101859055600381018590556004810185905560058101859055928301849055600783018490556008830184905560098301849055600a8301805460ff19908116909155600b8401859055600c909301805490931690925590519182525f5160206154bf5f395f51905f5291015b60405180910390a25050565b5f51602061549f5f395f51905f52611cf781612c0e565b6117e6613df2565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f51602061549f5f395f51905f52611d4081612c0e565b6001600160a01b038216611d885760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401611021565b601880546001600160a01b03841661010081026001600160a81b0319909216919091176001179091556040515f51602061547f5f395f51905f5290611cd4905f90604080825260119082015270135251d490551253d397d1539050931151607a1b6060820152602081019190915260800190565b5f51602061543f5f395f51905f52611e1381612c0e565b600354600160a01b900460ff16611e3c5760405162461bcd60e51b815260040161102190615107565b611e506001600160a01b0384163384613e2f565b6001600160a01b0383165f9081526007602052604090205460ff1615611ea6576001600160a01b0383165f9081526006602052604090208054831115611e96575f611ea3565b8054611ea390849061515e565b90555b60408051818152601491810191909152731153515491d15390d657d5d2551211149055d05360621b60608201526020810183905233905f51602061547f5f395f51905f5290608001611a76565b5f51602061549f5f395f51905f52611f0a81612c0e565b6001600160a01b0383165f9081526007602052604090205460ff16611f415760405162461bcd60e51b815260040161102190615135565b60648210158015611f5457506107d08211155b611f705760405162461bcd60e51b815260040161102190615185565b6001600160a01b0383165f8181526006602052604090819020600501849055517f0667ebf166f2e070e9507737efb78c89e4b4c34097b2f7fd0525696187a7753390611a769085906064906107d0909283526020830191909152604082015260600190565b7f00000000000000000000000000000000000000000000000000000000000000005f8080806120048186611cff565b801561204257506120425f51602061549f5f395f51905f527f0000000000000000000000000000000000000000000000000000000000000000611cff565b801561208057506120805f51602061543f5f395f51905f527f0000000000000000000000000000000000000000000000000000000000000000611cff565b93506120ae5f51602061545f5f395f51905f52600260019054906101000a90046001600160a01b0316611cff565b600d549596949590949093507f000000000000000000000000000000000000000000000000000000000000000092509050565b600d81815481106120f0575f80fd5b5f918252602090912001546001600160a01b0316905081565b5f51602061549f5f395f51905f5261212081612c0e565b601880546001600160a81b03191690556040805181815260129181019190915271135251d490551253d397d11254d05093115160721b60608201525f60208201819052905f51602061547f5f395f51905f52906080016119d3565b5f51602061543f5f395f51905f5261219281612c0e565b6001600160a01b0382165f818152600660209081526040808320600a01805460ff19169055519182525f5160206154bf5f395f51905f52910160405180910390a260408051818152601791810191909152761413d3d317d153515491d15390d657d11254d050931151604a1b60608201525f60208201526001600160a01b038316905f51602061547f5f395f51905f5290608001611cd4565b5f51602061549f5f395f51905f5261224281612c0e565b6001600160a01b0384166122905760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420746f6b656e206164647265737360581b6044820152606401611021565b6001600160a01b0384165f9081526007602052604090205460ff16156122ef5760405162461bcd60e51b8152602060048201526014602482015273546f6b656e20616c72656164792065786973747360601b6044820152606401611021565b600d546032116123385760405162461bcd60e51b8152602060048201526014602482015273546f6f206d616e7920746f6b656e20706f6f6c7360601b6044820152606401611021565b6064821015801561234b57506107d08211155b6123675760405162461bcd60e51b815260040161102190615185565b604051806101a001604052805f81526020015f81526020015f81526020015f81526020015f8152602001838152602001606481526020016107d0815260200161271081526020015f81526020015f151581526020014281526020018460ff1681525060065f866001600160a01b03166001600160a01b031681526020019081526020015f205f820151815f01556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015f6101000a81548160ff02191690831515021790555061016082015181600b015561018082015181600c015f6101000a81548160ff021916908360ff160217905550905050600160075f866001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff021916908315150217905550600d84908060018154018082558091505060019003905f5260205f20015f9091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550836001600160a01b03167f0667ebf166f2e070e9507737efb78c89e4b4c34097b2f7fd0525696187a775338360646107d0604051612571939291909283526020830191909152604082015260600190565b60405180910390a250505050565b5f5f5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231866040518263ffffffff1660e01b81526004016125cf9190614d13565b602060405180830381865afa1580156125ea573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061260e9190615089565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126919190615089565b9050600f548210806126a1575080155b156126b457505f93509150829050612729565b5f816126c2846127106150a0565b6126cc91906150b7565b60115490915060649082106126e4575060105461271d565b5f60646010546126f4919061515e565b60115490915061270484836150a0565b61270e91906150b7565b612719906064615062565b9150505b95509193506001925050505b9193909250565b6001600160a01b0381165f90815260066020818152604080842081516101a081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a08301529182015460c0820152600782015460e082015260088201546101008201526009820154610120820152600a82015460ff908116158015610140840152600b840154610160840152600c909301541661018082015290806127ec57508051155b156127f957505f92915050565b60a081015181516127109161280d916150a0565b61281791906150b7565b9392505050565b5f51602061549f5f395f51905f5261283581612c0e565b6064831015801561284857506101f48311155b61288f5760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420626f6f73742070657263656e7461676560401b6044820152606401611021565b5f821180156128a057506103e88211155b6128e85760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b2103137b7b9ba103232b737b6b4b730ba37b960391b6044820152606401611021565b50600f92909255601055601155565b5f828152600160208190526040909120015461291281612c0e565b6115f98383613702565b6129335f51602061545f5f395f51905f5233611cff565b61294f5760405162461bcd60e51b815260040161102190615029565b6001600160a01b0382165f818152600960209081526040808320805486151560ff199182168117909255600884529382902060070180549094168117909355519182527fbbda13cced3fcbbcbbb46f891220f8490dd963accb06ab843e6aca4d1e7289e19101611cd4565b5f51602061549f5f395f51905f526129d181612c0e565b60185460ff16612a1b5760405162461bcd60e51b8152602060048201526015602482015274135a59dc985d1a5bdb881b9bdd08195b98589b1959605a1b6044820152606401611021565b60185461010090046001600160a01b0316612a735760405162461bcd60e51b8152602060048201526018602482015277135a59dc985d1a5bdb881d185c99d95d081b9bdd081cd95d60421b6044820152606401611021565b5f5b828110156115f9575f848483818110612a9057612a90615075565b9050602002016020810190612aa59190614ce3565b6001600160a01b0381165f9081526019602052604090205490915060ff16612c05576040516370a0823160e01b81525f906001600160a01b038316906370a0823190612af5903090600401614d13565b602060405180830381865afa158015612b10573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b349190615089565b90508015612c0357601854612b5b906001600160a01b038481169161010090041683613e2f565b6001600160a01b0382165f908152601960209081526040808320805460ff19166001179055600790915290205460ff1615612ba9576001600160a01b0382165f908152600660205260408120555b816001600160a01b03165f51602061547f5f395f51905f5282604051612bfa91906040808252600e908201526d1513d2d15397d35251d49055115160921b6060820152602081019190915260800190565b60405180910390a25b505b50600101612a75565b6117e68133613e55565b60025f5403612c695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611021565b60025f55565b60025460ff1615612cb55760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611021565b565b868514612cd65760405162461bcd60e51b8152600401611021906151ab565b848314612cf55760405162461bcd60e51b8152600401611021906151ab565b828114612d145760405162461bcd60e51b8152600401611021906151ab565b60c8871115612d575760405162461bcd60e51b815260206004820152600f60248201526e426174636820746f6f206c6172676560881b6044820152606401611021565b5050505050505050565b5f8a8a8a8a8a8a8a8a612d7661012c426150b7565b604051602001612d8e99989796959493929190615250565b60408051601f1981840301815291815281516020928301205f818152600590935291205490915060ff1615612dfe5760405162461bcd60e51b815260206004820152601660248201527514da59db985d1d5c9948185b1c9958591e481d5cd95960521b6044820152606401611021565b5f818152600560209081526040808320805460ff1916600117905551612e52918491017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051808303601f190181528282528051602091820120600254601f880183900483028501830190935286845293506101009091046001600160a01b031691612eb89187908790819084018382808284375f920191909152508693925050613e809050565b6001600160a01b031614612f025760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401611021565b505050505050505050505050565b5f5b838110156130815760045f868684818110612f2f57612f2f615075565b9050602002016020810190612f449190614ce3565b6001600160a01b0316815260208101919091526040015f2054612f68906001615062565b838383818110612f7a57612f7a615075565b9050602002013514612fbe5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c6964206e6f6e636560981b6044820152606401611021565b828282818110612fd057612fd0615075565b9050602002013560045f878785818110612fec57612fec615075565b90506020020160208101906130019190614ce3565b6001600160a01b0316815260208101919091526040015f205582828281811061302c5761302c615075565b9050602002013560085f87878581811061304857613048615075565b905060200201602081019061305d9190614ce3565b6001600160a01b0316815260208101919091526040015f2060080155600101612f12565b5050505050565b5f5f61309688888888613ea8565b90505f81116130db5760405162461bcd60e51b81526020600482015260116024820152704e6f20656c696769626c6520757365727360781b6044820152606401611021565b5f5b8781101561318f575f8787838181106130f8576130f8615075565b905060200201351115613187575f6131768a8a8481811061311b5761311b615075565b90506020020160208101906131309190614ce3565b89898581811061314257613142615075565b9050602002013588888681811061315b5761315b615075565b90506020020160208101906131709190614ce3565b86613ff3565b5090506131838185615062565b9350505b6001016130dd565b5069d3c21bcecceda10000008211156131f45760405162461bcd60e51b815260206004820152602160248201527f446973747269627574696f6e206578636565647320736166657479206c696d696044820152601d60fa1b6064820152608401611021565b509695505050505050565b5f5b600d54811080156132125750603281105b156117e6575f600d828154811061322b5761322b615075565b5f918252602090912001546018546001600160a01b03909116915060ff16158061326d57506001600160a01b0381165f9081526019602052604090205460ff16155b156133c9576040516370a0823160e01b81525f906001600160a01b038316906370a08231906132a0903090600401614d13565b602060405180830381865afa1580156132bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132df9190615089565b6001600160a01b0383165f90815260066020526040902054909150808211156133c6575f61330d828461515e565b6001600160a01b0385165f90815260066020526040902084815560018101549192509061333b908390615062565b6001820155600a81015460ff1661338a57600a8101805460ff191660019081179091556040519081526001600160a01b038616905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038716915f51602061541f5f395f51905f52916133bb91868252602082015260400190565b60405180910390a250505b50505b50806133d4816150ef565b915050613201565b5f5b600d54811080156133ef5750603281105b156117e6575f600d828154811061340857613408615075565b5f9182526020808320909101546001600160a01b031680835260069091526040909120600a8101549192509060ff16613442575050613570565b5f81600b015442613453919061515e565b90505f620151808211613466578161346b565b620151805b90508083600901541161347e575f61348e565b80836009015461348e919061515e565b6009840155600883015483545f906134a6575f6134cf565b600285015485546134b79190615062565b85546134c5906103e86150a0565b6134cf91906150b7565b90505f6103e88660090154116134e95785600901546134ed565b6103e85b9050806134fc83612710615062565b6135069190615062565b60088701819055831461356857600886015460098701546040805186815260208101939093528201526001600160a01b038816907f5cc0cdc903ddb7757f4c28d31b1bf7656a2150dd3dac148f72b108fccf3b42479060600160405180910390a25b505050505050505b8061357a816150ef565b9150506133de565b60c88611156135c45760405162461bcd60e51b815260206004820152600e60248201526d546f6f206d616e7920757365727360901b6044820152606401611021565b69d3c21bcecceda10000008111156136175760405162461bcd60e51b8152602060048201526016602482015275446973747269627574696f6e20746f6f206c6172676560501b6044820152606401611021565b5f61362488888888613ea8565b90506136536040518060a001604052805f81526020015f81526020015f81526020015f81526020015f81525090565b5f5b888110156136d6576136ce8a8a8381811061367257613672615075565b90506020020160208101906136879190614ce3565b89898481811061369957613699615075565b905060200201358888858181106136b2576136b2615075565b90506020020160208101906136c79190614ce3565b8686614092565b600101613655565b506136f7815f01518260200151836040015184606001518560800151614213565b505050505050505050565b5f61370d8383611cff565b1561376d575f8381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610fb7565b505f610fb7565b5f61377f8383611cff565b61376d575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610fb7565b6040516001600160a01b0384811660248301528381166044830152606482018390526115f99186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614398565b6001600160a01b0381165f9081526007602052604090205460ff1661386c5750565b6040516370a0823160e01b81525f906001600160a01b038316906370a082319061389a903090600401614d13565b602060405180830381865afa1580156138b5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138d99190615089565b6001600160a01b0383165f908152600660205260409020549091508082111561168c575f613907828461515e565b6001600160a01b0385165f908152600660205260409020848155600181015491925090613935908390615062565b6001820155600a81015460ff1661398457600a8101805460ff191660019081179091556040519081526001600160a01b038616905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038716915f51602061541f5f395f51905f52916139b591868252602082015260400190565b60405180910390a25050505050565b5f6012545f196139d491906150b7565b831115613a1d5760405162461bcd60e51b815260206004820152601760248201527653747265616d696e672074696d65206f766572666c6f7760481b6044820152606401611021565b5f60125484613a2c91906150a0565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613aaf9190615089565b90505f8415801590613ac057505f82115b15613af7575f82613ad3876127106150a0565b613add91906150b7565b9050613af3613aee826103e86150a0565b6143fb565b9150505b5f613b0188613c74565b90505f613b0f8260646150a0565b613b1b90612710615062565b6013546001600160a01b038b165f9081526008602052604081206006015492935091613b4791906150a0565b905060328111613b575780613b5a565b60325b90505f613b678588615062565b9050613b74835f196150b7565b811115613bc35760405162461bcd60e51b815260206004820152601b60248201527f5765696768742063616c63756c6174696f6e206f766572666c6f7700000000006044820152606401611021565b612710613bd084836150a0565b613bda91906150b7565b90505f613be88360646150a0565b613bf490612710615062565b9050613c01815f196150b7565b821115613c4d5760405162461bcd60e51b815260206004820152601a602482015279436f6e736563757469766520626f6e7573206f766572666c6f7760301b6044820152606401611021565b612710613c5a82846150a0565b613c6491906150b7565b9c9b505050505050505050505050565b5f5f5f613c808461257f565b925050915080613c91576064613c93565b815b949350505050565b600d545f908190613cac575f613cd4565b600d5f81548110613cbf57613cbf615075565b5f918252602090912001546001600160a01b03165b91505f5b600d5481108015613ce95750603281105b15613d9f575f600d8281548110613d0257613d02615075565b5f9182526020808320909101546001600160a01b031680835260069091526040909120600a015490915060ff16613d395750613d8d565b6001600160a01b038082165f81815260066020908152604080832060080154948a168352600c8252808320938352929052908120549091613d7991615062565b905083811115613d8a578093508194505b50505b80613d97816150ef565b915050613cd8565b5050919050565b613dae614458565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613de89190614d13565b60405180910390a1565b613dfa612c6f565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ddb3390565b61168c83846001600160a01b031663a9059cbb85856040516024016138189291906152b7565b613e5f8282611cff565b6115d057808260405163e2517d3f60e01b81526004016110219291906152b7565b5f5f5f5f613e8e86866144a1565b925092509250613e9e82826144ea565b5090949350505050565b5f805b84811015613fea575f848483818110613ec657613ec6615075565b905060200201351115613fe2575f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231888885818110613f1557613f15615075565b9050602002016020810190613f2a9190614ce3565b6040518263ffffffff1660e01b8152600401613f469190614d13565b602060405180830381865afa158015613f61573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613f859190615089565b90505f613fd1888885818110613f9d57613f9d615075565b9050602002016020810190613fb29190614ce3565b878786818110613fc457613fc4615075565b90506020020135846139c4565b9050613fdd8185615062565b935050505b600101613eab565b50949350505050565b5f5f5f5f6140008861257f565b925092505080614017575f5f935093505050614089565b6001600160a01b0386165f908152600660205260409020600a015460ff16158061405657506001600160a01b0386165f90815260066020526040902054155b15614068575f5f935093505050614089565b5f6140748989856139c4565b90506140818782886145a2565b945094505050505b94509492505050565b8315613081576140a2858561476c565b5f5f6140b087878787613ff3565b9092509050811561420a576140c58183615062565b6001600160a01b0386165f9081526006602052604090205410156140fb5760405162461bcd60e51b8152600401611021906152d0565b61410787868484614965565b8251614114906001615062565b83526020830151614126908390615062565b6020840152604083015161413b908290615062565b60408401526060830151614150908790615062565b60608401526001600160a01b0387165f90815260086020526040902060030154608084015161417f9190615062565b60808401526001600160a01b038781165f81815260086020526040902060030154918716917f7441a72878a40f771783d92af2b6e5b60cc3c51112de2a9951e42a23b5bfdc1590859085906141d38d613c74565b6001600160a01b038c165f908152600660205260409081902060080154905161420195949392918f91614ef8565b60405180910390a35b50505050505050565b601454614221906001615062565b60148190555f908152600a602090815260409182902042815560018101879055600281018690556003810188905582516318160ddd60e01b8152925190926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926318160ddd926004808401938290030181865afa1580156142ad573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142d19190615089565b600482015560058101805460ff19811682556002546001600160a01b036101009182900416026001600160a81b031990911617905585614311575f61431b565b61431b86836150b7565b60068201556007810183905542601555601754614339906001615062565b6017556014546006820154604080519283526020830189905282018790526060820152608081018490527f48cc863944b1d83eb06515eabfaa6068f616ca4254a7812a01661ab659c3cd909060a00160405180910390a1505050505050565b5f5f60205f8451602086015f885af1806143b7576040513d5f823e3d81fd5b50505f513d915081156143ce5780600114156143db565b6001600160a01b0384163b155b156115f95783604051635274afe760e01b81526004016110219190614d13565b5f815f0361440a57505f919050565b5f6002614418846001615062565b61442291906150b7565b9050825b8082101561281757508060028161443d81876150b7565b6144479190615062565b61445191906150b7565b9150614426565b60025460ff16612cb55760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611021565b5f5f5f83516041036144d8576020840151604085015160608601515f1a6144ca88828585614b26565b9550955095505050506144e3565b505081515f91506002905b9250925092565b5f8260038111156144fd576144fd615303565b03614506575050565b600182600381111561451a5761451a615303565b036145385760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561454c5761454c615303565b0361456d5760405163fce698f760e01b815260048101829052602401611021565b600382600381111561458157614581615303565b036115d0576040516335e2f38360e21b815260048101829052602401611021565b6001600160a01b0383165f90815260066020818152604080842081516101a08101835281548082526001830154948201949094526002820154928101929092526003810154606083015260048101546080830152600581015460a083018190529381015460c0830152600781015460e083015260088101546101008301526009810154610120830152600a81015460ff9081161515610140840152600b820154610160840152600c90910154166101808201528392909183916127109161466991906150a0565b61467391906150b7565b90505f61468582846101800151614be4565b90505f6127108461010001518361469c91906150a0565b6146a691906150b7565b90508615614760575f876146ba8a846150a0565b6146c491906150b7565b90506146d581866101800151614c1d565b9650612710600e54886146e891906150a0565b6146f291906150b7565b95505f6146ff8789615062565b865190915081111561475d5785515f90829061471d906127106150a0565b61472791906150b7565b9050612710614736828b6150a0565b61474091906150b7565b985061271061474f828a6150a0565b61475991906150b7565b9750505b50505b50505050935093915050565b6001600160a01b0382165f90815260086020526040902061478e825f1961515e565b816004015411156147e15760405162461bcd60e51b815260206004820152601d60248201527f546f74616c2073747265616d696e672074696d65206f766572666c6f770000006044820152606401611021565b8181600401546147f19190615062565b6004808301919091554260058301556040516370a0823160e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916370a082319161484a91879101614d13565b602060405180830381865afa158015614865573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906148899190615089565b600382015560018101545f901561490d575f620151808360010154426148af919061515e565b6148b991906150b7565b9050806001036148f6576005836006015410156148e55760068301546148e0906001615062565b6148e8565b60055b600684015560019150614907565b600181111561490757600160068401555b50614915565b600160068301555b6004820154604080518581526020810192909252821515908201526001600160a01b038516907f40117a8b474a070124a8d6175fdc8ccabd07b076caaf6bc042480c64f646b87390606001612571565b6001600160a01b0383165f908152600660205260408120906149878385615062565b905080825f015410156149ac5760405162461bcd60e51b8152600401611021906152d0565b81546149b990829061515e565b825560028201546149cb908590615062565b600283015560038201546149e0908490615062565b60038301556004820184905542600b8301556009820154614a02906064615062565b60098301556001600160a01b0386165f9081526008602052604090208054614a2b908690615062565b81554260018201556002810180546001600160a01b0319166001600160a01b038816908117909155614a5e908887613e2f565b8315614ac257600354614a7e906001600160a01b03888116911686613e2f565b856001600160a01b03167f9deb1f7b3050d677ab4e466e9cacb7285d73e64294379b9d6f22fb0bfccbdba285604051614ab991815260200190565b60405180910390a25b6001600160a01b038088165f908152600c60209081526040808320938a1683529290522054614af290600a615062565b6001600160a01b039788165f908152600c6020908152604080832099909a1682529790975296909520959095555050505050565b5f80806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03841115614b5557505f91506003905082614bda565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015614ba6573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614bd157505f925060019150829050614bda565b92505f91508190505b9450945094915050565b5f600860ff831611614bf7575081610fb7565b5f614c03600884615317565b9050614c1360ff8216600a615413565b613c9390856150b7565b5f600860ff831611614c30575081610fb7565b5f614c3c600884615317565b9050614c4c60ff8216600a615413565b613c9390856150a0565b602080825282518282018190525f918401906040840190835b81811015614c965783516001600160a01b0316835260209384019390920191600101614c6f565b509095945050505050565b5f60208284031215614cb1575f5ffd5b81356001600160e01b031981168114612817575f5ffd5b80356001600160a01b0381168114614cde575f5ffd5b919050565b5f60208284031215614cf3575f5ffd5b61281782614cc8565b5f60208284031215614d0c575f5ffd5b5035919050565b6001600160a01b0391909116815260200190565b5f5f83601f840112614d37575f5ffd5b5081356001600160401b03811115614d4d575f5ffd5b6020830191508360208260051b8501011115614d67575f5ffd5b9250929050565b5f5f83601f840112614d7e575f5ffd5b5081356001600160401b03811115614d94575f5ffd5b602083019150836020828501011115614d67575f5ffd5b5f5f5f5f5f5f5f5f5f5f60a08b8d031215614dc4575f5ffd5b8a356001600160401b03811115614dd9575f5ffd5b614de58d828e01614d27565b909b5099505060208b01356001600160401b03811115614e03575f5ffd5b614e0f8d828e01614d27565b90995097505060408b01356001600160401b03811115614e2d575f5ffd5b614e398d828e01614d27565b90975095505060608b01356001600160401b03811115614e57575f5ffd5b614e638d828e01614d27565b90955093505060808b01356001600160401b03811115614e81575f5ffd5b614e8d8d828e01614d6e565b915080935050809150509295989b9194979a5092959850565b5f5f60408385031215614eb7575f5ffd5b614ec083614cc8565b946020939093013593505050565b5f5f60408385031215614edf575f5ffd5b82359150614eef60208401614cc8565b90509250929050565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b5f5f5f60608486031215614f32575f5ffd5b614f3b84614cc8565b9250602084013560ff81168114614f50575f5ffd5b929592945050506040919091013590565b5f5f60408385031215614f72575f5ffd5b614f7b83614cc8565b9150614eef60208401614cc8565b5f5f5f60608486031215614f9b575f5ffd5b505081359360208301359350604090920135919050565b5f5f60408385031215614fc3575f5ffd5b614fcc83614cc8565b915060208301358015158114614fe0575f5ffd5b809150509250929050565b5f5f60208385031215614ffc575f5ffd5b82356001600160401b03811115615011575f5ffd5b61501d85828601614d27565b90969095509350505050565b6020808252600b908201526a4f6e6c79206f7261636c6560a81b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610fb757610fb761504e565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215615099575f5ffd5b5051919050565b8082028115828204841417610fb757610fb761504e565b5f826150d157634e487b7160e01b5f52601260045260245ffd5b500490565b91151582526001600160a01b0316602082015260400190565b5f600182016151005761510061504e565b5060010190565b602080825260149082015273456d657267656e6379206e6f742061637469766560601b604082015260600190565b6020808252600f908201526e151bdad95b881b9bdd08199bdd5b99608a1b604082015260600190565b81810381811115610fb757610fb761504e565b634e487b7160e01b5f52603160045260245ffd5b6020808252600c908201526b496e76616c6964207261746560a01b604082015260600190565b602080825260159082015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b604082015260600190565b8183526020830192505f815f5b84811015615216576001600160a01b0361520083614cc8565b16865260209586019591909101906001016151e7565b5093949350505050565b8183525f6001600160fb1b03831115615237575f5ffd5b8260051b80836020870137939093016020019392505050565b60a081525f61526360a083018b8d6151da565b8281036020840152615276818a8c615220565b9050828103604084015261528b81888a6151da565b905082810360608401526152a0818688615220565b9150508260808301529a9950505050505050505050565b6001600160a01b03929092168252602082015260400190565b602080825260199082015278496e73756666696369656e7420706f6f6c2062616c616e636560381b604082015260600190565b634e487b7160e01b5f52602160045260245ffd5b60ff8281168282160390811115610fb757610fb761504e565b6001815b600184111561536b5780850481111561534f5761534f61504e565b600184161561535d57908102905b60019390931c928002615334565b935093915050565b5f8261538157506001610fb7565b8161538d57505f610fb7565b81600181146153a357600281146153ad576153c9565b6001915050610fb7565b60ff8411156153be576153be61504e565b50506001821b610fb7565b5060208310610133831016604e8410600b84101617156153ec575081810a610fb7565b6153f85f198484615330565b805f190482111561540b5761540b61504e565b029392505050565b5f612817838361537356fea913f2a31be8313c1e31f36da8b180f63fdd4dff9cdcf5274495b67f7bc8d4f6bf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b2668e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef16ac6f29cb533706676e94ff2d30d8f95dd3e0c525a0e07e44c1f7762360b4894a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775200e5013b1e7d404942300da3670a81a06231d29673d2ea5b80ee2015dad9f00a264697066735822122054355c3d45e7b45634c225b2f096b122f393016a9d3511a2779cedf02d6b803764736f6c634300081e0033464154414c3a2041646d696e20726f6c65206772616e74206661696c65640000000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf7100000000000000000000000017e7b189982d8df2539d059b46467a09a7bcb91d000000000000000000000000ff27fbf6fd7d68af82473f68ebc665d2eacceaec
Deployed ByteCode
0x608060405234801561000f575f5ffd5b5060043610610423575f3560e01c80636f5f50f611610227578063ae4983101161012d578063c3d2c3c1116100bb578063c3d2c3c114610cc5578063cea64a8c14610da7578063d4d5887814610dba578063d547741f14610de1578063e84721cb14610df4578063f0360bad14610e1b578063f0e74bd214610ecd578063f32c8e9e14610ee0578063f5b9626514610ee9578063f978fd6114610ef2578063ff4ea29e14610f14575f5ffd5b8063ae49831014610ae5578063aeefffad14610af8578063b075381414610beb578063b0c67d9714610bfe578063b4f3df3114610c20578063b57328e014610c50578063b7fba9f614610c7a578063c0128a8814610c8d578063c1b8411a14610c95578063c2a44cf314610cbc575f5ffd5b80638a65d874116101b55780638a65d8741461096c5780638dbde93a14610a2557806391d1485414610a2e5780639457c1dc14610a4157806395ccea6714610a545780639d5ccea114610a675780639e7e0dc114610a7a5780639ead722214610aba578063a217fddf14610acd578063a4b6c17614610ad4578063adf5e30c14610add575f5ffd5b80636f5f50f6146108a457806375151b63146108b757806375b238fc146108e257806376fc5700146108f65780637ab46f1c146108ff5780637c5b4805146109255780637e2ecccb1461093f57806382fb0f3d146109525780638456cb591461095b5780638a19c8bc14610963575f5ffd5b80633564fe381161032c5780634a4e3bd5116102ba5780634a4e3bd5146107055780634c3fb3b51461070d5780634e43603a1461072c57806350299b411461081157806350c1d19d1461082457806351858e271461083e5780635b51acff146108465780635c975abb1461085e5780635ce521361461086957806368c4ac261461087157806368f2881c14610893575f5ffd5b80633564fe381461063657806335b944bf1461063e57806336568abe1461064b5780633ba825741461065e5780633be2b335146106855780633c18910b146106c05780633f4ba83a146106c957806341d384d9146106d157806344abc68c146106da57806348e74045146106e3575f5ffd5b806320df4359116103b457806320df435914610548578063248a9ca31461055c57806324d7806c1461057f578063259e50eb1461059257806327c830a91461059b57806328bff9db146105af5780632aa76bfa146105c25780632bfd5146146105ca5780632f076bf8146105dd5780632f2ff15d146106045780632f7801f414610617575f5ffd5b80630107e4721461042757806301ffc9a7146104455780630574ebac1461046857806306bfa9381461047d57806307e2cea5146104ca57806312cac02d146104ec57806315294f66146104f55780631709a61b146105085780631d7314411461052d5780631fb3402b14610535575b5f5ffd5b61042f610f27565b60405161043c9190614c56565b60405180910390f35b610458610453366004614ca1565b610f87565b604051901515815260200161043c565b61047b610476366004614ce3565b610fbd565b005b61049061048b366004614ce3565b61104d565b6040805197885260208801969096529486019390935260608501919091521515608084015260a083015260ff1660c082015260e00161043c565b6104de5f51602061545f5f395f51905f5281565b60405190815260200161043c565b6104de60135481565b61047b610503366004614cfc565b611138565b6002546105209061010090046001600160a01b031681565b60405161043c9190614d13565b6104de603281565b61047b610543366004614dab565b61119f565b6104de5f51602061543f5f395f51905f5281565b6104de61056a366004614cfc565b5f908152600160208190526040909120015490565b61045861058d366004614ce3565b611310565b6104de600e5481565b60035461045890600160a01b900460ff1681565b61047b6105bd366004614ce3565b611338565b6104de60c881565b61047b6105d8366004614ea6565b611437565b6105207f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf7181565b61047b610612366004614ece565b6115d4565b6104de610625366004614ce3565b60046020525f908152604090205481565b61047b6115ff565b6018546104589060ff1681565b61047b610659366004614ece565b611659565b6105207f000000000000000000000000756639c761e228143780e022a175325d79797eec81565b610698610693366004614ea6565b611691565b604080519485526001600160a01b03909316602085015291830152606082015260800161043c565b6104de600f5481565b61047b6117c7565b6104de60175481565b6104de6101f481565b6104586106f1366004614ce3565b60096020525f908152604090205460ff1681565b61047b6117e9565b6104de61071b366004614ce3565b600b6020525f908152604090205481565b6107d661073a366004614ce3565b6001600160a01b039081165f8181526008602081815260408084208151610120810183528154808252600183015482860181905260028401549099168285018190526003840154606084015260048085015460808501819052600586015460a0860152600686015460c08601819052600787015460ff16151560e087015295909801546101009094019390935297875293529320549095919291565b6040805196875260208701959095526001600160a01b03909316938501939093526060840152608083019190915260a082015260c00161043c565b600354610520906001600160a01b031681565b61082c61184a565b60405161043c96959493929190614ef8565b61047b61192b565b6018546105209061010090046001600160a01b031681565b60025460ff16610458565b600d546104de565b61045861087f366004614ce3565b60076020525f908152604090205460ff1681565b6104de69d3c21bcecceda100000081565b61047b6108b2366004614ea6565b6119de565b6104586108c5366004614ce3565b6001600160a01b03165f9081526007602052604090205460ff1690565b6104de5f51602061549f5f395f51905f5281565b6104de60105481565b7f000000000000000000000000756639c761e228143780e022a175325d79797eec610520565b61092d600881565b60405160ff909116815260200161043c565b61047b61094d366004614ce3565b611a83565b6104de60115481565b61047b611ce0565b6104de60145481565b6109d361097a366004614ce3565b600860208190525f9182526040909120805460018201546002830154600384015460048501546005860154600687015460078801549790980154959794966001600160a01b039094169592949193909260ff9091169089565b60408051998a5260208a01989098526001600160a01b03909616968801969096526060870193909352608086019190915260a085015260c084015290151560e08301526101008201526101200161043c565b6104de61271081565b610458610a3c366004614ece565b611cff565b61047b610a4f366004614ce3565b611d29565b61047b610a62366004614ea6565b611dfc565b61047b610a75366004614ea6565b611ef3565b610a82611fd5565b604080516001600160a01b0390961686529315156020860152911515928401929092526060830191909152608082015260a00161043c565b610520610ac8366004614cfc565b6120e1565b6104de5f81565b6104de60155481565b61047b612109565b61047b610af3366004614ce3565b61217b565b610ba2600254600354600d547f000000000000000000000000756639c761e228143780e022a175325d79797eec937f000000000000000000000000756639c761e228143780e022a175325d79797eec9361010090046001600160a01b039081169316917f00000000000000000000000000000000000000000000000000000000017fb459917f00000000000000000000000000000000000000000000000000000000692bc7cb9190565b604080516001600160a01b039889168152968816602088015294871694860194909452949091166060840152608083015260a082019290925260c081019190915260e00161043c565b61047b610bf9366004614f20565b61222b565b610458610c0c366004614ce3565b60196020525f908152604090205460ff1681565b610c33610c2e366004614ce3565b61257f565b60408051938452602084019290925215159082015260600161043c565b6104de610c5e366004614f61565b600c60209081525f928352604080842090915290825290205481565b6104de610c88366004614ce3565b612730565b6104de606481565b6105207f000000000000000000000000756639c761e228143780e022a175325d79797eec81565b6104de6107d081565b610d40610cd3366004614ce3565b600660208190525f918252604090912080546001820154600283015460038401546004850154600586015496860154600787015460088801546009890154600a8a0154600b8b0154600c909b0154999b989a9799969895979596949593949293919260ff9182169291168d565b604080519d8e5260208e019c909c529a8c019990995260608b019790975260808a019590955260a089019390935260c088019190915260e0870152610100860152610120850152151561014084015261016083015260ff166101808201526101a00161043c565b61047b610db5366004614f89565b61281e565b6104de7f00000000000000000000000000000000000000000000000000000000017fb45981565b61047b610def366004614ece565b6128f7565b6104de7f00000000000000000000000000000000000000000000000000000000692bc7cb81565b610e7e610e29366004614cfc565b600a6020525f9081526040902080546001820154600283015460038401546004850154600586015460068701546007909701549596949593949293919260ff8216926101009092046001600160a01b03169189565b60408051998a5260208a01989098529688019590955260608701939093526080860191909152151560a08501526001600160a01b031660c084015260e08301526101008201526101200161043c565b61047b610edb366004614fb2565b61291c565b6104de60125481565b6104de60165481565b610458610f00366004614cfc565b60056020525f908152604090205460ff1681565b61047b610f22366004614feb565b6129ba565b6060600d805480602002602001604051908101604052809291908181526020018280548015610f7d57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610f5f575b5050505050905090565b5f6001600160e01b03198216637965db0b60e01b1480610fb757506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f51602061549f5f395f51905f52610fd481612c0e565b6001600160a01b03821661102a5760405162461bcd60e51b8152602060048201526018602482015277496e76616c6964207472656173757279206164647265737360401b60448201526064015b60405180910390fd5b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381165f90815260066020818152604080842081516101a0810183528154808252600183015494820185905260028301549382018490526003830154606083015260048301546080830152600583015460a083018190529583015460c0830152600783015460e083015260088301546101008301526009830154610120830152600a83015460ff90811615156101408401819052600b850154610160850152600c909401541661018083015286958695869586958695869590949093929161111b8e612730565b61018090960151949e939d50919b50995097509195509350915050565b5f51602061549f5f395f51905f5261114f81612c0e565b6103e88211156111995760405162461bcd60e51b81526020600482015260156024820152745461782063616e6e6f74206578636565642031302560581b6044820152606401611021565b50600e55565b6111a7612c18565b6111be5f51602061545f5f395f51905f5233611cff565b6111da5760405162461bcd60e51b815260040161102190615029565b6111e2612c6f565b600354600160a01b900460ff16156112355760405162461bcd60e51b8152602060048201526016602482015275456d657267656e63792070617573652061637469766560501b6044820152606401611021565b60185460ff161561129c5760405162461bcd60e51b815260206004820152602b60248201527f4175746f2d646973747269627574696f6e2064697361626c656420647572696e60448201526a339036b4b3b930ba34b7b760a91b6064820152608401611021565b6112ac8a8a8a8a8a8a8a8a612cb7565b6112be8a8a8a8a8a8a8a8a8a8a612d61565b6112ca8a8a8686612f10565b5f6112d98b8b8b8b8b8b613088565b90506112e36131ff565b6112eb6133dc565b6112fa8b8b8b8b8b8b87613582565b5061130460015f55565b50505050505050505050565b5f6113285f51602061549f5f395f51905f5283611cff565b80610fb75750610fb75f83611cff565b5f51602061549f5f395f51905f5261134f81612c0e565b6001600160a01b03821661139e5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964206f7261636c65206164647265737360501b6044820152606401611021565b60025461010090046001600160a01b03166113c65f51602061545f5f395f51905f5282613702565b506113de5f51602061545f5f395f51905f5284613774565b5060028054610100600160a81b0319166101006001600160a01b0386811691820292909217909255604051908316907f05cd89403c6bdeac21c2ff33de395121a31fa1bc2bf3adf4825f1f86e79969dd905f90a3505050565b61143f612c18565b611447612c6f565b6001600160a01b0382165f9081526007602052604090205460ff166114a45760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b6044820152606401611021565b5f81116114f35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401611021565b6115086001600160a01b0383163330846137e3565b6001600160a01b0382165f908152600660205260409020805461152c908390615062565b8155600181015461153e908390615062565b6001820155600a81015460ff1661158d57600a8101805460ff191660019081179091556040519081526001600160a01b038416905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038516915f51602061541f5f395f51905f52916115be91868252602082015260400190565b60405180910390a2506115d060015f55565b5050565b5f82815260016020819052604090912001546115ef81612c0e565b6115f98383613774565b50505050565b5f51602061549f5f395f51905f5261161681612c0e565b5f5b600d548110156115d057611651600d828154811061163857611638615075565b5f918252602090912001546001600160a01b031661384a565b600101611618565b6001600160a01b03811633146116825760405163334bd91960e11b815260040160405180910390fd5b61168c8282613702565b505050565b5f5f5f5f5f7f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf716001600160a01b03166370a08231886040518263ffffffff1660e01b81526004016116e29190614d13565b602060405180830381865afa1580156116fd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117219190615089565b905061172e8787836139c4565b925061173987613c74565b915061174487613c9b565b6001600160a01b0381165f908152600660205260409020600a015490945060ff16801561178757506001600160a01b0384165f9081526006602052604090205415155b156117bd575f61179685612730565b90506117a584620f4240615062565b6117af85836150a0565b6117b991906150b7565b9550505b5092959194509250565b5f51602061549f5f395f51905f526117de81612c0e565b6117e6613da6565b50565b5f51602061549f5f395f51905f5261180081612c0e565b6003805460ff60a01b191690556040517f81fb10540499dac6157b25576349c719be885b5774e4a0dda606c2f33947d51f9061183f905f9033906150d6565b60405180910390a150565b600d546014546015546016545f9283929091835b600d548110801561186f5750603281105b156119225760065f600d838154811061188a5761188a615075565b5f9182526020808320909101546001600160a01b031683528201929092526040019020600a015460ff16156118c7576118c4866001615062565b95505b60065f600d83815481106118dd576118dd615075565b5f9182526020808320909101546001600160a01b0316835282019290925260400190206002015461190e9086615062565b94508061191a816150ef565b91505061185e565b50909192939495565b5f51602061543f5f395f51905f5261194281612c0e565b6003805460ff60a01b1916600160a01b1790556040517f81fb10540499dac6157b25576349c719be885b5774e4a0dda606c2f33947d51f906119889060019033906150d6565b60405180910390a160408051818152600f918101919091526e454d455247454e43595f504155534560881b606082015242602082015233905f51602061547f5f395f51905f52906080015b60405180910390a250565b5f51602061543f5f395f51905f526119f581612c0e565b600354600160a01b900460ff16611a1e5760405162461bcd60e51b815260040161102190615107565b6001600160a01b0383165f818152600460209081526040918290208590558151828152600b928101929092526a1393d390d157d49154d15560aa1b606083015281018490525f51602061547f5f395f51905f52906080015b60405180910390a2505050565b5f51602061549f5f395f51905f52611a9a81612c0e565b6001600160a01b0382165f9081526007602052604090205460ff16611ad15760405162461bcd60e51b815260040161102190615135565b6001600160a01b0382165f9081526006602052604090205415611b2b5760405162461bcd60e51b8152602060048201526012602482015271506f6f6c206d75737420626520656d70747960701b6044820152606401611021565b6001600160a01b0382165f908152600760205260408120805460ff191690555b600d54811015611c3f57826001600160a01b0316600d8281548110611b7257611b72615075565b5f918252602090912001546001600160a01b031603611c3757600d8054611b9b9060019061515e565b81548110611bab57611bab615075565b5f91825260209091200154600d80546001600160a01b039092169183908110611bd657611bd6615075565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550600d805480611c1257611c12615171565b5f8281526020902081015f1990810180546001600160a01b0319169055019055611c3f565b600101611b4b565b506001600160a01b0382165f8181526006602081815260408084208481556001810185905560028101859055600381018590556004810185905560058101859055928301849055600783018490556008830184905560098301849055600a8301805460ff19908116909155600b8401859055600c909301805490931690925590519182525f5160206154bf5f395f51905f5291015b60405180910390a25050565b5f51602061549f5f395f51905f52611cf781612c0e565b6117e6613df2565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f51602061549f5f395f51905f52611d4081612c0e565b6001600160a01b038216611d885760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401611021565b601880546001600160a01b03841661010081026001600160a81b0319909216919091176001179091556040515f51602061547f5f395f51905f5290611cd4905f90604080825260119082015270135251d490551253d397d1539050931151607a1b6060820152602081019190915260800190565b5f51602061543f5f395f51905f52611e1381612c0e565b600354600160a01b900460ff16611e3c5760405162461bcd60e51b815260040161102190615107565b611e506001600160a01b0384163384613e2f565b6001600160a01b0383165f9081526007602052604090205460ff1615611ea6576001600160a01b0383165f9081526006602052604090208054831115611e96575f611ea3565b8054611ea390849061515e565b90555b60408051818152601491810191909152731153515491d15390d657d5d2551211149055d05360621b60608201526020810183905233905f51602061547f5f395f51905f5290608001611a76565b5f51602061549f5f395f51905f52611f0a81612c0e565b6001600160a01b0383165f9081526007602052604090205460ff16611f415760405162461bcd60e51b815260040161102190615135565b60648210158015611f5457506107d08211155b611f705760405162461bcd60e51b815260040161102190615185565b6001600160a01b0383165f8181526006602052604090819020600501849055517f0667ebf166f2e070e9507737efb78c89e4b4c34097b2f7fd0525696187a7753390611a769085906064906107d0909283526020830191909152604082015260600190565b7f000000000000000000000000756639c761e228143780e022a175325d79797eec5f8080806120048186611cff565b801561204257506120425f51602061549f5f395f51905f527f000000000000000000000000756639c761e228143780e022a175325d79797eec611cff565b801561208057506120805f51602061543f5f395f51905f527f000000000000000000000000756639c761e228143780e022a175325d79797eec611cff565b93506120ae5f51602061545f5f395f51905f52600260019054906101000a90046001600160a01b0316611cff565b600d549596949590949093507f00000000000000000000000000000000000000000000000000000000017fb45992509050565b600d81815481106120f0575f80fd5b5f918252602090912001546001600160a01b0316905081565b5f51602061549f5f395f51905f5261212081612c0e565b601880546001600160a81b03191690556040805181815260129181019190915271135251d490551253d397d11254d05093115160721b60608201525f60208201819052905f51602061547f5f395f51905f52906080016119d3565b5f51602061543f5f395f51905f5261219281612c0e565b6001600160a01b0382165f818152600660209081526040808320600a01805460ff19169055519182525f5160206154bf5f395f51905f52910160405180910390a260408051818152601791810191909152761413d3d317d153515491d15390d657d11254d050931151604a1b60608201525f60208201526001600160a01b038316905f51602061547f5f395f51905f5290608001611cd4565b5f51602061549f5f395f51905f5261224281612c0e565b6001600160a01b0384166122905760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420746f6b656e206164647265737360581b6044820152606401611021565b6001600160a01b0384165f9081526007602052604090205460ff16156122ef5760405162461bcd60e51b8152602060048201526014602482015273546f6b656e20616c72656164792065786973747360601b6044820152606401611021565b600d546032116123385760405162461bcd60e51b8152602060048201526014602482015273546f6f206d616e7920746f6b656e20706f6f6c7360601b6044820152606401611021565b6064821015801561234b57506107d08211155b6123675760405162461bcd60e51b815260040161102190615185565b604051806101a001604052805f81526020015f81526020015f81526020015f81526020015f8152602001838152602001606481526020016107d0815260200161271081526020015f81526020015f151581526020014281526020018460ff1681525060065f866001600160a01b03166001600160a01b031681526020019081526020015f205f820151815f01556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015f6101000a81548160ff02191690831515021790555061016082015181600b015561018082015181600c015f6101000a81548160ff021916908360ff160217905550905050600160075f866001600160a01b03166001600160a01b031681526020019081526020015f205f6101000a81548160ff021916908315150217905550600d84908060018154018082558091505060019003905f5260205f20015f9091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550836001600160a01b03167f0667ebf166f2e070e9507737efb78c89e4b4c34097b2f7fd0525696187a775338360646107d0604051612571939291909283526020830191909152604082015260600190565b60405180910390a250505050565b5f5f5f5f7f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf716001600160a01b03166370a08231866040518263ffffffff1660e01b81526004016125cf9190614d13565b602060405180830381865afa1580156125ea573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061260e9190615089565b90505f7f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf716001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126919190615089565b9050600f548210806126a1575080155b156126b457505f93509150829050612729565b5f816126c2846127106150a0565b6126cc91906150b7565b60115490915060649082106126e4575060105461271d565b5f60646010546126f4919061515e565b60115490915061270484836150a0565b61270e91906150b7565b612719906064615062565b9150505b95509193506001925050505b9193909250565b6001600160a01b0381165f90815260066020818152604080842081516101a081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a08301529182015460c0820152600782015460e082015260088201546101008201526009820154610120820152600a82015460ff908116158015610140840152600b840154610160840152600c909301541661018082015290806127ec57508051155b156127f957505f92915050565b60a081015181516127109161280d916150a0565b61281791906150b7565b9392505050565b5f51602061549f5f395f51905f5261283581612c0e565b6064831015801561284857506101f48311155b61288f5760405162461bcd60e51b8152602060048201526018602482015277496e76616c696420626f6f73742070657263656e7461676560401b6044820152606401611021565b5f821180156128a057506103e88211155b6128e85760405162461bcd60e51b815260206004820152601960248201527824b73b30b634b2103137b7b9ba103232b737b6b4b730ba37b960391b6044820152606401611021565b50600f92909255601055601155565b5f828152600160208190526040909120015461291281612c0e565b6115f98383613702565b6129335f51602061545f5f395f51905f5233611cff565b61294f5760405162461bcd60e51b815260040161102190615029565b6001600160a01b0382165f818152600960209081526040808320805486151560ff199182168117909255600884529382902060070180549094168117909355519182527fbbda13cced3fcbbcbbb46f891220f8490dd963accb06ab843e6aca4d1e7289e19101611cd4565b5f51602061549f5f395f51905f526129d181612c0e565b60185460ff16612a1b5760405162461bcd60e51b8152602060048201526015602482015274135a59dc985d1a5bdb881b9bdd08195b98589b1959605a1b6044820152606401611021565b60185461010090046001600160a01b0316612a735760405162461bcd60e51b8152602060048201526018602482015277135a59dc985d1a5bdb881d185c99d95d081b9bdd081cd95d60421b6044820152606401611021565b5f5b828110156115f9575f848483818110612a9057612a90615075565b9050602002016020810190612aa59190614ce3565b6001600160a01b0381165f9081526019602052604090205490915060ff16612c05576040516370a0823160e01b81525f906001600160a01b038316906370a0823190612af5903090600401614d13565b602060405180830381865afa158015612b10573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b349190615089565b90508015612c0357601854612b5b906001600160a01b038481169161010090041683613e2f565b6001600160a01b0382165f908152601960209081526040808320805460ff19166001179055600790915290205460ff1615612ba9576001600160a01b0382165f908152600660205260408120555b816001600160a01b03165f51602061547f5f395f51905f5282604051612bfa91906040808252600e908201526d1513d2d15397d35251d49055115160921b6060820152602081019190915260800190565b60405180910390a25b505b50600101612a75565b6117e68133613e55565b60025f5403612c695760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611021565b60025f55565b60025460ff1615612cb55760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611021565b565b868514612cd65760405162461bcd60e51b8152600401611021906151ab565b848314612cf55760405162461bcd60e51b8152600401611021906151ab565b828114612d145760405162461bcd60e51b8152600401611021906151ab565b60c8871115612d575760405162461bcd60e51b815260206004820152600f60248201526e426174636820746f6f206c6172676560881b6044820152606401611021565b5050505050505050565b5f8a8a8a8a8a8a8a8a612d7661012c426150b7565b604051602001612d8e99989796959493929190615250565b60408051601f1981840301815291815281516020928301205f818152600590935291205490915060ff1615612dfe5760405162461bcd60e51b815260206004820152601660248201527514da59db985d1d5c9948185b1c9958591e481d5cd95960521b6044820152606401611021565b5f818152600560209081526040808320805460ff1916600117905551612e52918491017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051808303601f190181528282528051602091820120600254601f880183900483028501830190935286845293506101009091046001600160a01b031691612eb89187908790819084018382808284375f920191909152508693925050613e809050565b6001600160a01b031614612f025760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401611021565b505050505050505050505050565b5f5b838110156130815760045f868684818110612f2f57612f2f615075565b9050602002016020810190612f449190614ce3565b6001600160a01b0316815260208101919091526040015f2054612f68906001615062565b838383818110612f7a57612f7a615075565b9050602002013514612fbe5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c6964206e6f6e636560981b6044820152606401611021565b828282818110612fd057612fd0615075565b9050602002013560045f878785818110612fec57612fec615075565b90506020020160208101906130019190614ce3565b6001600160a01b0316815260208101919091526040015f205582828281811061302c5761302c615075565b9050602002013560085f87878581811061304857613048615075565b905060200201602081019061305d9190614ce3565b6001600160a01b0316815260208101919091526040015f2060080155600101612f12565b5050505050565b5f5f61309688888888613ea8565b90505f81116130db5760405162461bcd60e51b81526020600482015260116024820152704e6f20656c696769626c6520757365727360781b6044820152606401611021565b5f5b8781101561318f575f8787838181106130f8576130f8615075565b905060200201351115613187575f6131768a8a8481811061311b5761311b615075565b90506020020160208101906131309190614ce3565b89898581811061314257613142615075565b9050602002013588888681811061315b5761315b615075565b90506020020160208101906131709190614ce3565b86613ff3565b5090506131838185615062565b9350505b6001016130dd565b5069d3c21bcecceda10000008211156131f45760405162461bcd60e51b815260206004820152602160248201527f446973747269627574696f6e206578636565647320736166657479206c696d696044820152601d60fa1b6064820152608401611021565b509695505050505050565b5f5b600d54811080156132125750603281105b156117e6575f600d828154811061322b5761322b615075565b5f918252602090912001546018546001600160a01b03909116915060ff16158061326d57506001600160a01b0381165f9081526019602052604090205460ff16155b156133c9576040516370a0823160e01b81525f906001600160a01b038316906370a08231906132a0903090600401614d13565b602060405180830381865afa1580156132bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906132df9190615089565b6001600160a01b0383165f90815260066020526040902054909150808211156133c6575f61330d828461515e565b6001600160a01b0385165f90815260066020526040902084815560018101549192509061333b908390615062565b6001820155600a81015460ff1661338a57600a8101805460ff191660019081179091556040519081526001600160a01b038616905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038716915f51602061541f5f395f51905f52916133bb91868252602082015260400190565b60405180910390a250505b50505b50806133d4816150ef565b915050613201565b5f5b600d54811080156133ef5750603281105b156117e6575f600d828154811061340857613408615075565b5f9182526020808320909101546001600160a01b031680835260069091526040909120600a8101549192509060ff16613442575050613570565b5f81600b015442613453919061515e565b90505f620151808211613466578161346b565b620151805b90508083600901541161347e575f61348e565b80836009015461348e919061515e565b6009840155600883015483545f906134a6575f6134cf565b600285015485546134b79190615062565b85546134c5906103e86150a0565b6134cf91906150b7565b90505f6103e88660090154116134e95785600901546134ed565b6103e85b9050806134fc83612710615062565b6135069190615062565b60088701819055831461356857600886015460098701546040805186815260208101939093528201526001600160a01b038816907f5cc0cdc903ddb7757f4c28d31b1bf7656a2150dd3dac148f72b108fccf3b42479060600160405180910390a25b505050505050505b8061357a816150ef565b9150506133de565b60c88611156135c45760405162461bcd60e51b815260206004820152600e60248201526d546f6f206d616e7920757365727360901b6044820152606401611021565b69d3c21bcecceda10000008111156136175760405162461bcd60e51b8152602060048201526016602482015275446973747269627574696f6e20746f6f206c6172676560501b6044820152606401611021565b5f61362488888888613ea8565b90506136536040518060a001604052805f81526020015f81526020015f81526020015f81526020015f81525090565b5f5b888110156136d6576136ce8a8a8381811061367257613672615075565b90506020020160208101906136879190614ce3565b89898481811061369957613699615075565b905060200201358888858181106136b2576136b2615075565b90506020020160208101906136c79190614ce3565b8686614092565b600101613655565b506136f7815f01518260200151836040015184606001518560800151614213565b505050505050505050565b5f61370d8383611cff565b1561376d575f8381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610fb7565b505f610fb7565b5f61377f8383611cff565b61376d575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610fb7565b6040516001600160a01b0384811660248301528381166044830152606482018390526115f99186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614398565b6001600160a01b0381165f9081526007602052604090205460ff1661386c5750565b6040516370a0823160e01b81525f906001600160a01b038316906370a082319061389a903090600401614d13565b602060405180830381865afa1580156138b5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138d99190615089565b6001600160a01b0383165f908152600660205260409020549091508082111561168c575f613907828461515e565b6001600160a01b0385165f908152600660205260409020848155600181015491925090613935908390615062565b6001820155600a81015460ff1661398457600a8101805460ff191660019081179091556040519081526001600160a01b038616905f5160206154bf5f395f51905f529060200160405180910390a25b80546040516001600160a01b038716915f51602061541f5f395f51905f52916139b591868252602082015260400190565b60405180910390a25050505050565b5f6012545f196139d491906150b7565b831115613a1d5760405162461bcd60e51b815260206004820152601760248201527653747265616d696e672074696d65206f766572666c6f7760481b6044820152606401611021565b5f60125484613a2c91906150a0565b90505f7f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf716001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613aaf9190615089565b90505f8415801590613ac057505f82115b15613af7575f82613ad3876127106150a0565b613add91906150b7565b9050613af3613aee826103e86150a0565b6143fb565b9150505b5f613b0188613c74565b90505f613b0f8260646150a0565b613b1b90612710615062565b6013546001600160a01b038b165f9081526008602052604081206006015492935091613b4791906150a0565b905060328111613b575780613b5a565b60325b90505f613b678588615062565b9050613b74835f196150b7565b811115613bc35760405162461bcd60e51b815260206004820152601b60248201527f5765696768742063616c63756c6174696f6e206f766572666c6f7700000000006044820152606401611021565b612710613bd084836150a0565b613bda91906150b7565b90505f613be88360646150a0565b613bf490612710615062565b9050613c01815f196150b7565b821115613c4d5760405162461bcd60e51b815260206004820152601a602482015279436f6e736563757469766520626f6e7573206f766572666c6f7760301b6044820152606401611021565b612710613c5a82846150a0565b613c6491906150b7565b9c9b505050505050505050505050565b5f5f5f613c808461257f565b925050915080613c91576064613c93565b815b949350505050565b600d545f908190613cac575f613cd4565b600d5f81548110613cbf57613cbf615075565b5f918252602090912001546001600160a01b03165b91505f5b600d5481108015613ce95750603281105b15613d9f575f600d8281548110613d0257613d02615075565b5f9182526020808320909101546001600160a01b031680835260069091526040909120600a015490915060ff16613d395750613d8d565b6001600160a01b038082165f81815260066020908152604080832060080154948a168352600c8252808320938352929052908120549091613d7991615062565b905083811115613d8a578093508194505b50505b80613d97816150ef565b915050613cd8565b5050919050565b613dae614458565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051613de89190614d13565b60405180910390a1565b613dfa612c6f565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ddb3390565b61168c83846001600160a01b031663a9059cbb85856040516024016138189291906152b7565b613e5f8282611cff565b6115d057808260405163e2517d3f60e01b81526004016110219291906152b7565b5f5f5f5f613e8e86866144a1565b925092509250613e9e82826144ea565b5090949350505050565b5f805b84811015613fea575f848483818110613ec657613ec6615075565b905060200201351115613fe2575f7f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf716001600160a01b03166370a08231888885818110613f1557613f15615075565b9050602002016020810190613f2a9190614ce3565b6040518263ffffffff1660e01b8152600401613f469190614d13565b602060405180830381865afa158015613f61573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613f859190615089565b90505f613fd1888885818110613f9d57613f9d615075565b9050602002016020810190613fb29190614ce3565b878786818110613fc457613fc4615075565b90506020020135846139c4565b9050613fdd8185615062565b935050505b600101613eab565b50949350505050565b5f5f5f5f6140008861257f565b925092505080614017575f5f935093505050614089565b6001600160a01b0386165f908152600660205260409020600a015460ff16158061405657506001600160a01b0386165f90815260066020526040902054155b15614068575f5f935093505050614089565b5f6140748989856139c4565b90506140818782886145a2565b945094505050505b94509492505050565b8315613081576140a2858561476c565b5f5f6140b087878787613ff3565b9092509050811561420a576140c58183615062565b6001600160a01b0386165f9081526006602052604090205410156140fb5760405162461bcd60e51b8152600401611021906152d0565b61410787868484614965565b8251614114906001615062565b83526020830151614126908390615062565b6020840152604083015161413b908290615062565b60408401526060830151614150908790615062565b60608401526001600160a01b0387165f90815260086020526040902060030154608084015161417f9190615062565b60808401526001600160a01b038781165f81815260086020526040902060030154918716917f7441a72878a40f771783d92af2b6e5b60cc3c51112de2a9951e42a23b5bfdc1590859085906141d38d613c74565b6001600160a01b038c165f908152600660205260409081902060080154905161420195949392918f91614ef8565b60405180910390a35b50505050505050565b601454614221906001615062565b60148190555f908152600a602090815260409182902042815560018101879055600281018690556003810188905582516318160ddd60e01b8152925190926001600160a01b037f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf7116926318160ddd926004808401938290030181865afa1580156142ad573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906142d19190615089565b600482015560058101805460ff19811682556002546001600160a01b036101009182900416026001600160a81b031990911617905585614311575f61431b565b61431b86836150b7565b60068201556007810183905542601555601754614339906001615062565b6017556014546006820154604080519283526020830189905282018790526060820152608081018490527f48cc863944b1d83eb06515eabfaa6068f616ca4254a7812a01661ab659c3cd909060a00160405180910390a1505050505050565b5f5f60205f8451602086015f885af1806143b7576040513d5f823e3d81fd5b50505f513d915081156143ce5780600114156143db565b6001600160a01b0384163b155b156115f95783604051635274afe760e01b81526004016110219190614d13565b5f815f0361440a57505f919050565b5f6002614418846001615062565b61442291906150b7565b9050825b8082101561281757508060028161443d81876150b7565b6144479190615062565b61445191906150b7565b9150614426565b60025460ff16612cb55760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611021565b5f5f5f83516041036144d8576020840151604085015160608601515f1a6144ca88828585614b26565b9550955095505050506144e3565b505081515f91506002905b9250925092565b5f8260038111156144fd576144fd615303565b03614506575050565b600182600381111561451a5761451a615303565b036145385760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561454c5761454c615303565b0361456d5760405163fce698f760e01b815260048101829052602401611021565b600382600381111561458157614581615303565b036115d0576040516335e2f38360e21b815260048101829052602401611021565b6001600160a01b0383165f90815260066020818152604080842081516101a08101835281548082526001830154948201949094526002820154928101929092526003810154606083015260048101546080830152600581015460a083018190529381015460c0830152600781015460e083015260088101546101008301526009810154610120830152600a81015460ff9081161515610140840152600b820154610160840152600c90910154166101808201528392909183916127109161466991906150a0565b61467391906150b7565b90505f61468582846101800151614be4565b90505f6127108461010001518361469c91906150a0565b6146a691906150b7565b90508615614760575f876146ba8a846150a0565b6146c491906150b7565b90506146d581866101800151614c1d565b9650612710600e54886146e891906150a0565b6146f291906150b7565b95505f6146ff8789615062565b865190915081111561475d5785515f90829061471d906127106150a0565b61472791906150b7565b9050612710614736828b6150a0565b61474091906150b7565b985061271061474f828a6150a0565b61475991906150b7565b9750505b50505b50505050935093915050565b6001600160a01b0382165f90815260086020526040902061478e825f1961515e565b816004015411156147e15760405162461bcd60e51b815260206004820152601d60248201527f546f74616c2073747265616d696e672074696d65206f766572666c6f770000006044820152606401611021565b8181600401546147f19190615062565b6004808301919091554260058301556040516370a0823160e01b81526001600160a01b037f000000000000000000000000644f10df242b43f3de45fcb3f6ef8526fb5fdf7116916370a082319161484a91879101614d13565b602060405180830381865afa158015614865573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906148899190615089565b600382015560018101545f901561490d575f620151808360010154426148af919061515e565b6148b991906150b7565b9050806001036148f6576005836006015410156148e55760068301546148e0906001615062565b6148e8565b60055b600684015560019150614907565b600181111561490757600160068401555b50614915565b600160068301555b6004820154604080518581526020810192909252821515908201526001600160a01b038516907f40117a8b474a070124a8d6175fdc8ccabd07b076caaf6bc042480c64f646b87390606001612571565b6001600160a01b0383165f908152600660205260408120906149878385615062565b905080825f015410156149ac5760405162461bcd60e51b8152600401611021906152d0565b81546149b990829061515e565b825560028201546149cb908590615062565b600283015560038201546149e0908490615062565b60038301556004820184905542600b8301556009820154614a02906064615062565b60098301556001600160a01b0386165f9081526008602052604090208054614a2b908690615062565b81554260018201556002810180546001600160a01b0319166001600160a01b038816908117909155614a5e908887613e2f565b8315614ac257600354614a7e906001600160a01b03888116911686613e2f565b856001600160a01b03167f9deb1f7b3050d677ab4e466e9cacb7285d73e64294379b9d6f22fb0bfccbdba285604051614ab991815260200190565b60405180910390a25b6001600160a01b038088165f908152600c60209081526040808320938a1683529290522054614af290600a615062565b6001600160a01b039788165f908152600c6020908152604080832099909a1682529790975296909520959095555050505050565b5f80806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03841115614b5557505f91506003905082614bda565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015614ba6573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614bd157505f925060019150829050614bda565b92505f91508190505b9450945094915050565b5f600860ff831611614bf7575081610fb7565b5f614c03600884615317565b9050614c1360ff8216600a615413565b613c9390856150b7565b5f600860ff831611614c30575081610fb7565b5f614c3c600884615317565b9050614c4c60ff8216600a615413565b613c9390856150a0565b602080825282518282018190525f918401906040840190835b81811015614c965783516001600160a01b0316835260209384019390920191600101614c6f565b509095945050505050565b5f60208284031215614cb1575f5ffd5b81356001600160e01b031981168114612817575f5ffd5b80356001600160a01b0381168114614cde575f5ffd5b919050565b5f60208284031215614cf3575f5ffd5b61281782614cc8565b5f60208284031215614d0c575f5ffd5b5035919050565b6001600160a01b0391909116815260200190565b5f5f83601f840112614d37575f5ffd5b5081356001600160401b03811115614d4d575f5ffd5b6020830191508360208260051b8501011115614d67575f5ffd5b9250929050565b5f5f83601f840112614d7e575f5ffd5b5081356001600160401b03811115614d94575f5ffd5b602083019150836020828501011115614d67575f5ffd5b5f5f5f5f5f5f5f5f5f5f60a08b8d031215614dc4575f5ffd5b8a356001600160401b03811115614dd9575f5ffd5b614de58d828e01614d27565b909b5099505060208b01356001600160401b03811115614e03575f5ffd5b614e0f8d828e01614d27565b90995097505060408b01356001600160401b03811115614e2d575f5ffd5b614e398d828e01614d27565b90975095505060608b01356001600160401b03811115614e57575f5ffd5b614e638d828e01614d27565b90955093505060808b01356001600160401b03811115614e81575f5ffd5b614e8d8d828e01614d6e565b915080935050809150509295989b9194979a5092959850565b5f5f60408385031215614eb7575f5ffd5b614ec083614cc8565b946020939093013593505050565b5f5f60408385031215614edf575f5ffd5b82359150614eef60208401614cc8565b90509250929050565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b5f5f5f60608486031215614f32575f5ffd5b614f3b84614cc8565b9250602084013560ff81168114614f50575f5ffd5b929592945050506040919091013590565b5f5f60408385031215614f72575f5ffd5b614f7b83614cc8565b9150614eef60208401614cc8565b5f5f5f60608486031215614f9b575f5ffd5b505081359360208301359350604090920135919050565b5f5f60408385031215614fc3575f5ffd5b614fcc83614cc8565b915060208301358015158114614fe0575f5ffd5b809150509250929050565b5f5f60208385031215614ffc575f5ffd5b82356001600160401b03811115615011575f5ffd5b61501d85828601614d27565b90969095509350505050565b6020808252600b908201526a4f6e6c79206f7261636c6560a81b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610fb757610fb761504e565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215615099575f5ffd5b5051919050565b8082028115828204841417610fb757610fb761504e565b5f826150d157634e487b7160e01b5f52601260045260245ffd5b500490565b91151582526001600160a01b0316602082015260400190565b5f600182016151005761510061504e565b5060010190565b602080825260149082015273456d657267656e6379206e6f742061637469766560601b604082015260600190565b6020808252600f908201526e151bdad95b881b9bdd08199bdd5b99608a1b604082015260600190565b81810381811115610fb757610fb761504e565b634e487b7160e01b5f52603160045260245ffd5b6020808252600c908201526b496e76616c6964207261746560a01b604082015260600190565b602080825260159082015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b604082015260600190565b8183526020830192505f815f5b84811015615216576001600160a01b0361520083614cc8565b16865260209586019591909101906001016151e7565b5093949350505050565b8183525f6001600160fb1b03831115615237575f5ffd5b8260051b80836020870137939093016020019392505050565b60a081525f61526360a083018b8d6151da565b8281036020840152615276818a8c615220565b9050828103604084015261528b81888a6151da565b905082810360608401526152a0818688615220565b9150508260808301529a9950505050505050505050565b6001600160a01b03929092168252602082015260400190565b602080825260199082015278496e73756666696369656e7420706f6f6c2062616c616e636560381b604082015260600190565b634e487b7160e01b5f52602160045260245ffd5b60ff8281168282160390811115610fb757610fb761504e565b6001815b600184111561536b5780850481111561534f5761534f61504e565b600184161561535d57908102905b60019390931c928002615334565b935093915050565b5f8261538157506001610fb7565b8161538d57505f610fb7565b81600181146153a357600281146153ad576153c9565b6001915050610fb7565b60ff8411156153be576153be61504e565b50506001821b610fb7565b5060208310610133831016604e8410600b84101617156153ec575081810a610fb7565b6153f85f198484615330565b805f190482111561540b5761540b61504e565b029392505050565b5f612817838361537356fea913f2a31be8313c1e31f36da8b180f63fdd4dff9cdcf5274495b67f7bc8d4f6bf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b2668e79a7bf1e0bc45d0a330c573bc367f9cf464fd326078812f301165fbda4ef16ac6f29cb533706676e94ff2d30d8f95dd3e0c525a0e07e44c1f7762360b4894a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775200e5013b1e7d404942300da3670a81a06231d29673d2ea5b80ee2015dad9f00a264697066735822122054355c3d45e7b45634c225b2f096b122f393016a9d3511a2779cedf02d6b803764736f6c634300081e0033