ETH Price: $3,539.54 (-0.06%)

Contract

0x43828c5d14ab0101cD7697971487C7A68fab7e88

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
720866652023-03-21 10:18:47965 days ago1679393927
0x43828c5d...68fab7e88
0 ETH
720866132023-03-21 10:18:34965 days ago1679393914
0x43828c5d...68fab7e88
0 ETH
720866132023-03-21 10:18:34965 days ago1679393914
0x43828c5d...68fab7e88
0 ETH
720866132023-03-21 10:18:34965 days ago1679393914
0x43828c5d...68fab7e88
0 ETH
720866132023-03-21 10:18:34965 days ago1679393914
0x43828c5d...68fab7e88
0 ETH
720865592023-03-21 10:18:20965 days ago1679393900
0x43828c5d...68fab7e88
0 ETH
720865592023-03-21 10:18:20965 days ago1679393900
0x43828c5d...68fab7e88
0 ETH
720865592023-03-21 10:18:20965 days ago1679393900
0x43828c5d...68fab7e88
0 ETH
720865592023-03-21 10:18:20965 days ago1679393900
0x43828c5d...68fab7e88
0 ETH
720863742023-03-21 10:17:40965 days ago1679393860
0x43828c5d...68fab7e88
0 ETH
720863742023-03-21 10:17:40965 days ago1679393860
0x43828c5d...68fab7e88
0 ETH
720863742023-03-21 10:17:40965 days ago1679393860
0x43828c5d...68fab7e88
0 ETH
720863742023-03-21 10:17:40965 days ago1679393860
0x43828c5d...68fab7e88
0 ETH
720863072023-03-21 10:17:23965 days ago1679393843
0x43828c5d...68fab7e88
0 ETH
720862002023-03-21 10:16:55965 days ago1679393815
0x43828c5d...68fab7e88
0 ETH
720862002023-03-21 10:16:55965 days ago1679393815
0x43828c5d...68fab7e88
0 ETH
720862002023-03-21 10:16:55965 days ago1679393815
0x43828c5d...68fab7e88
0 ETH
720862002023-03-21 10:16:55965 days ago1679393815
0x43828c5d...68fab7e88
0 ETH
720861412023-03-21 10:16:40965 days ago1679393800
0x43828c5d...68fab7e88
0 ETH
720861412023-03-21 10:16:40965 days ago1679393800
0x43828c5d...68fab7e88
0 ETH
720861412023-03-21 10:16:40965 days ago1679393800
0x43828c5d...68fab7e88
0 ETH
720861412023-03-21 10:16:40965 days ago1679393800
0x43828c5d...68fab7e88
0 ETH
720861362023-03-21 10:16:39965 days ago1679393799
0x43828c5d...68fab7e88
0 ETH
720861362023-03-21 10:16:39965 days ago1679393799
0x43828c5d...68fab7e88
0 ETH
720861362023-03-21 10:16:39965 days ago1679393799
0x43828c5d...68fab7e88
0 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChefIncentivesController

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 26 : ChefIncentivesController.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "../../interfaces/IMultiFeeDistribution.sol";
import "../../interfaces/IEligibilityDataProvider.sol";
import "../../interfaces/IOnwardIncentivesController.sol";
import "../../interfaces/IAToken.sol";
import "../../interfaces/IMiddleFeeDistribution.sol";

