Overview
POL Balance
0 POL
POL Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Sponsored
Latest 25 from a total of 681 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 48923898 | 359 days ago | IN | 0 POL | 0.02036466 | ||||
Withdraw | 47721209 | 390 days ago | IN | 0 POL | 0.04687734 | ||||
Withdraw | 47721130 | 390 days ago | IN | 0 POL | 0.05325194 | ||||
Withdraw | 47635307 | 392 days ago | IN | 0 POL | 0.04923197 | ||||
Withdraw | 47609971 | 393 days ago | IN | 0 POL | 0.05326717 | ||||
Withdraw | 47407104 | 398 days ago | IN | 0 POL | 0.03988715 | ||||
Withdraw | 47385492 | 398 days ago | IN | 0 POL | 0.04771439 | ||||
Withdraw | 47354758 | 399 days ago | IN | 0 POL | 0.06529708 | ||||
Withdraw | 47337902 | 400 days ago | IN | 0 POL | 0.06192508 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.05025774 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.05001173 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281344 | 401 days ago | IN | 0 POL | 0.05128348 | ||||
Withdraw | 47281280 | 401 days ago | IN | 0 POL | 0.05100628 | ||||
Withdraw | 47281274 | 401 days ago | IN | 0 POL | 0.05100628 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.050004 | ||||
Withdraw | 47281267 | 401 days ago | IN | 0 POL | 0.05100668 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x44FE2EF1...774254c07 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Pool
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import "hardhat/console.sol"; import "./strategies/IStrategy.sol"; //*********************************************************************// // --------------------------- custom errors ------------------------- // //*********************************************************************// error ADMIN_FEE_WITHDRAWN(); error DEPOSIT_NOT_ALLOWED(); error EARLY_EXIT_NOT_POSSIBLE(); error GAME_ALREADY_INITIALIZED(); error GAME_ALREADY_STARTED(); error GAME_COMPLETED(); error GAME_NOT_COMPLETED(); error GAME_NOT_INITIALIZED(); error INVALID_CUSTOM_FEE(); error INVALID_DEPOSIT_COUNT(); error INVALID_EARLY_WITHDRAW_FEE(); error INVALID_FLEXIBLE_AMOUNT(); error INVALID_INBOUND_TOKEN(); error INVALID_INCENTIVE_TOKEN(); error INVALID_MAX_FLEXIBLE_AMOUNT(); error INVALID_MAX_PLAYER_COUNT(); error INVALID_NET_DEPOSIT_AMOUNT(); error INVALID_TRANSACTIONAL_TOKEN_SENDER(); error INVALID_OWNER(); error INVALID_SEGMENT_LENGTH(); error INVALID_SEGMENT_PAYMENT(); error INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); error INVALID_STRATEGY(); error INVALID_WAITING_ROUND_SEGMENT_LENGTH(); error MAX_PLAYER_COUNT_REACHED(); error NOT_PLAYER(); error PLAYER_ALREADY_JOINED(); error PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT(); error PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT(); error PLAYER_ALREADY_WITHDREW_EARLY(); error PLAYER_ALREADY_WITHDREW(); error PLAYER_DOES_NOT_EXIST(); error TOKEN_TRANSFER_FAILURE(); error TRANSACTIONAL_TOKEN_TRANSFER_FAILURE(); error RENOUNCE_OWNERSHIP_NOT_ALLOWED(); /** @title GoodGhosting V2 Hodl Contract @notice Allows users to join a pool with a yield bearing strategy, the winners get interest and rewards, losers get their principal back. @author Francis Odisi & Viraz Malhotra. */ contract Pool is Ownable, Pausable, ReentrancyGuard { /// @notice Multiplier used for calculating playerIndex to avoid precision issues. uint256 public constant MULTIPLIER = 10 ** 12; /// @notice Maximum Flexible Deposit Amount in case of flexible pools. uint256 public immutable maxFlexibleSegmentPaymentAmount; /// @notice The time duration (in seconds) of each segment. uint64 public immutable segmentLength; /// @notice The performance admin fee (percentage). uint64 public immutable adminFee; /// @notice The time duration (in seconds) of last segment (waiting round). uint64 public immutable waitingRoundSegmentLength; /// @notice Defines the max quantity of players allowed in the game. uint64 public immutable maxPlayersCount; /// @notice The amount to be paid on each segment in case "flexibleSegmentPayment" is false (fixed payments). uint256 public immutable segmentPayment; /// @notice Address of the token used for depositing into the game by players. address public immutable inboundToken; /// @notice Flag which determines whether the segment payment is fixed or not. bool public immutable flexibleSegmentPayment; /// @notice Flag which determines whether the deposit token is a transactional token like eth or matic (blockchain native token, not ERC20). bool public immutable isTransactionalToken; /// @notice When the game started (game initialized timestamp). uint64 public firstSegmentStart; /// @notice Timestamp when the waiting segment starts. uint64 public waitingRoundSegmentStart; /// @notice The number of segments in the game (segment count). uint64 public depositCount; /// @notice The early withdrawal fee (percentage). uint64 public earlyWithdrawalFee; /// @notice Controls the amount of active players in the game (ignores players that early withdraw). uint64 public activePlayersCount; /// @notice winner counter to track no of winners. uint64 public winnerCount; /// @notice counter to track no of winners lef to withdraw for admin accounting. uint64 public winnersLeftToWithdraw; /// @notice the % share of interest accrued during the total duration of deposit rounds. /// @dev the interest/rewards/incentive accounting is divided in two phases: /// a) the total duration of deposit rounds in the game /// b) the total duration of the waiting round in the game /// These are compared against the total game duration to calculate the weight uint64 public depositRoundInterestSharePercentage; /// @notice Stores the total amount of net interest received in the game. uint256 public totalGameInterest; /// @notice net total principal amount to reduce the slippage imapct from amm strategies. uint256 public netTotalGamePrincipal; /// @notice total principal amount only used to keep a track of the gross deposits. uint256 public totalGamePrincipal; /// @notice performance fee amount allocated to the admin. uint256[] public adminFeeAmount; /// @notice total amount of incentive tokens to be distributed among winners. uint256 public totalIncentiveAmount; /// @notice share % from impermanent loss. uint256 public impermanentLossShare; /// @notice total rewardTokenAmounts. uint256[] public rewardTokenAmounts; /// @notice emaergency withdraw flag. bool public emergencyWithdraw; /// @notice Checks if admin fee has been assigned. bool public adminFeeSet; /// @notice Controls if reward tokens are to be claimed at the time of redeem. bool public disableRewardTokenClaim; /// @notice controls if admin withdrew or not the performance fee. bool public adminWithdraw; /// @notice Ownership Control flag. bool public allowRenouncingOwnership; /// @notice Strategy Contract Address IStrategy public strategy; /// @notice Defines an optional token address used to provide additional incentives to users. Accepts "0x0" adresses when no incentive token exists. IERC20 public incentiveToken; /// @notice address of additional reward token accured from investing via different strategies like wmatic. IERC20[] public rewardTokens; /// @notice struct for storing all player stats. /// @param withdrawn boolean flag indicating whether a player has withdrawn or not /// @param canRejoin boolean flag indicating whether a player can re-join or not /// @param isWinner boolean flag indicating whether a player is a winner or not /// @param addr player address /// @param withdrawalSegment segment at which a player withdraws /// @param mostRecentSegmentPaid is the most recent segment in which the deposit was made by the player /// @param amountPaid the total amount paid by a player /// @param netAmountPaid the new total amount paid by a player considering the slippage & fees for amm strategies /// @param depositAmount the deposit amount the player has decided to pay per segment needed for variable deposit game struct Player { bool withdrawn; bool canRejoin; bool isWinner; address addr; uint64 withdrawalSegment; uint64 mostRecentSegmentPaid; uint256 amountPaid; uint256 netAmountPaid; uint256 depositAmount; } /// @notice Stores info about the players in the game. mapping(address => Player) public players; /// @notice Stores info about the player index which is used to determine the share of interest of each winner. mapping(address => mapping(uint256 => uint256)) public playerIndex; /// @notice Stores info of the no of players that deposited in each segment. mapping(uint256 => uint256) public segmentCounter; /// @notice Stores info of cumulativePlayerIndexSum for each segment for early exit scenario. /// so if for the key as segment `3` cumulativePlayerIndexSum will have player index sum /// of all players who have deposited in segment `3` from the current segment and previous segments. mapping(uint256 => uint256) public cumulativePlayerIndexSum; /// @notice Stores the total deposited amount by winners in each segment. /// @dev we need this for calculating the waiting round share amount of the /// winners depending on their total deposit size (individual ratio compared to all winners). /// totalWinnerDepositsPerSegment for let's say segment `3` will be the sum of deposits from // all winning players who have deposited in segment `3` & other previous segments. mapping(uint256 => uint256) public totalWinnerDepositsPerSegment; /// @notice list of players. address[] public iterablePlayers; //*********************************************************************// // ------------------------- events -------------------------- // //*********************************************************************// event JoinedGame( address indexed player, uint256 amount, uint256 netAmount, uint256 playerIndex, uint256 cumulativePlayerIndexSum, uint256 totalWinnerDepositsPerSegment ); event Deposit( address indexed player, uint256 indexed segment, uint256 amount, uint256 netAmount, uint256 playerIndex, uint256 cumulativePlayerIndexSum, uint256 totalWinnerDepositsPerSegment ); event WithdrawInboundTokens(address indexed player, uint256 amount); event WithdrawIncentiveToken(address indexed player, uint256 amount); event WithdrawRewardTokens(address indexed player, uint256[] amounts); event UpdateGameStats( address indexed player, uint256 totalBalance, uint256 totalGamePrincipal, uint256 netTotalGamePrincipal, uint256 totalGameInterest, uint256 totalIncentiveAmount, uint256[] totalRewardAmounts, uint256 impermanentLossShare, uint256 cumulativePlayerIndexSum, uint256 totalWinnerDepositsPerSegment ); event EarlyWithdrawal( address indexed player, uint256 amount, uint256 totalGamePrincipal, uint256 netTotalGamePrincipal, uint256 depositedAmount, uint256 depositedNetAmount, uint256 cumulativePlayerIndexSum, uint256 totalWinnerDepositsPerSegment ); event AdminWithdrawal( address indexed admin, uint256 totalGameInterest, uint256 adminIncentiveAmount, uint256[] adminFeeAmounts ); event EndGameStats( address indexed player, uint256 totalBalance, uint256 totalGamePrincipal, uint256 netTotalGamePricipal, uint256 totalGameInterest, uint256[] grossRewardTokenAmount, uint256 totalIncentiveAmount, uint256 impermanentLossShare ); event AdminFee(uint256[] adminFeeAmounts); event ExternalTokenTransferError(address indexed token, bytes reason); event ExternalTokenGetBalanceError(address indexed token, bytes reason); event Initialized(uint64 firstSegmentStart, uint64 waitingRoundSegmentStart); event IncentiveTokenSet(address token); event EmergencyWithdrawalEnabled( uint64 currentSegment, uint64 winnerCount, uint64 depositRoundInterestSharePercentage ); event EarlyWithdrawalFeeChanged(uint64 currentSegment, uint64 oldFee, uint64 newFee); event ClaimRewardTokensDisabled(uint64 currentSegment); //*********************************************************************// // ------------------------- modifiers -------------------------- // //*********************************************************************// modifier whenGameIsCompleted() { if (!isGameCompleted()) { revert GAME_NOT_COMPLETED(); } _; } modifier whenGameIsNotCompleted() { if (isGameCompleted()) { revert GAME_COMPLETED(); } _; } modifier whenGameIsInitialized() { if (firstSegmentStart == 0) { revert GAME_NOT_INITIALIZED(); } _; } modifier whenGameIsNotInitialized() { if (firstSegmentStart != 0) { revert GAME_ALREADY_INITIALIZED(); } _; } //*********************************************************************// // ------------------------- external views -------------------------- // //*********************************************************************// /// @dev Checks if the game is completed or not. /// @return "true" if completeted; otherwise, "false". function isGameCompleted() public view returns (bool) { // Game is completed when the current segment is greater than "depositCount" of the game // or if "emergencyWithdraw" was enabled. return getCurrentSegment() > depositCount || emergencyWithdraw; } /// @dev Checks if player is a winner. /// @param _player player address /// @return "true" if player is a winner; otherwise, return "false". function isWinner(address _player) external view returns (bool) { if (players[_player].amountPaid == 0) { return false; } return _isWinner(players[_player], depositCount); } /// @dev gets the number of players in the game. /// @return number of players. function getNumberOfPlayers() external view returns (uint256) { return iterablePlayers.length; } /// @dev Calculates the current segment of the game. /// @return current game segment. // UPDATE - A1 Audit Report function getCurrentSegment() public view whenGameIsInitialized returns (uint64) { uint256 currentSegment; // to avoid SLOAD multiple times uint256 _waitingRoundSegmentStart = waitingRoundSegmentStart; uint256 endOfWaitingRound = _waitingRoundSegmentStart + waitingRoundSegmentLength; // logic for getting the current segment while the game is on waiting round if (_waitingRoundSegmentStart <= block.timestamp && block.timestamp < endOfWaitingRound) { currentSegment = depositCount; } else if (block.timestamp >= endOfWaitingRound) { // logic for getting the current segment after the game completes (waiting round is over) currentSegment = depositCount + 1 + ((block.timestamp - endOfWaitingRound) / segmentLength); } else { // logic for getting the current segment during segments that allows depositing (before waiting round) currentSegment = (block.timestamp - firstSegmentStart) / segmentLength; } return uint64(currentSegment); } /// @dev Checks if the game has been initialized or not. function isInitialized() external view returns (bool) { return firstSegmentStart != 0; } //*********************************************************************// // ------------------------- constructor -------------------------- // //*********************************************************************// /** Creates a new instance of GoodGhosting game @param _inboundCurrency Smart contract address of inbound currency used for the game. @param _maxFlexibleSegmentPaymentAmount Maximum Flexible Deposit Amount in case of flexible pools. @param _depositCount Number of segments in the game. @param _segmentLength Lenght of each segment, in seconds (i.e., 180 (sec) => 3 minutes). @param _waitingRoundSegmentLength Lenght of waiting round segment, in seconds (i.e., 180 (sec) => 3 minutes). @param _segmentPayment Amount of tokens each player needs to contribute per segment @param _earlyWithdrawalFee Fee paid by users on early withdrawals (before the game completes). Used as an integer percentage (i.e., 10 represents 10%). @param _customFee performance fee charged by admin. Used as an integer percentage (i.e., 10 represents 10%). Does not accept "decimal" fees like "0.5". @param _maxPlayersCount max quantity of players allowed to join the game @param _strategy investment strategy contract address. @param _isTransactionalToken isTransactionalToken flag. */ constructor( address _inboundCurrency, uint256 _maxFlexibleSegmentPaymentAmount, uint64 _depositCount, uint64 _segmentLength, uint64 _waitingRoundSegmentLength, uint256 _segmentPayment, uint64 _earlyWithdrawalFee, uint64 _customFee, uint64 _maxPlayersCount, bool _flexibleSegmentPayment, IStrategy _strategy, bool _isTransactionalToken ) { flexibleSegmentPayment = _flexibleSegmentPayment; isTransactionalToken = _isTransactionalToken; if (_customFee > 100) { revert INVALID_CUSTOM_FEE(); } if (_earlyWithdrawalFee > 99) { revert INVALID_EARLY_WITHDRAW_FEE(); } if (_maxPlayersCount == 0) { revert INVALID_MAX_PLAYER_COUNT(); } if (address(_inboundCurrency) == address(0) && !_isTransactionalToken) { revert INVALID_INBOUND_TOKEN(); } if (address(_strategy) == address(0)) { revert INVALID_STRATEGY(); } if (_depositCount == 0) { revert INVALID_DEPOSIT_COUNT(); } if (_segmentLength == 0) { revert INVALID_SEGMENT_LENGTH(); } if (!_flexibleSegmentPayment && _segmentPayment == 0) { revert INVALID_SEGMENT_PAYMENT(); } if (_waitingRoundSegmentLength == 0) { revert INVALID_WAITING_ROUND_SEGMENT_LENGTH(); } if (_waitingRoundSegmentLength < _segmentLength) { revert INVALID_WAITING_ROUND_SEGMENT_LENGTH(); } if (_flexibleSegmentPayment && _maxFlexibleSegmentPaymentAmount == 0) { revert INVALID_MAX_FLEXIBLE_AMOUNT(); } address _underlyingAsset = _strategy.getUnderlyingAsset(); // UPDATE - A4 Audit Report if (_underlyingAsset != _inboundCurrency && !_isTransactionalToken) { revert INVALID_INBOUND_TOKEN(); } // Initializes default variables depositCount = _depositCount; segmentLength = _segmentLength; waitingRoundSegmentLength = _waitingRoundSegmentLength; segmentPayment = _segmentPayment; earlyWithdrawalFee = _earlyWithdrawalFee; adminFee = _customFee; inboundToken = _inboundCurrency; strategy = _strategy; maxPlayersCount = _maxPlayersCount; maxFlexibleSegmentPaymentAmount = _maxFlexibleSegmentPaymentAmount; rewardTokens = strategy.getRewardTokens(); rewardTokenAmounts = new uint256[](rewardTokens.length); // length of the array is more, considering the inbound token since there would be fee on interest adminFeeAmount = new uint256[](rewardTokens.length + 1); } /** @dev Initializes the pool by setting the start time, the waiting round start time, incentive token (optional) & updates the interest share % of the deposit phase @param _incentiveToken Incentive token address (optional to set). */ function initialize(IERC20 _incentiveToken) public virtual onlyOwner whenGameIsNotInitialized whenNotPaused { if (strategy.strategyOwner() != address(this)) { revert INVALID_OWNER(); } firstSegmentStart = uint64(block.timestamp); //gets current time unchecked { waitingRoundSegmentStart = firstSegmentStart + (segmentLength * depositCount); } _updateInterestShares(0); setIncentiveToken(_incentiveToken); emit Initialized(firstSegmentStart, waitingRoundSegmentStart); } //*********************************************************************// // ------------------------- internal methods -------------------------- // //*********************************************************************// /** @dev Transfer external tokens with try/catch in place so the external token transfer failures don't affect the transaction confirmation @param _token token address. @param _to recipient of the token. @param _amount transfer amount. */ // UPDATE - N1 Audit Report function _transferTokenOrContinueOnFailure( address _token, address _to, uint256 _amount ) internal returns (uint256) { try IERC20(_token).balanceOf(address(this)) returns (uint256 tokenBalance) { if (_amount > tokenBalance) { _amount = tokenBalance; } } catch (bytes memory reason) { _amount = 0; emit ExternalTokenGetBalanceError(_token, reason); } if (_amount != 0) { try IERC20(_token).transfer(_to, _amount) returns (bool success) { if (!success) { // forces error event to be emitted in case false is returned from ERC20.transfer. revert TOKEN_TRANSFER_FAILURE(); } } catch (bytes memory reason) { emit ExternalTokenTransferError(_token, reason); } } return _amount; } /** @dev Winner interest accounting based on the interest amount share in the deposit rounds & waiting round. @param _segment last deposit segment for the winners. @param _impermanentLossShare impermanent loss share during the current withdrawal. @return _playerIndexSharePercentage is the percentage share of the winners during deposit rounds for getting interest/rewards/incentives based on player index. @return _playerDepositAmountSharePercentage is the percentage share of the winners during waiting round for getting interest/rewards/incentives based on player deposits. @return _payout total amount to be transferred to the winners. */ function _calculateAndUpdateWinnerInterestAccounting( uint64 _segment, uint256 _impermanentLossShare ) internal returns (uint256 _playerIndexSharePercentage, uint256 _playerDepositAmountSharePercentage, uint256 _payout) { // memory variables for the player interest amount accounting for both deposits and waiting rounds. uint256 playerInterestAmountDuringDepositRounds; uint256 playerInterestAmountDuringWaitingRounds; // winners of the game get a share of the interest, reward & incentive tokens based on how early they deposit, the amount they deposit in case of avriable deposit pool & the ratio of the deposit & waiting round. // Calculate Cummalative index of the withdrawing player uint256 playerIndexSum = 0; // calculate playerIndexSum for each player for (uint256 i = 0; i <= _segment; ) { playerIndexSum += playerIndex[msg.sender][i]; unchecked { ++i; } } // calculate playerIndexSharePercentage for each player // UPDATE - H3 Audit Report _playerIndexSharePercentage = (playerIndexSum * MULTIPLIER) / cumulativePlayerIndexSum[_segment]; // reduce cumulativePlayerIndexSum since a winner only withdraws their own funds. cumulativePlayerIndexSum[_segment] -= playerIndexSum; _payout = players[msg.sender].netAmountPaid; // calculate _playerDepositAmountSharePercentage for each player for waiting round calculations depending on how much deposit share the player has. // have a safety check players[msg.sender].netAmountPaid > totalWinnerDepositsPerSegment[segment] in case of a impermanent loss // in case of a impermanent loss although we probably won't need it since we reduce player's netAmountPaid too but just in case. _playerDepositAmountSharePercentage = _payout > totalWinnerDepositsPerSegment[_segment] ? MULTIPLIER // UPDATE - H3 Audit Report : (_payout * MULTIPLIER) / totalWinnerDepositsPerSegment[_segment]; // update storage vars since each winner withdraws only funds entitled to them. if (totalWinnerDepositsPerSegment[_segment] < _payout) { totalWinnerDepositsPerSegment[_segment] = 0; } else { totalWinnerDepositsPerSegment[_segment] -= _payout; } // checking for impermenent loss if (_impermanentLossShare != 0) { // new payput in case of impermanent loss _payout = (_payout * _impermanentLossShare) / 100; // update netAmountPaid in case of impermanent loss players[msg.sender].netAmountPaid = _payout; } // checking for impermenent loss // save gas by checking the interest before entering in the if block if (_impermanentLossShare == 0 && totalGameInterest != 0) { // calculating the interest amount accrued in waiting & deposit Rounds. uint256 interestAccruedDuringDepositRounds = (totalGameInterest * depositRoundInterestSharePercentage) / MULTIPLIER; // we calculate interestAccruedDuringWaitingRound by subtracting the totalGameInterest by interestAccruedDuringDepositRounds uint256 interestAccruedDuringWaitingRound = depositRoundInterestSharePercentage == MULTIPLIER ? 0 : totalGameInterest - interestAccruedDuringDepositRounds; // calculating the player interest share split b/w the waiting & deposit rounds. playerInterestAmountDuringWaitingRounds = (interestAccruedDuringWaitingRound * _playerDepositAmountSharePercentage) / MULTIPLIER; playerInterestAmountDuringDepositRounds = (interestAccruedDuringDepositRounds * _playerIndexSharePercentage) / MULTIPLIER; // update the total amount to be redeemed _payout += playerInterestAmountDuringDepositRounds + playerInterestAmountDuringWaitingRounds; // reduce totalGameInterest since a winner only withdraws their own funds. totalGameInterest -= (playerInterestAmountDuringDepositRounds + playerInterestAmountDuringWaitingRounds); } winnersLeftToWithdraw -= 1; } /** @dev Non-winner amount accounting. @param _impermanentLossShare impermanent loss share %. @param _netAmountPaid net amount paid by the player. @return payout amount to be sent to the player. */ function _calculateAndUpdateNonWinnerAccounting( uint256 _impermanentLossShare, uint256 _netAmountPaid ) internal returns (uint256 payout) { if (_impermanentLossShare != 0) { // new payput in case of impermanent loss payout = (_netAmountPaid * _impermanentLossShare) / 100; // reduce player netAmountPaid in case of impermanent loss players[msg.sender].netAmountPaid = payout; } else { payout = _netAmountPaid; } // non-winners don't get any rewards/incentives uint256[] memory rewardAmounts = new uint256[](rewardTokens.length); emit WithdrawIncentiveToken(msg.sender, 0); emit WithdrawRewardTokens(msg.sender, rewardAmounts); } /** @dev Winner reward accounting based on the player amount share % calculated based on player index & total deposits made. @param playerDepositAmountSharePercentage Deposit amount share %. @param playerIndexSharePercentage Player index share %.. */ function _calculateAndUpdateWinnerRewardAccounting( uint256 playerDepositAmountSharePercentage, uint256 playerIndexSharePercentage ) internal { // calculating winners share of the reward amounts // memory vars to avoid SLOADS & for the player rewards share accounting IERC20[] memory _rewardTokens = rewardTokens; uint256[] memory _rewardTokenAmounts = rewardTokenAmounts; uint256[] memory playerRewards = new uint256[](_rewardTokens.length); // reference for array length to save gas uint256 _rewardLength = _rewardTokens.length; for (uint256 i = 0; i < _rewardLength; ) { if (address(_rewardTokens[i]) != address(0) && _rewardTokenAmounts[i] != 0) { // calculating the reward token amount split b/w waiting & deposit Rounds. uint256 totalRewardAmountsDuringDepositRounds = (_rewardTokenAmounts[i] * depositRoundInterestSharePercentage) / MULTIPLIER; // we calculate totalRewardAmountsWaitingRounds by subtracting the rewardTokenAmounts by totalRewardAmountsDuringDepositRounds uint256 totalRewardAmountsWaitingRounds = depositRoundInterestSharePercentage == MULTIPLIER ? 0 : _rewardTokenAmounts[i] - totalRewardAmountsDuringDepositRounds; // calculating the winner reward token amount share split b/w the waiting & deposit rounds. uint256 playerRewardShareAmountDuringDepositRounds = (totalRewardAmountsDuringDepositRounds * playerIndexSharePercentage) / MULTIPLIER; uint256 playerRewardShareAmountDuringWaitingRounds = (totalRewardAmountsWaitingRounds * playerDepositAmountSharePercentage) / MULTIPLIER; // update the rewards to be transferred playerRewards[i] = playerRewardShareAmountDuringDepositRounds + playerRewardShareAmountDuringWaitingRounds; // update storage var since each winner withdraws only funds entitled to them. _rewardTokenAmounts[i] -= playerRewards[i]; // transferring the reward token share to the winner // updates variable value to make sure on a failure, event is emitted w/ correct value. // UPDATE - Related to N1 Audit Report (If an external protocol reward token get's compromised) playerRewards[i] = _transferTokenOrContinueOnFailure( address(_rewardTokens[i]), msg.sender, playerRewards[i] ); } unchecked { ++i; } } // avoid SSTORE inside loop rewardTokenAmounts = _rewardTokenAmounts; // We have to ignore the "check-effects-interactions" pattern here and emit the event // only at the end of the function, in order to emit it w/ the correct withdrawal amount. // In case the safety checks above are evaluated to true, payout, playerIncentiv and playerReward // are updated, so we need the event to be emitted with the correct info. emit WithdrawRewardTokens(msg.sender, playerRewards); } /** @dev Winner incentive accounting based on the player amount share % calculated based on player index & total deposits made. @param playerDepositAmountSharePercentage Deposit amount share %. @param playerIndexSharePercentage Player index share %.. */ function _calculateAndUpdateWinnerIncentivesAccounting( uint256 playerDepositAmountSharePercentage, uint256 playerIndexSharePercentage ) internal { uint256 playerIncentive; if (totalIncentiveAmount != 0) { // calculating the incentive amount split b/w waiting & deposit Rounds. uint256 incentiveAmountSharedDuringDepositRounds = (totalIncentiveAmount * depositRoundInterestSharePercentage) / MULTIPLIER; // we calculate incentiveAmountShareDuringWaitingRound by subtracting the totalIncentiveAmount by incentiveAmountSharedDuringDepositRounds uint256 incentiveAmountShareDuringWaitingRound = depositRoundInterestSharePercentage == MULTIPLIER ? 0 : totalIncentiveAmount - incentiveAmountSharedDuringDepositRounds; // calculating the winner incentive amount share split b/w the waiting & deposit rounds. uint256 playerIncentiveAmountDuringDepositRounds = (incentiveAmountSharedDuringDepositRounds * playerIndexSharePercentage) / MULTIPLIER; uint256 playerIncentiveAmountDuringWaitingRounds = (incentiveAmountShareDuringWaitingRound * playerDepositAmountSharePercentage) / MULTIPLIER; playerIncentive = playerIncentiveAmountDuringDepositRounds + playerIncentiveAmountDuringWaitingRounds; // update storage var since each winner withdraws only funds entitled to them. totalIncentiveAmount -= playerIncentive; // transferring the incentive share to the winner // updates variable value to make sure on a failure, event is emitted w/ correct value. // UPDATE - N1 Audit Report playerIncentive = _transferTokenOrContinueOnFailure(address(incentiveToken), msg.sender, playerIncentive); } // We have to ignore the "check-effects-interactions" pattern here and emit the event // only at the end of the function, in order to emit it w/ the correct withdrawal amount. // In case the safety checks above are evaluated to true, payout, playerIncentiv and playerReward // are updated, so we need the event to be emitted with the correct info. emit WithdrawIncentiveToken(msg.sender, playerIncentive); } /** @notice updates the waiting and deposit rounds time percentages based on the total duration of the pool, total deposit round & waiting round duration. @param _currentSegment current segment value. */ function _updateInterestShares(uint64 _currentSegment) internal { // if emergencyWithdraw hasn't been enabled then the calculation of the percentages is pretty straightforward // we get the total durations of the deposit and waiting round and get the % share out of the total duration if (!emergencyWithdraw) { uint64 endOfWaitingRound = waitingRoundSegmentStart + waitingRoundSegmentLength; uint64 totalGameDuration = endOfWaitingRound - firstSegmentStart; depositRoundInterestSharePercentage = uint64( (segmentLength * depositCount * MULTIPLIER) / totalGameDuration ); } else { // if emergencyWithdraw is enabled & it got enabled during the waiting round then we re-calculate the waiting round period // we then get the total durations of the deposit and waiting round and get the % share out of the total duration if (_currentSegment == depositCount) { uint64 totalGameDuration = uint64(block.timestamp) - firstSegmentStart; depositRoundInterestSharePercentage = uint64( (segmentLength * depositCount * MULTIPLIER) / totalGameDuration ); } else { // if emergencyWithdraw is enabled & it got enabled before the waiting round then we set the depositRoundInterestSharePercentage to 100 % and waitingRoundInterestSharePercentage will indirectly be 0. depositRoundInterestSharePercentage = uint64(MULTIPLIER); } } } /** @notice check if there are any rewards to claim for the admin. @param _adminFeeAmount admin fee amount value. */ function _checkRewardsClaimableByAdmin(uint256[] memory _adminFeeAmount) internal pure returns (bool) { // reference for array length to save gas uint256 _adminFeeAmountsLength = _adminFeeAmount.length; // starts loop from 1, because first spot of _adminFeeAmount is reserved for admin interest share. for (uint256 i = 1; i < _adminFeeAmountsLength; ) { if (_adminFeeAmount[i] != 0) { return true; } unchecked { ++i; } } return false; } /** @notice Transfer funds after balance checks to the players / admin. @param _recepient address which will receive tokens. @param _amount transfer amount. */ // UPDATE - A3 Audit Report function _transferFundsSafelyOrFail(address _recepient, uint256 _amount) internal returns (uint256) { if (isTransactionalToken) { // safety check // this scenario is very tricky to mock // and our mock contracts are pretty complex currently so haven't tested this line with unit tests if (_amount > address(this).balance) { _amount = address(this).balance; } (bool success, ) = _recepient.call{ value: _amount }(""); if (!success) { revert TRANSACTIONAL_TOKEN_TRANSFER_FAILURE(); } } else { // safety check if (_amount > IERC20(inboundToken).balanceOf(address(this))) { _amount = IERC20(inboundToken).balanceOf(address(this)); } bool success = IERC20(inboundToken).transfer(_recepient, _amount); if (!success) { revert TOKEN_TRANSFER_FAILURE(); } } return _amount; } /** @notice Calculates and updates's game accounting called by methods _setGlobalPoolParams. Updates the game storage vars used for calculating player interest, incentives etc. @param _totalBalance Total inbound token balance in the contract. @param _grossRewardTokenAmount Gross reward amounts. */ function _calculateAndUpdateGameAccounting( uint256 _totalBalance, uint256[] memory _grossRewardTokenAmount ) internal returns (uint256) { uint256 _grossInterest = 0; if (_totalBalance >= netTotalGamePrincipal) { // calculates the gross interest _grossInterest = _totalBalance - netTotalGamePrincipal; } else { // handling impermanent loss case impermanentLossShare = (_totalBalance * 100) / netTotalGamePrincipal; netTotalGamePrincipal = _totalBalance; } // sets the totalIncentiveAmount if available // UPDATE - N1 Audit Report address _incentiveToken = address(incentiveToken); if (_incentiveToken != address(0)) { try IERC20(_incentiveToken).balanceOf(address(this)) returns (uint256 _totalIncentiveAmount) { totalIncentiveAmount = _totalIncentiveAmount; } catch (bytes memory reason) { emit ExternalTokenGetBalanceError(_incentiveToken, reason); } } // this condition is added because emit is to only be emitted when adminFeeSet flag is false but this mehtod is called for every player withdrawal in variable deposit pool. if (!adminFeeSet) { winnersLeftToWithdraw = winnerCount; emit EndGameStats( msg.sender, _totalBalance, totalGamePrincipal, netTotalGamePrincipal, _grossInterest, _grossRewardTokenAmount, totalIncentiveAmount, impermanentLossShare ); } return _grossInterest; } /** @notice Calculates and set's admin accounting called by methods _setGlobalPoolParams. Updates the admin fee storage var used for admin fee. @param _grossInterest Gross interest amount. @param _grossRewardTokenAmount Gross reward amount array. */ function _calculateAndSetAdminAccounting( uint256 _grossInterest, uint256[] memory _grossRewardTokenAmount ) internal { // calculates the performance/admin fee (takes a cut - the admin percentage fee - from the pool's interest, strategy rewards). // calculates the "gameInterest" (net interest) that will be split among winners in the game // calculates the rewardTokenAmounts that will be split among winners in the game // when there's no winners, admin takes all the interest + rewards // to avoid SLOAD multiple times IERC20[] memory _rewardTokens = rewardTokens; uint256[] memory _adminFeeAmount = adminFeeAmount; uint256[] memory _rewardTokenAmounts = rewardTokenAmounts; // handling the scenario when some winners withdraw later so they should get extra interest/rewards // the scenario wasn't handled before if (adminFeeSet) { // if the admin fee is set a check is made to check whether the admin has withdrawn or not if (adminWithdraw) { // we update the totalGameInterest/reward amounts as the gross values totalGameInterest = _grossInterest; _rewardTokenAmounts = _grossRewardTokenAmount; } else { uint256 _interestIncludingFee = totalGameInterest + _adminFeeAmount[0]; // if the admin hasn't made a withdrawal yet so we calculate the rise in interest & update the admin fee & interest if (_grossInterest >= _interestIncludingFee) { uint256 difference = _grossInterest - _interestIncludingFee; uint256 adminfeeShareForDifference; // if there are no winners then set the difference as the admin share & total game interest if (winnerCount == 0 || winnersLeftToWithdraw == 0) { adminfeeShareForDifference = difference; totalGameInterest += difference; } else { // if there are winners then calculate the rise in admin fee & update both admin fee & interest accordingly adminfeeShareForDifference = (difference * adminFee) / 100; totalGameInterest = difference > 0 ? _grossInterest - (_adminFeeAmount[0] + adminfeeShareForDifference) : totalGameInterest; } _adminFeeAmount[0] += adminfeeShareForDifference; } else { // if _grossInterest is non zero then update admin fee & game interest with the new gross interest uint256 adminfeeShareForDifference; if (winnerCount == 0 || winnersLeftToWithdraw == 0) { // if there are no winners then set the _grossInterest as the admin share & total game interest adminfeeShareForDifference = _grossInterest; totalGameInterest = _grossInterest; } else { // if there are winners then calculate the new admin fee share based on the gross interest & update both admin fee & interest adminfeeShareForDifference = (_grossInterest * adminFee) / 100; totalGameInterest = _grossInterest - adminfeeShareForDifference; } _adminFeeAmount[0] = adminfeeShareForDifference; } // reference for array length to save gas uint256 _rewardsLength = _rewardTokens.length; for (uint256 i = 0; i < _rewardsLength; ) { // first slot is reserved for admin interest amount, so starts at 1. if (_grossRewardTokenAmount[i] >= _rewardTokenAmounts[i]) { uint256 difference = _grossRewardTokenAmount[i] - _rewardTokenAmounts[i]; uint256 adminfeeShareForDifference; if (winnerCount == 0 || winnersLeftToWithdraw == 0) { adminfeeShareForDifference = difference; _rewardTokenAmounts[i] += difference; } else { adminfeeShareForDifference = (difference * adminFee) / 100; _rewardTokenAmounts[i] = difference > 0 ? _grossRewardTokenAmount[i] - adminfeeShareForDifference : _rewardTokenAmounts[i]; } _adminFeeAmount[i + 1] += adminfeeShareForDifference; } else { uint256 adminfeeShareForDifference; if (winnerCount == 0 || winnersLeftToWithdraw == 0) { adminfeeShareForDifference = _grossRewardTokenAmount[i]; _rewardTokenAmounts[i] = _grossRewardTokenAmount[i]; } else { adminfeeShareForDifference = (_grossRewardTokenAmount[i] * adminFee) / 100; _rewardTokenAmounts[i] = _grossRewardTokenAmount[i] - adminfeeShareForDifference; } _adminFeeAmount[i + 1] = adminfeeShareForDifference; } unchecked { ++i; } } } } else { // reference for array length to save gas uint256 _rewardsLength = _rewardTokens.length; // if the admin fee isn't set then we set it in the else part // UPDATE - N2 Audit Report if (winnerCount == 0) { // in case of no winners the admin takes all the interest and the rewards & the incentive amount (check adminFeeWithdraw method) _adminFeeAmount[0] = _grossInterest; // just setting these for consistency since if there are no winners then for accounting both these vars aren't used totalGameInterest = _grossInterest; for (uint256 i = 0; i < _rewardsLength; ) { _rewardTokenAmounts[i] = _grossRewardTokenAmount[i]; // first slot is reserved for admin interest amount, so starts at 1. _adminFeeAmount[i + 1] = _grossRewardTokenAmount[i]; unchecked { ++i; } } } else if (adminFee != 0) { // if admin fee != 0 then the admin get's a share based on the adminFee % _adminFeeAmount[0] = (_grossInterest * adminFee) / 100; totalGameInterest = _grossInterest - _adminFeeAmount[0]; for (uint256 i = 0; i < _rewardsLength; ) { // first slot is reserved for admin interest amount, so starts at 1. _adminFeeAmount[i + 1] = (_grossRewardTokenAmount[i] * adminFee) / 100; _rewardTokenAmounts[i] = _grossRewardTokenAmount[i] - _adminFeeAmount[i + 1]; unchecked { ++i; } } } else { // if there are winners and there is no admin fee in that case the admin fee will always be 0 totalGameInterest = _grossInterest; for (uint256 i = 0; i < _rewardsLength; ) { _rewardTokenAmounts[i] = _grossRewardTokenAmount[i]; unchecked { ++i; } } } } // avoid SSTORE in loop rewardTokenAmounts = _rewardTokenAmounts; adminFeeAmount = _adminFeeAmount; emit AdminFee(_adminFeeAmount); } /** @dev Initializes the player stats when they join. @param _minAmount Slippage based amount to cover for impermanent loss scenario. @param _depositAmount Variable Deposit Amount in case of a variable deposit pool. */ function _joinGame(uint256 _minAmount, uint256 _depositAmount) internal virtual { uint64 _currentSegment = getCurrentSegment(); if (_currentSegment != 0) { revert GAME_ALREADY_STARTED(); } bool canRejoin = players[msg.sender].canRejoin; if (players[msg.sender].addr == msg.sender && !canRejoin) { revert PLAYER_ALREADY_JOINED(); } activePlayersCount += 1; if (activePlayersCount > maxPlayersCount) { revert MAX_PLAYER_COUNT_REACHED(); } if (flexibleSegmentPayment && (_depositAmount == 0 || _depositAmount > maxFlexibleSegmentPaymentAmount)) { revert INVALID_FLEXIBLE_AMOUNT(); } uint256 amount = flexibleSegmentPayment ? _depositAmount : segmentPayment; if (isTransactionalToken) { if (msg.value != amount) { revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); } } else { if (msg.value != 0) { revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); } } // get net deposit amount from the strategy uint256 netAmount = strategy.getNetDepositAmount(amount); if (netAmount == 0) { revert INVALID_NET_DEPOSIT_AMOUNT(); } Player memory newPlayer = Player({ addr: msg.sender, withdrawalSegment: 0, mostRecentSegmentPaid: 0, amountPaid: 0, netAmountPaid: 0, withdrawn: false, canRejoin: false, isWinner: false, depositAmount: amount }); players[msg.sender] = newPlayer; if (!canRejoin) { iterablePlayers.push(msg.sender); } _transferInboundTokenToContract(_minAmount, amount, netAmount); emit JoinedGame( msg.sender, amount, netAmount, playerIndex[msg.sender][_currentSegment], cumulativePlayerIndexSum[_currentSegment], totalWinnerDepositsPerSegment[_currentSegment] ); } /** @dev Manages the transfer of funds from the player to the specific strategy used for the game/pool and updates the player index which determines the interest and reward share of the winner based on the deposit amount amount and the time they deposit in a particular segment. @param _minAmount Slippage based amount to cover for impermanent loss scenario. @param _depositAmount Variable Deposit Amount in case of a variable deposit pool. @param _netDepositAmount Net deposit amount. */ function _transferInboundTokenToContract( uint256 _minAmount, uint256 _depositAmount, uint256 _netDepositAmount ) internal virtual { // this scenario given the inputs to the mock contract methods isn't possible to mock locally // UPDATE - H1 Audit Report if (_netDepositAmount > _depositAmount) { revert INVALID_NET_DEPOSIT_AMOUNT(); } uint64 currentSegment = getCurrentSegment(); players[msg.sender].mostRecentSegmentPaid = currentSegment; players[msg.sender].amountPaid += _depositAmount; players[msg.sender].netAmountPaid += _netDepositAmount; // PLAYER INDEX CALCULATION TO DETERMINE INTEREST SHARE // player index = prev. segment player index + segment amount deposited / difference in time of deposit from the current segment starting time // UPDATE - H2 Audit Report uint256 currentSegmentplayerIndex = (_netDepositAmount * MULTIPLIER) / (segmentLength + block.timestamp - (firstSegmentStart + (currentSegment * segmentLength))); playerIndex[msg.sender][currentSegment] = currentSegmentplayerIndex; // updating the cummulative player Index with all the deposits made by the player till that segment // Avoids SLOAD in loop uint256 cummalativePlayerIndexSumInMemory = cumulativePlayerIndexSum[currentSegment]; for (uint256 i = 0; i <= currentSegment; ) { cummalativePlayerIndexSumInMemory += playerIndex[msg.sender][i]; unchecked { ++i; } } cumulativePlayerIndexSum[currentSegment] = cummalativePlayerIndexSumInMemory; // update totalWinnerDepositsPerSegment for every segment for every deposit made totalWinnerDepositsPerSegment[currentSegment] += players[msg.sender].netAmountPaid; // check if this is deposit for the last segment. If yes, the player is a winner. // since both join game and deposit method call this method so having it here if (currentSegment == (depositCount - 1)) { // array indexes start from 0 unchecked { winnerCount += 1; } players[msg.sender].isWinner = true; } // segment counter calculation unchecked { segmentCounter[currentSegment] += 1; if (currentSegment != 0 && segmentCounter[currentSegment - 1] != 0) { segmentCounter[currentSegment - 1] -= 1; } } // updating both totalGamePrincipal & netTotalGamePrincipal to maintain consistency totalGamePrincipal += _depositAmount; netTotalGamePrincipal += _netDepositAmount; if (!isTransactionalToken) { bool success = IERC20(inboundToken).transferFrom(msg.sender, address(strategy), _depositAmount); if (!success) { revert TOKEN_TRANSFER_FAILURE(); } } strategy.invest{ value: msg.value }(inboundToken, _minAmount); } /// @dev Sets the game stats without redeeming the funds from the strategy. /// Can only be called after the game is completed when each player withdraws. function _setGlobalPoolParams() internal virtual whenGameIsCompleted { // this method is called everytime a player decides to withdraw, // to update the game storage vars because every player withdraw's their entitled amount that includes the incentive & reward tokens. // so totalBalance keeps a track of the ucrrent balance & the accumulated principal + interest stored in the strategy protocol. uint256 totalBalance = isTransactionalToken ? address(this).balance + strategy.getTotalAmount() : IERC20(inboundToken).balanceOf(address(this)) + strategy.getTotalAmount(); // to avoid SLOAD multiple times IERC20[] memory _rewardTokens = rewardTokens; uint256[] memory _rewardTokenAmounts = rewardTokenAmounts; uint256[] memory grossRewardTokenAmount = new uint256[](_rewardTokens.length); // get the accumulated reward tokens from the strategy uint256[] memory accumulatedRewardTokenAmount = strategy.getAccumulatedRewardTokenAmounts( disableRewardTokenClaim ); // reference for array length to save gas uint256 _rewardsLength = _rewardTokens.length; // iterate through the reward token array to set the total reward amounts accumulated for (uint256 i = 0; i < _rewardsLength; ) { // the reward calculation is the sum of the current reward amount the remaining rewards being accumulated in the strategy protocols. // the reason being like totalBalance for every player this is updated and prev. value is used to add any left over value if (address(_rewardTokens[i]) != address(0) && inboundToken != address(_rewardTokens[i])) { grossRewardTokenAmount[i] = _rewardTokenAmounts[i] + accumulatedRewardTokenAmount[i]; } unchecked { ++i; } } // gets the grossInterest after updating the game accounting uint256 grossInterest = _calculateAndUpdateGameAccounting(totalBalance, grossRewardTokenAmount); _calculateAndSetAdminAccounting(grossInterest, grossRewardTokenAmount); adminFeeSet = true; } /// @dev Checks if player is a winner. /// @dev this function assumes that the player has already joined the game. /// We check if the player is a participant in the pool before using this function. /// @return "true" if player is a winner; otherwise, return "false". function _isWinner(Player storage _player, uint64 _depositCountMemory) internal view returns (bool) { // considers the emergency withdraw scenario too where if a player has paid in that or the previous segment they are considered as a winner return _player.isWinner || (emergencyWithdraw && ( _depositCountMemory == 0 ? _player.mostRecentSegmentPaid >= _depositCountMemory : _player.mostRecentSegmentPaid >= (_depositCountMemory - 1) )); } /** Returns the maximum amount that can be redeemed from a strategy for a player/admin */ function getRedemptionValue(uint256 _amountToRedeem, uint256 _totalAmount) internal returns (uint256) { if (_amountToRedeem > _totalAmount) { return _totalAmount; } return _amountToRedeem; } //*********************************************************************// // ------------------------- external/public methods -------------------------- // //*********************************************************************// /** @dev Enable early game completion in case of a emergency like the strategy contract becomes inactive in the midddle of the game etc. // Once enabled players can withdraw their funds along with interest for winners. */ function enableEmergencyWithdraw() external onlyOwner whenGameIsNotCompleted { if (totalGamePrincipal == 0) { revert EARLY_EXIT_NOT_POSSIBLE(); } uint64 currentSegment = getCurrentSegment(); // UPDATE - N2 Audit Report // updates the winner count based on the segment counter winnerCount = currentSegment != 0 ? uint64(segmentCounter[currentSegment] + segmentCounter[currentSegment - 1]) : uint64(segmentCounter[currentSegment]); emergencyWithdraw = true; // updates the interest shhare % for the deposit round _updateInterestShares(currentSegment); // setting depositCount as current segment to manage all scenario's to handle emergency withdraw depositCount = currentSegment; emit EmergencyWithdrawalEnabled(currentSegment, winnerCount, depositRoundInterestSharePercentage); } /** @dev Set's the incentive token address. @param _incentiveToken Incentive token address */ function setIncentiveToken(IERC20 _incentiveToken) public onlyOwner whenGameIsNotCompleted { // incentiveToken can only be set once, so we check if it has already been set if not then we check the inbound token is same as incentive token if ( (address(incentiveToken) != address(0)) || (inboundToken != address(0) && inboundToken == address(_incentiveToken)) ) { revert INVALID_INCENTIVE_TOKEN(); } // incentiveToken cannot be the same as one of the reward tokens. IERC20[] memory _rewardTokens = rewardTokens; // reference for array length to save gas uint256 _rewardsLength = _rewardTokens.length; for (uint256 i = 0; i < _rewardsLength; ) { if ((address(_rewardTokens[i]) != address(0) && address(_rewardTokens[i]) == address(_incentiveToken))) { revert INVALID_INCENTIVE_TOKEN(); } unchecked { ++i; } } incentiveToken = _incentiveToken; emit IncentiveTokenSet(address(_incentiveToken)); } /** @dev Disable claiming reward tokens for emergency scenarios, like when external reward contracts become inactive or rewards funds aren't available, allowing users to withdraw principal + interest from contract. */ function disableClaimingRewardTokens() external onlyOwner whenGameIsNotCompleted { disableRewardTokenClaim = true; emit ClaimRewardTokensDisabled(getCurrentSegment()); } /// @dev pauses the game. This function can be called only by the contract's admin. function pause() external onlyOwner whenNotPaused { _pause(); } /// @dev unpauses the game. This function can be called only by the contract's admin. function unpause() external onlyOwner whenPaused { _unpause(); } /// @dev Unlocks renounceOwnership. function unlockRenounceOwnership() external onlyOwner { allowRenouncingOwnership = true; } /// @dev Renounces Ownership. function renounceOwnership() public override onlyOwner { if (!allowRenouncingOwnership) { revert RENOUNCE_OWNERSHIP_NOT_ALLOWED(); } super.renounceOwnership(); } /** @dev Allows admin to set a lower early withdrawal fee. @param _newEarlyWithdrawFee New earlywithdrawal fee. */ function lowerEarlyWithdrawFee(uint64 _newEarlyWithdrawFee) external virtual onlyOwner { uint64 currentFee = earlyWithdrawalFee; if (_newEarlyWithdrawFee >= currentFee) { revert INVALID_EARLY_WITHDRAW_FEE(); } earlyWithdrawalFee = _newEarlyWithdrawFee; emit EarlyWithdrawalFeeChanged(getCurrentSegment(), currentFee, _newEarlyWithdrawFee); } /// @dev Allows the admin to withdraw the performance fee, if applicable. This function can be called only by the contract's admin. /// Cannot be called before the game ends. /// @param _minAmount Slippage based amount to cover for impermanent loss scenario. function adminFeeWithdraw(uint256 _minAmount) external virtual onlyOwner whenGameIsCompleted { if (adminWithdraw) { revert ADMIN_FEE_WITHDRAWN(); } adminWithdraw = true; // UPDATE - C2 Audit Report - removing redeem method _setGlobalPoolParams(); // to avoid SLOAD multiple times // UPDATE - A5 Audit Report uint256[] memory _adminFeeAmount = adminFeeAmount; IERC20[] memory _rewardTokens = rewardTokens; // flag that indicates if there are any rewards claimable by the admin bool _claimableRewards = _checkRewardsClaimableByAdmin(_adminFeeAmount); // have to check for both since the rewards, interest accumulated along with the total deposit is withdrawn in a single redeem call if (_adminFeeAmount[0] != 0 || _claimableRewards) { // safety check in case some incentives in the form of the deposit tokens are transferred to the pool uint256 _amountToRedeem = getRedemptionValue(_adminFeeAmount[0], strategy.getTotalAmount()); strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim); // need the updated value for the event // balance check before transferring the funds _adminFeeAmount[0] = _transferFundsSafelyOrFail(owner(), _adminFeeAmount[0]); if (_claimableRewards) { // reference for array length to save gas uint256 _rewardsLength = _rewardTokens.length; for (uint256 i = 0; i < _rewardsLength; ) { if (address(_rewardTokens[i]) != address(0)) { // updates variable value to make sure on a failure, event is emitted w/ correct value. // first slot is reserved for admin interest amount, so starts at 1. _adminFeeAmount[i + 1] = _transferTokenOrContinueOnFailure( address(_rewardTokens[i]), owner(), _adminFeeAmount[i + 1] ); } unchecked { ++i; } } } } uint256 _adminIncentiveAmount; // winnerCount will always have the correct number of winners fetched from segment counter if emergency withdraw is enabled. // UPDATE - N2 Audit Report if (winnerCount == 0) { if (totalIncentiveAmount != 0) { // updates variable value to make sure on a failure, event is emitted w/ correct value. // UPDATE - N1 Audit Report _adminIncentiveAmount = _transferTokenOrContinueOnFailure( address(incentiveToken), owner(), totalIncentiveAmount ); } } // emitting it here since to avoid duplication made the if block common for incentive and reward tokens emit AdminWithdrawal(owner(), totalGameInterest, _adminIncentiveAmount, _adminFeeAmount); } /** @dev Allows a player to join the game/pool by makking the first deposit. @param _minAmount Slippage based amount to cover for impermanent loss scenario. @param _depositAmount Variable Deposit Amount in case of a variable deposit pool. */ function joinGame( uint256 _minAmount, uint256 _depositAmount ) external payable virtual whenGameIsInitialized whenNotPaused whenGameIsNotCompleted nonReentrant { _joinGame(_minAmount, _depositAmount); } /** @dev Allows a player to withdraw funds before the game ends. An early withdrawal fee is charged. @param _minAmount Slippage based amount to cover for impermanent loss scenario in case of a amm strategy like curve or mobius. */ // UPDATE - L1 Audit Report function earlyWithdraw(uint256 _minAmount) external whenNotPaused whenGameIsNotCompleted nonReentrant { Player storage player = players[msg.sender]; if (player.amountPaid == 0) { revert PLAYER_DOES_NOT_EXIST(); } if (player.withdrawn) { revert PLAYER_ALREADY_WITHDREW_EARLY(); } player.withdrawn = true; activePlayersCount -= 1; // In an early withdraw, users get their principal minus the earlyWithdrawalFee % defined in the constructor & it also considers the impermanent loss. uint256 _totalBalance = isTransactionalToken ? address(this).balance + strategy.getTotalAmount() : IERC20(inboundToken).balanceOf(address(this)) + strategy.getTotalAmount(); uint256 withdrawAmount = player.netAmountPaid - ((player.netAmountPaid * earlyWithdrawalFee) / 100); if (_totalBalance < netTotalGamePrincipal) { // handling impermanent loss case uint256 _impermanentLossShare = (_totalBalance * 100) / netTotalGamePrincipal; withdrawAmount = (withdrawAmount * _impermanentLossShare) / 100; } // Decreases the totalGamePrincipal & netTotalGamePrincipal on earlyWithdraw totalGamePrincipal -= player.amountPaid; netTotalGamePrincipal -= player.netAmountPaid; uint64 currentSegment = getCurrentSegment(); player.withdrawalSegment = currentSegment; uint256 playerIndexSum; // calculate playerIndexSum for each player for (uint256 i = 0; i <= player.mostRecentSegmentPaid; ) { playerIndexSum += playerIndex[msg.sender][i]; unchecked { ++i; } } // Users that early withdraw during the first segment, are allowed to rejoin. if (currentSegment == 0) { player.canRejoin = true; playerIndex[msg.sender][currentSegment] = 0; } // FIX - C3 Audit Report // reduce the cumulativePlayerIndexSum for the segment where the player doing the early withdraw deposited last // cumulativePlayerIndexSum has the value of the player index sums for all player till the current segment. cumulativePlayerIndexSum[player.mostRecentSegmentPaid] -= playerIndexSum; // reduce the totalWinnerDepositsPerSegment for the segment. totalWinnerDepositsPerSegment[player.mostRecentSegmentPaid] -= player.netAmountPaid; unchecked { // update winner count if (winnerCount != 0 && player.isWinner) { winnerCount -= 1; player.isWinner = false; } // segment counter calculation needed for ui as backup in case graph goes down if (segmentCounter[player.mostRecentSegmentPaid] != 0) { segmentCounter[player.mostRecentSegmentPaid] -= 1; } } strategy.earlyWithdraw(inboundToken, withdrawAmount, _minAmount); // balance check before transferring the funds uint256 actualTransferredAmount = _transferFundsSafelyOrFail(msg.sender, withdrawAmount); // We have to ignore the "check-effects-interactions" pattern here and emit the event // only at the end of the function, in order to emit it w/ the correct withdrawal amount. // In case the safety checks above are evaluated to true, withdrawAmount is updated, // so we need the event to be emitted with the correct info. emit EarlyWithdrawal( msg.sender, actualTransferredAmount, totalGamePrincipal, netTotalGamePrincipal, player.amountPaid, player.netAmountPaid, cumulativePlayerIndexSum[currentSegment], totalWinnerDepositsPerSegment[currentSegment] ); } /** @dev Allows player to withdraw their funds after the game ends with no loss (fee). Winners get a share of the interest earned & additional rewards based on the player index. @param _minAmount Slippage based amount to cover for impermanent loss scenario in case of a amm strategy like curve or mobius. */ // UPDATE - L1 Audit Report function withdraw(uint256 _minAmount) external virtual nonReentrant { Player storage player = players[msg.sender]; if (player.amountPaid == 0) { revert PLAYER_DOES_NOT_EXIST(); } if (player.withdrawn) { revert PLAYER_ALREADY_WITHDREW(); } player.withdrawn = true; // UPDATE - C2 Audit Report - removing redeem method _setGlobalPoolParams(); // to avoid SLOAD multiple times uint64 depositCountMemory = depositCount; uint256 _impermanentLossShare = impermanentLossShare; uint256 payout; uint64 segment = depositCountMemory == 0 ? 0 : uint64(depositCountMemory - 1); if (_isWinner(player, depositCountMemory)) { // determining last game segment considering the possibility of emergencyWithdraw ( uint256 playerIndexSharePercentage, uint256 playerDepositAmountSharePercentage, uint256 _payout ) = _calculateAndUpdateWinnerInterestAccounting(segment, _impermanentLossShare); payout = _payout; // safety check in case some incentives in the form of the deposit tokens are transferred to the pool\ uint256 _amountToRedeem = getRedemptionValue(payout, strategy.getTotalAmount()); strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim); // calculating winners share of the incentive amount _calculateAndUpdateWinnerIncentivesAccounting( playerDepositAmountSharePercentage, playerIndexSharePercentage ); // calculating winners share of the reward earned from the external protocol deposits/no_strategy _calculateAndUpdateWinnerRewardAccounting(playerDepositAmountSharePercentage, playerIndexSharePercentage); } else { payout = _calculateAndUpdateNonWinnerAccounting(_impermanentLossShare, player.netAmountPaid); // safety check in case some incentives in the form of the deposit tokens are transferred to the pool uint256 _amountToRedeem = getRedemptionValue(payout, strategy.getTotalAmount()); // Withdraws the principal for non-winners strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim); } uint64 _currentSegment = getCurrentSegment(); // sets withdrawalSegment for the player player.withdrawalSegment = _currentSegment; if (_impermanentLossShare != 0) { // resetting I.Loss Share % after every withdrawal to be consistent impermanentLossShare = 0; } // Updating total principal as well after each player withdraws this is separate since we have to do this for non-players if (netTotalGamePrincipal < player.netAmountPaid) { netTotalGamePrincipal = 0; totalGamePrincipal = 0; } else { netTotalGamePrincipal -= player.netAmountPaid; totalGamePrincipal -= player.amountPaid; } // sending the inbound token amount i.e principal + interest to the winners and just the principal in case of players // adding a balance safety check to ensure the tx does not revert in case of impermanent loss uint256 actualTransferredAmount = _transferFundsSafelyOrFail(msg.sender, payout); // We have to ignore the "check-effects-interactions" pattern here and emit the event // only at the end of the function, in order to emit it w/ the correct withdrawal amount. // In case the safety checks above are evaluated to true, payout, playerIncentive and playerReward // are updated, so we need the event to be emitted with the correct info. emit WithdrawInboundTokens(msg.sender, actualTransferredAmount); emit UpdateGameStats( msg.sender, isTransactionalToken ? address(this).balance : IERC20(inboundToken).balanceOf(address(this)), totalGamePrincipal, netTotalGamePrincipal, totalGameInterest, totalIncentiveAmount, rewardTokenAmounts, impermanentLossShare, cumulativePlayerIndexSum[segment], totalWinnerDepositsPerSegment[segment] ); } /** @dev Allows players to make deposits for the game segments, after joining the game. @param _minAmount Slippage based amount to cover for impermanent loss scenario. @param _depositAmount Variable Deposit Amount in case of a variable deposit pool. */ function makeDeposit(uint256 _minAmount, uint256 _depositAmount) external payable whenNotPaused nonReentrant { if (players[msg.sender].withdrawn) { revert PLAYER_ALREADY_WITHDREW_EARLY(); } // only registered players can deposit if (players[msg.sender].addr != msg.sender) { revert NOT_PLAYER(); } if (flexibleSegmentPayment) { if (_depositAmount != players[msg.sender].depositAmount) { revert INVALID_FLEXIBLE_AMOUNT(); } } uint256 currentSegment = getCurrentSegment(); // User can only deposit between segment 1 and segment n-1 (where n is the number of segments for the game) or if the emergencyWithdraw flag has not been enabled. // Details: // Segment 0 is paid when user joins the game (the first deposit window). // Last segment doesn't accept payments, because the payment window for the last // segment happens on segment n-1 (penultimate segment). // Any segment greater than the last segment means the game is completed, and cannot // receive payments if (currentSegment == 0 || currentSegment >= depositCount || emergencyWithdraw) { revert DEPOSIT_NOT_ALLOWED(); } //check if current segment is currently unpaid if (players[msg.sender].mostRecentSegmentPaid == currentSegment) { revert PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT(); } // check if player has made payments up to the previous segment if (players[msg.sender].mostRecentSegmentPaid != (currentSegment - 1)) { revert PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT(); } uint256 amount = flexibleSegmentPayment ? _depositAmount : segmentPayment; if (isTransactionalToken) { if (msg.value != amount) { revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); } } else { if (msg.value != 0) { revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); } } // get net deposit amount from the strategy uint256 netAmount = strategy.getNetDepositAmount(amount); if (netAmount == 0) { revert INVALID_NET_DEPOSIT_AMOUNT(); } _transferInboundTokenToContract(_minAmount, amount, netAmount); emit Deposit( msg.sender, currentSegment, amount, netAmount, playerIndex[msg.sender][currentSegment], cumulativePlayerIndexSum[currentSegment], totalWinnerDepositsPerSegment[currentSegment] ); } // Fallback Functions for calldata and reciever for handling only ether transfer // UPDATE - A7 Audit Report receive() external payable { if (msg.sender != address(strategy)) { revert INVALID_TRANSACTIONAL_TOKEN_SENDER(); } if (!isTransactionalToken) { revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT(); } } }
pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IStrategy { function invest(address _inboundCurrency, uint256 _minAmount) external payable; function earlyWithdraw(address _inboundCurrency, uint256 _amount, uint256 _minAmount) external; function redeem( address _inboundCurrency, uint256 _amount, uint256 _minAmount, bool disableRewardTokenClaim ) external; function getTotalAmount() external view returns (uint256); function getLPTokenAmount(uint256 _amount) external view returns (uint256); function getFee() external view returns (uint256); function getNetDepositAmount(uint256 _amount) external view returns (uint256); function getAccumulatedRewardTokenAmounts(bool disableRewardTokenClaim) external returns (uint256[] memory); function getRewardTokens() external view returns (IERC20[] memory); function getUnderlyingAsset() external view returns (address); function strategyOwner() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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; } }
// 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()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 10 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_inboundCurrency","type":"address"},{"internalType":"uint256","name":"_maxFlexibleSegmentPaymentAmount","type":"uint256"},{"internalType":"uint64","name":"_depositCount","type":"uint64"},{"internalType":"uint64","name":"_segmentLength","type":"uint64"},{"internalType":"uint64","name":"_waitingRoundSegmentLength","type":"uint64"},{"internalType":"uint256","name":"_segmentPayment","type":"uint256"},{"internalType":"uint64","name":"_earlyWithdrawalFee","type":"uint64"},{"internalType":"uint64","name":"_customFee","type":"uint64"},{"internalType":"uint64","name":"_maxPlayersCount","type":"uint64"},{"internalType":"bool","name":"_flexibleSegmentPayment","type":"bool"},{"internalType":"contract IStrategy","name":"_strategy","type":"address"},{"internalType":"bool","name":"_isTransactionalToken","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADMIN_FEE_WITHDRAWN","type":"error"},{"inputs":[],"name":"DEPOSIT_NOT_ALLOWED","type":"error"},{"inputs":[],"name":"EARLY_EXIT_NOT_POSSIBLE","type":"error"},{"inputs":[],"name":"GAME_ALREADY_INITIALIZED","type":"error"},{"inputs":[],"name":"GAME_ALREADY_STARTED","type":"error"},{"inputs":[],"name":"GAME_COMPLETED","type":"error"},{"inputs":[],"name":"GAME_NOT_COMPLETED","type":"error"},{"inputs":[],"name":"GAME_NOT_INITIALIZED","type":"error"},{"inputs":[],"name":"INVALID_CUSTOM_FEE","type":"error"},{"inputs":[],"name":"INVALID_DEPOSIT_COUNT","type":"error"},{"inputs":[],"name":"INVALID_EARLY_WITHDRAW_FEE","type":"error"},{"inputs":[],"name":"INVALID_FLEXIBLE_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_INBOUND_TOKEN","type":"error"},{"inputs":[],"name":"INVALID_INCENTIVE_TOKEN","type":"error"},{"inputs":[],"name":"INVALID_MAX_FLEXIBLE_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_MAX_PLAYER_COUNT","type":"error"},{"inputs":[],"name":"INVALID_NET_DEPOSIT_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_OWNER","type":"error"},{"inputs":[],"name":"INVALID_SEGMENT_LENGTH","type":"error"},{"inputs":[],"name":"INVALID_SEGMENT_PAYMENT","type":"error"},{"inputs":[],"name":"INVALID_STRATEGY","type":"error"},{"inputs":[],"name":"INVALID_TRANSACTIONAL_TOKEN_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_TRANSACTIONAL_TOKEN_SENDER","type":"error"},{"inputs":[],"name":"INVALID_WAITING_ROUND_SEGMENT_LENGTH","type":"error"},{"inputs":[],"name":"MAX_PLAYER_COUNT_REACHED","type":"error"},{"inputs":[],"name":"NOT_PLAYER","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_JOINED","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_WITHDREW","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_WITHDREW_EARLY","type":"error"},{"inputs":[],"name":"PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT","type":"error"},{"inputs":[],"name":"PLAYER_DOES_NOT_EXIST","type":"error"},{"inputs":[],"name":"RENOUNCE_OWNERSHIP_NOT_ALLOWED","type":"error"},{"inputs":[],"name":"TOKEN_TRANSFER_FAILURE","type":"error"},{"inputs":[],"name":"TRANSACTIONAL_TOKEN_TRANSFER_FAILURE","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"adminFeeAmounts","type":"uint256[]"}],"name":"AdminFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"adminIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"adminFeeAmounts","type":"uint256[]"}],"name":"AdminWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"}],"name":"ClaimRewardTokensDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":true,"internalType":"uint256","name":"segment","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cumulativePlayerIndexSum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWinnerDepositsPerSegment","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositedNetAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cumulativePlayerIndexSum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWinnerDepositsPerSegment","type":"uint256"}],"name":"EarlyWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"oldFee","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"newFee","type":"uint64"}],"name":"EarlyWithdrawalFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"winnerCount","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"depositRoundInterestSharePercentage","type":"uint64"}],"name":"EmergencyWithdrawalEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePricipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"grossRewardTokenAmount","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"impermanentLossShare","type":"uint256"}],"name":"EndGameStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"ExternalTokenGetBalanceError","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"ExternalTokenTransferError","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"IncentiveTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"firstSegmentStart","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"waitingRoundSegmentStart","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"playerIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cumulativePlayerIndexSum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWinnerDepositsPerSegment","type":"uint256"}],"name":"JoinedGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"totalRewardAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"impermanentLossShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cumulativePlayerIndexSum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWinnerDepositsPerSegment","type":"uint256"}],"name":"UpdateGameStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawInboundTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawIncentiveToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"WithdrawRewardTokens","type":"event"},{"inputs":[],"name":"MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activePlayersCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"adminFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminFeeSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"adminFeeWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowRenouncingOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cumulativePlayerIndexSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositRoundInterestSharePercentage","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableClaimingRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableRewardTokenClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"earlyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyWithdrawalFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"firstSegmentStart","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flexibleSegmentPayment","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSegment","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumberOfPlayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"impermanentLossShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inboundToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incentiveToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_incentiveToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isGameCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTransactionalToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"isWinner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"iterablePlayers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"name":"joinGame","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_newEarlyWithdrawFee","type":"uint64"}],"name":"lowerEarlyWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"name":"makeDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"maxFlexibleSegmentPaymentAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPlayersCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"netTotalGamePrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"playerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"players","outputs":[{"internalType":"bool","name":"withdrawn","type":"bool"},{"internalType":"bool","name":"canRejoin","type":"bool"},{"internalType":"bool","name":"isWinner","type":"bool"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"withdrawalSegment","type":"uint64"},{"internalType":"uint64","name":"mostRecentSegmentPaid","type":"uint64"},{"internalType":"uint256","name":"amountPaid","type":"uint256"},{"internalType":"uint256","name":"netAmountPaid","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokenAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"segmentCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"segmentLength","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"segmentPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_incentiveToken","type":"address"}],"name":"setIncentiveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGameInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGamePrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalIncentiveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalWinnerDepositsPerSegment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockRenounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"waitingRoundSegmentLength","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"waitingRoundSegmentStart","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winnerCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winnersLeftToWithdraw","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x6080604052600436106102c65760003560e01c80638014c113116101775780638014c113146107645780638456cb5914610791578063872a61f2146107a65780638da5cb5b146107d357806395224b33146107e85780639d9ca28d146107fe5780639f60d9a11461081e578063a0be06f914610845578063a8c62e7614610879578063aad739f5146108a0578063ae545311146108c0578063b60b9fcb146108e0578063b6e4ca08146108f3578063c00a866214610913578063c22b5bbd14610929578063c39b583c1461095d578063c4d66de814610972578063c68e0a0414610992578063ca920b98146109ca578063caa02e08146109ea578063d013666e14610a11578063db2e21bc14610a45578063dbe3cbe514610a5f578063e2eb41ff14610a93578063e843633614610b75578063ebca4eeb14610b9c578063f18d20be14610bbb578063f2fde38b14610bdc578063f4ceab1c14610bfc578063f5c9786714610c11578063fd6673f514610c2657600080fd5b8063059f8b161461034257806306c6e5361461036e578063088e0ed1146103a25780630c423f32146103c25780630c8ac6451461040e5780630f1e37ea1461044257806316330d4014610458578063250a2b0d1461047f5780632dfdf0b51461049f5780632e1a7d4d146104c657806336301533146104e6578063392e53cd146104fb5780633e7433eb146105275780633f0f4076146105475780633f4ba83a1461055a5780634281b1fb1461056f57806349761947146105b0578063537788fd146105c55780635a497ad4146105e55780635c975abb1461060c5780635faeea3714610621578063638126f8146106375780636a79328a146106575780636b5b96961461066d5780636e8108a11461068d5780636fc3f8f6146106ba578063715018a6146106da5780637bb7bed1146106ef5780637c80e6da1461070f5780637e5f84761461074357600080fd5b3661033d57600b54600160281b90046001600160a01b031633146102fd576040516305ca55ed60e11b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061033b5760405163e1f0844960e01b815260040160405180910390fd5b005b600080fd5b34801561034e57600080fd5b5061035b64e8d4a5100081565b6040519081526020015b60405180910390f35b34801561037a57600080fd5b5061035b7f0000000000000000000000000000000000000000000000000000000ba43b740081565b3480156103ae57600080fd5b5061035b6103bd3660046157ed565b610c3b565b3480156103ce57600080fd5b506103f67f000000000000000000000000000000000000000000000000000000000012750081565b6040516001600160401b039091168152602001610365565b34801561041a57600080fd5b5061035b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561044e57600080fd5b5061035b60095481565b34801561046457600080fd5b506002546103f690600160c01b90046001600160401b031681565b34801561048b57600080fd5b506003546103f6906001600160401b031681565b3480156104ab57600080fd5b506002546103f690600160801b90046001600160401b031681565b3480156104d257600080fd5b5061033b6104e13660046157ed565b610c5c565b3480156104f257600080fd5b5061033b6111a1565b34801561050757600080fd5b506002546001600160401b031615155b6040519015158152602001610365565b34801561053357600080fd5b506002546103f6906001600160401b031681565b61033b61055536600461581f565b611335565b34801561056657600080fd5b5061033b6116d2565b34801561057b57600080fd5b506105a37f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417481565b60405161036591906158a5565b3480156105bc57600080fd5b5061033b6116ec565b3480156105d157600080fd5b50600b546105179062010000900460ff1681565b3480156105f157600080fd5b506003546103f690600160801b90046001600160401b031681565b34801561061857600080fd5b50610517611772565b34801561062d57600080fd5b5061035b60065481565b34801561064357600080fd5b50600c546105a3906001600160a01b031681565b34801561066357600080fd5b5061035b60085481565b34801561067957600080fd5b5061033b6106883660046157ed565b611782565b34801561069957600080fd5b5061035b6106a83660046157ed565b60116020526000908152604090205481565b3480156106c657600080fd5b5061035b6106d53660046157ed565b611e18565b3480156106e657600080fd5b5061033b611e28565b3480156106fb57600080fd5b506105a361070a3660046157ed565b611e62565b34801561071b57600080fd5b506103f67f000000000000000000000000000000000000000000000000000000000000271081565b34801561074f57600080fd5b50600b5461051790600160201b900460ff1681565b34801561077057600080fd5b5061035b61077f3660046157ed565b60106020526000908152604090205481565b34801561079d57600080fd5b5061033b611e8c565b3480156107b257600080fd5b5061035b6107c13660046157ed565b60126020526000908152604090205481565b3480156107df57600080fd5b506105a3611ea4565b3480156107f457600080fd5b5061035b60045481565b34801561080a57600080fd5b506105176108193660046156a1565b611eb3565b34801561082a57600080fd5b506003546103f690600160c01b90046001600160401b031681565b34801561085157600080fd5b506103f67f000000000000000000000000000000000000000000000000000000000000000a81565b34801561088557600080fd5b50600b546105a390600160281b90046001600160a01b031681565b3480156108ac57600080fd5b506105a36108bb3660046157ed565b611f16565b3480156108cc57600080fd5b5061033b6108db3660046156a1565b611f26565b61033b6108ee36600461581f565b612142565b3480156108ff57600080fd5b5061033b61090e3660046157ed565b6121b4565b34801561091f57600080fd5b5061035b60055481565b34801561093557600080fd5b506105177f000000000000000000000000000000000000000000000000000000000000000181565b34801561096957600080fd5b506105176125c8565b34801561097e57600080fd5b5061033b61098d3660046156a1565b612602565b34801561099e57600080fd5b5061035b6109ad3660046156db565b600f60209081526000928352604080842090915290825290205481565b3480156109d657600080fd5b5061033b6109e5366004615841565b6127ac565b3480156109f657600080fd5b506003546103f690600160401b90046001600160401b031681565b348015610a1d57600080fd5b506103f67f000000000000000000000000000000000000000000000000000000000012750081565b348015610a5157600080fd5b50600b546105179060ff1681565b348015610a6b57600080fd5b506105177f000000000000000000000000000000000000000000000000000000000000000081565b348015610a9f57600080fd5b50610b18610aae3660046156a1565b600e602052600090815260409020805460018201546002830154600384015460049094015460ff80851695610100860482169562010000810490921694630100000083046001600160a01b031694600160b81b9093046001600160401b0390811694911692919089565b604080519915158a5297151560208a0152951515968801969096526001600160a01b0390931660608701526001600160401b0391821660808701521660a085015260c084015260e083019190915261010082015261012001610365565b348015610b8157600080fd5b506002546103f690600160401b90046001600160401b031681565b348015610ba857600080fd5b50600b5461051790610100900460ff1681565b348015610bc757600080fd5b50600b54610517906301000000900460ff1681565b348015610be857600080fd5b5061033b610bf73660046156a1565b612851565b348015610c0857600080fd5b5061033b6128cc565b348015610c1d57600080fd5b506103f66128e9565b348015610c3257600080fd5b5060135461035b565b600a8181548110610c4b57600080fd5b600091825260209091200154905081565b610c64612a58565b336000908152600e602052604090206002810154610c955760405163c5e3efc560e01b815260040160405180910390fd5b805460ff1615610cb8576040516323791bbf60e21b815260040160405180910390fd5b805460ff19166001178155610ccb612ab2565b600254600954600160801b9091046001600160401b0316906000808315610cfc57610cf7600185615b63565b610cff565b60005b9050610d0b8585612f83565b15610e80576000806000610d1f8487612ff3565b9250925092508094506000610db986600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7c57600080fd5b505afa158015610d90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db49190615806565b6132ff565b9050600b60059054906101000a90046001600160a01b03166001600160a01b03166365e0d7317f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174838d600b60029054906101000a900460ff166040518563ffffffff1660e01b8152600401610e3194939291906158d2565b600060405180830381600087803b158015610e4b57600080fd5b505af1158015610e5f573d6000803e3d6000fd5b50505050610e6d8385613317565b610e778385613439565b50505050610f7e565b610e8e838660030154613797565b91506000610ee483600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7c57600080fd5b600b546040516365e0d73160e01b8152919250600160281b81046001600160a01b0316916365e0d73191610f4a917f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841749186918d9162010000900460ff16906004016158d2565b600060405180830381600087803b158015610f6457600080fd5b505af1158015610f78573d6000803e3d6000fd5b50505050505b6000610f886128e9565b8654600160b81b600160f81b031916600160b81b6001600160401b0383160217875590508315610fb85760006009555b85600301546005541015610fd5576000600581905560065561100d565b856003015460056000828254610feb9190615b4c565b9091555050600286015460068054600090611007908490615b4c565b90915550505b60006110193385613878565b60405181815290915033907faa7d2735c626954bee68a4b13fc5d4947d926e5d80e93302cdb6ab18972577cd9060200160405180910390a2337f9a6ad2f2e3400f4b4290488f47748f48ac213bd7a67e7fd52dc134d27eb24fba7f0000000000000000000000000000000000000000000000000000000000000000611139576040516370a0823160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906370a08231906110e49030906004016158a5565b60206040518083038186803b1580156110fc57600080fd5b505afa158015611110573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111349190615806565b61113b565b475b6006546005546004546008546009546001600160401b038b16600090815260116020908152604080832054601290925291829020549151611186989796959493600a939092916159ee565b60405180910390a25050505050505061119e60018055565b50565b6111a9613b33565b6111b16125c8565b156111cf576040516302066c1160e61b815260040160405180910390fd5b6006546111ef5760405163f585c2c160e01b815260040160405180910390fd5b60006111f96128e9565b90506001600160401b038116611227576001600160401b038116600090815260106020526040902054611275565b60106000611236600184615b63565b6001600160401b031681526020019081526020016000205460106000836001600160401b03168152602001908152602001600020546112759190615a99565b600380546001600160401b0392909216600160401b02600160401b600160801b0319909216919091179055600b805460ff191660011790556112b681613b92565b600280546001600160401b03808416600160801b02600160801b600160c01b0319909216919091179091556003546040517fb6b6b40c75a707f2e02161e4c3a0fedc1b52de156954e15ca2c0cd0cc77e721d9261132a928592600160401b8204831692600160c01b90920490911690615a76565b60405180910390a150565b61133d613d6f565b611345612a58565b336000908152600e602052604090205460ff16156113765760405163b3db1d7f60e01b815260040160405180910390fd5b336000818152600e6020526040902054630100000090046001600160a01b0316146113b457604051633fa546c360e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000011561140c57336000908152600e6020526040902060040154811461140c57604051637292a14360e11b815260040160405180910390fd5b60006114166128e9565b6001600160401b031690508015806114405750600254600160801b90046001600160401b03168110155b8061144d5750600b5460ff165b1561146b5760405163a406d3cf60e01b815260040160405180910390fd5b336000908152600e60205260409020600101546001600160401b03168114156114a75760405163bdf3e4c560e01b815260040160405180910390fd5b6114b2600182615b4c565b336000908152600e60205260409020600101546001600160401b0316146114ec576040516378e1742160e01b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000001611539577f000000000000000000000000000000000000000000000000000000000000000061153b565b825b90507f000000000000000000000000000000000000000000000000000000000000000015611588578034146115835760405163e1f0844960e01b815260040160405180910390fd5b6115a7565b34156115a75760405163e1f0844960e01b815260040160405180910390fd5b600b546040516365237abb60e01b815260048101839052600091600160281b90046001600160a01b0316906365237abb9060240160206040518083038186803b1580156115f357600080fd5b505afa158015611607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162b9190615806565b90508061164b57604051630d2eb29360e41b815260040160405180910390fd5b611656858383613db7565b336000818152600f6020908152604080832087845282528083205460118352818420546012909352928190205490518794937f55e1b84deec6eefe49c2c96afe1d5b43ca37768907f7388696c6009e7bbe3b54936116ba93899389939291906159cb565b60405180910390a35050506116ce60018055565b5050565b6116da613b33565b6116e261426c565b6116ea6142b7565b565b6116f4613b33565b6116fc6125c8565b1561171a576040516302066c1160e61b815260040160405180910390fd5b600b805462ff00001916620100001790557f58ef3e4ef459813e0b4b35635d3f11015f47a47986df341c25242e98073c0c296117546128e9565b6040516001600160401b0390911681526020015b60405180910390a1565b600054600160a01b900460ff1690565b61178a613d6f565b6117926125c8565b156117b0576040516302066c1160e61b815260040160405180910390fd5b6117b8612a58565b336000908152600e6020526040902060028101546117e95760405163c5e3efc560e01b815260040160405180910390fd5b805460ff161561180c5760405163b3db1d7f60e01b815260040160405180910390fd5b805460ff191660019081178255600380546000906118349084906001600160401b0316615b63565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555060007f00000000000000000000000000000000000000000000000000000000000000006119b057600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b1580156118cd57600080fd5b505afa1580156118e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119059190615806565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906370a08231906119519030906004016158a5565b60206040518083038186803b15801561196957600080fd5b505afa15801561197d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a19190615806565b6119ab9190615a99565b611a40565b600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b1580156119fe57600080fd5b505afa158015611a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a369190615806565b611a409047615a99565b905060006064600260189054906101000a90046001600160401b03166001600160401b03168460030154611a749190615afe565b611a7e9190615adc565b8360030154611a8d9190615b4c565b9050600554821015611ad057600554600090611aaa846064615afe565b611ab49190615adc565b90506064611ac28284615afe565b611acc9190615adc565b9150505b826002015460066000828254611ae69190615b4c565b9091555050600383015460058054600090611b02908490615b4c565b9091555060009050611b126128e9565b8454600160b81b600160f81b031916600160b81b6001600160401b0383160217855590506000805b60018601546001600160401b03168111611b7d57336000908152600f60209081526040808320848452909152902054611b739083615a99565b9150600101611b3a565b506001600160401b038216611bbe57845461ff001916610100178555336000908152600f602090815260408083206001600160401b03861684529091528120555b60018501546001600160401b031660009081526011602052604081208054839290611bea908490615b4c565b9091555050600385015460018601546001600160401b031660009081526012602052604081208054909190611c20908490615b4c565b9091555050600354600160401b90046001600160401b031615801590611c4d5750845462010000900460ff165b15611c8e57600380546000196001600160401b03600160401b8084048216929092011602600160401b600160801b0319909116179055845462ff0000191685555b60018501546001600160401b031660009081526010602052604090205415611cd55760018501546001600160401b0316600090815260106020526040902080546000190190555b600b54604051634bfd657160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174811660048301526024820186905260448201899052600160281b90920490911690634bfd657190606401600060405180830381600087803b158015611d5257600080fd5b505af1158015611d66573d6000803e3d6000fd5b505050506000611d763385613878565b600654600554600289015460038a01546001600160401b0388166000908152601160209081526040808320546012835292819020548151898152928301979097528101949094526060840192909252608083015260a082015260c081019190915290915033907f23414e631fecded7c3faab78fe5b21b51dbc9e467e4292e2f86ba9c5564227bf9060e00160405180910390a250505050505061119e60018055565b60078181548110610c4b57600080fd5b611e30613b33565b600b54600160201b900460ff16611e5a5760405163243f519360e21b815260040160405180910390fd5b6116ea6142fc565b600d8181548110611e7257600080fd5b6000918252602090912001546001600160a01b0316905081565b611e94613b33565b611e9c613d6f565b6116ea61430e565b6000546001600160a01b031690565b6001600160a01b0381166000908152600e6020526040812060020154611edb57506000919050565b6001600160a01b0382166000908152600e60205260409020600254611f109190600160801b90046001600160401b0316612f83565b92915050565b60138181548110611e7257600080fd5b611f2e613b33565b611f366125c8565b15611f54576040516302066c1160e61b815260040160405180910390fd5b600c546001600160a01b0316151580611fd157507f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b031615801590611fd15750806001600160a01b03167f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b0316145b15611fef5760405163cd2ac49f60e01b815260040160405180910390fd5b6000600d80548060200260200160405190810160405280929190818152602001828054801561204757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612029575b505083519394506000925050505b818110156120e95760006001600160a01b031683828151811061207a5761207a615ba1565b60200260200101516001600160a01b0316141580156120c35750836001600160a01b03168382815181106120b0576120b0615ba1565b60200260200101516001600160a01b0316145b156120e15760405163cd2ac49f60e01b815260040160405180910390fd5b600101612055565b50600c80546001600160a01b0319166001600160a01b0385161790556040517fdfb445dece52cc4e5554970d1ff164cd2eaa0babde21897b763c96655125f390906121359085906158a5565b60405180910390a1505050565b6002546001600160401b031661216b5760405163c4a5ed8960e01b815260040160405180910390fd5b612173613d6f565b61217b6125c8565b15612199576040516302066c1160e61b815260040160405180910390fd5b6121a1612a58565b6121ab8282614351565b6116ce60018055565b6121bc613b33565b6121c46125c8565b6121e157604051630418dd1f60e21b815260040160405180910390fd5b600b546301000000900460ff161561220c5760405163f788b3bd60e01b815260040160405180910390fd5b600b805463ff00000019166301000000179055612227612ab2565b6000600780548060200260200160405190810160405280929190818152602001828054801561227557602002820191906000526020600020905b815481526020019060010190808311612261575b505050505090506000600d8054806020026020016040519081016040528092919081815260200182805480156122d457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122b6575b5050505050905060006122e683614809565b9050826000815181106122fb576122fb615ba1565b6020026020010151600014158061230f5750805b1561252e5760006123828460008151811061232c5761232c615ba1565b6020026020010151600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7c57600080fd5b600b546040516365e0d73160e01b8152919250600160281b81046001600160a01b0316916365e0d731916123e8917f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841749186918b9162010000900460ff16906004016158d2565b600060405180830381600087803b15801561240257600080fd5b505af1158015612416573d6000803e3d6000fd5b50505050612445612425611ea4565b8560008151811061243857612438615ba1565b6020026020010151613878565b8460008151811061245857612458615ba1565b602002602001018181525050811561252c57825160005b818110156125295760006001600160a01b031685828151811061249457612494615ba1565b60200260200101516001600160a01b031614612521576124f88582815181106124bf576124bf615ba1565b60200260200101516124cf611ea4565b886124db856001615a99565b815181106124eb576124eb615ba1565b6020026020010151614856565b86612504836001615a99565b8151811061251457612514615ba1565b6020026020010181815250505b60010161246f565b50505b505b600354600090600160401b90046001600160401b0316612573576008541561257357600c54612570906001600160a01b0316612568611ea4565b600854614856565b90505b61257b611ea4565b6001600160a01b03167f390c89b8a52039f3cc9dc1e4fa212f6b6227a4e37b93dd8455bbe3f092a3a95b60045483876040516125b993929190615962565b60405180910390a25050505050565b600254600090600160801b90046001600160401b03166125e66128e9565b6001600160401b031611806125fd5750600b5460ff165b905090565b61260a613b33565b6002546001600160401b03161561263457604051638cb3c0bd60e01b815260040160405180910390fd5b61263c613d6f565b600b54604080516371ed7a2b60e11b815290513092600160281b90046001600160a01b03169163e3daf456916004808301926020929190829003018186803b15801561268757600080fd5b505afa15801561269b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126bf91906156be565b6001600160a01b0316146126e657604051639d2d273160e01b815260040160405180910390fd5b600280547f0000000000000000000000000000000000000000000000000000000000127500600160801b6001600160401b034281166001600160401b031985168117929092048116929092028101909116600160401b026001600160801b0319909216171790556127576000613b92565b61276081611f26565b600254604080516001600160401b038084168252600160401b90930490921660208301527f0709318331fb59e779a19041b4e090bf8f8481b96601401c9b6887924248fec9910161132a565b6127b4613b33565b6002546001600160401b03600160c01b909104811690821681116127eb57604051633686fa6760e21b815260040160405180910390fd5b600280546001600160c01b0316600160c01b6001600160401b038516021790557f21020cbcf9f28164b52dd3fbd0e7dd8219bf982577046ed79c1c44c28a5d07f06128346128e9565b828460405161284593929190615a76565b60405180910390a15050565b612859613b33565b6001600160a01b0381166128c35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61119e81614a68565b6128d4613b33565b600b805460ff60201b1916600160201b179055565b6002546000906001600160401b03166129155760405163c4a5ed8960e01b815260040160405180910390fd5b6002546000906001600160401b03600160401b909104811690829061295c907f00000000000000000000000000000000000000000000000000000000001275001683615a99565b905042821115801561296d57508042105b1561298c57600254600160801b90046001600160401b03169250612a50565b804210612a09576001600160401b037f0000000000000000000000000000000000000000000000000000000000127500166129c78242615b4c565b6129d19190615adc565b6002546129ef90600160801b90046001600160401b03166001615ab1565b6001600160401b0316612a029190615a99565b9250612a50565b6002546001600160401b037f0000000000000000000000000000000000000000000000000000000000127500811691612a43911642615b4c565b612a4d9190615adc565b92505b509091505090565b60026001541415612aab5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016128ba565b6002600155565b612aba6125c8565b612ad757604051630418dd1f60e21b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000612c2f57600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015612b4c57600080fd5b505afa158015612b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b849190615806565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906370a0823190612bd09030906004016158a5565b60206040518083038186803b158015612be857600080fd5b505afa158015612bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c209190615806565b612c2a9190615a99565b612cbf565b600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015612c7d57600080fd5b505afa158015612c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb59190615806565b612cbf9047615a99565b90506000600d805480602002602001604051908101604052809291908181526020018280548015612d1957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612cfb575b505050505090506000600a805480602002602001604051908101604052809291908181526020018280548015612d6e57602002820191906000526020600020905b815481526020019060010190808311612d5a575b50505050509050600082516001600160401b03811115612d9057612d90615bb7565b604051908082528060200260200182016040528015612db9578160200160208202803683370190505b50600b5460405163ca63279b60e01b815262010000820460ff1615156004820152919250600091600160281b9091046001600160a01b03169063ca63279b90602401600060405180830381600087803b158015612e1557600080fd5b505af1158015612e29573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e519190810190615707565b845190915060005b81811015612f525760006001600160a01b0316868281518110612e7e57612e7e615ba1565b60200260200101516001600160a01b031614158015612ee85750858181518110612eaa57612eaa615ba1565b60200260200101516001600160a01b03167f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b031614155b15612f4a57828181518110612eff57612eff615ba1565b6020026020010151858281518110612f1957612f19615ba1565b6020026020010151612f2b9190615a99565b848281518110612f3d57612f3d615ba1565b6020026020010181815250505b600101612e59565b506000612f5f8785614ab8565b9050612f6b8185614c82565b5050600b805461ff0019166101001790555050505050565b815460009062010000900460ff1680612fec5750600b5460ff168015612fec57506001600160401b03821615612fd757612fbe600183615b63565b60018401546001600160401b0391821691161015612fec565b60018301546001600160401b03808416911610155b9392505050565b60008080808080805b886001600160401b0316811161303b57336000908152600f602090815260408083208484529091529020546130319083615a99565b9150600101612ffc565b506001600160401b03881660009081526011602052604090205461306464e8d4a5100083615afe565b61306e9190615adc565b955080601160008a6001600160401b03168152602001908152602001600020600082825461309c9190615b4c565b9091555050336000908152600e60209081526040808320600301546001600160401b038c168452601290925290912054909450841161310c576001600160401b0388166000908152601260205260409020546130fd64e8d4a5100086615afe565b6131079190615adc565b613113565b64e8d4a510005b6001600160401b038916600090815260126020526040902054909550841115613154576001600160401b038816600090815260126020526040812055613182565b6001600160401b0388166000908152601260205260408120805486929061317c908490615b4c565b90915550505b86156131b65760646131948886615afe565b61319e9190615adc565b336000908152600e6020526040902060030181905593505b861580156131c5575060045415155b156132ac5760035460045460009164e8d4a51000916131f491600160c01b90046001600160401b031690615afe565b6131fe9190615adc565b6003549091506000906001600160401b03600160c01b9091041664e8d4a510001461323657816004546132319190615b4c565b613239565b60005b905064e8d4a5100061324b8883615afe565b6132559190615adc565b935064e8d4a510006132678984615afe565b6132719190615adc565b945061327d8486615a99565b6132879087615a99565b95506132938486615a99565b600460008282546132a49190615b4c565b909155505050505b6001600360108282829054906101000a90046001600160401b03166132d19190615b63565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505050509250925092565b600081831115613310575080611f10565b5090919050565b60006008546000146134115760035460085460009164e8d4a510009161334d91600160c01b90046001600160401b031690615afe565b6133579190615adc565b6003549091506000906001600160401b03600160c01b9091041664e8d4a510001461338f578160085461338a9190615b4c565b613392565b60005b9050600064e8d4a510006133a68685615afe565b6133b09190615adc565b9050600064e8d4a510006133c48885615afe565b6133ce9190615adc565b90506133da8183615a99565b945084600860008282546133ee9190615b4c565b9091555050600c5461340a906001600160a01b03163387614856565b9450505050505b6040518181523390600080516020615be38339815191529060200160405180910390a2505050565b6000600d80548060200260200160405190810160405280929190818152602001828054801561349157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613473575b505050505090506000600a8054806020026020016040519081016040528092919081815260200182805480156134e657602002820191906000526020600020905b8154815260200190600101908083116134d2575b50505050509050600082516001600160401b0381111561350857613508615bb7565b604051908082528060200260200182016040528015613531578160200160208202803683370190505b50835190915060005b8181101561374b5760006001600160a01b031685828151811061355f5761355f615ba1565b60200260200101516001600160a01b031614158015613598575083818151811061358b5761358b615ba1565b6020026020010151600014155b1561374357600064e8d4a51000600360189054906101000a90046001600160401b03166001600160401b03168684815181106135d6576135d6615ba1565b60200260200101516135e89190615afe565b6135f29190615adc565b6003549091506000906001600160401b03600160c01b9091041664e8d4a5100014613641578186848151811061362a5761362a615ba1565b602002602001015161363c9190615b4c565b613644565b60005b9050600064e8d4a510006136588a85615afe565b6136629190615adc565b9050600064e8d4a510006136768c85615afe565b6136809190615adc565b905061368c8183615a99565b87868151811061369e5761369e615ba1565b6020026020010181815250508685815181106136bc576136bc615ba1565b60200260200101518886815181106136d6576136d6615ba1565b602002602001018181516136ea9190615b4c565b9052508851613720908a908790811061370557613705615ba1565b6020026020010151338988815181106124eb576124eb615ba1565b87868151811061373257613732615ba1565b602002602001018181525050505050505b60010161353a565b50825161375f90600a906020860190615641565b50336001600160a01b0316600080516020615c238339815191528360405161378791906158fa565b60405180910390a2505050505050565b600082156137d15760646137ab8484615afe565b6137b59190615adc565b336000908152600e6020526040902060030181905590506137d4565b50805b600d546000906001600160401b038111156137f1576137f1615bb7565b60405190808252806020026020018201604052801561381a578160200160208202803683370190505b50604051600081529091503390600080516020615be38339815191529060200160405180910390a2336001600160a01b0316600080516020615c238339815191528260405161386991906158fa565b60405180910390a25092915050565b60007f00000000000000000000000000000000000000000000000000000000000000001561392657478211156138ac574791505b6000836001600160a01b03168360405160006040518083038185875af1925050503d80600081146138f9576040519150601f19603f3d011682016040523d82523d6000602084013e6138fe565b606091505b505090508061392057604051634d4c5bd160e11b815260040160405180910390fd5b50613b2d565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906370a08231906139729030906004016158a5565b60206040518083038186803b15801561398a57600080fd5b505afa15801561399e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139c29190615806565b821115613a68576040516370a0823160e01b81526001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906370a0823190613a159030906004016158a5565b60206040518083038186803b158015613a2d57600080fd5b505afa158015613a41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a659190615806565b91505b60405163a9059cbb60e01b81526000906001600160a01b037f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174169063a9059cbb90613ab990879087906004016158b9565b602060405180830381600087803b158015613ad357600080fd5b505af1158015613ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b0b91906157cb565b905080613b2b57604051638dc18fdb60e01b815260040160405180910390fd5b505b50919050565b33613b3c611ea4565b6001600160a01b0316146116ea5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016128ba565b600b5460ff16613c8c57600254600090613bdd907f000000000000000000000000000000000000000000000000000000000012750090600160401b90046001600160401b0316615ab1565b600254909150600090613bf9906001600160401b031683615b63565b6002549091506001600160401b038083169164e8d4a5100091613c4491600160801b9004167f0000000000000000000000000000000000000000000000000000000000127500615b1d565b6001600160401b0316613c579190615afe565b613c619190615adc565b600360186101000a8154816001600160401b0302191690836001600160401b03160217905550505050565b6002546001600160401b03828116600160801b909204161415613d5457600254600090613cc2906001600160401b031642615b63565b6002549091506001600160401b038083169164e8d4a5100091613d0d91600160801b9004167f0000000000000000000000000000000000000000000000000000000000127500615b1d565b6001600160401b0316613d209190615afe565b613d2a9190615adc565b600360186101000a8154816001600160401b0302191690836001600160401b031602179055505050565b50600380546001600160c01b0316630e8d4a5160cc1b179055565b613d77611772565b156116ea5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016128ba565b81811115613dd857604051630d2eb29360e41b815260040160405180910390fd5b6000613de26128e9565b336000908152600e602052604081206001810180546001600160401b0319166001600160401b03851617905560020180549293508592909190613e26908490615a99565b9091555050336000908152600e602052604081206003018054849290613e4d908490615a99565b9091555060009050613e7f7f000000000000000000000000000000000000000000000000000000000012750083615b1d565b600254613e9591906001600160401b0316615ab1565b6001600160401b0316427f00000000000000000000000000000000000000000000000000000000001275006001600160401b0316613ed39190615a99565b613edd9190615b4c565b613eec64e8d4a5100085615afe565b613ef69190615adc565b336000908152600f602090815260408083206001600160401b0387168452825280832084905560119091528120549192505b836001600160401b03168111613f6757336000908152600f60209081526040808320848452909152902054613f5d9083615a99565b9150600101613f28565b506001600160401b0383166000818152601160209081526040808320859055338352600e825280832060030154938352601290915281208054909190613fae908490615a99565b9091555050600254613fd290600190600160801b90046001600160401b0316615b63565b6001600160401b0316836001600160401b0316141561403957600380546001600160401b03600160401b808304821660010190911602600160401b600160801b0319909116179055336000908152600e60205260409020805462ff00001916620100001790555b6001600160401b0383166000818152601060205260409020805460010190551580159061408157506001600160401b0360001984011660009081526010602052604090205415155b156140ab576000198381016001600160401b03166000908152601060205260409020805490910190555b84600660008282546140bd9190615a99565b9250508190555083600560008282546140d69190615a99565b909155507f000000000000000000000000000000000000000000000000000000000000000090506141d857600b546040516323b872dd60e01b81523360048201526001600160a01b03600160281b90920482166024820152604481018790526000917f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417416906323b872dd90606401602060405180830381600087803b15801561417e57600080fd5b505af1158015614192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141b691906157cb565b9050806141d657604051638dc18fdb60e01b815260040160405180910390fd5b505b600b54604051635cdc612360e11b8152600160281b9091046001600160a01b03169063b9b8c246903490614232907f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174908b906004016158b9565b6000604051808303818588803b15801561424b57600080fd5b505af115801561425f573d6000803e3d6000fd5b5050505050505050505050565b614274611772565b6116ea5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016128ba565b6142bf61426c565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161176891906158a5565b614304613b33565b6116ea6000614a68565b614316613d6f565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586142ef3390565b600061435b6128e9565b90506001600160401b03811615614385576040516359d9d9a760e11b815260040160405180910390fd5b336000818152600e602052604090205460ff6101008204169163010000009091046001600160a01b03161480156143ba575080155b156143d85760405163a510df3760e01b815260040160405180910390fd5b60038054600191906000906143f79084906001600160401b0316615ab1565b82546101009290920a6001600160401b038181021990931691831602179091556003547f000000000000000000000000000000000000000000000000000000000000271082169116111590506144605760405163e7b9e0e760e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000180156144b457508215806144b457507f0000000000000000000000000000000000000000000000000000000ba43b740083115b156144d257604051637292a14360e11b815260040160405180910390fd5b60007f000000000000000000000000000000000000000000000000000000000000000161451f577f0000000000000000000000000000000000000000000000000000000000000000614521565b835b90507f00000000000000000000000000000000000000000000000000000000000000001561456e578034146145695760405163e1f0844960e01b815260040160405180910390fd5b61458d565b341561458d5760405163e1f0844960e01b815260040160405180910390fd5b600b546040516365237abb60e01b815260048101839052600091600160281b90046001600160a01b0316906365237abb9060240160206040518083038186803b1580156145d957600080fd5b505afa1580156145ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146119190615806565b90508061463157604051630d2eb29360e41b815260040160405180910390fd5b60408051610120810182526000808252602080830182815283850183815233606086018181526080870186815260a0880187815260c0890188815260e08a01898152610100808c018f8152968b52600e9099529a90982089518154975196519451935161ffff1990981690151561ff001916179515159097029490941762010000600160b81b03191662010000921515929092026301000000600160b81b0319169190911763010000006001600160a01b039092169190910217600160b81b600160f81b031916600160b81b6001600160401b039485160217845590516001840180546001600160401b03191691909316179091559151600282015592516003840155516004909201919091558361478657601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0900180546001600160a01b031916331790555b614791878484613db7565b336000818152600f602090815260408083206001600160401b038a16845282528083205460118352818420546012909352928190205490517fa4fc37a300adef01277cb72a11955e4467e1e93635050178f96e52641f26e3ef936147f893899389936159cb565b60405180910390a250505050505050565b805160009060015b8181101561484c5783818151811061482b5761482b615ba1565b6020026020010151600014614844575060019392505050565b600101614811565b5060009392505050565b6040516370a0823160e01b81526000906001600160a01b038516906370a08231906148859030906004016158a5565b60206040518083038186803b15801561489d57600080fd5b505afa9250505080156148cd575060408051601f3d908101601f191682019092526148ca91810190615806565b60015b61493a573d8080156148fb576040519150601f19603f3d011682016040523d82523d6000602084013e614900565b606091505b5060009250846001600160a01b0316600080516020615c038339815191528260405161492c919061590d565b60405180910390a250614948565b80831115614946578092505b505b8115614a615760405163a9059cbb60e01b81526001600160a01b0385169063a9059cbb9061497c90869086906004016158b9565b602060405180830381600087803b15801561499657600080fd5b505af19250505080156149c6575060408051601f3d908101601f191682019092526149c3918101906157cb565b60015b614a41573d8080156149f4576040519150601f19603f3d011682016040523d82523d6000602084013e6149f9565b606091505b50846001600160a01b03167ffdba62ff5ed53473134bad9bdefe10d1bbc01c3cb36e9660032a629b6c926a6182604051614a33919061590d565b60405180910390a250614a61565b80614a5f57604051638dc18fdb60e01b815260040160405180910390fd5b505b5092915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60055460009081908410614ada57600554614ad39085615b4c565b9050614afb565b600554614ae8856064615afe565b614af29190615adc565b60095560058490555b600c546001600160a01b03168015614bee576040516370a0823160e01b81526001600160a01b038216906370a0823190614b399030906004016158a5565b60206040518083038186803b158015614b5157600080fd5b505afa925050508015614b81575060408051601f3d908101601f19168201909252614b7e91810190615806565b60015b614bea573d808015614baf576040519150601f19603f3d011682016040523d82523d6000602084013e614bb4565b606091505b50816001600160a01b0316600080516020615c0383398151915282604051614bdc919061590d565b60405180910390a250614bee565b6008555b600b54610100900460ff16614c7a5760038054600160801b6001600160401b03600160401b83041602600160801b600160c01b031990911617905560065460055460085460095460405133947f5a8920b0ea1c4677685868cec72bce61e9a586ef5f317707ecc34ae94018567594614c71948c94929391928a928d92919061598a565b60405180910390a25b509392505050565b6000600d805480602002602001604051908101604052809291908181526020018280548015614cda57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311614cbc575b5050505050905060006007805480602002602001604051908101604052809291908181526020018280548015614d2f57602002820191906000526020600020905b815481526020019060010190808311614d1b575b505050505090506000600a805480602002602001604051908101604052809291908181526020018280548015614d8457602002820191906000526020600020905b815481526020019060010190808311614d70575b50505050509050600b60019054906101000a900460ff161561530857600b546301000000900460ff1615614dbe57506004849055826155db565b600082600081518110614dd357614dd3615ba1565b6020026020010151600454614de89190615a99565b9050808610614f0f576000614dfd8288615b4c565b600354909150600090600160401b90046001600160401b03161580614e325750600354600160801b90046001600160401b0316155b15614e57578190508160046000828254614e4c9190615a99565b90915550614edc9050565b6064614e8c6001600160401b037f000000000000000000000000000000000000000000000000000000000000000a1684615afe565b614e969190615adc565b905060008211614ea857600454614ed8565b8085600081518110614ebc57614ebc615ba1565b6020026020010151614ece9190615a99565b614ed89089615b4c565b6004555b8085600081518110614ef057614ef0615ba1565b60200260200101818151614f049190615a99565b905250614fc3915050565b600354600090600160401b90046001600160401b03161580614f415750600354600160801b90046001600160401b0316155b15614f525750600486905585614fa1565b6064614f876001600160401b037f000000000000000000000000000000000000000000000000000000000000000a1689615afe565b614f919190615adc565b9050614f9d8188615b4c565b6004555b8084600081518110614fb557614fb5615ba1565b602002602001018181525050505b835160005b8181101561530057838181518110614fe257614fe2615ba1565b6020026020010151878281518110614ffc57614ffc615ba1565b60200260200101511061519d57600084828151811061501d5761501d615ba1565b602002602001015188838151811061503757615037615ba1565b60200260200101516150499190615b4c565b600354909150600090600160401b90046001600160401b0316158061507e5750600354600160801b90046001600160401b0316155b156150b5578190508186848151811061509957615099615ba1565b602002602001018181516150ad9190615a99565b905250615161565b60646150ea6001600160401b037f000000000000000000000000000000000000000000000000000000000000000a1684615afe565b6150f49190615adc565b90506000821161511d5785838151811061511057615110615ba1565b6020026020010151615142565b8089848151811061513057615130615ba1565b60200260200101516151429190615b4c565b86848151811061515457615154615ba1565b6020026020010181815250505b808761516e856001615a99565b8151811061517e5761517e615ba1565b602002602001018181516151929190615a99565b9052506152f8915050565b600354600090600160401b90046001600160401b031615806151cf5750600354600160801b90046001600160401b0316155b1561522d578782815181106151e6576151e6615ba1565b6020026020010151905087828151811061520257615202615ba1565b602002602001015185838151811061521c5761521c615ba1565b6020026020010181815250506152cd565b60647f000000000000000000000000000000000000000000000000000000000000000a6001600160401b031689848151811061526b5761526b615ba1565b602002602001015161527d9190615afe565b6152879190615adc565b90508088838151811061529c5761529c615ba1565b60200260200101516152ae9190615b4c565b8583815181106152c0576152c0615ba1565b6020026020010181815250505b80866152da846001615a99565b815181106152ea576152ea615ba1565b602002602001018181525050505b600101614fc8565b5050506155db565b8251600354600160401b90046001600160401b03166153d957858360008151811061533557615335615ba1565b6020908102919091010152600486905560005b818110156153d35785818151811061536257615362615ba1565b602002602001015183828151811061537c5761537c615ba1565b60200260200101818152505085818151811061539a5761539a615ba1565b6020026020010151848260016153b09190615a99565b815181106153c0576153c0615ba1565b6020908102919091010152600101615348565b506155d9565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000000a161561558857606461543d6001600160401b037f000000000000000000000000000000000000000000000000000000000000000a1688615afe565b6154479190615adc565b8360008151811061545a5761545a615ba1565b6020026020010181815250508260008151811061547957615479615ba1565b60200260200101518661548c9190615b4c565b60045560005b818110156153d35760647f000000000000000000000000000000000000000000000000000000000000000a6001600160401b03168783815181106154d8576154d8615ba1565b60200260200101516154ea9190615afe565b6154f49190615adc565b84615500836001615a99565b8151811061551057615510615ba1565b602090810291909101015283615527826001615a99565b8151811061553757615537615ba1565b602002602001015186828151811061555157615551615ba1565b60200260200101516155639190615b4c565b83828151811061557557615575615ba1565b6020908102919091010152600101615492565b600486905560005b818110156155d7578581815181106155aa576155aa615ba1565b60200260200101518382815181106155c4576155c4615ba1565b6020908102919091010152600101615590565b505b505b80516155ee90600a906020840190615641565b508151615602906007906020850190615641565b507f4d58284f2a68a6d9baded7cdff0efbca82dbc7d35a3571c1d8bb6d06eb2528278260405161563291906158fa565b60405180910390a15050505050565b82805482825590600052602060002090810192821561567c579160200282015b8281111561567c578251825591602001919060010190615661565b5061568892915061568c565b5090565b5b80821115615688576000815560010161568d565b6000602082840312156156b357600080fd5b8135612fec81615bcd565b6000602082840312156156d057600080fd5b8151612fec81615bcd565b600080604083850312156156ee57600080fd5b82356156f981615bcd565b946020939093013593505050565b6000602080838503121561571a57600080fd5b82516001600160401b038082111561573157600080fd5b818501915085601f83011261574557600080fd5b81518181111561575757615757615bb7565b8060051b604051601f19603f8301168101818110858211171561577c5761577c615bb7565b604052828152858101935084860182860187018a101561579b57600080fd5b600095505b838610156157be5780518552600195909501949386019386016157a0565b5098975050505050505050565b6000602082840312156157dd57600080fd5b81518015158114612fec57600080fd5b6000602082840312156157ff57600080fd5b5035919050565b60006020828403121561581857600080fd5b5051919050565b6000806040838503121561583257600080fd5b50508035926020909101359150565b60006020828403121561585357600080fd5b81356001600160401b0381168114612fec57600080fd5b600081518084526020808501945080840160005b8381101561589a5781518752958201959082019060010161587e565b509495945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b602081526000612fec602083018461586a565b600060208083528351808285015260005b8181101561593a5785810183015185820160400152820161591e565b8181111561594c576000604083870101525b50601f01601f1916929092016040019392505050565b838152826020820152606060408201526000615981606083018461586a565b95945050505050565b87815286602082015285604082015284606082015260e0608082015260006159b560e083018661586a565b60a08301949094525060c0015295945050505050565b948552602085019390935260408401919091526060830152608082015260a00190565b60006101208083018c845260208c818601528b60408601528a60608601528960808601528260a08601528192508854808352610140860193508960005281600020925060005b81811015615a5057835485529382019360019384019301615a34565b5050505060c08301959095525060e0810192909252610100909101529695505050505050565b6001600160401b0393841681529183166020830152909116604082015260600190565b60008219821115615aac57615aac615b8b565b500190565b60006001600160401b03828116848216808303821115615ad357615ad3615b8b565b01949350505050565b600082615af957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615b1857615b18615b8b565b500290565b60006001600160401b0382811684821681151582840482111615615b4357615b43615b8b565b02949350505050565b600082821015615b5e57615b5e615b8b565b500390565b60006001600160401b0383811690831681811015615b8357615b83615b8b565b039392505050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461119e57600080fdfe977e26f874eac308da255c037e203c4a501cf2cb08a8abf87e011d750f657ccf7a30d31a8bd18ad5251980ab4105d3f180c3cc00767d79b1393c3e4ca392638e38a6a91aca8b2590b32c77b7f06e41eafed98470306bce6fe498c5bfd7346926a26469706673582212204b6883ab9aec356515cbc65a2cb4efe6811ab33618bc19d469437ee68353f4f664736f6c63430008070033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.