// based on the Sushi MasterChef
// https://github.com/sushiswap/sushiswap/blob/master/contracts/MasterChef.sol
contract ChefIncentivesController is Initializable, PausableUpgradeable, OwnableUpgradeable {
	using SafeMath for uint256;
	using SafeERC20 for IERC20;

	// Info of each user.
	// reward = user.`amount` * pool.`accRewardPerShare` - `rewardDebt`
	struct UserInfo {
		uint256 amount;
		uint256 rewardDebt;
		uint256 enterTime;
		uint256 lastClaimTime;
	}

	// Info of each pool.
	struct PoolInfo {
		uint256 totalSupply;
		uint256 allocPoint; // How many allocation points assigned to this pool.
		uint256 lastRewardTime; // Last second that reward distribution occurs.
		uint256 accRewardPerShare; // Accumulated rewards per share, times ACC_REWARD_PRECISION. See below.
		IOnwardIncentivesController onwardIncentives;
	}

	// Info about token emissions for a given time period.
	struct EmissionPoint {
		uint128 startTimeOffset;
		uint128 rewardsPerSecond;
	}

	// Emitted when rewardPerSecond is updated
	event RewardsPerSecondUpdated(uint256 indexed rewardsPerSecond, bool persist);

	event BalanceUpdated(address indexed token, address indexed user, uint256 balance, uint256 totalSupply);

	event EmissionScheduleAppended(uint256[] startTimeOffsets, uint256[] rewardsPerSeconds);

	event ChefReserveLow(uint256 _balance);

	event ChefReserveEmpty(uint256 _balance);

	event Disqualified(address indexed user);

	// multiplier for reward calc
	uint256 private constant ACC_REWARD_PRECISION = 1e12;

	// Data about the future reward rates. emissionSchedule stored in chronological order,
	// whenever the number of blocks since the start block exceeds the next block offset a new
	// reward rate is applied.
	EmissionPoint[] public emissionSchedule;

	// If true, keep this new reward rate indefinitely
	// If false, keep this reward rate until the next scheduled block offset, then return to the schedule.
	bool public persistRewardsPerSecond;

	/********************** Emission Info ***********************/

	// Array of tokens for reward
	address[] public registeredTokens;

	// Current reward per second
	uint256 public rewardsPerSecond;

	// last RPS, used during refill after reserve empty
	uint256 public lastRPS;

	// Index in emission schedule which the last rewardsPerSeconds was used
	// only used for scheduled rewards
	uint256 public emissionScheduleIndex;

	// Info of each pool.
	mapping(address => PoolInfo) public poolInfo;
	mapping(address => bool) private validRTokens;

	// Total allocation poitns. Must be the sum of all allocation points in all pools.
	uint256 public totalAllocPoint;

	// token => user => Info of each user that stakes LP tokens.
	mapping(address => mapping(address => UserInfo)) public userInfo;

	// user => base claimable balance
	mapping(address => uint256) public userBaseClaimable;

	// MFD, bounties, AC, middlefee
	mapping(address => bool) public eligibilityExempt;

	// The block number when reward mining starts.
	uint256 public startTime;

	bool public eligibilityEnabled;

	address public poolConfigurator;
	uint256 public depositedRewards;
	uint256 public accountedRewards;
	uint256 public lastAllPoolUpdate;

	IMiddleFeeDistribution public rewardMinter;
	IEligibilityDataProvider public eligibleDataProvider;
	address public bountyManager;

	function initialize(
		address _poolConfigurator,
		IEligibilityDataProvider _eligibleDataProvider,
		IMiddleFeeDistribution _rewardMinter,
		uint256 _rewardsPerSecond
	) public initializer {
		require(address(_poolConfigurator) != address(0), "!invalid address");
		require(address(_eligibleDataProvider) != address(0), "!invalid address");
		require(address(_rewardMinter) != address(0), "!invalid address");

		__Ownable_init();
		__Pausable_init();

		poolConfigurator = _poolConfigurator;
		eligibleDataProvider = _eligibleDataProvider;
		rewardMinter = _rewardMinter;
		rewardsPerSecond = _rewardsPerSecond;
		persistRewardsPerSecond = true;

		eligibilityEnabled = true;
	}

	function poolLength() external view returns (uint256) {
		return registeredTokens.length;
	}

	function _getMfd() internal view returns (IMultiFeeDistribution mfd) {
		address multiFeeDistribution = rewardMinter.getMultiFeeDistributionAddress();
		mfd = IMultiFeeDistribution(multiFeeDistribution);
	}

	function setOnwardIncentives(address _token, IOnwardIncentivesController _incentives) external onlyOwner {
		require(poolInfo[_token].lastRewardTime != 0, "pool doesn't exist");
		poolInfo[_token].onwardIncentives = _incentives;
	}

	function setBountyManager(address _bountyManager) external onlyOwner {
		bountyManager = _bountyManager;
	}

	function setEligibilityEnabled(bool _newVal) external onlyOwner {
		eligibilityEnabled = _newVal;
	}

	/********************** Pool Setup + Admin ***********************/

	function start() public onlyOwner {
		require(startTime == 0, "already started");
		startTime = block.timestamp;
	}

	// Add a new lp to the pool. Can only be called by the poolConfigurator.
	function addPool(address _token, uint256 _allocPoint) external {
		require(msg.sender == poolConfigurator, "not allowed");
		require(poolInfo[_token].lastRewardTime == 0, "pool already exists");
		_updateEmissions();
		totalAllocPoint = totalAllocPoint.add(_allocPoint);
		registeredTokens.push(_token);
		poolInfo[_token] = PoolInfo({
			totalSupply: 0,
			allocPoint: _allocPoint,
			lastRewardTime: block.timestamp,
			accRewardPerShare: 0,
			onwardIncentives: IOnwardIncentivesController(address(0))
		});
		validRTokens[_token] = true;
	}

	// Update the given pool's allocation point. Can only be called by the owner.
	function batchUpdateAllocPoint(address[] calldata _tokens, uint256[] calldata _allocPoints) public onlyOwner {
		require(_tokens.length == _allocPoints.length, "params length mismatch");
		_massUpdatePools();
		uint256 _totalAllocPoint = totalAllocPoint;
		for (uint256 i = 0; i < _tokens.length; i++) {
			PoolInfo storage pool = poolInfo[_tokens[i]];
			require(pool.lastRewardTime > 0, "pool doesn't exist");
			_totalAllocPoint = _totalAllocPoint.sub(pool.allocPoint).add(_allocPoints[i]);
			pool.allocPoint = _allocPoints[i];
		}
		totalAllocPoint = _totalAllocPoint;
	}

	/**
	 * @notice Sets the reward per second to be distributed. Can only be called by the owner.
	 * @dev Its decimals count is ACC_REWARD_PRECISION
	 * @param _rewardsPerSecond The amount of reward to be distributed per second.
	 */
	function setRewardsPerSecond(uint256 _rewardsPerSecond, bool _persist) external onlyOwner {
		_massUpdatePools();
		rewardsPerSecond = _rewardsPerSecond;
		persistRewardsPerSecond = _persist;
		emit RewardsPerSecondUpdated(_rewardsPerSecond, _persist);
	}

	function setScheduledRewardsPerSecond() internal {
		if (!persistRewardsPerSecond) {
			uint256 length = emissionSchedule.length;
			uint256 i = emissionScheduleIndex;
			uint128 offset = uint128(block.timestamp.sub(startTime));
			for (; i < length && offset >= emissionSchedule[i].startTimeOffset; i++) {}
			if (i > emissionScheduleIndex) {
				emissionScheduleIndex = i;
				_massUpdatePools();
				rewardsPerSecond = uint256(emissionSchedule[i - 1].rewardsPerSecond);
			}
		}
	}

	function setEmissionSchedule(
		uint256[] calldata _startTimeOffsets,
		uint256[] calldata _rewardsPerSecond
	) external onlyOwner {
		uint256 length = _startTimeOffsets.length;
		require(length > 0 && length == _rewardsPerSecond.length, "empty or mismatch params");

		for (uint256 i = 0; i < length; i++) {
			if (i > 0) {
				require(_startTimeOffsets[i - 1] < _startTimeOffsets[i], "should be ascending");
			}
			require(_startTimeOffsets[i] <= type(uint128).max, "startTimeOffsets > max uint128");
			require(_rewardsPerSecond[i] <= type(uint128).max, "rewardsPerSecond > max uint128");

			if (startTime > 0) {
				require(_startTimeOffsets[i] > block.timestamp.sub(startTime), "invalid start time");
			}
			emissionSchedule.push(
				EmissionPoint({
					startTimeOffset: uint128(_startTimeOffsets[i]),
					rewardsPerSecond: uint128(_rewardsPerSecond[i])
				})
			);
		}
		emit EmissionScheduleAppended(_startTimeOffsets, _rewardsPerSecond);
	}

	function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
		IERC20(tokenAddress).safeTransfer(owner(), tokenAmount);
	}

	/********************** Pool State Changers ***********************/

	function _updateEmissions() internal {
		if (block.timestamp > endRewardTime()) {
			_massUpdatePools();
			lastRPS = rewardsPerSecond;
			rewardsPerSecond = 0;
			return;
		}
		setScheduledRewardsPerSecond();
	}

	// Update reward variables for all pools
	function _massUpdatePools() internal {
		uint256 totalAP = totalAllocPoint;
		uint256 length = registeredTokens.length;
		for (uint256 i = 0; i < length; ++i) {
			_updatePool(poolInfo[registeredTokens[i]], totalAP);
		}
		lastAllPoolUpdate = block.timestamp;
	}

	// Update reward variables of the given pool to be up-to-date.
	function _updatePool(PoolInfo storage pool, uint256 _totalAllocPoint) internal {
		uint256 timestamp = block.timestamp;
		if (endRewardTime() <= block.timestamp) {
			timestamp = endRewardTime();
		}
		if (timestamp <= pool.lastRewardTime) {
			return;
		}

		uint256 lpSupply = pool.totalSupply;
		if (lpSupply == 0) {
			pool.lastRewardTime = timestamp;
			return;
		}

		uint256 duration = timestamp.sub(pool.lastRewardTime);
		uint256 rawReward = duration.mul(rewardsPerSecond);
		if (availableRewards() < rawReward) {
			rawReward = availableRewards();
		}
		uint256 reward = rawReward.mul(pool.allocPoint).div(_totalAllocPoint);
		accountedRewards = accountedRewards.add(reward);
		pool.accRewardPerShare = pool.accRewardPerShare.add(reward.mul(ACC_REWARD_PRECISION).div(lpSupply));
		pool.lastRewardTime = timestamp;
	}

	/********************** Emission Calc + Transfer ***********************/

	function pendingRewards(address _user, address[] memory _tokens) public view returns (uint256[] memory) {
		uint256[] memory claimable = new uint256[](_tokens.length);
		for (uint256 i = 0; i < _tokens.length; i++) {
			address token = _tokens[i];
			PoolInfo storage pool = poolInfo[token];
			UserInfo storage user = userInfo[token][_user];
			uint256 accRewardPerShare = pool.accRewardPerShare;
			uint256 lpSupply = pool.totalSupply;
			if (block.timestamp > pool.lastRewardTime && lpSupply != 0) {
				uint256 duration = block.timestamp.sub(pool.lastRewardTime);
				uint256 reward = duration.mul(rewardsPerSecond).mul(pool.allocPoint).div(totalAllocPoint);
				accRewardPerShare = accRewardPerShare.add(reward.mul(ACC_REWARD_PRECISION).div(lpSupply));
			}
			claimable[i] = user.amount.mul(accRewardPerShare).div(ACC_REWARD_PRECISION).sub(user.rewardDebt);
		}
		return claimable;
	}

	// Claim pending rewards for one or more pools.
	// Rewards are not received directly, they are minted by the rewardMinter.
	function claim(address _user, address[] memory _tokens) public whenNotPaused {
		if (eligibilityEnabled) {
			checkAndProcessEligibility(_user);
		}

		_updateEmissions();

		uint256 pending = userBaseClaimable[_user];
		userBaseClaimable[_user] = 0;
		uint256 _totalAllocPoint = totalAllocPoint;
		for (uint256 i = 0; i < _tokens.length; i++) {
			require(validRTokens[_tokens[i]], "invalid rtoken");
			PoolInfo storage pool = poolInfo[_tokens[i]];
			require(pool.lastRewardTime > 0, "pool doesn't exist");
			_updatePool(pool, _totalAllocPoint);
			UserInfo storage user = userInfo[_tokens[i]][_user];
			uint256 rewardDebt = user.amount.mul(pool.accRewardPerShare).div(ACC_REWARD_PRECISION);
			pending = pending.add(rewardDebt.sub(user.rewardDebt));
			user.rewardDebt = rewardDebt;
			user.lastClaimTime = block.timestamp;
		}

		_mint(_user, pending);

		if (endRewardTime() < block.timestamp + 5 days) {
			_emitReserveLow();
		}
	}

	function _emitReserveLow() internal {
		address rdntToken = rewardMinter.getRdntTokenAddress();
		emit ChefReserveLow(IERC20(rdntToken).balanceOf(address(this)));
	}

	function _mint(address _user, uint256 _amount) internal {
		_amount = _sendRadiant(address(_getMfd()), _amount);
		_getMfd().mint(_user, _amount, true);
	}

	function setEligibilityExempt(address _contract) public onlyOwner {
		eligibilityExempt[_contract] = true;
	}

	/********************** Eligibility + Disqualification ***********************/

	/**
	 * @notice `after` Hook for deposit and borrow update.
	 * @dev important! eligible status can be updated here
	 */
	function handleActionAfter(address _user, uint256 _balance, uint256 _totalSupply) external {
		require(validRTokens[msg.sender] || msg.sender == address(_getMfd()), "!rToken || mfd");

		if (_user == address(rewardMinter) || _user == address(_getMfd()) || eligibilityExempt[_user]) {
			return;
		}
		if (eligibilityEnabled) {
			eligibleDataProvider.refresh(_user);
			if (eligibleDataProvider.isEligibleForRewards(_user)) {
				_handleActionAfterForToken(msg.sender, _user, _balance, _totalSupply);
			} else {
				checkAndProcessEligibility(_user);
			}
		} else {
			_handleActionAfterForToken(msg.sender, _user, _balance, _totalSupply);
		}
	}

	function _handleActionAfterForToken(
		address _token,
		address _user,
		uint256 _balance,
		uint256 _totalSupply
	) internal {
		PoolInfo storage pool = poolInfo[_token];
		require(pool.lastRewardTime > 0, "pool doesn't exist");
		_updateEmissions();
		_updatePool(pool, totalAllocPoint);
		UserInfo storage user = userInfo[_token][_user];
		uint256 amount = user.amount;
		uint256 accRewardPerShare = pool.accRewardPerShare;
		if (amount != 0) {
			uint256 pending = amount.mul(accRewardPerShare).div(ACC_REWARD_PRECISION).sub(user.rewardDebt);
			if (pending != 0) {
				userBaseClaimable[_user] = userBaseClaimable[_user].add(pending);
			}
		}
		pool.totalSupply = pool.totalSupply.sub(user.amount);
		user.amount = _balance;
		user.rewardDebt = _balance.mul(accRewardPerShare).div(ACC_REWARD_PRECISION);
		if (user.amount > 0) {
			user.enterTime = block.timestamp;
		}
		pool.totalSupply = pool.totalSupply.add(_balance);
		if (pool.onwardIncentives != IOnwardIncentivesController(address(0))) {
			pool.onwardIncentives.handleAction(_token, _user, _balance, _totalSupply);
		}

		emit BalanceUpdated(_token, _user, _balance, _totalSupply);
	}

	/**
	 * @notice `before` Hook for deposit and borrow update.
	 */
	function handleActionBefore(address _user) external {}

	/**
	 * @notice Hook for lock update.
	 * @dev Called by the locking contracts before locking or unlocking happens
	 */
	function beforeLockUpdate(address _user) external {
		require(msg.sender == address(_getMfd()), "!mfd");
		if (eligibilityEnabled) {
			checkAndProcessEligibility(_user);
		}
	}

	/**
	 * @notice Hook for lock update.
	 * @dev Called by the locking contracts after locking or unlocking happens
	 */
	function afterLockUpdate(address _user) external {
		require(msg.sender == address(_getMfd()), "!MFD");
		if (eligibilityEnabled) {
			eligibleDataProvider.updatePrice();
			if (eligibleDataProvider.isEligibleForRewards(_user)) {
				for (uint256 i = 0; i < registeredTokens.length; i++) {
					uint256 newBal = IERC20(registeredTokens[i]).balanceOf(_user);
					uint256 registeredBal = userInfo[registeredTokens[i]][_user].amount;
					if (newBal != 0 && newBal != registeredBal) {
						_handleActionAfterForToken(
							registeredTokens[i],
							_user,
							newBal,
							poolInfo[registeredTokens[i]].totalSupply.add(newBal).sub(registeredBal)
						);
					}
				}
			}
			eligibleDataProvider.refresh(_user);
		}
	}

	/********************** Eligibility + Disqualification ***********************/

	function hasEligibleDeposits(address _user) internal view returns (bool hasDeposits) {
		for (uint256 i = 0; i < registeredTokens.length; i++) {
			UserInfo storage user = userInfo[registeredTokens[i]][_user];
			if (user.amount != 0) {
				hasDeposits = true;
				break;
			}
		}
	}

	function checkAndProcessEligibility(address _user, bool _execute) internal returns (bool issueBaseBounty) {
		bool isEligible = eligibleDataProvider.isEligibleForRewards(_user);
		bool hasEligDeposits = hasEligibleDeposits(_user);
		uint256 lastDqTime = eligibleDataProvider.getDqTime(_user);
		bool alreadyDqd = lastDqTime != 0;

		if (!isEligible && hasEligDeposits && !alreadyDqd) {
			issueBaseBounty = true;
		}
		if (_execute && issueBaseBounty) {
			stopEmissionsFor(_user);
			emit Disqualified(_user);
			eligibleDataProvider.refresh(_user);
		}
	}

	function checkAndProcessEligibility(address _user) internal {
		checkAndProcessEligibility(_user, true);
	}

	function claimBounty(address _user, bool _execute) public returns (bool issueBaseBounty) {
		require(msg.sender == address(bountyManager), "bounty only");
		issueBaseBounty = checkAndProcessEligibility(_user, _execute);
	}

	function stopEmissionsFor(address _user) internal {
		require(eligibilityEnabled, "!EE");
		require(!eligibleDataProvider.isEligibleForRewards(_user), "user is still eligible");
		uint256 length = registeredTokens.length;
		for (uint256 i = 0; i < length; ++i) {
			address token = registeredTokens[i];
			PoolInfo storage pool = poolInfo[token];
			UserInfo storage user = userInfo[token][_user];

			_handleActionAfterForToken(token, _user, 0, pool.totalSupply.sub(user.amount));
		}
		eligibleDataProvider.setDqTime(_user, block.timestamp);
	}

	function _sendRadiant(address _user, uint256 _amount) internal returns (uint256) {
		if (_amount == 0) {
			return 0;
		}

		address rdntToken = rewardMinter.getRdntTokenAddress();
		uint256 chefReserve = IERC20(rdntToken).balanceOf(address(this));
		if (_amount > chefReserve) {
			emit ChefReserveEmpty(chefReserve);
			_pause();
		} else {
			IERC20(rdntToken).safeTransfer(_user, _amount);
		}
		return _amount;
	}

	/********************** RDNT Reserve Management ***********************/

	function endRewardTime() public view returns (uint256 timestamp) {
		uint256 unclaimedRewards = depositedRewards.sub(accountedRewards);
		uint256 extra = 0;
		for (uint256 i; i < registeredTokens.length; i++) {
			if (poolInfo[registeredTokens[i]].lastRewardTime <= lastAllPoolUpdate) {
				continue;
			} else {
				extra = extra.add(
					poolInfo[registeredTokens[i]]
						.lastRewardTime
						.sub(lastAllPoolUpdate)
						.mul(poolInfo[registeredTokens[i]].allocPoint)
						.mul(rewardsPerSecond)
						.div(totalAllocPoint)
				);
			}
		}
		if (rewardsPerSecond == 0) {
			timestamp = type(uint256).max;
		} else {
			timestamp = (unclaimedRewards + extra).div(rewardsPerSecond) + (lastAllPoolUpdate);
		}
	}

	function registerRewardDeposit(uint256 _amount) external onlyOwner {
		depositedRewards = depositedRewards.add(_amount);
		_massUpdatePools();
		if (rewardsPerSecond == 0 && lastRPS > 0) {
			rewardsPerSecond = lastRPS;
		}
	}

	function availableRewards() internal view returns (uint256 amount) {
		return depositedRewards.sub(accountedRewards);
	}

	/********************** Helper/Convenience Methods ***********************/

	/**
	 * @notice Claim pending rewards for one or more pools into base claimable.
	 * @dev Rewards are not transferred, just converted into base claimable.
	 */
	function claimToBase(address _user, address[] memory _tokens) public {
		uint256 _userBaseClaimable = userBaseClaimable[_user];

		// updatePool must be called after calculation of pending rewards
		// this is because of reward calculation based on eligibility
		uint256[] memory pending = pendingRewards(_user, _tokens);
		_updateEmissions();
		uint256 _totalAllocPoint = totalAllocPoint;
		for (uint256 i = 0; i < _tokens.length; i++) {
			require(validRTokens[_tokens[i]], "invalid rtoken");
			UserInfo storage user = userInfo[_tokens[i]][_user];
			_userBaseClaimable = _userBaseClaimable.add(pending[i]);

			// Set pending reward to zero
			PoolInfo storage pool = poolInfo[_tokens[i]];
			_updatePool(pool, _totalAllocPoint);
			uint256 newDebt = user.amount.mul(pool.accRewardPerShare).div(ACC_REWARD_PRECISION);
			user.rewardDebt = newDebt;
			user.lastClaimTime = block.timestamp;
		}
		userBaseClaimable[_user] = _userBaseClaimable;
	}

	function saveUserRewards(address[] memory _users) public {
		address[] memory _tokens = registeredTokens;
		for (uint256 i = 0; i < _users.length; i++) {
			if (_users[i] != address(0)) {
				claimToBase(_users[i], _tokens);
			}
		}
	}

	function claimAll(address _user) external {
		claim(_user, registeredTokens);
	}

	function allPendingRewards(address _user) public view returns (uint256 pending) {
		pending = userBaseClaimable[_user];
		uint256[] memory claimable = pendingRewards(_user, registeredTokens);
		for (uint256 i = 0; i < claimable.length; i++) {
			pending += claimable[i];
		}
	}

	function pause() external onlyOwner {
		_pause();
	}

	function unpause() external onlyOwner {
		_unpause();
	}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions 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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _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());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// 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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IScaledBalanceToken} from "./IScaledBalanceToken.sol";
import {IInitializableAToken} from "./IInitializableAToken.sol";
import {IAaveIncentivesController} from "./IAaveIncentivesController.sol";

interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
	/**
	 * @dev Emitted after the mint action
	 * @param from The address performing the mint
	 * @param value The amount being
	 * @param index The new liquidity index of the reserve
	 **/
	event Mint(address indexed from, uint256 value, uint256 index);

	/**
	 * @dev Mints `amount` aTokens to `user`
	 * @param user The address receiving the minted tokens
	 * @param amount The amount of tokens getting minted
	 * @param index The new liquidity index of the reserve
	 * @return `true` if the the previous balance of the user was 0
	 */
	function mint(address user, uint256 amount, uint256 index) external returns (bool);

	/**
	 * @dev Emitted after aTokens are burned
	 * @param from The owner of the aTokens, getting them burned
	 * @param target The address that will receive the underlying
	 * @param value The amount being burned
	 * @param index The new liquidity index of the reserve
	 **/
	event Burn(address indexed from, address indexed target, uint256 value, uint256 index);

	/**
	 * @dev Emitted during the transfer action
	 * @param from The user whose tokens are being transferred
	 * @param to The recipient
	 * @param value The amount being transferred
	 * @param index The new liquidity index of the reserve
	 **/
	event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);

	/**
	 * @dev Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
	 * @param user The owner of the aTokens, getting them burned
	 * @param receiverOfUnderlying The address that will receive the underlying
	 * @param amount The amount being burned
	 * @param index The new liquidity index of the reserve
	 **/
	function burn(address user, address receiverOfUnderlying, uint256 amount, uint256 index) external;

	/**
	 * @dev Mints aTokens to the reserve treasury
	 * @param amount The amount of tokens getting minted
	 * @param index The new liquidity index of the reserve
	 */
	function mintToTreasury(uint256 amount, uint256 index) external;

	/**
	 * @dev Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
	 * @param from The address getting liquidated, current owner of the aTokens
	 * @param to The recipient
	 * @param value The amount of tokens getting transferred
	 **/
	function transferOnLiquidation(address from, address to, uint256 value) external;

	/**
	 * @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer
	 * assets in borrow(), withdraw() and flashLoan()
	 * @param user The recipient of the underlying
	 * @param amount The amount getting transferred
	 * @return The amount transferred
	 **/
	function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);

	/**
	 * @dev Invoked to execute actions on the aToken side after a repayment.
	 * @param user The user executing the repayment
	 * @param amount The amount getting repaid
	 **/
	function handleRepayment(address user, uint256 amount) external;

	/**
	 * @dev Returns the address of the incentives controller contract
	 **/
	function getIncentivesController() external view returns (IAaveIncentivesController);

	/**
	 * @dev Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
	 **/
	function UNDERLYING_ASSET_ADDRESS() external view returns (address);
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;

interface IAaveIncentivesController {
	event RewardsAccrued(address indexed user, uint256 amount);

	event RewardsClaimed(address indexed user, address indexed to, uint256 amount);

	event RewardsClaimed(address indexed user, address indexed to, address indexed claimer, uint256 amount);

	event ClaimerSet(address indexed user, address indexed claimer);

	/*
	 * @dev Returns the configuration of the distribution for a certain asset
	 * @param asset The address of the reference asset of the distribution
	 * @return The asset index, the emission per second and the last updated timestamp
	 **/
	function getAssetData(address asset) external view returns (uint256, uint256, uint256);

	/**
	 * @dev Whitelists an address to claim the rewards on behalf of another address
	 * @param user The address of the user
	 * @param claimer The address of the claimer
	 */
	function setClaimer(address user, address claimer) external;

	/**
	 * @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
	 * @param user The address of the user
	 * @return The claimer address
	 */
	function getClaimer(address user) external view returns (address);

	/**
	 * @dev Configure assets for a certain rewards emission
	 * @param assets The assets to incentivize
	 * @param emissionsPerSecond The emission for each asset
	 */
	function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond) external;

	/**
	 * @dev Called by the corresponding asset on any update that affects the rewards distribution
	 * @param user The address of the user
	 **/
	function handleActionBefore(address user) external;

	/**
	 * @dev Called by the corresponding asset on any update that affects the rewards distribution
	 * @param user The address of the user
	 * @param userBalance The balance of the user of the asset in the lending pool
	 * @param totalSupply The total supply of the asset in the lending pool
	 **/
	function handleActionAfter(address user, uint256 userBalance, uint256 totalSupply) external;

	/**
	 * @dev Returns the total of rewards of an user, already accrued + not yet accrued
	 * @param user The address of the user
	 * @return The rewards
	 **/
	function getRewardsBalance(address[] calldata assets, address user) external view returns (uint256);

	/**
	 * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
	 * @param amount Amount of rewards to claim
	 * @param to Address that will be receiving the rewards
	 * @return Rewards claimed
	 **/
	function claimRewards(address[] calldata assets, uint256 amount, address to) external returns (uint256);

	/**
	 * @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
	 * be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
	 * @param amount Amount of rewards to claim
	 * @param user Address to check and claim rewards
	 * @param to Address that will be receiving the rewards
	 * @return Rewards claimed
	 **/
	function claimRewardsOnBehalf(
		address[] calldata assets,
		uint256 amount,
		address user,
		address to
	) external returns (uint256);

	/**
	 * @dev returns the unclaimed rewards of the user
	 * @param user the address of the user
	 * @return the unclaimed user rewards
	 */
	function getUserUnclaimedRewards(address user) external view returns (uint256);

	/**
	 * @dev returns the unclaimed rewards of the user
	 * @param user the address of the user
	 * @param asset The asset to incentivize
	 * @return the user index for the asset
	 */
	function getUserAssetData(address user, address asset) external view returns (uint256);

	/**
	 * @dev for backward compatibility with previous implementation of the Incentives controller
	 */
	function REWARD_TOKEN() external view returns (address);

	/**
	 * @dev for backward compatibility with previous implementation of the Incentives controller
	 */
	function PRECISION() external view returns (uint8);

	/**
	 * @dev Gets the distribution end timestamp of the emissions
	 */
	function DISTRIBUTION_END() external view returns (uint256);
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;

interface IEligibilityDataProvider {
	function refresh(address user) external;

	function updatePrice() external;

	function requiredEthValue(address user) external view returns (uint256 required);

	function isEligibleForRewards(address _user) external view returns (bool isEligible);

	function lastEligibleTime(address user) external view returns (uint256 lastEligibleTimestamp);

	function lockedUsdValue(address user) external view returns (uint256);

	function requiredUsdValue(address user) external view returns (uint256 required);

	function lastEligibleStatus(address user) external view returns (bool);

	function isMarketDisqualified(address user) external view returns (bool);

	function rewardEligibleAmount(address token) external view returns (uint256);

	function setDqTime(address _user, uint256 _time) external;

	function getDqTime(address _user) external view returns (uint256);

	function autoprune() external returns (uint256 processed);

	function requiredDepositRatio() external view returns (uint256);

	function RATIO_DIVISOR() external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;
pragma abicoder v2;

import "./LockedBalance.sol";

interface IFeeDistribution {
	struct RewardData {
		address token;
		uint256 amount;
	}

	function addReward(address rewardsToken) external;

	function lockedBalances(
		address user
	) external view returns (uint256, uint256, uint256, uint256, LockedBalance[] memory);
}

File 17 of 26 : IInitializableAToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

import {ILendingPool} from "./ILendingPool.sol";
import {IAaveIncentivesController} from "./IAaveIncentivesController.sol";

/**
 * @title IInitializableAToken
 * @notice Interface for the initialize function on AToken
 * @author Aave
 **/
interface IInitializableAToken {
	/**
	 * @dev Emitted when an aToken is initialized
	 * @param underlyingAsset The address of the underlying asset
	 * @param pool The address of the associated lending pool
	 * @param treasury The address of the treasury
	 * @param incentivesController The address of the incentives controller for this aToken
	 * @param aTokenDecimals the decimals of the underlying
	 * @param aTokenName the name of the aToken
	 * @param aTokenSymbol the symbol of the aToken
	 * @param params A set of encoded parameters for additional initialization
	 **/
	event Initialized(
		address indexed underlyingAsset,
		address indexed pool,
		address treasury,
		address incentivesController,
		uint8 aTokenDecimals,
		string aTokenName,
		string aTokenSymbol,
		bytes params
	);

	/**
	 * @dev Initializes the aToken
	 * @param pool The address of the lending pool where this aToken will be used
	 * @param treasury The address of the Aave treasury, receiving the fees on this aToken
	 * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
	 * @param incentivesController The smart contract managing potential incentives distribution
	 * @param aTokenDecimals The decimals of the aToken, same as the underlying asset's
	 * @param aTokenName The name of the aToken
	 * @param aTokenSymbol The symbol of the aToken
	 */
	function initialize(
		ILendingPool pool,
		address treasury,
		address underlyingAsset,
		IAaveIncentivesController incentivesController,
		uint8 aTokenDecimals,
		string calldata aTokenName,
		string calldata aTokenSymbol,
		bytes calldata params
	) external;
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;

import {ILendingPoolAddressesProvider} from "./ILendingPoolAddressesProvider.sol";
import {DataTypes} from "../lending/libraries/types/DataTypes.sol";

interface ILendingPool {
	/**
	 * @dev Emitted on deposit()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The address initiating the deposit
	 * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens
	 * @param amount The amount deposited
	 * @param referral The referral code used
	 **/
	event Deposit(
		address indexed reserve,
		address user,
		address indexed onBehalfOf,
		uint256 amount,
		uint16 indexed referral
	);

	/**
	 * @dev Emitted on withdraw()
	 * @param reserve The address of the underlyng asset being withdrawn
	 * @param user The address initiating the withdrawal, owner of aTokens
	 * @param to Address that will receive the underlying
	 * @param amount The amount to be withdrawn
	 **/
	event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);

	/**
	 * @dev Emitted on borrow() and flashLoan() when debt needs to be opened
	 * @param reserve The address of the underlying asset being borrowed
	 * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
	 * initiator of the transaction on flashLoan()
	 * @param onBehalfOf The address that will be getting the debt
	 * @param amount The amount borrowed out
	 * @param borrowRateMode The rate mode: 1 for Stable, 2 for Variable
	 * @param borrowRate The numeric rate at which the user has borrowed
	 * @param referral The referral code used
	 **/
	event Borrow(
		address indexed reserve,
		address user,
		address indexed onBehalfOf,
		uint256 amount,
		uint256 borrowRateMode,
		uint256 borrowRate,
		uint16 indexed referral
	);

	/**
	 * @dev Emitted on repay()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The beneficiary of the repayment, getting his debt reduced
	 * @param repayer The address of the user initiating the repay(), providing the funds
	 * @param amount The amount repaid
	 **/
	event Repay(address indexed reserve, address indexed user, address indexed repayer, uint256 amount);

	/**
	 * @dev Emitted on swapBorrowRateMode()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The address of the user swapping his rate mode
	 * @param rateMode The rate mode that the user wants to swap to
	 **/
	event Swap(address indexed reserve, address indexed user, uint256 rateMode);

	/**
	 * @dev Emitted on setUserUseReserveAsCollateral()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The address of the user enabling the usage as collateral
	 **/
	event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);

	/**
	 * @dev Emitted on setUserUseReserveAsCollateral()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The address of the user enabling the usage as collateral
	 **/
	event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);

	/**
	 * @dev Emitted on rebalanceStableBorrowRate()
	 * @param reserve The address of the underlying asset of the reserve
	 * @param user The address of the user for which the rebalance has been executed
	 **/
	event RebalanceStableBorrowRate(address indexed reserve, address indexed user);

	/**
	 * @dev Emitted on flashLoan()
	 * @param target The address of the flash loan receiver contract
	 * @param initiator The address initiating the flash loan
	 * @param asset The address of the asset being flash borrowed
	 * @param amount The amount flash borrowed
	 * @param premium The fee flash borrowed
	 * @param referralCode The referral code used
	 **/
	event FlashLoan(
		address indexed target,
		address indexed initiator,
		address indexed asset,
		uint256 amount,
		uint256 premium,
		uint16 referralCode
	);

	/**
	 * @dev Emitted when the pause is triggered.
	 */
	event Paused();

	/**
	 * @dev Emitted when the pause is lifted.
	 */
	event Unpaused();

	/**
	 * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via
	 * LendingPoolCollateral manager using a DELEGATECALL
	 * This allows to have the events in the generated ABI for LendingPool.
	 * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
	 * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
	 * @param user The address of the borrower getting liquidated
	 * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
	 * @param liquidatedCollateralAmount The amount of collateral received by the liiquidator
	 * @param liquidator The address of the liquidator
	 * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
	 * to receive the underlying collateral asset directly
	 **/
	event LiquidationCall(
		address indexed collateralAsset,
		address indexed debtAsset,
		address indexed user,
		uint256 debtToCover,
		uint256 liquidatedCollateralAmount,
		address liquidator,
		bool receiveAToken
	);

	/**
	 * @dev Emitted when the state of a reserve is updated. NOTE: This event is actually declared
	 * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,
	 * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it
	 * gets added to the LendingPool ABI
	 * @param reserve The address of the underlying asset of the reserve
	 * @param liquidityRate The new liquidity rate
	 * @param stableBorrowRate The new stable borrow rate
	 * @param variableBorrowRate The new variable borrow rate
	 * @param liquidityIndex The new liquidity index
	 * @param variableBorrowIndex The new variable borrow index
	 **/
	event ReserveDataUpdated(
		address indexed reserve,
		uint256 liquidityRate,
		uint256 stableBorrowRate,
		uint256 variableBorrowRate,
		uint256 liquidityIndex,
		uint256 variableBorrowIndex
	);

	/**
	 * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
	 * - E.g. User deposits 100 USDC and gets in return 100 aUSDC
	 * @param asset The address of the underlying asset to deposit
	 * @param amount The amount to be deposited
	 * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
	 *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
	 *   is a different wallet
	 * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
	 *   0 if the action is executed directly by the user, without any middle-man
	 **/
	function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;

	function depositWithAutoDLP(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;

	/**
	 * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
	 * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
	 * @param asset The address of the underlying asset to withdraw
	 * @param amount The underlying amount to be withdrawn
	 *   - Send the value type(uint256).max in order to withdraw the whole aToken balance
	 * @param to Address that will receive the underlying, same as msg.sender if the user
	 *   wants to receive it on his own wallet, or a different address if the beneficiary is a
	 *   different wallet
	 * @return The final amount withdrawn
	 **/
	function withdraw(address asset, uint256 amount, address to) external returns (uint256);

	/**
	 * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
	 * already deposited enough collateral, or he was given enough allowance by a credit delegator on the
	 * corresponding debt token (StableDebtToken or VariableDebtToken)
	 * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
	 *   and 100 stable/variable debt tokens, depending on the `interestRateMode`
	 * @param asset The address of the underlying asset to borrow
	 * @param amount The amount to be borrowed
	 * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
	 * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
	 *   0 if the action is executed directly by the user, without any middle-man
	 * @param onBehalfOf Address of the user who will receive the debt. Should be the address of the borrower itself
	 * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
	 * if he has been given credit delegation allowance
	 **/
	function borrow(
		address asset,
		uint256 amount,
		uint256 interestRateMode,
		uint16 referralCode,
		address onBehalfOf
	) external;

	/**
	 * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
	 * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
	 * @param asset The address of the borrowed underlying asset previously borrowed
	 * @param amount The amount to repay
	 * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
	 * @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
	 * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
	 * user calling the function if he wants to reduce/remove his own debt, or the address of any other
	 * other borrower whose debt should be removed
	 * @return The final amount repaid
	 **/
	function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) external returns (uint256);

	/**
	 * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa
	 * @param asset The address of the underlying asset borrowed
	 * @param rateMode The rate mode that the user wants to swap to
	 **/
	function swapBorrowRateMode(address asset, uint256 rateMode) external;

	/**
	 * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
	 * - Users can be rebalanced if the following conditions are satisfied:
	 *     1. Usage ratio is above 95%
	 *     2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been
	 *        borrowed at a stable rate and depositors are not earning enough
	 * @param asset The address of the underlying asset borrowed
	 * @param user The address of the user to be rebalanced
	 **/
	function rebalanceStableBorrowRate(address asset, address user) external;

	/**
	 * @dev Allows depositors to enable/disable a specific deposited asset as collateral
	 * @param asset The address of the underlying asset deposited
	 * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise
	 **/
	function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;

	/**
	 * @dev Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
	 * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
	 *   a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
	 * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
	 * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
	 * @param user The address of the borrower getting liquidated
	 * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
	 * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
	 * to receive the underlying collateral asset directly
	 **/
	function liquidationCall(
		address collateralAsset,
		address debtAsset,
		address user,
		uint256 debtToCover,
		bool receiveAToken
	) external;

	/**
	 * @dev Allows smartcontracts to access the liquidity of the pool within one transaction,
	 * as long as the amount taken plus a fee is returned.
	 * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.
	 * For further details please visit https://developers.aave.com
	 * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
	 * @param assets The addresses of the assets being flash-borrowed
	 * @param amounts The amounts amounts being flash-borrowed
	 * @param modes Types of the debt to open if the flash loan is not returned:
	 *   0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
	 *   1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
	 *   2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
	 * @param onBehalfOf The address  that will receive the debt in the case of using on `modes` 1 or 2
	 * @param params Variadic packed params to pass to the receiver as extra information
	 * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
	 *   0 if the action is executed directly by the user, without any middle-man
	 **/
	function flashLoan(
		address receiverAddress,
		address[] calldata assets,
		uint256[] calldata amounts,
		uint256[] calldata modes,
		address onBehalfOf,
		bytes calldata params,
		uint16 referralCode
	) external;

	/**
	 * @dev Returns the user account data across all the reserves
	 * @param user The address of the user
	 * @return totalCollateralETH the total collateral in ETH of the user
	 * @return totalDebtETH the total debt in ETH of the user
	 * @return availableBorrowsETH the borrowing power left of the user
	 * @return currentLiquidationThreshold the liquidation threshold of the user
	 * @return ltv the loan to value of the user
	 * @return healthFactor the current health factor of the user
	 **/
	function getUserAccountData(
		address user
	)
		external
		view
		returns (
			uint256 totalCollateralETH,
			uint256 totalDebtETH,
			uint256 availableBorrowsETH,
			uint256 currentLiquidationThreshold,
			uint256 ltv,
			uint256 healthFactor
		);

	function initReserve(
		address reserve,
		address aTokenAddress,
		address stableDebtAddress,
		address variableDebtAddress,
		address interestRateStrategyAddress
	) external;

	function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external;

	function setConfiguration(address reserve, uint256 configuration) external;

	/**
	 * @dev Returns the configuration of the reserve
	 * @param asset The address of the underlying asset of the reserve
	 * @return The configuration of the reserve
	 **/
	function getConfiguration(address asset) external view returns (DataTypes.ReserveConfigurationMap memory);

	/**
	 * @dev Returns the configuration of the user across all the reserves
	 * @param user The user address
	 * @return The configuration of the user
	 **/
	function getUserConfiguration(address user) external view returns (DataTypes.UserConfigurationMap memory);

	/**
	 * @dev Returns the normalized income normalized income of the reserve
	 * @param asset The address of the underlying asset of the reserve
	 * @return The reserve's normalized income
	 */
	function getReserveNormalizedIncome(address asset) external view returns (uint256);

	/**
	 * @dev Returns the normalized variable debt per unit of asset
	 * @param asset The address of the underlying asset of the reserve
	 * @return The reserve normalized variable debt
	 */
	function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);

	/**
	 * @dev Returns the state and configuration of the reserve
	 * @param asset The address of the underlying asset of the reserve
	 * @return The state of the reserve
	 **/
	function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);

	function finalizeTransfer(
		address asset,
		address from,
		address to,
		uint256 amount,
		uint256 balanceFromAfter,
		uint256 balanceToBefore
	) external;

	function getReservesList() external view returns (address[] memory);

	function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);

	function setPause(bool val) external;

	function paused() external view returns (bool);
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

/**
 * @title LendingPoolAddressesProvider contract
 * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles
 * - Acting also as factory of proxies and admin of those, so with right to change its implementations
 * - Owned by the Aave Governance
 * @author Aave
 **/
interface ILendingPoolAddressesProvider {
	event MarketIdSet(string newMarketId);
	event LendingPoolUpdated(address indexed newAddress);
	event ConfigurationAdminUpdated(address indexed newAddress);
	event EmergencyAdminUpdated(address indexed newAddress);
	event LendingPoolConfiguratorUpdated(address indexed newAddress);
	event LendingPoolCollateralManagerUpdated(address indexed newAddress);
	event PriceOracleUpdated(address indexed newAddress);
	event LendingRateOracleUpdated(address indexed newAddress);
	event ProxyCreated(bytes32 id, address indexed newAddress);
	event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);

	function getMarketId() external view returns (string memory);

	function setMarketId(string calldata marketId) external;

	function setAddress(bytes32 id, address newAddress) external;

	function setAddressAsProxy(bytes32 id, address impl) external;

	function getAddress(bytes32 id) external view returns (address);

	function getLendingPool() external view returns (address);

	function setLendingPoolImpl(address pool) external;

	function getLendingPoolConfigurator() external view returns (address);

	function setLendingPoolConfiguratorImpl(address configurator) external;

	function getLendingPoolCollateralManager() external view returns (address);

	function setLendingPoolCollateralManager(address manager) external;

	function getPoolAdmin() external view returns (address);

	function setPoolAdmin(address admin) external;

	function getEmergencyAdmin() external view returns (address);

	function setEmergencyAdmin(address admin) external;

	function getPriceOracle() external view returns (address);

	function setPriceOracle(address priceOracle) external;

	function getLendingRateOracle() external view returns (address);

	function setLendingRateOracle(address lendingRateOracle) external;

	function getLiquidationFeeTo() external view returns (address);

	function setLiquidationFeeTo(address liquidationFeeTo) external;
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;
pragma abicoder v2;

import "./LockedBalance.sol";
import {IFeeDistribution} from "./IMultiFeeDistribution.sol";

interface IMiddleFeeDistribution is IFeeDistribution {
	function forwardReward(address[] memory _rewardTokens) external;

	function getRdntTokenAddress() external view returns (address);

	function getMultiFeeDistributionAddress() external view returns (address);

	function operationExpenseRatio() external view returns (uint256);

	function operationExpenses() external view returns (address);

	function isRewardToken(address) external view returns (bool);
}

// SPDX-License-Identifier: agpl-3.0

pragma solidity 0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IMintableToken is IERC20 {
	function mint(address _receiver, uint256 _amount) external returns (bool);

	function burn(uint256 _amount) external returns (bool);

	function setMinter(address _minter) external returns (bool);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;
pragma abicoder v2;

import "./LockedBalance.sol";
import "./IFeeDistribution.sol";
import "./IMintableToken.sol";

interface IMultiFeeDistribution is IFeeDistribution {
	function exit(bool claimRewards) external;

	function stake(uint256 amount, address onBehalfOf, uint256 typeIndex) external;

	function rdntToken() external view returns (IMintableToken);

	function getPriceProvider() external view returns (address);

	function lockInfo(address user) external view returns (LockedBalance[] memory);

	function autocompoundEnabled(address user) external view returns (bool);

	function defaultLockIndex(address _user) external view returns (uint256);

	function autoRelockDisabled(address user) external view returns (bool);

	function totalBalance(address user) external view returns (uint256);

	function zapVestingToLp(address _address) external returns (uint256);

	function withdrawExpiredLocksFor(address _address) external returns (uint256);

	function claimableRewards(address account) external view returns (IFeeDistribution.RewardData[] memory rewards);

	function setDefaultRelockTypeIndex(uint256 _index) external;

	function daoTreasury() external view returns (address);

	function stakingToken() external view returns (address);

	function claimFromConverter(address) external;

	function mint(address user, uint256 amount, bool withPenalty) external;
}

interface IMFDPlus is IMultiFeeDistribution {
	function getLastClaimTime(address _user) external returns (uint256);

	function claimBounty(address _user, bool _execute) external returns (bool issueBaseBounty);

	function claimCompound(address _user, bool _execute) external returns (uint256 bountyAmt);

	function setAutocompound(bool _newVal) external;

	function getAutocompoundEnabled(address _user) external view returns (bool);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;

interface IOnwardIncentivesController {
	function handleAction(address _token, address _user, uint256 _balance, uint256 _totalSupply) external;
}

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

interface IScaledBalanceToken {
	/**
	 * @dev Returns the scaled balance of the user. The scaled balance is the sum of all the
	 * updated stored balance divided by the reserve's liquidity index at the moment of the update
	 * @param user The user whose balance is calculated
	 * @return The scaled balance of the user
	 **/
	function scaledBalanceOf(address user) external view returns (uint256);

	/**
	 * @dev Returns the scaled balance of the user and the scaled total supply.
	 * @param user The address of the user
	 * @return The scaled balance of the user
	 * @return The scaled balance and the scaled total supply
	 **/
	function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);

	/**
	 * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
	 * @return The scaled total supply
	 **/
	function scaledTotalSupply() external view returns (uint256);
}

File 25 of 26 : LockedBalance.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.12;
pragma abicoder v2;

struct LockedBalance {
	uint256 amount;
	uint256 unlockTime;
	uint256 multiplier;
	uint256 duration;
}

struct EarnedBalance {
	uint256 amount;
	uint256 unlockTime;
	uint256 penalty;
}

struct Reward {
	uint256 periodFinish;
	uint256 rewardPerSecond;
	uint256 lastUpdateTime;
	uint256 rewardPerTokenStored;
	// tracks already-added balances to handle accrued interest in aToken rewards
	// for the stakingToken this value is unused and will always be 0
	uint256 balance;
}

struct Balances {
	uint256 total; // sum of earnings and lockings; no use when LP and RDNT is different
	uint256 unlocked; // RDNT token
	uint256 locked; // LP token or RDNT token
	uint256 lockedWithMultiplier; // Multiplied locked amount
	uint256 earned; // RDNT token
}

File 26 of 26 : DataTypes.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;

library DataTypes {
	// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
	struct ReserveData {
		//stores the reserve configuration
		ReserveConfigurationMap configuration;
		//the liquidity index. Expressed in ray
		uint128 liquidityIndex;
		//variable borrow index. Expressed in ray
		uint128 variableBorrowIndex;
		//the current supply rate. Expressed in ray
		uint128 currentLiquidityRate;
		//the current variable borrow rate. Expressed in ray
		uint128 currentVariableBorrowRate;
		//the current stable borrow rate. Expressed in ray
		uint128 currentStableBorrowRate;
		uint40 lastUpdateTimestamp;
		//tokens addresses
		address aTokenAddress;
		address stableDebtTokenAddress;
		address variableDebtTokenAddress;
		//address of the interest rate strategy
		address interestRateStrategyAddress;
		//the id of the reserve. Represents the position in the list of the active reserves
		uint8 id;
	}

	struct ReserveConfigurationMap {
		//bit 0-15: LTV
		//bit 16-31: Liq. threshold
		//bit 32-47: Liq. bonus
		//bit 48-55: Decimals
		//bit 56: Reserve is active
		//bit 57: reserve is frozen
		//bit 58: borrowing is enabled
		//bit 59: stable rate borrowing enabled
		//bit 60-63: reserved
		//bit 64-79: reserve factor
		uint256 data;
	}

	struct UserConfigurationMap {
		uint256 data;
	}

	enum InterestRateMode {
		NONE,
		STABLE,
		VARIABLE
	}
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"BalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"ChefReserveEmpty","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"ChefReserveLow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Disqualified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"startTimeOffsets","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"rewardsPerSeconds","type":"uint256[]"}],"name":"EmissionScheduleAppended","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":true,"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"},{"indexed":false,"internalType":"bool","name":"persist","type":"bool"}],"name":"RewardsPerSecondUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"accountedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"afterLockUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"allPendingRewards","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_allocPoints","type":"uint256[]"}],"name":"batchUpdateAllocPoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"beforeLockUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bountyManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_execute","type":"bool"}],"name":"claimBounty","outputs":[{"internalType":"bool","name":"issueBaseBounty","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"claimToBase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eligibilityEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"eligibilityExempt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eligibleDataProvider","outputs":[{"internalType":"contract IEligibilityDataProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"emissionSchedule","outputs":[{"internalType":"uint128","name":"startTimeOffset","type":"uint128"},{"internalType":"uint128","name":"rewardsPerSecond","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionScheduleIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endRewardTime","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_balance","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"name":"handleActionAfter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"handleActionBefore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolConfigurator","type":"address"},{"internalType":"contract IEligibilityDataProvider","name":"_eligibleDataProvider","type":"address"},{"internalType":"contract IMiddleFeeDistribution","name":"_rewardMinter","type":"address"},{"internalType":"uint256","name":"_rewardsPerSecond","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastAllPoolUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRPS","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":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"pendingRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"persistRewardsPerSecond","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolConfigurator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"contract IOnwardIncentivesController","name":"onwardIncentives","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"registerRewardDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"registeredTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardMinter","outputs":[{"internalType":"contract IMiddleFeeDistribution","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"saveUserRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bountyManager","type":"address"}],"name":"setBountyManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_newVal","type":"bool"}],"name":"setEligibilityEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setEligibilityExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_startTimeOffsets","type":"uint256[]"},{"internalType":"uint256[]","name":"_rewardsPerSecond","type":"uint256[]"}],"name":"setEmissionSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"contract IOnwardIncentivesController","name":"_incentives","type":"address"}],"name":"setOnwardIncentives","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsPerSecond","type":"uint256"},{"internalType":"bool","name":"_persist","type":"bool"}],"name":"setRewardsPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","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":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userBaseClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"enterTime","type":"uint256"},{"internalType":"uint256","name":"lastClaimTime","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50613d45806100206000396000f3fe608060405234801561001057600080fd5b50600436106103415760003560e01c80637ab8955d116101bd578063be05d3fb116100f9578063d0557090116100a2578063f2fde38b1161007c578063f2fde38b14610756578063f5fe161014610769578063f6d69c281461077c578063ff66a3051461078f57600080fd5b8063d055709014610722578063de7e410c14610735578063eacdaabc1461074d57600080fd5b8063cccd82b0116100d3578063cccd82b0146106e9578063cd1a4d86146106fc578063cf756fdf1461070f57600080fd5b8063be05d3fb146106b8578063be9a6555146106c1578063bfccff45146106c957600080fd5b80639a0ba2ea116101665780639b8e5563116101405780639b8e556314610676578063a3eaf99a14610689578063b36b9ffd1461069c578063ba04a111146106af57600080fd5b80639a0ba2ea146105db5780639a7b5f11146105ee5780639b5a734f1461066557600080fd5b80638980f11f116101975780638980f11f146105a45780638da5cb5b146105b75780638e2eba09146105c857600080fd5b80637ab8955d1461057c578063800ce1da1461058f5780638456cb591461059c57600080fd5b80633adcdfc81161028c5780635ea3f4fa11610235578063715018a61161020f578063715018a61461054f57806377329f3514610557578063779f61691461056a57806378e979251461057357600080fd5b80635ea3f4fa146105085780635fe4f7411461051b5780636d4f675c1461054657600080fd5b8063566cac7611610266578063566cac76146104d75780635c1a8ac6146104ea5780635c975abb146104fd57600080fd5b80633adcdfc81461049c5780633df8161c146104af5780633f4ba83a146104cf57600080fd5b80631b2064f7116102ee57806332a9caba116102c857806332a9caba14610443578063334d0bbd1461045657806334c542301461048957600080fd5b80631b2064f71461040e5780631d94f24d1461041b57806325dc43871461043057600080fd5b80630c6342481161031f5780630c6342481461039c5780630f208beb146103a557806317caf6f11461040557600080fd5b806302a24770146103465780630702a95d14610361578063081e3eda14610394575b600080fd5b61034e6107a2565b6040519081526020015b60405180910390f35b61038461036f366004613747565b60a26020526000908152604090205460ff1681565b6040519015158152602001610358565b60995461034e565b61034e609c5481565b6103e56103b3366004613764565b60a060209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610358565b61034e609f5481565b6098546103849060ff1681565b61042e61042936600461379d565b610917565b005b61042e61043e3660046137e0565b610b02565b61042e610451366004613805565b610b61565b610469610464366004613831565b610d04565b604080516001600160801b03938416815292909116602083015201610358565b61042e610497366004613896565b610d39565b61042e6104aa366004613747565b610eb8565b6104c26104bd3660046139af565b61120b565b60405161035891906139ff565b61042e6113a0565b61042e6104e5366004613a43565b6113b2565b61042e6104f8366004613747565b611485565b60335460ff16610384565b61034e610516366004613747565b6114b1565b60a95461052e906001600160a01b031681565b6040516001600160a01b039091168152602001610358565b61034e60a55481565b61042e61157d565b61042e610565366004613747565b61158f565b61034e60a75481565b61034e60a35481565b61038461058a366004613a78565b6115f3565b60a4546103849060ff1681565b61042e611661565b61042e6105b2366004613805565b611671565b6065546001600160a01b031661052e565b61042e6105d63660046139af565b6116a3565b61052e6105e9366004613831565b61191c565b6106346105fc366004613747565b609d6020526000908152604090208054600182015460028301546003840154600490940154929391929091906001600160a01b031685565b6040805195865260208601949094529284019190915260608301526001600160a01b0316608082015260a001610358565b61042e610673366004613747565b50565b60a85461052e906001600160a01b031681565b61042e6106973660046139af565b611946565b60aa5461052e906001600160a01b031681565b61034e609b5481565b61034e60a65481565b61042e611b54565b61034e6106d7366004613747565b60a16020526000908152604090205481565b61042e6106f7366004613747565b611bb2565b61042e61070a366004613764565b611c30565b61042e61071d366004613aa6565b611cc6565b61042e610730366004613831565b611f4c565b60a45461052e9061010090046001600160a01b031681565b61034e609a5481565b61042e610764366004613747565b611f8c565b61042e610777366004613af7565b612019565b61042e61078a366004613896565b612034565b61042e61079d366004613747565b61235c565b6000806107bc60a65460a55461238690919063ffffffff16565b90506000805b6099548110156108e05760a754609d6000609984815481106107e6576107e6613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015411610818576108ce565b6108cb6108c4609f546108be609a546108b8609d60006099898154811061084157610841613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400181206001015460a7546099805492936108b893609d92908d90811061088a5761088a613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015490612386565b90612392565b9061239e565b83906123aa565b91505b806108d881613b40565b9150506107c2565b50609a546108f2576000199250505090565b60a754609a54610906906108be8486613b5b565b6109109190613b5b565b9250505090565b336000908152609e602052604090205460ff168061094d57506109386123b6565b6001600160a01b0316336001600160a01b0316145b61099e5760405162461bcd60e51b815260206004820152600e60248201527f2172546f6b656e207c7c206d666400000000000000000000000000000000000060448201526064015b60405180910390fd5b60a8546001600160a01b03848116911614806109d257506109bd6123b6565b6001600160a01b0316836001600160a01b0316145b806109f557506001600160a01b038316600090815260a2602052604090205460ff165b156109ff57505050565b60a45460ff1615610af65760a954604051630afb040960e01b81526001600160a01b03858116600483015290911690630afb040990602401600060405180830381600087803b158015610a5157600080fd5b505af1158015610a65573d6000803e3d6000fd5b505060a954604051633300c37360e11b81526001600160a01b038781166004830152909116925063660186e69150602401602060405180830381865afa158015610ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad79190613b73565b15610aed57610ae833848484612430565b505050565b610ae883612686565b610ae833848484612430565b610b0a612691565b610b126126eb565b609a8290556098805460ff191682151590811790915560405190815282907f91bb2acfac3265da2e9b45e815cdcb50f9b349454c54e812590ecb5d109ae8dc9060200160405180910390a25050565b60a45461010090046001600160a01b03163314610bc05760405162461bcd60e51b815260206004820152600b60248201527f6e6f7420616c6c6f7765640000000000000000000000000000000000000000006044820152606401610995565b6001600160a01b0382166000908152609d602052604090206002015415610c295760405162461bcd60e51b815260206004820152601360248201527f706f6f6c20616c726561647920657869737473000000000000000000000000006044820152606401610995565b610c31612759565b609f54610c3e90826123aa565b609f556099805460018082019092557f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000180546001600160a01b03199081166001600160a01b039586169081179092556040805160a08101825260008082526020808301978852428385019081526060840183815260808501848152978452609d835285842094518555985184890155516002840155965160038301559351600490910180549093169616959095179055609e909252919020805460ff19169091179055565b60978181548110610d1457600080fd5b6000918252602090912001546001600160801b038082169250600160801b9091041682565b610d41612691565b828114610d905760405162461bcd60e51b815260206004820152601660248201527f706172616d73206c656e677468206d69736d61746368000000000000000000006044820152606401610995565b610d986126eb565b609f5460005b84811015610eae576000609d6000888885818110610dbe57610dbe613b14565b9050602002016020810190610dd39190613747565b6001600160a01b03166001600160a01b0316815260200190815260200160002090506000816002015411610e3e5760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b610e77858584818110610e5357610e53613b14565b90506020020135610e7183600101548661238690919063ffffffff16565b906123aa565b9250848483818110610e8b57610e8b613b14565b905060200201358160010181905550508080610ea690613b40565b915050610d9e565b50609f5550505050565b610ec06123b6565b6001600160a01b0316336001600160a01b031614610f225760405162461bcd60e51b81526004016109959060208082526004908201527f214d464400000000000000000000000000000000000000000000000000000000604082015260600190565b60a45460ff16156106735760a960009054906101000a90046001600160a01b03166001600160a01b031663673a7e286040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f7d57600080fd5b505af1158015610f91573d6000803e3d6000fd5b505060a954604051633300c37360e11b81526001600160a01b038581166004830152909116925063660186e69150602401602060405180830381865afa158015610fdf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110039190613b73565b156111a95760005b6099548110156111a75760006099828154811061102a5761102a613b14565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038581166004830152909116906370a0823190602401602060405180830381865afa15801561107d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a19190613b90565b9050600060a06000609985815481106110bc576110bc613b14565b60009182526020808320909101546001600160a01b0390811684528382019490945260409283018220938816825292909252902054905081158015906111025750808214155b15611192576111926099848154811061111d5761111d613b14565b9060005260206000200160009054906101000a90046001600160a01b0316858461118d8561118788609d600060998d8154811061115c5761115c613b14565b60009182526020808320909101546001600160a01b03168352820192909252604001902054906123aa565b90612386565b612430565b5050808061119f90613b40565b91505061100b565b505b60a954604051630afb040960e01b81526001600160a01b03838116600483015290911690630afb040990602401600060405180830381600087803b1580156111f057600080fd5b505af1158015611204573d6000803e3d6000fd5b5050505050565b60606000825167ffffffffffffffff81111561122957611229613902565b604051908082528060200260200182016040528015611252578160200160208202803683370190505b50905060005b835181101561139657600084828151811061127557611275613b14565b6020908102919091018101516001600160a01b038082166000908152609d8452604080822060a08652818320938c16835292909452929092206003830154835460028501549395509192909190421180156112cf57508015155b156113385760006112ed85600201544261238690919063ffffffff16565b90506000611314609f546108be88600101546108b8609a548761239290919063ffffffff16565b905061133361132c846108be8464e8d4a51000612392565b85906123aa565b935050505b611360836001015461118764e8d4a510006108be86886000015461239290919063ffffffff16565b87878151811061137257611372613b14565b6020026020010181815250505050505050808061138e90613b40565b915050611258565b5090505b92915050565b6113a8612691565b6113b0612785565b565b6000609980548060200260200160405190810160405280929190818152602001828054801561140a57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113ec575b5050505050905060005b8251811015610ae85760006001600160a01b031683828151811061143a5761143a613b14565b60200260200101516001600160a01b0316146114735761147383828151811061146557611465613b14565b602002602001015183611946565b8061147d81613b40565b915050611414565b61148d612691565b6001600160a01b0316600090815260a260205260409020805460ff19166001179055565b6001600160a01b038116600090815260a160209081526040808320546099805483518186028101860190945280845291949361152f93879390929183018282801561152557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611507575b505050505061120b565b905060005b81518110156115765781818151811061154f5761154f613b14565b6020026020010151836115629190613b5b565b92508061156e81613b40565b915050611534565b5050919050565b611585612691565b6113b060006127d7565b6106738160998054806020026020016040519081016040528092919081815260200182805480156115e957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115cb575b50505050506116a3565b60aa546000906001600160a01b031633146116505760405162461bcd60e51b815260206004820152600b60248201527f626f756e7479206f6e6c790000000000000000000000000000000000000000006044820152606401610995565b61165a8383612829565b9392505050565b611669612691565b6113b0612a0f565b611679612691565b61169f61168e6065546001600160a01b031690565b6001600160a01b0384169083612a4c565b5050565b6116ab612acc565b60a45460ff16156116bf576116bf82612686565b6116c7612759565b6001600160a01b038216600090815260a160205260408120805490829055609f5490915b83518110156118e857609e600085838151811061170a5761170a613b14565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1661177d5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642072746f6b656e0000000000000000000000000000000000006044820152606401610995565b6000609d600086848151811061179557611795613b14565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020905060008160020154116118085760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b6118128184612b1f565b600060a0600087858151811061182a5761182a613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000209050600061189d64e8d4a510006108be8560030154856000015461239290919063ffffffff16565b90506118c06118b983600101548361238690919063ffffffff16565b87906123aa565b60018301919091554260039092019190915593508190506118e081613b40565b9150506116eb565b506118f38483612c11565b6119004262069780613b5b565b6119086107a2565b101561191657611916612cb5565b50505050565b6099818154811061192c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b038216600090815260a160205260408120549061196a848461120b565b9050611974612759565b609f5460005b8451811015611b3157609e600086838151811061199957611999613b14565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16611a0c5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642072746f6b656e0000000000000000000000000000000000006044820152606401610995565b600060a06000878481518110611a2457611a24613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000209050611a9d848381518110611a8657611a86613b14565b6020026020010151866123aa90919063ffffffff16565b94506000609d6000888581518110611ab757611ab7613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209050611aeb8185612b1f565b6000611b1164e8d4a510006108be8460030154866000015461239290919063ffffffff16565b600184015550504260039091015580611b2981613b40565b91505061197a565b5050506001600160a01b03909216600090815260a1602052604090209190915550565b611b5c612691565b60a35415611bac5760405162461bcd60e51b815260206004820152600f60248201527f616c7265616479207374617274656400000000000000000000000000000000006044820152606401610995565b4260a355565b611bba6123b6565b6001600160a01b0316336001600160a01b031614611c1c5760405162461bcd60e51b81526004016109959060208082526004908201527f216d666400000000000000000000000000000000000000000000000000000000604082015260600190565b60a45460ff16156106735761067381612686565b611c38612691565b6001600160a01b0382166000908152609d6020526040902060020154611c955760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b6001600160a01b039182166000908152609d6020526040902060040180546001600160a01b03191691909216179055565b600054610100900460ff1615808015611ce65750600054600160ff909116105b80611d005750303b158015611d00575060005460ff166001145b611d725760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610995565b6000805460ff191660011790558015611d95576000805461ff0019166101001790555b6001600160a01b038516611dde5760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b6001600160a01b038416611e275760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b6001600160a01b038316611e705760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b611e78612dc4565b611e80612e37565b60a4805460a980546001600160a01b038881166001600160a01b03199283161790925560a880548884169216919091179055609a8590556098805460ff19908116600190811790925591891661010002919091167fffffffffffffffffffffff000000000000000000000000000000000000000000909216919091171790558015611204576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050505050565b611f54612691565b60a554611f6190826123aa565b60a555611f6c6126eb565b609a54158015611f7e57506000609b54115b1561067357609b54609a5550565b611f94612691565b6001600160a01b0381166120105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610995565b610673816127d7565b612021612691565b60a4805460ff1916911515919091179055565b61203c612691565b82801580159061204b57508082145b6120975760405162461bcd60e51b815260206004820152601860248201527f656d707479206f72206d69736d6174636820706172616d7300000000000000006044820152606401610995565b60005b81811015612326578015612133578585828181106120ba576120ba613b14565b9050602002013586866001846120d09190613ba9565b8181106120df576120df613b14565b90506020020135106121335760405162461bcd60e51b815260206004820152601360248201527f73686f756c6420626520617363656e64696e67000000000000000000000000006044820152606401610995565b6001600160801b0386868381811061214d5761214d613b14565b9050602002013511156121a25760405162461bcd60e51b815260206004820152601e60248201527f737461727454696d654f666673657473203e206d61782075696e7431323800006044820152606401610995565b6001600160801b038484838181106121bc576121bc613b14565b9050602002013511156122115760405162461bcd60e51b815260206004820152601e60248201527f726577617264735065725365636f6e64203e206d61782075696e7431323800006044820152606401610995565b60a3541561228d5760a354612227904290612386565b86868381811061223957612239613b14565b905060200201351161228d5760405162461bcd60e51b815260206004820152601260248201527f696e76616c69642073746172742074696d6500000000000000000000000000006044820152606401610995565b609760405180604001604052808888858181106122ac576122ac613b14565b905060200201356001600160801b031681526020018686858181106122d3576122d3613b14565b6001600160801b03602091820293909301358316909352508354600181018555600094855293829020835193909201518116600160801b029216919091179101558061231e81613b40565b91505061209a565b507f0a4b885eafe78f585b7c7667ea419f9b1b17d09dfdf23ffa7925b73db6986f1685858585604051611f3d9493929190613c0f565b612364612691565b60aa80546001600160a01b0319166001600160a01b0392909216919091179055565b600061165a8284613ba9565b600061165a8284613c36565b600061165a8284613c55565b600061165a8284613b5b565b60008060a860009054906101000a90046001600160a01b03166001600160a01b031663cd57ed6c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561240c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190613c77565b6001600160a01b0384166000908152609d60205260409020600281015461248e5760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b612496612759565b6124a281609f54612b1f565b6001600160a01b03808616600090815260a06020908152604080832093881683529290522080546003830154811561253a5760018301546000906124f39061118764e8d4a510006108be8787612392565b90508015612538576001600160a01b038816600090815260a1602052604090205461251e90826123aa565b6001600160a01b038916600090815260a160205260409020555b505b8254845461254791612386565b845585835561255f64e8d4a510006108be8884612392565b6001840155825415612572574260028401555b835461257e90876123aa565b845560048401546001600160a01b031615612626576004848101546040517fae0b53710000000000000000000000000000000000000000000000000000000081526001600160a01b038b8116938201939093528983166024820152604481018990526064810188905291169063ae0b537190608401600060405180830381600087803b15801561260d57600080fd5b505af1158015612621573d6000803e3d6000fd5b505050505b866001600160a01b0316886001600160a01b03167f526824944047da5b81071fb6349412005c5da81380b336103fbe5dd34556c7768888604051612674929190918252602082015260400190565b60405180910390a35050505050505050565b61169f816001612829565b6065546001600160a01b031633146113b05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610995565b609f5460995460005b8181101561275057612740609d60006099848154811061271657612716613b14565b60009182526020808320909101546001600160a01b03168352820192909252604001902084612b1f565b61274981613b40565b90506126f4565b50504260a75550565b6127616107a2565b42111561277d576127706126eb565b609a8054609b5560009055565b6113b0612eaa565b61278d612f77565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60a954604051633300c37360e11b81526001600160a01b038481166004830152600092839291169063660186e690602401602060405180830381865afa158015612877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289b9190613b73565b905060006128a885612fc9565b60a9546040517f6f21a1790000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015292935060009290911690636f21a17990602401602060405180830381865afa158015612911573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129359190613b90565b9050801515831580156129455750825b801561294f575080155b1561295957600194505b8580156129635750845b15612a055761297187613051565b6040516001600160a01b038816907fa77719a89d2325682411f1762214545e5d0fc4b374cc00cb48fcd390a670f2e190600090a260a954604051630afb040960e01b81526001600160a01b03898116600483015290911690630afb040990602401600060405180830381600087803b1580156129ec57600080fd5b505af1158015612a00573d6000803e3d6000fd5b505050505b5050505092915050565b612a17612acc565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127ba3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ae890849061323e565b60335460ff16156113b05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610995565b4280612b296107a2565b11612b3957612b366107a2565b90505b82600201548111612b4957505050565b825480612b5d575060029092019190915550565b6000612b7685600201548461238690919063ffffffff16565b90506000612b8f609a548361239290919063ffffffff16565b905080612b9a613323565b1015612bab57612ba8613323565b90505b6000612bc8866108be89600101548561239290919063ffffffff16565b60a654909150612bd890826123aa565b60a655612bfc612bf1856108be8464e8d4a51000612392565b6003890154906123aa565b60038801555050505060029092019190915550565b612c22612c1c6123b6565b82613341565b9050612c2c6123b6565b6040517fd1a1beb40000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820184905260016044830152919091169063d1a1beb4906064015b600060405180830381600087803b158015612c9957600080fd5b505af1158015612cad573d6000803e3d6000fd5b505050505050565b60a8546040805163ab453a5960e01b815290516000926001600160a01b03169163ab453a599160048083019260209291908290030181865afa158015612cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d239190613c77565b6040516370a0823160e01b81523060048201529091507f1681e542d7f33ef0ad012aecd346fa867be856110f81d25dcbbd72f972a57a45906001600160a01b038316906370a0823190602401602060405180830381865afa158015612d8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db09190613b90565b60405190815260200160405180910390a150565b600054610100900460ff16612e2f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0613493565b600054610100900460ff16612ea25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0613507565b60985460ff166113b057609754609c5460a354600090612ecb904290612386565b90505b8282108015612f08575060978281548110612eeb57612eeb613b14565b6000918252602090912001546001600160801b0390811690821610155b15612f1f5781612f1781613b40565b925050612ece565b609c54821115610ae857609c829055612f366126eb565b6097612f43600184613ba9565b81548110612f5357612f53613b14565b600091825260209091200154600160801b90046001600160801b0316609a55505050565b60335460ff166113b05760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610995565b6000805b60995481101561304b57600060a0600060998481548110612ff057612ff0613b14565b60009182526020808320909101546001600160a01b0390811684528382019490945260409283018220938816825292909252902080549091501561303857600192505061304b565b508061304381613b40565b915050612fcd565b50919050565b60a45460ff166130a35760405162461bcd60e51b815260206004820152600360248201527f21454500000000000000000000000000000000000000000000000000000000006044820152606401610995565b60a954604051633300c37360e11b81526001600160a01b0383811660048301529091169063660186e690602401602060405180830381865afa1580156130ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131119190613b73565b1561315e5760405162461bcd60e51b815260206004820152601660248201527f75736572206973207374696c6c20656c696769626c65000000000000000000006044820152606401610995565b60995460005b818110156131ec5760006099828154811061318157613181613b14565b60009182526020808320909101546001600160a01b03908116808452609d8352604080852060a08552818620938a1686529290935291832080548254939550919390926131d89286928a92909161118d9190612386565b505050806131e590613b40565b9050613164565b5060a9546040517fe2c75ca00000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301524260248301529091169063e2c75ca090604401612c7f565b6000613293826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661357e9092919063ffffffff16565b805190915015610ae857808060200190518101906132b19190613b73565b610ae85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610995565b600061333c60a65460a55461238690919063ffffffff16565b905090565b6000816133505750600061139a565b60a8546040805163ab453a5960e01b815290516000926001600160a01b03169163ab453a599160048083019260209291908290030181865afa15801561339a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133be9190613c77565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061342c9190613b90565b905080841115613476576040518181527f09fb3e34da56fdc0b28f9769c6dcb55321715bc673f744205e208b82c97963c99060200160405180910390a1613471612a0f565b61348a565b61348a6001600160a01b0383168686612a4c565b50919392505050565b600054610100900460ff166134fe5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0336127d7565b600054610100900460ff166135725760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6033805460ff19169055565b606061358d8484600085613595565b949350505050565b60608247101561360d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610995565b600080866001600160a01b031685876040516136299190613cc0565b60006040518083038185875af1925050503d8060008114613666576040519150601f19603f3d011682016040523d82523d6000602084013e61366b565b606091505b509150915061367c87838387613687565b979650505050505050565b606083156136f35782516136ec576001600160a01b0385163b6136ec5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610995565b508161358d565b61358d83838151156137085781518083602001fd5b8060405162461bcd60e51b81526004016109959190613cdc565b6001600160a01b038116811461067357600080fd5b803561374281613722565b919050565b60006020828403121561375957600080fd5b813561165a81613722565b6000806040838503121561377757600080fd5b823561378281613722565b9150602083013561379281613722565b809150509250929050565b6000806000606084860312156137b257600080fd5b83356137bd81613722565b95602085013595506040909401359392505050565b801515811461067357600080fd5b600080604083850312156137f357600080fd5b823591506020830135613792816137d2565b6000806040838503121561381857600080fd5b823561382381613722565b946020939093013593505050565b60006020828403121561384357600080fd5b5035919050565b60008083601f84011261385c57600080fd5b50813567ffffffffffffffff81111561387457600080fd5b6020830191508360208260051b850101111561388f57600080fd5b9250929050565b600080600080604085870312156138ac57600080fd5b843567ffffffffffffffff808211156138c457600080fd5b6138d08883890161384a565b909650945060208701359150808211156138e957600080fd5b506138f68782880161384a565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261392957600080fd5b8135602067ffffffffffffffff8083111561394657613946613902565b8260051b604051601f19603f8301168101818110848211171561396b5761396b613902565b60405293845285810183019383810192508785111561398957600080fd5b83870191505b8482101561367c576139a082613737565b8352918301919083019061398f565b600080604083850312156139c257600080fd5b82356139cd81613722565b9150602083013567ffffffffffffffff8111156139e957600080fd5b6139f585828601613918565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613a3757835183529284019291840191600101613a1b565b50909695505050505050565b600060208284031215613a5557600080fd5b813567ffffffffffffffff811115613a6c57600080fd5b61358d84828501613918565b60008060408385031215613a8b57600080fd5b8235613a9681613722565b91506020830135613792816137d2565b60008060008060808587031215613abc57600080fd5b8435613ac781613722565b93506020850135613ad781613722565b92506040850135613ae781613722565b9396929550929360600135925050565b600060208284031215613b0957600080fd5b813561165a816137d2565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613b5457613b54613b2a565b5060010190565b60008219821115613b6e57613b6e613b2a565b500190565b600060208284031215613b8557600080fd5b815161165a816137d2565b600060208284031215613ba257600080fd5b5051919050565b600082821015613bbb57613bbb613b2a565b500390565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115613bf257600080fd5b8260051b8083602087013760009401602001938452509192915050565b604081526000613c23604083018688613bc0565b828103602084015261367c818587613bc0565b6000816000190483118215151615613c5057613c50613b2a565b500290565b600082613c7257634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613c8957600080fd5b815161165a81613722565b60005b83811015613caf578181015183820152602001613c97565b838111156119165750506000910152565b60008251613cd2818460208701613c94565b9190910192915050565b6020815260008251806020840152613cfb816040850160208701613c94565b601f01601f1916919091016040019291505056fea26469706673582212209f5a738d902be02247d03d6359ba6c0f3b840983519cc8719f95b7c31742f5ce64736f6c634300080c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103415760003560e01c80637ab8955d116101bd578063be05d3fb116100f9578063d0557090116100a2578063f2fde38b1161007c578063f2fde38b14610756578063f5fe161014610769578063f6d69c281461077c578063ff66a3051461078f57600080fd5b8063d055709014610722578063de7e410c14610735578063eacdaabc1461074d57600080fd5b8063cccd82b0116100d3578063cccd82b0146106e9578063cd1a4d86146106fc578063cf756fdf1461070f57600080fd5b8063be05d3fb146106b8578063be9a6555146106c1578063bfccff45146106c957600080fd5b80639a0ba2ea116101665780639b8e5563116101405780639b8e556314610676578063a3eaf99a14610689578063b36b9ffd1461069c578063ba04a111146106af57600080fd5b80639a0ba2ea146105db5780639a7b5f11146105ee5780639b5a734f1461066557600080fd5b80638980f11f116101975780638980f11f146105a45780638da5cb5b146105b75780638e2eba09146105c857600080fd5b80637ab8955d1461057c578063800ce1da1461058f5780638456cb591461059c57600080fd5b80633adcdfc81161028c5780635ea3f4fa11610235578063715018a61161020f578063715018a61461054f57806377329f3514610557578063779f61691461056a57806378e979251461057357600080fd5b80635ea3f4fa146105085780635fe4f7411461051b5780636d4f675c1461054657600080fd5b8063566cac7611610266578063566cac76146104d75780635c1a8ac6146104ea5780635c975abb146104fd57600080fd5b80633adcdfc81461049c5780633df8161c146104af5780633f4ba83a146104cf57600080fd5b80631b2064f7116102ee57806332a9caba116102c857806332a9caba14610443578063334d0bbd1461045657806334c542301461048957600080fd5b80631b2064f71461040e5780631d94f24d1461041b57806325dc43871461043057600080fd5b80630c6342481161031f5780630c6342481461039c5780630f208beb146103a557806317caf6f11461040557600080fd5b806302a24770146103465780630702a95d14610361578063081e3eda14610394575b600080fd5b61034e6107a2565b6040519081526020015b60405180910390f35b61038461036f366004613747565b60a26020526000908152604090205460ff1681565b6040519015158152602001610358565b60995461034e565b61034e609c5481565b6103e56103b3366004613764565b60a060209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610358565b61034e609f5481565b6098546103849060ff1681565b61042e61042936600461379d565b610917565b005b61042e61043e3660046137e0565b610b02565b61042e610451366004613805565b610b61565b610469610464366004613831565b610d04565b604080516001600160801b03938416815292909116602083015201610358565b61042e610497366004613896565b610d39565b61042e6104aa366004613747565b610eb8565b6104c26104bd3660046139af565b61120b565b60405161035891906139ff565b61042e6113a0565b61042e6104e5366004613a43565b6113b2565b61042e6104f8366004613747565b611485565b60335460ff16610384565b61034e610516366004613747565b6114b1565b60a95461052e906001600160a01b031681565b6040516001600160a01b039091168152602001610358565b61034e60a55481565b61042e61157d565b61042e610565366004613747565b61158f565b61034e60a75481565b61034e60a35481565b61038461058a366004613a78565b6115f3565b60a4546103849060ff1681565b61042e611661565b61042e6105b2366004613805565b611671565b6065546001600160a01b031661052e565b61042e6105d63660046139af565b6116a3565b61052e6105e9366004613831565b61191c565b6106346105fc366004613747565b609d6020526000908152604090208054600182015460028301546003840154600490940154929391929091906001600160a01b031685565b6040805195865260208601949094529284019190915260608301526001600160a01b0316608082015260a001610358565b61042e610673366004613747565b50565b60a85461052e906001600160a01b031681565b61042e6106973660046139af565b611946565b60aa5461052e906001600160a01b031681565b61034e609b5481565b61034e60a65481565b61042e611b54565b61034e6106d7366004613747565b60a16020526000908152604090205481565b61042e6106f7366004613747565b611bb2565b61042e61070a366004613764565b611c30565b61042e61071d366004613aa6565b611cc6565b61042e610730366004613831565b611f4c565b60a45461052e9061010090046001600160a01b031681565b61034e609a5481565b61042e610764366004613747565b611f8c565b61042e610777366004613af7565b612019565b61042e61078a366004613896565b612034565b61042e61079d366004613747565b61235c565b6000806107bc60a65460a55461238690919063ffffffff16565b90506000805b6099548110156108e05760a754609d6000609984815481106107e6576107e6613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015411610818576108ce565b6108cb6108c4609f546108be609a546108b8609d60006099898154811061084157610841613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400181206001015460a7546099805492936108b893609d92908d90811061088a5761088a613b14565b60009182526020808320909101546001600160a01b0316835282019290925260400190206002015490612386565b90612392565b9061239e565b83906123aa565b91505b806108d881613b40565b9150506107c2565b50609a546108f2576000199250505090565b60a754609a54610906906108be8486613b5b565b6109109190613b5b565b9250505090565b336000908152609e602052604090205460ff168061094d57506109386123b6565b6001600160a01b0316336001600160a01b0316145b61099e5760405162461bcd60e51b815260206004820152600e60248201527f2172546f6b656e207c7c206d666400000000000000000000000000000000000060448201526064015b60405180910390fd5b60a8546001600160a01b03848116911614806109d257506109bd6123b6565b6001600160a01b0316836001600160a01b0316145b806109f557506001600160a01b038316600090815260a2602052604090205460ff165b156109ff57505050565b60a45460ff1615610af65760a954604051630afb040960e01b81526001600160a01b03858116600483015290911690630afb040990602401600060405180830381600087803b158015610a5157600080fd5b505af1158015610a65573d6000803e3d6000fd5b505060a954604051633300c37360e11b81526001600160a01b038781166004830152909116925063660186e69150602401602060405180830381865afa158015610ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad79190613b73565b15610aed57610ae833848484612430565b505050565b610ae883612686565b610ae833848484612430565b610b0a612691565b610b126126eb565b609a8290556098805460ff191682151590811790915560405190815282907f91bb2acfac3265da2e9b45e815cdcb50f9b349454c54e812590ecb5d109ae8dc9060200160405180910390a25050565b60a45461010090046001600160a01b03163314610bc05760405162461bcd60e51b815260206004820152600b60248201527f6e6f7420616c6c6f7765640000000000000000000000000000000000000000006044820152606401610995565b6001600160a01b0382166000908152609d602052604090206002015415610c295760405162461bcd60e51b815260206004820152601360248201527f706f6f6c20616c726561647920657869737473000000000000000000000000006044820152606401610995565b610c31612759565b609f54610c3e90826123aa565b609f556099805460018082019092557f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000180546001600160a01b03199081166001600160a01b039586169081179092556040805160a08101825260008082526020808301978852428385019081526060840183815260808501848152978452609d835285842094518555985184890155516002840155965160038301559351600490910180549093169616959095179055609e909252919020805460ff19169091179055565b60978181548110610d1457600080fd5b6000918252602090912001546001600160801b038082169250600160801b9091041682565b610d41612691565b828114610d905760405162461bcd60e51b815260206004820152601660248201527f706172616d73206c656e677468206d69736d61746368000000000000000000006044820152606401610995565b610d986126eb565b609f5460005b84811015610eae576000609d6000888885818110610dbe57610dbe613b14565b9050602002016020810190610dd39190613747565b6001600160a01b03166001600160a01b0316815260200190815260200160002090506000816002015411610e3e5760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b610e77858584818110610e5357610e53613b14565b90506020020135610e7183600101548661238690919063ffffffff16565b906123aa565b9250848483818110610e8b57610e8b613b14565b905060200201358160010181905550508080610ea690613b40565b915050610d9e565b50609f5550505050565b610ec06123b6565b6001600160a01b0316336001600160a01b031614610f225760405162461bcd60e51b81526004016109959060208082526004908201527f214d464400000000000000000000000000000000000000000000000000000000604082015260600190565b60a45460ff16156106735760a960009054906101000a90046001600160a01b03166001600160a01b031663673a7e286040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f7d57600080fd5b505af1158015610f91573d6000803e3d6000fd5b505060a954604051633300c37360e11b81526001600160a01b038581166004830152909116925063660186e69150602401602060405180830381865afa158015610fdf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110039190613b73565b156111a95760005b6099548110156111a75760006099828154811061102a5761102a613b14565b6000918252602090912001546040516370a0823160e01b81526001600160a01b038581166004830152909116906370a0823190602401602060405180830381865afa15801561107d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a19190613b90565b9050600060a06000609985815481106110bc576110bc613b14565b60009182526020808320909101546001600160a01b0390811684528382019490945260409283018220938816825292909252902054905081158015906111025750808214155b15611192576111926099848154811061111d5761111d613b14565b9060005260206000200160009054906101000a90046001600160a01b0316858461118d8561118788609d600060998d8154811061115c5761115c613b14565b60009182526020808320909101546001600160a01b03168352820192909252604001902054906123aa565b90612386565b612430565b5050808061119f90613b40565b91505061100b565b505b60a954604051630afb040960e01b81526001600160a01b03838116600483015290911690630afb040990602401600060405180830381600087803b1580156111f057600080fd5b505af1158015611204573d6000803e3d6000fd5b5050505050565b60606000825167ffffffffffffffff81111561122957611229613902565b604051908082528060200260200182016040528015611252578160200160208202803683370190505b50905060005b835181101561139657600084828151811061127557611275613b14565b6020908102919091018101516001600160a01b038082166000908152609d8452604080822060a08652818320938c16835292909452929092206003830154835460028501549395509192909190421180156112cf57508015155b156113385760006112ed85600201544261238690919063ffffffff16565b90506000611314609f546108be88600101546108b8609a548761239290919063ffffffff16565b905061133361132c846108be8464e8d4a51000612392565b85906123aa565b935050505b611360836001015461118764e8d4a510006108be86886000015461239290919063ffffffff16565b87878151811061137257611372613b14565b6020026020010181815250505050505050808061138e90613b40565b915050611258565b5090505b92915050565b6113a8612691565b6113b0612785565b565b6000609980548060200260200160405190810160405280929190818152602001828054801561140a57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113ec575b5050505050905060005b8251811015610ae85760006001600160a01b031683828151811061143a5761143a613b14565b60200260200101516001600160a01b0316146114735761147383828151811061146557611465613b14565b602002602001015183611946565b8061147d81613b40565b915050611414565b61148d612691565b6001600160a01b0316600090815260a260205260409020805460ff19166001179055565b6001600160a01b038116600090815260a160209081526040808320546099805483518186028101860190945280845291949361152f93879390929183018282801561152557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611507575b505050505061120b565b905060005b81518110156115765781818151811061154f5761154f613b14565b6020026020010151836115629190613b5b565b92508061156e81613b40565b915050611534565b5050919050565b611585612691565b6113b060006127d7565b6106738160998054806020026020016040519081016040528092919081815260200182805480156115e957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115cb575b50505050506116a3565b60aa546000906001600160a01b031633146116505760405162461bcd60e51b815260206004820152600b60248201527f626f756e7479206f6e6c790000000000000000000000000000000000000000006044820152606401610995565b61165a8383612829565b9392505050565b611669612691565b6113b0612a0f565b611679612691565b61169f61168e6065546001600160a01b031690565b6001600160a01b0384169083612a4c565b5050565b6116ab612acc565b60a45460ff16156116bf576116bf82612686565b6116c7612759565b6001600160a01b038216600090815260a160205260408120805490829055609f5490915b83518110156118e857609e600085838151811061170a5761170a613b14565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1661177d5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642072746f6b656e0000000000000000000000000000000000006044820152606401610995565b6000609d600086848151811061179557611795613b14565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020905060008160020154116118085760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b6118128184612b1f565b600060a0600087858151811061182a5761182a613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000209050600061189d64e8d4a510006108be8560030154856000015461239290919063ffffffff16565b90506118c06118b983600101548361238690919063ffffffff16565b87906123aa565b60018301919091554260039092019190915593508190506118e081613b40565b9150506116eb565b506118f38483612c11565b6119004262069780613b5b565b6119086107a2565b101561191657611916612cb5565b50505050565b6099818154811061192c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b038216600090815260a160205260408120549061196a848461120b565b9050611974612759565b609f5460005b8451811015611b3157609e600086838151811061199957611999613b14565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16611a0c5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c69642072746f6b656e0000000000000000000000000000000000006044820152606401610995565b600060a06000878481518110611a2457611a24613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000209050611a9d848381518110611a8657611a86613b14565b6020026020010151866123aa90919063ffffffff16565b94506000609d6000888581518110611ab757611ab7613b14565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000209050611aeb8185612b1f565b6000611b1164e8d4a510006108be8460030154866000015461239290919063ffffffff16565b600184015550504260039091015580611b2981613b40565b91505061197a565b5050506001600160a01b03909216600090815260a1602052604090209190915550565b611b5c612691565b60a35415611bac5760405162461bcd60e51b815260206004820152600f60248201527f616c7265616479207374617274656400000000000000000000000000000000006044820152606401610995565b4260a355565b611bba6123b6565b6001600160a01b0316336001600160a01b031614611c1c5760405162461bcd60e51b81526004016109959060208082526004908201527f216d666400000000000000000000000000000000000000000000000000000000604082015260600190565b60a45460ff16156106735761067381612686565b611c38612691565b6001600160a01b0382166000908152609d6020526040902060020154611c955760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b6001600160a01b039182166000908152609d6020526040902060040180546001600160a01b03191691909216179055565b600054610100900460ff1615808015611ce65750600054600160ff909116105b80611d005750303b158015611d00575060005460ff166001145b611d725760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610995565b6000805460ff191660011790558015611d95576000805461ff0019166101001790555b6001600160a01b038516611dde5760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b6001600160a01b038416611e275760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b6001600160a01b038316611e705760405162461bcd60e51b815260206004820152601060248201526f21696e76616c6964206164647265737360801b6044820152606401610995565b611e78612dc4565b611e80612e37565b60a4805460a980546001600160a01b038881166001600160a01b03199283161790925560a880548884169216919091179055609a8590556098805460ff19908116600190811790925591891661010002919091167fffffffffffffffffffffff000000000000000000000000000000000000000000909216919091171790558015611204576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050505050565b611f54612691565b60a554611f6190826123aa565b60a555611f6c6126eb565b609a54158015611f7e57506000609b54115b1561067357609b54609a5550565b611f94612691565b6001600160a01b0381166120105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610995565b610673816127d7565b612021612691565b60a4805460ff1916911515919091179055565b61203c612691565b82801580159061204b57508082145b6120975760405162461bcd60e51b815260206004820152601860248201527f656d707479206f72206d69736d6174636820706172616d7300000000000000006044820152606401610995565b60005b81811015612326578015612133578585828181106120ba576120ba613b14565b9050602002013586866001846120d09190613ba9565b8181106120df576120df613b14565b90506020020135106121335760405162461bcd60e51b815260206004820152601360248201527f73686f756c6420626520617363656e64696e67000000000000000000000000006044820152606401610995565b6001600160801b0386868381811061214d5761214d613b14565b9050602002013511156121a25760405162461bcd60e51b815260206004820152601e60248201527f737461727454696d654f666673657473203e206d61782075696e7431323800006044820152606401610995565b6001600160801b038484838181106121bc576121bc613b14565b9050602002013511156122115760405162461bcd60e51b815260206004820152601e60248201527f726577617264735065725365636f6e64203e206d61782075696e7431323800006044820152606401610995565b60a3541561228d5760a354612227904290612386565b86868381811061223957612239613b14565b905060200201351161228d5760405162461bcd60e51b815260206004820152601260248201527f696e76616c69642073746172742074696d6500000000000000000000000000006044820152606401610995565b609760405180604001604052808888858181106122ac576122ac613b14565b905060200201356001600160801b031681526020018686858181106122d3576122d3613b14565b6001600160801b03602091820293909301358316909352508354600181018555600094855293829020835193909201518116600160801b029216919091179101558061231e81613b40565b91505061209a565b507f0a4b885eafe78f585b7c7667ea419f9b1b17d09dfdf23ffa7925b73db6986f1685858585604051611f3d9493929190613c0f565b612364612691565b60aa80546001600160a01b0319166001600160a01b0392909216919091179055565b600061165a8284613ba9565b600061165a8284613c36565b600061165a8284613c55565b600061165a8284613b5b565b60008060a860009054906101000a90046001600160a01b03166001600160a01b031663cd57ed6c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561240c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190613c77565b6001600160a01b0384166000908152609d60205260409020600281015461248e5760405162461bcd60e51b81526020600482015260126024820152711c1bdbdb08191bd95cdb89dd08195e1a5cdd60721b6044820152606401610995565b612496612759565b6124a281609f54612b1f565b6001600160a01b03808616600090815260a06020908152604080832093881683529290522080546003830154811561253a5760018301546000906124f39061118764e8d4a510006108be8787612392565b90508015612538576001600160a01b038816600090815260a1602052604090205461251e90826123aa565b6001600160a01b038916600090815260a160205260409020555b505b8254845461254791612386565b845585835561255f64e8d4a510006108be8884612392565b6001840155825415612572574260028401555b835461257e90876123aa565b845560048401546001600160a01b031615612626576004848101546040517fae0b53710000000000000000000000000000000000000000000000000000000081526001600160a01b038b8116938201939093528983166024820152604481018990526064810188905291169063ae0b537190608401600060405180830381600087803b15801561260d57600080fd5b505af1158015612621573d6000803e3d6000fd5b505050505b866001600160a01b0316886001600160a01b03167f526824944047da5b81071fb6349412005c5da81380b336103fbe5dd34556c7768888604051612674929190918252602082015260400190565b60405180910390a35050505050505050565b61169f816001612829565b6065546001600160a01b031633146113b05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610995565b609f5460995460005b8181101561275057612740609d60006099848154811061271657612716613b14565b60009182526020808320909101546001600160a01b03168352820192909252604001902084612b1f565b61274981613b40565b90506126f4565b50504260a75550565b6127616107a2565b42111561277d576127706126eb565b609a8054609b5560009055565b6113b0612eaa565b61278d612f77565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60a954604051633300c37360e11b81526001600160a01b038481166004830152600092839291169063660186e690602401602060405180830381865afa158015612877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289b9190613b73565b905060006128a885612fc9565b60a9546040517f6f21a1790000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015292935060009290911690636f21a17990602401602060405180830381865afa158015612911573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129359190613b90565b9050801515831580156129455750825b801561294f575080155b1561295957600194505b8580156129635750845b15612a055761297187613051565b6040516001600160a01b038816907fa77719a89d2325682411f1762214545e5d0fc4b374cc00cb48fcd390a670f2e190600090a260a954604051630afb040960e01b81526001600160a01b03898116600483015290911690630afb040990602401600060405180830381600087803b1580156129ec57600080fd5b505af1158015612a00573d6000803e3d6000fd5b505050505b5050505092915050565b612a17612acc565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127ba3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ae890849061323e565b60335460ff16156113b05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610995565b4280612b296107a2565b11612b3957612b366107a2565b90505b82600201548111612b4957505050565b825480612b5d575060029092019190915550565b6000612b7685600201548461238690919063ffffffff16565b90506000612b8f609a548361239290919063ffffffff16565b905080612b9a613323565b1015612bab57612ba8613323565b90505b6000612bc8866108be89600101548561239290919063ffffffff16565b60a654909150612bd890826123aa565b60a655612bfc612bf1856108be8464e8d4a51000612392565b6003890154906123aa565b60038801555050505060029092019190915550565b612c22612c1c6123b6565b82613341565b9050612c2c6123b6565b6040517fd1a1beb40000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820184905260016044830152919091169063d1a1beb4906064015b600060405180830381600087803b158015612c9957600080fd5b505af1158015612cad573d6000803e3d6000fd5b505050505050565b60a8546040805163ab453a5960e01b815290516000926001600160a01b03169163ab453a599160048083019260209291908290030181865afa158015612cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d239190613c77565b6040516370a0823160e01b81523060048201529091507f1681e542d7f33ef0ad012aecd346fa867be856110f81d25dcbbd72f972a57a45906001600160a01b038316906370a0823190602401602060405180830381865afa158015612d8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db09190613b90565b60405190815260200160405180910390a150565b600054610100900460ff16612e2f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0613493565b600054610100900460ff16612ea25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0613507565b60985460ff166113b057609754609c5460a354600090612ecb904290612386565b90505b8282108015612f08575060978281548110612eeb57612eeb613b14565b6000918252602090912001546001600160801b0390811690821610155b15612f1f5781612f1781613b40565b925050612ece565b609c54821115610ae857609c829055612f366126eb565b6097612f43600184613ba9565b81548110612f5357612f53613b14565b600091825260209091200154600160801b90046001600160801b0316609a55505050565b60335460ff166113b05760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610995565b6000805b60995481101561304b57600060a0600060998481548110612ff057612ff0613b14565b60009182526020808320909101546001600160a01b0390811684528382019490945260409283018220938816825292909252902080549091501561303857600192505061304b565b508061304381613b40565b915050612fcd565b50919050565b60a45460ff166130a35760405162461bcd60e51b815260206004820152600360248201527f21454500000000000000000000000000000000000000000000000000000000006044820152606401610995565b60a954604051633300c37360e11b81526001600160a01b0383811660048301529091169063660186e690602401602060405180830381865afa1580156130ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131119190613b73565b1561315e5760405162461bcd60e51b815260206004820152601660248201527f75736572206973207374696c6c20656c696769626c65000000000000000000006044820152606401610995565b60995460005b818110156131ec5760006099828154811061318157613181613b14565b60009182526020808320909101546001600160a01b03908116808452609d8352604080852060a08552818620938a1686529290935291832080548254939550919390926131d89286928a92909161118d9190612386565b505050806131e590613b40565b9050613164565b5060a9546040517fe2c75ca00000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301524260248301529091169063e2c75ca090604401612c7f565b6000613293826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661357e9092919063ffffffff16565b805190915015610ae857808060200190518101906132b19190613b73565b610ae85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610995565b600061333c60a65460a55461238690919063ffffffff16565b905090565b6000816133505750600061139a565b60a8546040805163ab453a5960e01b815290516000926001600160a01b03169163ab453a599160048083019260209291908290030181865afa15801561339a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133be9190613c77565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015613408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061342c9190613b90565b905080841115613476576040518181527f09fb3e34da56fdc0b28f9769c6dcb55321715bc673f744205e208b82c97963c99060200160405180910390a1613471612a0f565b61348a565b61348a6001600160a01b0383168686612a4c565b50919392505050565b600054610100900460ff166134fe5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6113b0336127d7565b600054610100900460ff166135725760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610995565b6033805460ff19169055565b606061358d8484600085613595565b949350505050565b60608247101561360d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610995565b600080866001600160a01b031685876040516136299190613cc0565b60006040518083038185875af1925050503d8060008114613666576040519150601f19603f3d011682016040523d82523d6000602084013e61366b565b606091505b509150915061367c87838387613687565b979650505050505050565b606083156136f35782516136ec576001600160a01b0385163b6136ec5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610995565b508161358d565b61358d83838151156137085781518083602001fd5b8060405162461bcd60e51b81526004016109959190613cdc565b6001600160a01b038116811461067357600080fd5b803561374281613722565b919050565b60006020828403121561375957600080fd5b813561165a81613722565b6000806040838503121561377757600080fd5b823561378281613722565b9150602083013561379281613722565b809150509250929050565b6000806000606084860312156137b257600080fd5b83356137bd81613722565b95602085013595506040909401359392505050565b801515811461067357600080fd5b600080604083850312156137f357600080fd5b823591506020830135613792816137d2565b6000806040838503121561381857600080fd5b823561382381613722565b946020939093013593505050565b60006020828403121561384357600080fd5b5035919050565b60008083601f84011261385c57600080fd5b50813567ffffffffffffffff81111561387457600080fd5b6020830191508360208260051b850101111561388f57600080fd5b9250929050565b600080600080604085870312156138ac57600080fd5b843567ffffffffffffffff808211156138c457600080fd5b6138d08883890161384a565b909650945060208701359150808211156138e957600080fd5b506138f68782880161384a565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261392957600080fd5b8135602067ffffffffffffffff8083111561394657613946613902565b8260051b604051601f19603f8301168101818110848211171561396b5761396b613902565b60405293845285810183019383810192508785111561398957600080fd5b83870191505b8482101561367c576139a082613737565b8352918301919083019061398f565b600080604083850312156139c257600080fd5b82356139cd81613722565b9150602083013567ffffffffffffffff8111156139e957600080fd5b6139f585828601613918565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613a3757835183529284019291840191600101613a1b565b50909695505050505050565b600060208284031215613a5557600080fd5b813567ffffffffffffffff811115613a6c57600080fd5b61358d84828501613918565b60008060408385031215613a8b57600080fd5b8235613a9681613722565b91506020830135613792816137d2565b60008060008060808587031215613abc57600080fd5b8435613ac781613722565b93506020850135613ad781613722565b92506040850135613ae781613722565b9396929550929360600135925050565b600060208284031215613b0957600080fd5b813561165a816137d2565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613b5457613b54613b2a565b5060010190565b60008219821115613b6e57613b6e613b2a565b500190565b600060208284031215613b8557600080fd5b815161165a816137d2565b600060208284031215613ba257600080fd5b5051919050565b600082821015613bbb57613bbb613b2a565b500390565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115613bf257600080fd5b8260051b8083602087013760009401602001938452509192915050565b604081526000613c23604083018688613bc0565b828103602084015261367c818587613bc0565b6000816000190483118215151615613c5057613c50613b2a565b500290565b600082613c7257634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613c8957600080fd5b815161165a81613722565b60005b83811015613caf578181015183820152602001613c97565b838111156119165750506000910152565b60008251613cd2818460208701613c94565b9190910192915050565b6020815260008251806020840152613cfb816040850160208701613c94565b601f01601f1916919091016040019291505056fea26469706673582212209f5a738d902be02247d03d6359ba6c0f3b840983519cc8719f95b7c31742f5ce64736f6c634300080c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.