Address Details
contract
0x76567810b6a5Ab7005FAb1AA6E315727887Ccde4
- Contract Name
- DonationMinerImplementation
- Creator
- 0xa34737–43edab at 0x8a780a–30fd02
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 23819167
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- DonationMinerImplementation
- Optimization enabled
- true
- Compiler version
- v0.8.4+commit.c7e474f2
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2023-10-12T11:55:26.273420Z
contracts/donationMiner/DonationMinerImplementation.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./interfaces/DonationMinerStorageV5.sol"; contract DonationMinerImplementation is Initializable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, DonationMinerStorageV5 { address internal constant AIRDROP_V3_TOKEN_ADDRESS = 0x00000000000000000000000000000000000000A3; address internal constant MICROCREDIT_TOKEN_ADDRESS = 0x00000000000000000000000000000000000000C1; using SafeERC20Upgradeable for IERC20; /** * @notice Triggered when a donation has been added * * @param donationId Id of the donation * @param delegateAddress Address of the delegate * @param amount Value of the donation * @param token Address of the token after conversion * @param amount Number of token donated * @param target Address of the receiver (community or treasury) * or address of the DonationMiner contract otherwise */ event DonationAdded( uint256 indexed donationId, address indexed delegateAddress, uint256 amount, address token, uint256 initialAmount, address indexed target ); /** * @notice Triggered when a donor has claimed his reward * * @param donor Address of the donner * @param amount Value of the reward */ event RewardClaimed(address indexed donor, uint256 amount); /** * @notice Triggered when a donor has claimed his reward * * @param donor Address of the donner * @param amount Value of the reward * @param lastRewardPeriod Number of the last reward period for witch the claim was made */ event RewardClaimedPartial(address indexed donor, uint256 amount, uint256 lastRewardPeriod); /** * @notice Triggered when a donor has staked his reward * * @param donor Address of the donner * @param amount Value of the reward */ event RewardStaked(address indexed donor, uint256 amount); /** * @notice Triggered when a donor has staked his reward * * @param donor Address of the donner * @param amount Value of the reward * @param lastRewardPeriod Number of the last reward period for witch tha stake was made */ event RewardStakedPartial(address indexed donor, uint256 amount, uint256 lastRewardPeriod); /** * @notice Triggered when an amount of an ERC20 has been transferred from this contract to an address * * @param token ERC20 token address * @param to Address of the receiver * @param amount Amount of the transaction */ event TransferERC20(address indexed token, address indexed to, uint256 amount); /** * @notice Triggered when reward period params have been updated * * @param oldRewardPeriodSize Old rewardPeriodSize value * @param oldDecayNumerator Old decayNumerator value * @param oldDecayDenominator Old decayDenominator value * @param newRewardPeriodSize New rewardPeriodSize value * @param newDecayNumerator New decayNumerator value * @param newDecayDenominator New decayDenominator value * * For further information regarding each parameter, see * *DonationMiner* smart contract initialize method. */ event RewardPeriodParamsUpdated( uint256 oldRewardPeriodSize, uint256 oldDecayNumerator, uint256 oldDecayDenominator, uint256 newRewardPeriodSize, uint256 newDecayNumerator, uint256 newDecayDenominator ); /** * @notice Triggered when the claimDelay value has been updated * * @param oldClaimDelay Old claimDelay value * @param newClaimDelay New claimDelay value */ event ClaimDelayUpdated(uint256 oldClaimDelay, uint256 newClaimDelay); /** * @notice Triggered when the stakingDonationRatio value has been updated * * @param oldStakingDonationRatio Old stakingDonationRatio value * @param newStakingDonationRatio New stakingDonationRatio value */ event StakingDonationRatioUpdated( uint256 oldStakingDonationRatio, uint256 newStakingDonationRatio ); /** * @notice Triggered when the communityDonationRatio value has been updated * * @param oldCommunityDonationRatio Old communityDonationRatio value * @param newCommunityDonationRatio New communityDonationRatio value */ event CommunityDonationRatioUpdated( uint256 oldCommunityDonationRatio, uint256 newCommunityDonationRatio ); /** * @notice Triggered when the againstPeriods value has been updated * * @param oldAgainstPeriods Old againstPeriods value * @param newAgainstPeriods New againstPeriods value */ event AgainstPeriodsUpdated(uint256 oldAgainstPeriods, uint256 newAgainstPeriods); /** * @notice Triggered when the treasury address has been updated * * @param oldTreasury Old treasury address * @param newTreasury New treasury address */ event TreasuryUpdated(address indexed oldTreasury, address indexed newTreasury); /** * @notice Triggered when the staking address has been updated * * @param oldStaking Old staking address * @param newStaking New staking address */ event StakingUpdated(address indexed oldStaking, address indexed newStaking); /** * @notice Enforces beginning rewardPeriod has started */ modifier whenStarted() { require(block.number >= rewardPeriods[1].startBlock, "DonationMiner: ERR_NOT_STARTED"); _; } /** * @notice Enforces sender to be Staking contract */ modifier onlyStaking() { require(msg.sender == address(staking), "DonationMiner: NOT_STAKING"); _; } /** * @notice Enforces sender to be Staking contract */ modifier onlyRecurringCron() { require(msg.sender == recurringCronAddress, "DonationMiner: You are not allow to call this method"); _; } /** * @notice Used to initialize a new DonationMiner contract * * @param _cUSD Address of the cUSD token * @param _PACT Address of the PACT Token * @param _treasury Address of the Treasury * @param _firstRewardPerBlock Number of PACTs given for each block * from the first reward period * @param _rewardPeriodSize Number of blocks of the reward period * @param _startingBlock First block of the first reward period * @param _decayNumerator Decay numerator used for calculating the new reward per block based on the previous reward per block * @param _decayDenominator Decay denominator used for calculating the new reward per block based on the previous reward per block */ function initialize( IERC20 _cUSD, IERC20 _PACT, ITreasury _treasury, uint256 _firstRewardPerBlock, uint256 _rewardPeriodSize, uint256 _startingBlock, uint256 _decayNumerator, uint256 _decayDenominator ) public initializer { require(address(_cUSD) != address(0), "DonationMiner::initialize: cUSD address not set"); require(address(_PACT) != address(0), "DonationMiner::initialize: PACT address not set"); require(address(_treasury) != address(0), "DonationMiner::initialize: treasury_ not set"); require( _firstRewardPerBlock != 0, "DonationMiner::initialize: firstRewardPerBlock not set!" ); require(_startingBlock != 0, "DonationMiner::initialize: startingRewardPeriod not set!"); require(_rewardPeriodSize != 0, "DonationMiner::initialize: rewardPeriodSize is invalid!"); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); cUSD = _cUSD; PACT = _PACT; treasury = _treasury; rewardPeriodSize = _rewardPeriodSize; decayNumerator = _decayNumerator; decayDenominator = _decayDenominator; rewardPeriodCount = 1; initFirstPeriod(_startingBlock, _firstRewardPerBlock); } /** * @notice Returns the current implementation version */ function getVersion() external pure override returns (uint256) { return 5; } /** * @notice Returns the amount of cUSD donated by a user in a reward period * * @param _period number of the reward period * @param _donor address of the donor * @return uint256 amount of cUSD donated by the user in this reward period */ function rewardPeriodDonorAmount(uint256 _period, address _donor) external view override returns (uint256) { return rewardPeriods[_period].donorAmounts[_donor]; } /** * @notice Returns the amount of PACT staked by a user at the and of the reward period * * @param _period reward period number * @param _donor address of the donor * @return uint256 amount of PACT staked by a user at the and of the reward period */ function rewardPeriodDonorStakeAmounts(uint256 _period, address _donor) external view override returns (uint256) { return rewardPeriods[_period].donorStakeAmounts[_donor]; } /** * @notice Returns a reward period number from a donor reward period list * * @param _donor address of the donor * @param _rewardPeriodIndex index of the reward period * @return uint256 number of the reward period */ function donorRewardPeriod(address _donor, uint256 _rewardPeriodIndex) external view override returns (uint256) { return donors[_donor].rewardPeriods[_rewardPeriodIndex]; } /** * @notice Updates reward period default params * * @param _newRewardPeriodSize value of new rewardPeriodSize * @param _newDecayNumerator value of new decayNumerator * @param _newDecayDenominator value of new decayDenominator */ function updateRewardPeriodParams( uint256 _newRewardPeriodSize, uint256 _newDecayNumerator, uint256 _newDecayDenominator ) external override onlyOwner { require( _newRewardPeriodSize != 0, "DonationMiner::initialize: rewardPeriodSize is invalid!" ); initializeRewardPeriods(); emit RewardPeriodParamsUpdated( rewardPeriodSize, decayNumerator, decayDenominator, _newRewardPeriodSize, _newDecayNumerator, _newDecayDenominator ); rewardPeriodSize = _newRewardPeriodSize; decayNumerator = _newDecayNumerator; decayDenominator = _newDecayDenominator; } /** * @notice Updates claimDelay value * * @param _newClaimDelay Number of reward periods a donor has to wait after * a donation until he will be able to claim his reward */ function updateClaimDelay(uint256 _newClaimDelay) external override onlyOwner { emit ClaimDelayUpdated(claimDelay, _newClaimDelay); claimDelay = _newClaimDelay; } /** * @notice Updates stakingDonationRatio value * * @param _newStakingDonationRatio Number of tokens that need to be staked to be counted as 1 PACT donated */ function updateStakingDonationRatio(uint256 _newStakingDonationRatio) external override onlyOwner { initializeRewardPeriods(); emit StakingDonationRatioUpdated(stakingDonationRatio, _newStakingDonationRatio); stakingDonationRatio = _newStakingDonationRatio; } /** * @notice Updates communityDonationRatio value * * @param _newCommunityDonationRatio Ratio between 1USD donated into the treasury vs 1USD donated to a community */ function updateCommunityDonationRatio(uint256 _newCommunityDonationRatio) external override onlyOwner { emit CommunityDonationRatioUpdated(communityDonationRatio, _newCommunityDonationRatio); communityDonationRatio = _newCommunityDonationRatio; } /** * @notice Updates againstPeriods value * * @param _newAgainstPeriods Number of reward periods for the backward computation */ function updateAgainstPeriods(uint256 _newAgainstPeriods) external override onlyOwner { initializeRewardPeriods(); emit AgainstPeriodsUpdated(againstPeriods, _newAgainstPeriods); againstPeriods = _newAgainstPeriods; } /** * @notice Updates Treasury address * * @param _newTreasury address of new treasury_ contract */ function updateTreasury(ITreasury _newTreasury) external override onlyOwner { emit TreasuryUpdated(address(treasury), address(_newTreasury)); treasury = _newTreasury; } /** * @notice Updates Staking address * * @param _newStaking address of new Staking contract */ function updateStaking(IStaking _newStaking) external override onlyOwner { emit StakingUpdated(address(staking), address(_newStaking)); staking = _newStaking; } /** * @notice Updates AirdropV3 address * * @param _newAirdropV3 address of new AirdropV3 contract */ function updateAirdropV3(IAirdropV3 _newAirdropV3) external override onlyOwner { airdropV3 = _newAirdropV3; } /** * @notice Updates Microcredit address * * @param _newMicrocredit address of new Microcredit contract */ function updateMicrocredit(IMicrocredit _newMicrocredit) external override onlyOwner { microcredit = _newMicrocredit; } /** * @notice Updates recurring cron address address * * @param _newRecurringCronAddress new address of recurring cron */ function updateRecurringCronAddress(address _newRecurringCronAddress) external override onlyOwner { recurringCronAddress = _newRecurringCronAddress; } /** * @notice Transfers tokens to the treasury contract * * @param _token address of the token * @param _amount Amount of tokens to deposit. * @param _delegateAddress the address that will claim the reward for the donation */ function donate( IERC20 _token, uint256 _amount, address _delegateAddress ) external override whenNotPaused whenStarted nonReentrant { require(treasury.isToken(address(_token)), "DonationMiner::donate: Invalid token"); _token.safeTransferFrom(msg.sender, address(treasury), _amount); _addDonation(_delegateAddress, _token, _amount, address(treasury)); } /** * @notice Transfers tokens from the _from to the treasury contract * * @param _from address of the user * @param _token address of the token * @param _amount Amount of tokens to deposit. * @param _delegateAddress the address that will claim the reward for the donation */ function donateFrom( address _from, IERC20 _token, uint256 _amount, address _delegateAddress ) external override onlyRecurringCron whenNotPaused whenStarted nonReentrant { require( treasury.isToken(address(_token)), "DonationMiner: Invalid token"); _token.safeTransferFrom(_from, address(treasury), _amount); _addDonation(_delegateAddress, _token, _amount, address(treasury)); } /** * @dev Transfers tokens to the community contract * * @param _community address of the community * @param _token address of the token * @param _amount amount of tokens to deposit * @param _delegateAddress the address that will claim the reward for the donation */ function donateToCommunity( ICommunity _community, IERC20 _token, uint256 _amount, address _delegateAddress ) external override whenNotPaused whenStarted nonReentrant { ICommunityAdmin _communityAdmin = treasury.communityAdmin(); require( _communityAdmin.communities(address(_community)) == ICommunityAdmin.CommunityState.Valid, "DonationMiner::donateToCommunity: This is not a valid community address" ); require( address(_token) == address(_community.cUSD()), "DonationMiner::donateToCommunity: Invalid token" ); _community.donate(msg.sender, _amount); _addDonation(_delegateAddress, _token, _amount, address(_community)); } /** * @notice Virtual donate tokens to the treasury contract * * @param _amount Amount of tokens to fake deposit. * @param _delegateAddress the address that will claim the reward for the donation */ function donateVirtual(uint256 _amount, address _delegateAddress) external override whenNotPaused { if (msg.sender == address(airdropV3)) { _addDonation( _delegateAddress, IERC20(AIRDROP_V3_TOKEN_ADDRESS), _amount, address(treasury) ); } else if (msg.sender == address(microcredit)) { _addDonation( _delegateAddress, IERC20(MICROCREDIT_TOKEN_ADDRESS), _amount, address(treasury) ); } else { revert("DonationMiner: You are not allow to call this method"); } } /** * @notice Transfers to the sender the rewards */ function claimRewards() external override whenNotPaused whenStarted nonReentrant { uint256 _claimAmount = _computeRewardsByPeriodNumber(msg.sender, _getLastClaimablePeriod()); IERC20Upgradeable(address(PACT)).safeTransfer(msg.sender, _claimAmount); emit RewardClaimed(msg.sender, _claimAmount); } /** * @notice Transfers to the sender the rewards */ function claimRewardsPartial(uint256 _lastPeriodNumber) external override whenNotPaused whenStarted nonReentrant { require( _lastPeriodNumber <= _getLastClaimablePeriod(), "DonationMiner::claimRewardsPartial: This reward period isn't claimable yet" ); uint256 _claimAmount = _computeRewardsByPeriodNumber(msg.sender, _lastPeriodNumber); IERC20Upgradeable(address(PACT)).safeTransfer(msg.sender, _claimAmount); emit RewardClaimedPartial(msg.sender, _claimAmount, _lastPeriodNumber); } /** * @notice Stakes the reward */ function stakeRewards() external override whenNotPaused whenStarted nonReentrant { initializeRewardPeriods(); uint256 _stakeAmount = _computeRewardsByPeriodNumber(msg.sender, rewardPeriodCount - 1); PACT.approve(address(staking), _stakeAmount); staking.stake(msg.sender, _stakeAmount); emit RewardStaked(msg.sender, _stakeAmount); } /** * @notice Stakes the reward */ function stakeRewardsPartial(uint256 _lastPeriodNumber) external override whenNotPaused whenStarted nonReentrant { initializeRewardPeriods(); require( _lastPeriodNumber < rewardPeriodCount, "DonationMiner::stakeRewardsPartial: This reward period isn't claimable yet" ); uint256 _stakeAmount = _computeRewardsByPeriodNumber(msg.sender, _lastPeriodNumber); PACT.approve(address(staking), _stakeAmount); staking.stake(msg.sender, _stakeAmount); emit RewardStaked(msg.sender, _stakeAmount); } /** * @notice Calculates the rewards from ended reward periods of a donor * * @param _donorAddress address of the donor * @param _lastPeriodNumber last reward period number to be computed * @return uint256 sum of all donor's rewards that has not been claimed until _lastPeriodNumber */ function calculateClaimableRewardsByPeriodNumber( address _donorAddress, uint256 _lastPeriodNumber ) external view override returns (uint256) { uint256 _maxRewardPeriod; if (rewardPeriods[rewardPeriodCount].endBlock < block.number) { _maxRewardPeriod = (block.number - rewardPeriods[rewardPeriodCount].endBlock) / rewardPeriodSize; _maxRewardPeriod += rewardPeriodCount; } else { _maxRewardPeriod = rewardPeriodCount - 1; } require( _lastPeriodNumber <= _maxRewardPeriod, "DonationMiner::calculateClaimableRewardsByPeriodNumber: This reward period isn't available yet" ); (uint256 _claimAmount, ) = _calculateRewardByPeriodNumber(_donorAddress, _lastPeriodNumber); return _claimAmount; } /** * @notice Calculates the rewards from ended reward periods of a donor * * @param _donorAddress address of the donor * @return claimAmount uint256 sum of all donor's rewards that has not been claimed until _lastPeriodNumber */ function calculateClaimableRewards(address _donorAddress) external view override returns (uint256) { (uint256 _claimAmount, ) = _calculateRewardByPeriodNumber( _donorAddress, currentRewardPeriodNumber() - 1 ); return _claimAmount; } /** * @notice Calculates the estimate reward of a donor for current reward period * * @param _donorAddress address of the donor * * @return uint256 reward that donor will receive in current reward period if there isn't another donation */ function estimateClaimableReward(address _donorAddress) external view override whenStarted whenNotPaused returns (uint256) { return _estimateClaimableReward(_donorAddress, 0); } /** * @notice Calculates the estimate reward of a donor for the next x reward periods * * @param _donorAddress address of the donor * * @return uint256 reward that donor will receive in current reward period if there isn't another donation */ function estimateClaimableRewardAdvance(address _donorAddress) external view override whenStarted whenNotPaused returns (uint256) { return _estimateClaimableReward(_donorAddress, againstPeriods); } /** * @notice Calculates the estimate reward of a donor for current reward period based on his staking * * @return uint256 estimated reward by donor stakes */ function estimateClaimableRewardByStaking(address _donorAddress) external view override whenStarted whenNotPaused returns (uint256) { uint256 _donorAmount; uint256 _totalAmount; (, _totalAmount) = lastPeriodsDonations(address(0)); uint256 _currentPeriodReward = _calculateCurrentPeriodReward(); return (_currentPeriodReward * staking.stakeholderAmount(_donorAddress)) / (_totalAmount * stakingDonationRatio + staking.currentTotalAmount()); } /** * @notice Calculates the APR of a user based on his staking * * @param _stakeholderAddress address of the stakeHolder * * @return uint256 APR of the user */ function apr(address _stakeholderAddress) external view override whenStarted whenNotPaused returns (uint256) { uint256 _stakeholderAmount = staking.stakeholderAmount(_stakeholderAddress); if (_stakeholderAmount == 0) { return 0; } return (1e18 * 365100 * _estimateClaimableReward(_stakeholderAddress, 0)) / _stakeholderAmount; } /** * @notice Calculates the APR * * @return uint256 APR */ function generalApr() public view override whenStarted whenNotPaused returns (uint256) { uint256 _donorAmount; uint256 _totalAmount; (, _totalAmount) = lastPeriodsDonations(address(0)); uint256 _currentPeriodReward = _calculateCurrentPeriodReward(); uint256 _totalReward = _currentPeriodReward; uint256 _index; while (_index < 364) { _currentPeriodReward = (_currentPeriodReward * decayNumerator) / decayDenominator; _totalReward += _currentPeriodReward; _index++; } return (1e18 * 100 * _totalReward) / (_totalAmount * stakingDonationRatio + staking.currentTotalAmount()); } /** * @dev Calculate the score of a user based as * this ratio (his donation and staking) / (all donation and staking) * E.G. score = 0.01 * 1e18 => the donor have have 1% score * so he will get 1% of the reward * * @param _donorAddress address of the donor * * @return uint256 donor's score */ function donorScore(address _donorAddress) public view returns (uint256) { return _calculateDonorShare(_donorAddress, 1e18); } /** * @dev Calculate all donations on the last X epochs as well as everyone * else in the same period. * * @param _donorAddress address of the donor * * @return donorAmount uint256 sum of donor's donations * @return totalAmount uint256 sum of all donations */ function lastPeriodsDonations(address _donorAddress) public view override returns (uint256 donorAmount, uint256 totalAmount) { uint256 _currentRewardPeriodNumber = currentRewardPeriodNumber(); uint256 _startPeriod = _currentRewardPeriodNumber > againstPeriods ? _currentRewardPeriodNumber - againstPeriods : 1; if (rewardPeriodCount >= _startPeriod) { (donorAmount, totalAmount) = _calculateDonorIntervalAmounts( _donorAddress, _startPeriod, rewardPeriodCount ); } } /** * @notice Transfers an amount of an ERC20 from this contract to an address * * @param _token address of the ERC20 token * @param _to address of the receiver * @param _amount amount of the transaction */ function transfer( IERC20 _token, address _to, uint256 _amount ) external override onlyOwner nonReentrant { IERC20Upgradeable(address(_token)).safeTransfer(_to, _amount); emit TransferERC20(address(_token), _to, _amount); } function setStakingAmounts( address _holderAddress, uint256 _holderAmount, uint256 _totalAmount ) external override whenNotPaused whenStarted onlyStaking { initializeRewardPeriods(); RewardPeriod storage _rewardPeriod = rewardPeriods[rewardPeriodCount]; _rewardPeriod.hasSetStakeAmount[_holderAddress] = true; _rewardPeriod.donorStakeAmounts[_holderAddress] = _holderAmount; _rewardPeriod.stakesAmount = _totalAmount; Donor storage _donor = donors[_holderAddress]; //if user hasn't made any donation/staking //set _donor.lastClaimPeriod to be previous reward period //to not calculate reward for epochs 1 to rewardPeriodsCount -1 if (_donor.lastClaimPeriod == 0 && _donor.rewardPeriodsCount == 0) { _donor.lastClaimPeriod = rewardPeriodCount - 1; } treasury.useFundsForLP(); } function currentRewardPeriodNumber() public view override returns (uint256) { uint256 lastRewardPeriodEndBlock = rewardPeriods[rewardPeriodCount].endBlock; return lastRewardPeriodEndBlock > block.number ? rewardPeriodCount : rewardPeriodCount + (block.number - lastRewardPeriodEndBlock) / rewardPeriodSize + 1; } /** * @notice Initializes all reward periods that haven't been initialized yet until the current one. * The first donor in a reward period will pay for that operation. */ function initializeRewardPeriods() internal { RewardPeriod storage _lastPeriod = rewardPeriods[rewardPeriodCount]; while (_lastPeriod.endBlock < block.number) { rewardPeriodCount++; RewardPeriod storage _newPeriod = rewardPeriods[rewardPeriodCount]; _newPeriod.againstPeriods = againstPeriods; _newPeriod.startBlock = _lastPeriod.endBlock + 1; _newPeriod.endBlock = _newPeriod.startBlock + rewardPeriodSize - 1; _newPeriod.rewardPerBlock = (_lastPeriod.rewardPerBlock * decayNumerator) / decayDenominator; _newPeriod.stakesAmount = _lastPeriod.stakesAmount; _newPeriod.stakingDonationRatio = stakingDonationRatio; uint256 _rewardAmount = rewardPeriodSize * _newPeriod.rewardPerBlock; uint256 _startPeriod = (rewardPeriodCount - 1 > _lastPeriod.againstPeriods) ? rewardPeriodCount - 1 - _lastPeriod.againstPeriods : 1; if (!hasDonationOrStake(_startPeriod, rewardPeriodCount - 1)) { _rewardAmount += _lastPeriod.rewardAmount; } _newPeriod.rewardAmount = _rewardAmount; _lastPeriod = _newPeriod; } } /** * @notice Adds a new donation in donations list * * @param _delegateAddress address of the wallet that will claim the reward * @param _initialAmount amount of the donation * @param _target address of the receiver (community or treasury) */ function _addDonation( address _delegateAddress, IERC20 _token, uint256 _initialAmount, address _target ) internal { initializeRewardPeriods(); donationCount++; Donation storage _donation = donations[donationCount]; _donation.donor = _delegateAddress; _donation.target = _target; _donation.blockNumber = block.number; _donation.rewardPeriod = rewardPeriodCount; _donation.token = _token; _donation.initialAmount = _initialAmount; if ( _token == cUSD || address(_token) == AIRDROP_V3_TOKEN_ADDRESS || address(_token) == MICROCREDIT_TOKEN_ADDRESS ) { _donation.amount = _initialAmount; } else { _donation.amount = treasury.getConvertedAmount(address(_token), _initialAmount); } if (_target != address(treasury)) { _donation.amount = _donation.amount / communityDonationRatio; } updateRewardPeriodAmounts(rewardPeriodCount, _delegateAddress, _donation.amount); addCurrentRewardPeriodToDonor(_delegateAddress); treasury.useFundsForLP(); emit DonationAdded( donationCount, _delegateAddress, _donation.amount, address(_token), _initialAmount, _target ); } /** * @notice Adds the current reward period number to a donor's list only if it hasn't been added yet * * @param _donorAddress address of the donor */ function addCurrentRewardPeriodToDonor(address _donorAddress) internal { Donor storage _donor = donors[_donorAddress]; uint256 _lastDonorRewardPeriod = _donor.rewardPeriods[_donor.rewardPeriodsCount]; //ensures that the current reward period number hasn't been added in the donor's list if (_lastDonorRewardPeriod != rewardPeriodCount) { _donor.rewardPeriodsCount++; _donor.rewardPeriods[_donor.rewardPeriodsCount] = rewardPeriodCount; } //if user hasn't made any donation/staking //set _donor.lastClaimPeriod to be previous reward period //to not calculate reward for epochs 1 to rewardPeriodsCount -1 if (_donor.lastClaimPeriod == 0 && _donor.rewardPeriodsCount == 0) { _donor.lastClaimPeriod = rewardPeriodCount - 1; } } /** * @notice Updates the amounts of a reward period * * @param _rewardPeriodNumber number of the reward period * @param _donorAddress address of the donor * @param _amount amount to be added */ function updateRewardPeriodAmounts( uint256 _rewardPeriodNumber, address _donorAddress, uint256 _amount ) internal { RewardPeriod storage _currentPeriod = rewardPeriods[_rewardPeriodNumber]; _currentPeriod.donationsAmount += _amount; _currentPeriod.donorAmounts[_donorAddress] += _amount; } /** * @notice Checks if current reward period has been initialized * * @return bool true if current reward period has been initialized */ function isCurrentRewardPeriodInitialized() internal view returns (bool) { return rewardPeriods[rewardPeriodCount].endBlock >= block.number; } function _calculateDonorIntervalAmounts( address _donorAddress, uint256 _startPeriod, uint256 _endPeriod ) internal view returns (uint256, uint256) { uint256 _donorAmount; uint256 _totalAmount; uint256 _index = _startPeriod; for (; _index <= _endPeriod; _index++) { RewardPeriod storage _rewardPeriod = rewardPeriods[_index]; _donorAmount += _rewardPeriod.donorAmounts[_donorAddress]; _totalAmount += _rewardPeriod.donationsAmount; } return (_donorAmount, _totalAmount); } function _getLastClaimablePeriod() internal returns (uint256) { initializeRewardPeriods(); return rewardPeriodCount > claimDelay + 1 ? rewardPeriodCount - 1 - claimDelay : 0; } /** * @notice Computes the rewards */ function _computeRewardsByPeriodNumber(address _donorAddress, uint256 _lastPeriodNumber) internal returns (uint256) { Donor storage _donor = donors[_donorAddress]; uint256 _claimAmount; uint256 _lastDonorStakeAmount; (_claimAmount, _lastDonorStakeAmount) = _calculateRewardByPeriodNumber( _donorAddress, _lastPeriodNumber ); if (_donor.lastClaimPeriod < _lastPeriodNumber) { _donor.lastClaimPeriod = _lastPeriodNumber; } rewardPeriods[_lastPeriodNumber].donorStakeAmounts[_donorAddress] = _lastDonorStakeAmount; if (_claimAmount == 0) { return _claimAmount; } if (_claimAmount > PACT.balanceOf(address(this))) { _claimAmount = PACT.balanceOf(address(this)); } return _claimAmount; } /** * @notice Calculates the reward for a donor starting with his last reward period claimed * * @param _donorAddress address of the donor * @param _lastPeriodNumber last reward period number to be computed * @return _claimAmount uint256 sum of all donor's rewards that has not been claimed until _lastPeriodNumber * @return _lastDonorStakeAmount uint256 number of PACTs that are staked by the donor at the end of _lastPeriodNumber */ function _calculateRewardByPeriodNumber(address _donorAddress, uint256 _lastPeriodNumber) internal view returns (uint256 _claimAmount, uint256 _lastDonorStakeAmount) { Donor storage _donor = donors[_donorAddress]; // _index is the last reward period number for which the donor claimed his reward uint256 _index = _donor.lastClaimPeriod + 1; // this is only used for the transition from V2 to V3 // we have to be sure a user is not able to claim for a epoch that he's claimed // so, if the _donor.lastClaimPeriod hasn't been set yet, // we will start from _donor.rewardPeriods[_donor.lastClaim] if (_index == 1) { _index = _donor.rewardPeriods[_donor.lastClaim] + 1; } uint256 _donorAmount; uint256 _totalAmount; uint256 _rewardAmount; uint256 _stakesAmount; uint256 _stakingDonationRatio; //first time _previousRewardPeriod must be rewardPeriods[0] in order to have: //_currentRewardPeriod.againstPeriods = _currentRewardPeriod.againstPeriods - _previousRewardPeriod.againstPeriods RewardPeriod storage _previousRewardPeriod = rewardPeriods[0]; RewardPeriod storage _currentRewardPeriod = rewardPeriods[_index]; RewardPeriod storage _expiredRewardPeriod = rewardPeriods[0]; //we save the stake amount of a donor at the end of each claim, //so rewardPeriods[_index - 1].donorStakeAmounts[_donorAddress] is the amount staked by the donor at his last claim _lastDonorStakeAmount = rewardPeriods[_index - 1].donorStakeAmounts[_donorAddress]; while (_index <= _lastPeriodNumber) { if (_currentRewardPeriod.startBlock > 0) { // this case is used to calculate the reward for periods that have been initialized if (_currentRewardPeriod.againstPeriods == 0) { _donorAmount = _currentRewardPeriod.donorAmounts[_donorAddress]; _totalAmount = _currentRewardPeriod.donationsAmount; } else if ( _previousRewardPeriod.againstPeriods == _currentRewardPeriod.againstPeriods ) { if (_index > _currentRewardPeriod.againstPeriods + 1) { _expiredRewardPeriod = rewardPeriods[ _index - 1 - _currentRewardPeriod.againstPeriods ]; _donorAmount -= _expiredRewardPeriod.donorAmounts[_donorAddress]; _totalAmount -= _expiredRewardPeriod.donationsAmount; } _donorAmount += _currentRewardPeriod.donorAmounts[_donorAddress]; _totalAmount += _currentRewardPeriod.donationsAmount; } else { if (_index > _currentRewardPeriod.againstPeriods) { (_donorAmount, _totalAmount) = _calculateDonorIntervalAmounts( _donorAddress, _index - _currentRewardPeriod.againstPeriods, _index ); } else { (_donorAmount, _totalAmount) = _calculateDonorIntervalAmounts( _donorAddress, 0, _index ); } } _rewardAmount = _currentRewardPeriod.rewardAmount; _stakesAmount = _currentRewardPeriod.stakesAmount; _stakingDonationRatio = _currentRewardPeriod.stakingDonationRatio > 0 ? _currentRewardPeriod.stakingDonationRatio : 1; } else { // this case is used to calculate the reward for periods that have not been initialized yet // E.g. calculateClaimableRewardsByPeriodNumber & calculateClaimableRewards // this step can be reached only after calculating the reward for periods that have been initialized if (_index > againstPeriods + 1) { _expiredRewardPeriod = rewardPeriods[_index - 1 - againstPeriods]; //we already know that _donorAmount >= _expiredRewardPeriod.donorAmounts[_donorAddress] //because _donorAmount is a sum of some donorAmounts, including _expiredRewardPeriod.donorAmounts[_donorAddress] _donorAmount -= _expiredRewardPeriod.donorAmounts[_donorAddress]; //we already know that _totalAmount >= _expiredRewardPeriod.donationsAmount //because _totalAmount is a sum of some donationsAmounts, including _expiredRewardPeriod.donationsAmount _totalAmount -= _expiredRewardPeriod.donationsAmount; } _donorAmount += _currentRewardPeriod.donorAmounts[_donorAddress]; _totalAmount += _currentRewardPeriod.donationsAmount; _rewardAmount = (_rewardAmount * decayNumerator) / decayDenominator; } if (_currentRewardPeriod.hasSetStakeAmount[_donorAddress]) { _lastDonorStakeAmount = _currentRewardPeriod.donorStakeAmounts[_donorAddress]; } if (_donorAmount + _lastDonorStakeAmount > 0) { _claimAmount += (_rewardAmount * (_donorAmount * _stakingDonationRatio + _lastDonorStakeAmount)) / (_totalAmount * _stakingDonationRatio + _stakesAmount); } _index++; _previousRewardPeriod = _currentRewardPeriod; _currentRewardPeriod = rewardPeriods[_index]; } return (_claimAmount, _lastDonorStakeAmount); } /** * @notice Initializes the first reward period * * @param _startingBlock first block * @param _firstRewardPerBlock initial reward per block */ function initFirstPeriod(uint256 _startingBlock, uint256 _firstRewardPerBlock) internal { RewardPeriod storage _firstPeriod = rewardPeriods[1]; _firstPeriod.startBlock = _startingBlock; _firstPeriod.endBlock = _startingBlock + rewardPeriodSize - 1; _firstPeriod.rewardPerBlock = _firstRewardPerBlock; _firstPeriod.rewardAmount = _firstRewardPerBlock * rewardPeriodSize; } /** * @notice Checks if there is any donation or stake between _startPeriod and _endPeriod * * @return bool true if there is any donation or stake */ function hasDonationOrStake(uint256 _startPeriod, uint256 _endPeriod) internal view returns (bool) { while (_startPeriod <= _endPeriod) { if ( rewardPeriods[_startPeriod].donationsAmount + rewardPeriods[_startPeriod].stakesAmount > 0 ) { return true; } _startPeriod++; } return false; } /** * @notice Calculates the estimate reward of a donor * * @param _donorAddress address of the donor * @param _inAdvanceRewardPeriods number of reward periods in front * if _inAdvanceRewardPeriods is 0 the method returns * the estimated reward for current reward period * @return uint256 reward that donor will receive in current reward period if there isn't another donation */ function _estimateClaimableReward(address _donorAddress, uint256 _inAdvanceRewardPeriods) internal view returns (uint256) { uint256 _currentPeriodReward = _calculateCurrentPeriodReward(); uint256 _totalReward = _currentPeriodReward; while (_inAdvanceRewardPeriods > 0) { _currentPeriodReward = (_currentPeriodReward * decayNumerator) / decayDenominator; _totalReward += _currentPeriodReward; _inAdvanceRewardPeriods--; } return _calculateDonorShare(_donorAddress, _totalReward); } /** * @notice Calculates a donor share based on the donations and stakes from the last x rewardPeriods * * * @return uint256 the share from the _total */ function _calculateDonorShare(address _donorAddress, uint256 _total) internal view returns (uint256) { uint256 _donorAmount; uint256 _totalAmount; (_donorAmount, _totalAmount) = lastPeriodsDonations(_donorAddress); uint256 totalStakeAmount = staking.SPACT().totalSupply(); if (totalStakeAmount == 0 && _totalAmount == 0) { return 0; } uint256 _stakingDonationRatio = stakingDonationRatio > 0 ? stakingDonationRatio : 1; return (_total * (_donorAmount * _stakingDonationRatio + staking.stakeholderAmount(_donorAddress))) / (_totalAmount * _stakingDonationRatio + staking.currentTotalAmount()); } function _calculateCurrentPeriodReward() internal view returns (uint256) { uint256 _currentRewardPeriodNumber = currentRewardPeriodNumber(); uint256 _rewardPerBlock = (rewardPeriods[rewardPeriodCount].rewardPerBlock * decayNumerator**(_currentRewardPeriodNumber - rewardPeriodCount)) / decayDenominator**(_currentRewardPeriodNumber - rewardPeriodCount); return _rewardPerBlock * rewardPeriodSize; } }
/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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); } }
/contracts/proxy/ERC1967/ERC1967Proxy.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol) pragma solidity ^0.8.0; import "../Proxy.sol"; import "./ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
/contracts/proxy/ERC1967/ERC1967Upgrade.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
/contracts/proxy/beacon/IBeacon.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
/contracts/proxy/transparent/ProxyAdmin.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol) pragma solidity ^0.8.0; import "./TransparentUpgradeableProxy.sol"; import "../../access/Ownable.sol"; /** * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}. */ contract ProxyAdmin is Ownable { /** * @dev Returns the current implementation of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("implementation()")) == 0x5c60da1b (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b"); require(success); return abi.decode(returndata, (address)); } /** * @dev Returns the current admin of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("admin()")) == 0xf851a440 (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); require(success); return abi.decode(returndata, (address)); } /** * @dev Changes the admin of `proxy` to `newAdmin`. * * Requirements: * * - This contract must be the current admin of `proxy`. */ function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner { proxy.changeAdmin(newAdmin); } /** * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner { proxy.upgradeTo(implementation); } /** * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See * {TransparentUpgradeableProxy-upgradeToAndCall}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgradeAndCall( TransparentUpgradeableProxy proxy, address implementation, bytes memory data ) public payable virtual onlyOwner { proxy.upgradeToAndCall{value: msg.value}(implementation, data); } }
/contracts/proxy/transparent/TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967Proxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _changeAdmin(admin_); } /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _getAdmin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { _changeAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeToAndCall(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
/contracts-upgradeable/access/IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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); } uint256[49] private __gap; }
/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; 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 a proxied contract can't have 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. * * 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 initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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()); } uint256[49] private __gap; }
/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; }
/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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)); } } /** * @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(IERC20Upgradeable 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"); } } }
/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } 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; } uint256[50] private __gap; }
/airdropV3/interfaces/IAirdropV3.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "../../externalInterfaces/socialConnect/ISocialConnect.sol"; import "../../community/interfaces/ICommunity.sol"; import "../../donationMiner/interfaces/IDonationMiner.sol"; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; interface IAirdropV3 { struct Beneficiary { uint256 amount; } function getVersion() external pure returns(uint256); function donationMiner() external view returns(IDonationMiner); function socialConnect() external view returns(ISocialConnect); function socialConnectIssuer() external view returns(address); function amount() external view returns(uint256); function updateAmount(uint256 newTrancheAmount) external; function register(address[] memory beneficiaryAddresses, address[] memory communityAddresses) external; }
/ambassadors/interfaces/IAmbassadors.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; interface IAmbassadors { function getVersion() external pure returns(uint256); function isAmbassador(address _ambassador) external view returns (bool); function isAmbassadorOf(address _ambassador, address _community) external view returns (bool); function isEntityOf(address _ambassador, address _entityAddress) external view returns (bool); function isAmbassadorAt(address _ambassador, address _entityAddress) external view returns (bool); function addEntity(address _entity) external; function removeEntity(address _entity) external; function replaceEntityAccount(address _entity, address _newEntity) external; function addAmbassador(address _ambassador) external; function removeAmbassador(address _ambassador) external; function replaceAmbassadorAccount(address _ambassador, address _newAmbassador) external; function replaceAmbassador(address _oldAmbassador, address _newAmbassador) external; function transferAmbassador(address _ambassador, address _toEntity, bool _keepCommunities) external; function transferCommunityToAmbassador(address _to, address _community) external; function setCommunityToAmbassador(address _ambassador, address _community) external; function removeCommunity(address _community) external; }
/community/interfaces/ICommunity.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol"; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./ICommunityAdmin.sol"; interface ICommunity { enum BeneficiaryState { NONE, //the beneficiary hasn't been added yet Valid, Locked, Removed, AddressChanged, Copied //the beneficiary has been moved in a copy community } struct Beneficiary { BeneficiaryState state; //beneficiary state uint256 claims; //total number of claims uint256 claimedAmount; //total amount of tokens received //(based on token ratios when there are more than one token) uint256 lastClaim; //block number of the last claim mapping(address => uint256) claimedAmounts; } struct TokenUpdates { address tokenAddress; //address of the token uint256 ratio; //ratio between maxClaim and previous token maxClaim uint256 startBlock; //the number of the block from which the this token was "active" } function initialize( address _tokenAddress, address[] memory _managers, uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval, uint256 _minTranche, uint256 _maxTranche, uint256 _maxBeneficiaries, ICommunity _previousCommunity ) external; function getVersion() external pure returns(uint256); function previousCommunity() external view returns(ICommunity); function copyOf() external view returns(ICommunity); function copies() external view returns(address[] memory); function originalClaimAmount() external view returns(uint256); function claimAmount() external view returns(uint256); function baseInterval() external view returns(uint256); function incrementInterval() external view returns(uint256); function maxClaim() external view returns(uint256); function maxTotalClaim() external view returns(uint256); function validBeneficiaryCount() external view returns(uint); function maxBeneficiaries() external view returns(uint); function treasuryFunds() external view returns(uint); function privateFunds() external view returns(uint); function communityAdmin() external view returns(ICommunityAdmin); function cUSD() external view returns(IERC20); function token() external view returns(IERC20); function tokenList() external view returns(address[] memory); function locked() external view returns(bool); function beneficiaries(address _beneficiaryAddress) external view returns( BeneficiaryState state, uint256 claims, uint256 claimedAmount, uint256 lastClaim ); function beneficiaryClaimedAmounts(address _beneficiaryAddress) external view returns (uint256[] memory claimedAmounts); function decreaseStep() external view returns(uint); function beneficiaryListAt(uint256 _index) external view returns (address); function beneficiaryListLength() external view returns (uint256); function impactMarketAddress() external pure returns (address); function minTranche() external view returns(uint256); function maxTranche() external view returns(uint256); function lastFundRequest() external view returns(uint256); function tokenUpdates(uint256 _index) external view returns ( address tokenAddress, uint256 ratio, uint256 startBlock ); function tokenUpdatesLength() external view returns (uint256); function isSelfFunding() external view returns (bool); function setBeneficiaryState(address _beneficiaryAddress, BeneficiaryState _state) external; function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external; function updatePreviousCommunity(ICommunity _newPreviousCommunity) external; function updateBeneficiaryParams( uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval ) external; function updateCommunityParams( uint256 _minTranche, uint256 _maxTranche ) external; function updateMaxBeneficiaries(uint256 _newMaxBeneficiaries) external; function updateToken( IERC20 _newToken, bytes calldata _exchangePath, uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval ) external; function donate(address _sender, uint256 _amount) external; function transfer(IERC20 _token, address _to, uint256 _amount) external; function addManager(address _managerAddress) external; function removeManager(address _managerAddress) external; function addBeneficiary(address _beneficiaryAddress) external; function addBeneficiaries(address[] memory _beneficiaryAddresses) external; function addBeneficiariesUsingSignature( address[] memory _beneficiaryAddresses, uint256 _expirationTimestamp, bytes calldata _signature ) external; function copyBeneficiaries(address[] memory _beneficiaryAddresses) external; function lockBeneficiary(address _beneficiaryAddress) external; function lockBeneficiaries(address[] memory _beneficiaryAddresses) external; function lockBeneficiariesUsingSignature( address[] memory _beneficiaryAddresses, uint256 _expirationTimestamp, bytes calldata _signature ) external; function unlockBeneficiary(address _beneficiaryAddress) external; function unlockBeneficiaries(address[] memory _beneficiaryAddresses) external; function unlockBeneficiariesUsingSignature( address[] memory _beneficiaryAddresses, uint256 _expirationTimestamp, bytes calldata _signature ) external; function removeBeneficiary(address _beneficiaryAddress) external; function removeBeneficiaries(address[] memory _beneficiaryAddresses) external; function removeBeneficiariesUsingSignature( address[] memory _beneficiaryAddresses, uint256 _expirationTimestamp, bytes calldata _signature ) external; function changeBeneficiaryAddressByManager(address _oldBeneficiaryAddress, address _newBeneficiaryAddress) external; function changeBeneficiaryAddress(address _newBeneficiaryAddress) external; function claim() external; function lastInterval(address _beneficiaryAddress) external view returns (uint256); function claimCooldown(address _beneficiaryAddress) external view returns (uint256); function lock() external; function unlock() external; function requestFunds() external; function beneficiaryJoinFromMigrated(address _beneficiaryAddress) external; function getInitialMaxClaim() external view returns (uint256); function addCopy(ICommunity _copy) external; function copyCommunityDetails(ICommunity _originalCommunity) external; }
/community/interfaces/ICommunityAdmin.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "./ICommunity.sol"; import "../../treasury/interfaces/ITreasury.sol"; import "../../governor/impactMarketCouncil/interfaces/IImpactMarketCouncil.sol"; import "../../ambassadors/interfaces/IAmbassadors.sol"; interface ICommunityAdmin { enum CommunityState { NONE, Valid, Removed, Migrated } function getVersion() external pure returns(uint256); function cUSD() external view returns(IERC20); function treasury() external view returns(ITreasury); function impactMarketCouncil() external view returns(IImpactMarketCouncil); function ambassadors() external view returns(IAmbassadors); function communityMiddleProxy() external view returns(address); function authorizedWalletAddress() external view returns(address); function minClaimAmountRatio() external view returns(uint256); function minClaimAmountRatioPrecision() external view returns(uint256); function communities(address _community) external view returns(CommunityState); function communityImplementation() external view returns(ICommunity); function communityProxyAdmin() external view returns(ProxyAdmin); function communityListAt(uint256 _index) external view returns (address); function communityListLength() external view returns (uint256); function treasurySafetyPercentage() external view returns (uint256); function treasuryMinBalance() external view returns (uint256); function isAmbassadorOrEntityOfCommunity(address _community, address _ambassadorOrEntity) external view returns (bool); function updateTreasury(ITreasury _newTreasury) external; function updateImpactMarketCouncil(IImpactMarketCouncil _newImpactMarketCouncil) external; function updateAmbassadors(IAmbassadors _newAmbassadors) external; function updateCommunityMiddleProxy(address _communityMiddleProxy) external; function updateCommunityImplementation(ICommunity _communityImplementation_) external; function updateAuthorizedWalletAddress(address _newSignerAddress) external; function updateMinClaimAmountRatio(uint256 _newMinClaimAmountRatio) external; function updateTreasurySafetyPercentage(uint256 _newTreasurySafetyPercentage) external; function updateTreasuryMinBalance(uint256 _newTreasuryMinBalance) external; function setCommunityToAmbassador(address _ambassador, ICommunity _communityAddress) external; function updateBeneficiaryParams( ICommunity _community, uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval, uint256 _maxBeneficiaries ) external; function updateCommunityParams( ICommunity _community, uint256 _minTranche, uint256 _maxTranche ) external; function updateProxyImplementation(address _communityMiddleProxy, address _newLogic) external; function updateCommunityToken( ICommunity _community, IERC20 _newToken, bytes memory _exchangePath, uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval ) external; function addCommunity( address _tokenAddress, address[] memory _managers, address _ambassador, uint256 _claimAmount, uint256 _maxClaim, uint256 _decreaseStep, uint256 _baseInterval, uint256 _incrementInterval, uint256 _minTranche, uint256 _maxTranche, uint256 _maxBeneficiaries ) external; function migrateCommunity( address[] memory _managers, ICommunity _previousCommunity ) external; function splitCommunity( ICommunity _community, uint256 _numberOfCopies, address _ambassador, address[] memory _managers ) external; function removeCommunity(ICommunity _community) external; function fundCommunity() external returns(uint256); function transferToBeneficiary(IERC20 _token, address beneficiary, uint256 amount) external; function calculateCommunityTrancheAmount(ICommunity _community) external view returns (uint256); function transfer(IERC20 _token, address _to, uint256 _amount) external; function transferFromCommunity( ICommunity _community, IERC20 _token, address _to, uint256 _amount ) external; function getCommunityProxyImplementation(address _communityProxyAddress) external view returns(address); }
/donationMiner/interfaces/DonationMinerStorageV1.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "./IDonationMiner.sol"; /** * @title Storage for DonationMiner * @notice For future upgrades, do not change DonationMinerStorageV1. Create a new * contract which implements DonationMinerStorageV1 and following the naming convention * DonationMinerStorageVX. */ abstract contract DonationMinerStorageV1 is IDonationMiner { IERC20 public override cUSD; IERC20 public override PACT; ITreasury public override treasury; uint256 public override rewardPeriodSize; uint256 public override donationCount; uint256 public override rewardPeriodCount; uint256 public override decayNumerator; uint256 public override decayDenominator; mapping(uint256 => Donation) public override donations; mapping(uint256 => RewardPeriod) public override rewardPeriods; mapping(address => Donor) public override donors; }
/donationMiner/interfaces/DonationMinerStorageV2.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "./DonationMinerStorageV1.sol"; /** * @title Storage for DonationMiner * @notice For future upgrades, do not change DonationMinerStorageV2. Create a new * contract which implements DonationMinerStorageV2 and following the naming convention * DonationMinerStorageVX. */ abstract contract DonationMinerStorageV2 is DonationMinerStorageV1 { uint256 public override claimDelay; }
/donationMiner/interfaces/DonationMinerStorageV3.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "./DonationMinerStorageV2.sol"; /** * @title Storage for DonationMiner * @notice For future upgrades, do not change DonationMinerStorageV3. Create a new * contract which implements DonationMinerStorageV3 and following the naming convention * DonationMinerStorageVX. */ abstract contract DonationMinerStorageV3 is DonationMinerStorageV2 { uint256 public override againstPeriods; }
/donationMiner/interfaces/DonationMinerStorageV4.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "./DonationMinerStorageV3.sol"; /** * @title Storage for DonationMiner * @notice For future upgrades, do not change DonationMinerStorageV4. Create a new * contract which implements DonationMinerStorageV4 and following the naming convention * DonationMinerStorageVX. */ abstract contract DonationMinerStorageV4 is DonationMinerStorageV3 { IStaking public override staking; //ratio between 1 cUSD donated and 1 PACT staked uint256 public override stakingDonationRatio; uint256 public override communityDonationRatio; }
/donationMiner/interfaces/DonationMinerStorageV5.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "./DonationMinerStorageV4.sol"; /** * @title Storage for DonationMiner * @notice For future upgrades, do not change DonationMinerStorageV5. Create a new * contract which implements DonationMinerStorageV4 and following the naming convention * DonationMinerStorageVX. */ abstract contract DonationMinerStorageV5 is DonationMinerStorageV4 { IAirdropV3 public override airdropV3; IMicrocredit public override microcredit; address public override recurringCronAddress; }
/donationMiner/interfaces/IDonationMiner.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../../community/interfaces/ICommunityAdmin.sol"; import "../../community/interfaces/ICommunity.sol"; import "../../treasury/interfaces/ITreasury.sol"; import "../../staking/interfaces/IStaking.sol"; import "../../airdropV3/interfaces/IAirdropV3.sol"; import "../../microcredit/interfaces/IMicrocredit.sol"; interface IDonationMiner { struct RewardPeriod { //reward tokens created per block uint256 rewardPerBlock; //reward tokens from previous periods + reward tokens from this reward period uint256 rewardAmount; //block number at which reward period starts uint256 startBlock; //block number at which reward period ends uint256 endBlock; //total of donations for this rewardPeriod uint256 donationsAmount; //amounts donated by every donor in this rewardPeriod mapping(address => uint256) donorAmounts; uint256 againstPeriods; //total stake amount at the end of this rewardPeriod uint256 stakesAmount; //ratio between 1 cUSD donated and 1 PACT staked uint256 stakingDonationRatio; //true if user has staked/unstaked in this reward period mapping(address => bool) hasSetStakeAmount; //stake amount of a user at the end of this reward period; //if a user doesn't stake/unstake in a reward period, // this value will remain 0 (and hasSetStakeAmount will be false) //if hasNewStakeAmount is false it means the donorStakeAmount // is the same as the last reward period where hasSetStakeAmount is true mapping(address => uint256) donorStakeAmounts; } struct Donor { uint256 lastClaim; //last reward period index for which the donor has claimed the reward; used until v2 uint256 rewardPeriodsCount; //total number of reward periods in which the donor donated mapping(uint256 => uint256) rewardPeriods; //list of all reward period ids in which the donor donated uint256 lastClaimPeriod; //last reward period id for which the donor has claimed the reward } struct Donation { address donor; //address of the donner address target; //address of the receiver (community or treasury) uint256 rewardPeriod; //number of the reward period in which the donation was made uint256 blockNumber; //number of the block in which the donation was executed uint256 amount; //the convertedAmount value IERC20 token; //address of the token uint256 initialAmount; //number of tokens donated } function getVersion() external pure returns(uint256); function cUSD() external view returns (IERC20); function PACT() external view returns (IERC20); function treasury() external view returns (ITreasury); function staking() external view returns (IStaking); function airdropV3() external view returns (IAirdropV3); function microcredit() external view returns (IMicrocredit); function recurringCronAddress() external view returns (address); function rewardPeriodSize() external view returns (uint256); function decayNumerator() external view returns (uint256); function decayDenominator() external view returns (uint256); function stakingDonationRatio() external view returns (uint256); function communityDonationRatio() external view returns (uint256); function rewardPeriodCount() external view returns (uint256); function donationCount() external view returns (uint256); function rewardPeriods(uint256 _period) external view returns ( uint256 rewardPerBlock, uint256 rewardAmount, uint256 startBlock, uint256 endBlock, uint256 donationsAmount, uint256 againstPeriods, uint256 stakesAmount, uint256 stakingDonationRatio ); function rewardPeriodDonorAmount(uint256 _period, address _donor) external view returns (uint256); function rewardPeriodDonorStakeAmounts(uint256 _period, address _donor) external view returns (uint256); function donors(address _donor) external view returns ( uint256 rewardPeriodsCount, uint256 lastClaim, uint256 lastClaimPeriod ); function donorRewardPeriod(address _donor, uint256 _rewardPeriodIndex) external view returns (uint256); function donations(uint256 _index) external view returns ( address donor, address target, uint256 rewardPeriod, uint256 blockNumber, uint256 amount, IERC20 token, uint256 initialAmount ); function claimDelay() external view returns (uint256); function againstPeriods() external view returns (uint256); function updateRewardPeriodParams( uint256 _newRewardPeriodSize, uint256 _newDecayNumerator, uint256 _newDecayDenominator ) external; function updateClaimDelay(uint256 _newClaimDelay) external; function updateStakingDonationRatio(uint256 _newStakingDonationRatio) external; function updateCommunityDonationRatio(uint256 _newCommunityDonationRatio) external; function updateAgainstPeriods(uint256 _newAgainstPeriods) external; function updateTreasury(ITreasury _newTreasury) external; function updateStaking(IStaking _newStaking) external; function updateAirdropV3(IAirdropV3 _newAirdropV3) external; function updateMicrocredit(IMicrocredit newMicrocredit) external; function updateRecurringCronAddress(address newRecurringCronAddress) external; function donate(IERC20 _token, uint256 _amount, address _delegateAddress) external; function donateToCommunity(ICommunity _community, IERC20 _token, uint256 _amount, address _delegateAddress) external; function donateVirtual(uint256 _amount, address _delegateAddress) external; function donateFrom(address from, IERC20 token, uint256 amount, address delegateAddress) external; function claimRewards() external; function claimRewardsPartial(uint256 _lastPeriodNumber) external; function stakeRewards() external; function stakeRewardsPartial(uint256 _lastPeriodNumber) external; function calculateClaimableRewards(address _donor) external returns (uint256); function calculateClaimableRewardsByPeriodNumber(address _donor, uint256 _lastPeriodNumber) external returns (uint256); function estimateClaimableReward(address _donor) external view returns (uint256); function estimateClaimableRewardAdvance(address _donor) external view returns (uint256); function estimateClaimableRewardByStaking(address _donor) external view returns (uint256); function apr(address _stakeholderAddress) external view returns (uint256); function generalApr() external view returns (uint256); function lastPeriodsDonations(address _donor) external view returns (uint256 donorAmount, uint256 totalAmount); function transfer(IERC20 _token, address _to, uint256 _amount) external; function setStakingAmounts(address _holderAddress, uint256 _holderStakeAmount, uint256 _totalStakesAmount) external; function currentRewardPeriodNumber() external view returns (uint256); }
/externalInterfaces/openzeppelin/IMintableERC20.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; interface IMintableERC20 { function mint(address _account, uint96 _amount) external; function burn(address _account, uint96 _amount) external; function totalSupply() external view returns (uint256); function balanceOf(address _account) external view returns (uint256); function transfer(address _recipient, uint256 _amount) external returns (bool); function allowance(address _owner, address _spender) external view returns (uint256); function approve(address _spender, uint256 _amount) external returns (bool); function transferFrom( address _sender, address _recipient, uint256 _amount ) external returns (bool); }
/externalInterfaces/socialConnect/ISocialConnect.sol
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.4; interface ISocialConnect { /** * @notice Returns identifiers mapped to `account` by signers of `trustedIssuers` * @param account Address of the account * @param trustedIssuers Array of n issuers whose identifier mappings will be used * @return countsPerIssuer Array of number of identifiers returned per issuer * @return identifiers Array (length == sum([0])) of identifiers * @dev Adds identifier info to the arrays in order of provided trustedIssuers * @dev Expectation that only one attestation exists per (identifier, issuer, account) */ function lookupIdentifiers(address account, address[] calldata trustedIssuers) external view returns (uint256[] memory countsPerIssuer, bytes32[] memory identifiers); }
/externalInterfaces/uniswapV3/INonfungiblePositionManager.sol
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.4; pragma abicoder v2; /// @title Non-fungible token for positions /// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred /// and authorized. interface INonfungiblePositionManager { /// @notice Emitted when liquidity is increased for a position NFT /// @dev Also emitted when a token is minted /// @param tokenId The ID of the token for which liquidity was increased /// @param liquidity The amount by which liquidity for the NFT position was increased /// @param amount0 The amount of token0 that was paid for the increase in liquidity /// @param amount1 The amount of token1 that was paid for the increase in liquidity event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); /// @notice Emitted when liquidity is decreased for a position NFT /// @param tokenId The ID of the token for which liquidity was decreased /// @param liquidity The amount by which liquidity for the NFT position was decreased /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); /// @notice Emitted when tokens are collected for a position NFT /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior /// @param tokenId The ID of the token for which underlying tokens were collected /// @param recipient The address of the account that received the collected tokens /// @param amount0 The amount of token0 owed to the position that was collected /// @param amount1 The amount of token1 owed to the position that was collected event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1); /// @notice Returns the position information associated with a given token ID. /// @dev Throws if the token ID is not valid. /// @param tokenId The ID of the token that represents the position /// @return nonce The nonce for permits /// @return operator The address that is approved for spending /// @return token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific pool /// @return fee The fee associated with the pool /// @return tickLower The lower end of the tick range for the position /// @return tickUpper The higher end of the tick range for the position /// @return liquidity The liquidity of the position /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation function positions(uint256 tokenId) external view returns ( uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } /// @notice Creates a new position wrapped in a NFT /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized /// a method does not exist, i.e. the pool is assumed to be initialized. /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata /// @return tokenId The ID of the token that represents the minted position /// @return liquidity The amount of liquidity for this position /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function mint(MintParams calldata params) external payable returns ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender` /// @param params tokenId The ID of the token for which liquidity is being increased, /// amount0Desired The desired amount of token0 to be spent, /// amount1Desired The desired amount of token1 to be spent, /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check, /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check, /// deadline The time by which the transaction must be included to effect the change /// @return liquidity The new liquidity amount as a result of the increase /// @return amount0 The amount of token0 to acheive resulting liquidity /// @return amount1 The amount of token1 to acheive resulting liquidity function increaseLiquidity(IncreaseLiquidityParams calldata params) external payable returns ( uint128 liquidity, uint256 amount0, uint256 amount1 ); struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Decreases the amount of liquidity in a position and accounts it to the position /// @param params tokenId The ID of the token for which liquidity is being decreased, /// amount The amount by which liquidity will be decreased, /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity, /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity, /// deadline The time by which the transaction must be included to effect the change /// @return amount0 The amount of token0 accounted to the position's tokens owed /// @return amount1 The amount of token1 accounted to the position's tokens owed function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1); struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient /// @param params tokenId The ID of the NFT for which tokens are being collected, /// recipient The account that should receive the tokens, /// amount0Max The maximum amount of token0 to collect, /// amount1Max The maximum amount of token1 to collect /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens /// must be collected first. /// @param tokenId The ID of the token that is being burned function burn(uint256 tokenId) external payable; function ownerOf(uint256 tokenId) external view returns(address); }
/externalInterfaces/uniswapV3/IQuoter.sol
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.4; pragma abicoder v2; /// @title Quoter Interface /// @notice Supports quoting the calculated amounts from exact input or exact output swaps /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. interface IQuoter { /// @notice Returns the amount out received for a given exact input swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountIn The amount of the first token to swap /// @return amountOut The amount of the last token that would be received function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); /// @notice Returns the amount out received for a given exact input but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountIn The desired input amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountOut The amount of `tokenOut` that would be received function quoteExactInputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountOut); /// @notice Returns the amount in required for a given exact output swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order /// @param amountOut The amount of the last token to receive /// @return amountIn The amount of first token required to be paid function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn); /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountOut The desired output amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountIn The amount required as the input for the swap in order to receive `amountOut` function quoteExactOutputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountOut, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountIn); }
/externalInterfaces/uniswapV3/IUniswapRouter02.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; /// @title Router token swapping functionality interface IUniswapRouter02 { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, /// and swap the entire amount, enabling contracts to send tokens before calling this function. /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, /// and swap the entire amount, enabling contracts to send tokens before calling this function. /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); }
/governor/impactMarketCouncil/interfaces/IImpactMarketCouncil.sol
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; interface IImpactMarketCouncil { struct Proposal { // Unique id for looking up a proposal uint256 id; // Creator of the proposal address proposer; // The block at which voting ends: votes must be cast prior to this block uint256 endBlock; // Current number of votes in favor of this proposal uint256 forVotes; // Current number of votes in opposition to this proposal uint256 againstVotes; // Current number of votes for abstaining for this proposal uint256 abstainVotes; // Flag marking whether the proposal has been canceled bool canceled; // Flag marking whether the proposal has been executed bool executed; } /// @notice Ballot receipt record for a voter struct Receipt { // Whether or not a vote has been cast bool hasVoted; // Whether or not the voter supports the proposal or abstains uint8 support; // The number of votes the voter had, which were cast uint96 votes; } /// @notice Possible states that a proposal may be in enum ProposalState { Pending, Active, Canceled, Expired, Succeeded, Executed } }
/microcredit/interfaces/IMicrocredit.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../../donationMiner/interfaces/IDonationMiner.sol"; interface IMicrocredit { struct UserOld { LoanOld[] loans; } struct LoanOld { uint256 amountBorrowed; uint256 period; // the number of seconds after a loan should be fully repaid uint256 dailyInterest; uint256 claimDeadline; uint256 startDate; // the timestamp the user claimed the amountBorrowed uint256 lastComputedDebt; uint256 amountRepayed; Repayment[] repayments; uint256 lastComputedDate; address managerAddress; } struct WalletMetadata { uint256 userId; address movedTo; } struct User { uint256 loansLength; mapping(uint256 => Loan) loans; } struct Manager { uint256 currentLentAmountLimit; uint256 currentLentAmount; } struct Repayment { uint256 date; uint256 amount; } struct Loan { uint256 amountBorrowed; uint256 period; // the number of seconds after a loan should be fully repaid uint256 dailyInterest; uint256 claimDeadline; uint256 startDate; // the timestamp the user claimed the amountBorrowed uint256 lastComputedDebt; uint256 amountRepayed; uint256 repaymentsLength; mapping(uint256 => Repayment) repayments; uint256 lastComputedDate; address managerAddress; } function getVersion() external pure returns(uint256); function cUSD() external view returns(IERC20); function revenueAddress() external view returns(address); function donationMiner() external view returns(IDonationMiner); function walletMetadata(address userAddress) external view returns(uint256 userId, address movedTo, uint256 loansLength); function userLoans(address userAddress, uint256 loanId) external view returns( uint256 amountBorrowed, uint256 period, uint256 dailyInterest, uint256 claimDeadline, uint256 startDate, uint256 lastComputedDebt, uint256 currentDebt, uint256 amountRepayed, uint256 repaymentsLength, uint256 lastComputedDate, address managerAddress ); function userLoanRepayments(address userAddress, uint256 loanId, uint256 repaymentId) external view returns( uint256 date, uint256 amount); function walletListAt(uint256 index) external view returns (address); function walletListLength() external view returns (uint256); function managerListAt(uint256 index) external view returns (address); function managerListLength() external view returns (uint256); function managers(address managerAddress) external view returns ( uint256 currentLentAmountLimit, uint256 currentLentAmount ); function updateRevenueAddress(address newRevenueAddress) external; function updateDonationMiner(IDonationMiner newDonationMiner) external; function addManagers(address[] calldata managerAddresses, uint256[] calldata currentLentAmountLimit) external; function removeManagers(address[] calldata managerAddresses) external; function addLoan( address userAddress, uint256 amount, uint256 period, uint256 dailyInterest, uint256 claimDeadline ) external; function addLoans( address[] calldata userAddresses, uint256[] calldata amounts, uint256[] calldata periods, uint256[] calldata dailyInterests, uint256[] calldata claimDeadlines ) external; function cancelLoans( address[] calldata userAddresses, uint256[] calldata loansIds ) external; function changeUserAddress(address oldWalletAddress, address newWalletAddress) external; function claimLoan(uint256 loanId) external; function repayLoan(uint256 loanId, uint256 repaymentAmount) external; function changeManager(address[] memory borrowerAddresses, address managerAddress) external; function transferERC20(IERC20 _token, address _to, uint256 _amount) external; }
/staking/interfaces/IStaking.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../../donationMiner/interfaces/IDonationMiner.sol"; import "../../externalInterfaces/openzeppelin/IMintableERC20.sol"; interface IStaking { struct Unstake { uint256 amount; //amount unstaked uint256 cooldownBlock; //first block number that will allow holder to claim this unstake } struct Holder { uint256 amount; // amount of PACT that are staked by holder uint256 nextUnstakeId; // Unstake[] unstakes; //list of all unstakes amount } function getVersion() external pure returns(uint256); function updateCooldown(uint256 _newCooldown) external; function PACT() external view returns (IERC20); function SPACT() external view returns (IMintableERC20); function donationMiner() external view returns (IDonationMiner); function cooldown() external view returns(uint256); function currentTotalAmount() external view returns(uint256); function stakeholderAmount(address _holderAddress) external view returns(uint256); function stakeholder(address _holderAddress) external view returns (uint256 amount, uint256 nextUnstakeId, uint256 unstakeListLength, uint256 unstakedAmount); function stakeholderUnstakeAt(address _holderAddress, uint256 _unstakeIndex) external view returns (Unstake memory); function stakeholdersListAt(uint256 _index) external view returns (address); function stakeholdersListLength() external view returns (uint256); function stake(address _holder, uint256 _amount) external; function unstake(uint256 _amount) external; function claim() external; function claimPartial(uint256 _lastUnstakeId) external; function claimAmount(address _holderAddress) external view returns (uint256); }
/treasury/interfaces/ITreasury.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../../community/interfaces/ICommunityAdmin.sol"; import "../../treasuryLpSwap/interfaces/ITreasuryLpSwap.sol"; import "../../donationMiner/interfaces/IDonationMiner.sol"; interface ITreasury { enum LpStrategy { //strategy to use for splitting the LP fees between treasury and buyback NONE, //all funds remains into treasury MainCoin, //for UBI coins (like cUSD): UBI coin fees are kept in treasury, PACT fees are used for buyback SecondaryCoin //for non UBI coins (like cEUR): half of the fees are swapped to PACT and used for buyback, // half of the fees are swapped to cUSD and kept in treasury // (PACT fees are used for buyback) } struct Token { uint256 rate; //rate of the token in CUSD LpStrategy lpStrategy; //strategy to use for splitting the LP fees between treasury and buyback uint256 lpPercentage; //percentage of the funds to be used for LP uint256 lpMinLimit; //minimum amount of funds that need to be in the treasury (and not to be used for LP) uint256 uniswapNFTPositionManagerId; //id of the NFT position manager bytes exchangePathToCUSD; //uniswap path to exchange the token to CUSD bytes exchangePathToPACT; //uniswap path to exchange the token to PACT } function getVersion() external pure returns(uint256); function communityAdmin() external view returns(ICommunityAdmin); function lpSwap() external view returns(ITreasuryLpSwap); function PACT() external view returns (IERC20); function donationMiner() external view returns (IDonationMiner); function updateCommunityAdmin(ICommunityAdmin _communityAdmin) external; function updateLpSwap(ITreasuryLpSwap _lpSwap) external; function updatePACT(IERC20 _newPACT) external; function updateDonationMiner(IDonationMiner _newDonationMiner) external; function transfer(IERC20 _token, address _to, uint256 _amount) external; function isToken(address _tokenAddress) external view returns (bool); function tokenListLength() external view returns (uint256); function tokenListAt(uint256 _index) external view returns (address); function tokens(address _tokenAddress) external view returns ( uint256 rate, LpStrategy lpStrategy, uint256 lpPercentage, uint256 lpMinLimit, uint256 uniswapNFTPositionManagerId, bytes calldata exchangePathToCUSD, bytes calldata exchangePathToPACT ); function setToken( address _tokenAddress, uint256 _rate, LpStrategy _lpStrategy, uint256 _lpPercentage, uint256 _lpMinLimit, uint256 _uniswapNFTPositionManagerId, bytes memory _exchangePathToCUSD, bytes memory _exchangePathToPACT ) external; function removeToken(address _tokenAddress) external; function getConvertedAmount(address _tokenAddress, uint256 _amount) external returns (uint256); function convertAmount( address _tokenAddress, uint256 _amountIn, uint256 _amountOutMin, bytes memory _exchangePath ) external; function useFundsForLP() external; function collectFees(uint256 _uniswapNFTPositionManagerId) external; }
/treasuryLpSwap/interfaces/ITreasuryLpSwap.sol
//SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.4; import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../../treasury/interfaces/ITreasury.sol"; import "../../externalInterfaces/uniswapV3/INonfungiblePositionManager.sol"; import "../../externalInterfaces/uniswapV3/IUniswapRouter02.sol"; import "../../externalInterfaces/uniswapV3/IQuoter.sol"; interface ITreasuryLpSwap { function getVersion() external pure returns(uint256); function treasury() external view returns(ITreasury); function uniswapRouter() external view returns(IUniswapRouter02); function uniswapQuoter() external view returns(IQuoter); function uniswapNFTPositionManager() external view returns(INonfungiblePositionManager); function updateTreasury(ITreasury _treasury) external; function updateUniswapRouter(IUniswapRouter02 _uniswapRouter) external; function updateUniswapQuoter(IQuoter _uniswapQuoter) external; function updateUniswapNFTPositionManager(INonfungiblePositionManager _newUniswapNFTPositionManager) external; function transfer(IERC20 _token, address _to, uint256 _amount) external; function convertAmount( address _tokenAddress, uint256 _amountIn, uint256 _amountOutMin, bytes memory _exchangePath ) external; function addToLp(IERC20 _token, uint256 _amount) external; function collectFees(uint256 _uniswapNFTPositionManagerId) external returns (uint256 amount0, uint256 amount1); function decreaseLiquidity(uint256 _uniswapNFTPositionManagerId, uint128 _liquidityAmount) external returns (uint256 amount0, uint256 amount1); }
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/donationMiner/DonationMinerImplementation.sol":"DonationMinerImplementation"}}
Contract ABI
[{"type":"event","name":"AgainstPeriodsUpdated","inputs":[{"type":"uint256","name":"oldAgainstPeriods","internalType":"uint256","indexed":false},{"type":"uint256","name":"newAgainstPeriods","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ClaimDelayUpdated","inputs":[{"type":"uint256","name":"oldClaimDelay","internalType":"uint256","indexed":false},{"type":"uint256","name":"newClaimDelay","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CommunityDonationRatioUpdated","inputs":[{"type":"uint256","name":"oldCommunityDonationRatio","internalType":"uint256","indexed":false},{"type":"uint256","name":"newCommunityDonationRatio","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DonationAdded","inputs":[{"type":"uint256","name":"donationId","internalType":"uint256","indexed":true},{"type":"address","name":"delegateAddress","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"initialAmount","internalType":"uint256","indexed":false},{"type":"address","name":"target","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardClaimed","inputs":[{"type":"address","name":"donor","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardClaimedPartial","inputs":[{"type":"address","name":"donor","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"lastRewardPeriod","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardPeriodParamsUpdated","inputs":[{"type":"uint256","name":"oldRewardPeriodSize","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldDecayNumerator","internalType":"uint256","indexed":false},{"type":"uint256","name":"oldDecayDenominator","internalType":"uint256","indexed":false},{"type":"uint256","name":"newRewardPeriodSize","internalType":"uint256","indexed":false},{"type":"uint256","name":"newDecayNumerator","internalType":"uint256","indexed":false},{"type":"uint256","name":"newDecayDenominator","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardStaked","inputs":[{"type":"address","name":"donor","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardStakedPartial","inputs":[{"type":"address","name":"donor","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"lastRewardPeriod","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StakingDonationRatioUpdated","inputs":[{"type":"uint256","name":"oldStakingDonationRatio","internalType":"uint256","indexed":false},{"type":"uint256","name":"newStakingDonationRatio","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StakingUpdated","inputs":[{"type":"address","name":"oldStaking","internalType":"address","indexed":true},{"type":"address","name":"newStaking","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TransferERC20","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TreasuryUpdated","inputs":[{"type":"address","name":"oldTreasury","internalType":"address","indexed":true},{"type":"address","name":"newTreasury","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"PACT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"againstPeriods","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IAirdropV3"}],"name":"airdropV3","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"apr","inputs":[{"type":"address","name":"_stakeholderAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"cUSD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateClaimableRewards","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateClaimableRewardsByPeriodNumber","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"},{"type":"uint256","name":"_lastPeriodNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimDelay","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimRewardsPartial","inputs":[{"type":"uint256","name":"_lastPeriodNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"communityDonationRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentRewardPeriodNumber","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"decayDenominator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"decayNumerator","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"donate","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_delegateAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"donateFrom","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_delegateAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"donateToCommunity","inputs":[{"type":"address","name":"_community","internalType":"contract ICommunity"},{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_delegateAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"donateVirtual","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_delegateAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"donationCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"donor","internalType":"address"},{"type":"address","name":"target","internalType":"address"},{"type":"uint256","name":"rewardPeriod","internalType":"uint256"},{"type":"uint256","name":"blockNumber","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"token","internalType":"contract IERC20Upgradeable"},{"type":"uint256","name":"initialAmount","internalType":"uint256"}],"name":"donations","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"donorRewardPeriod","inputs":[{"type":"address","name":"_donor","internalType":"address"},{"type":"uint256","name":"_rewardPeriodIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"donorScore","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"lastClaim","internalType":"uint256"},{"type":"uint256","name":"rewardPeriodsCount","internalType":"uint256"},{"type":"uint256","name":"lastClaimPeriod","internalType":"uint256"}],"name":"donors","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"estimateClaimableReward","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"estimateClaimableRewardAdvance","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"estimateClaimableRewardByStaking","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"generalApr","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersion","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_cUSD","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_PACT","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_treasury","internalType":"contract ITreasury"},{"type":"uint256","name":"_firstRewardPerBlock","internalType":"uint256"},{"type":"uint256","name":"_rewardPeriodSize","internalType":"uint256"},{"type":"uint256","name":"_startingBlock","internalType":"uint256"},{"type":"uint256","name":"_decayNumerator","internalType":"uint256"},{"type":"uint256","name":"_decayDenominator","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"donorAmount","internalType":"uint256"},{"type":"uint256","name":"totalAmount","internalType":"uint256"}],"name":"lastPeriodsDonations","inputs":[{"type":"address","name":"_donorAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMicrocredit"}],"name":"microcredit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"recurringCronAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPeriodCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPeriodDonorAmount","inputs":[{"type":"uint256","name":"_period","internalType":"uint256"},{"type":"address","name":"_donor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPeriodDonorStakeAmounts","inputs":[{"type":"uint256","name":"_period","internalType":"uint256"},{"type":"address","name":"_donor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPeriodSize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"rewardPerBlock","internalType":"uint256"},{"type":"uint256","name":"rewardAmount","internalType":"uint256"},{"type":"uint256","name":"startBlock","internalType":"uint256"},{"type":"uint256","name":"endBlock","internalType":"uint256"},{"type":"uint256","name":"donationsAmount","internalType":"uint256"},{"type":"uint256","name":"againstPeriods","internalType":"uint256"},{"type":"uint256","name":"stakesAmount","internalType":"uint256"},{"type":"uint256","name":"stakingDonationRatio","internalType":"uint256"}],"name":"rewardPeriods","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStakingAmounts","inputs":[{"type":"address","name":"_holderAddress","internalType":"address"},{"type":"uint256","name":"_holderAmount","internalType":"uint256"},{"type":"uint256","name":"_totalAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakeRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakeRewardsPartial","inputs":[{"type":"uint256","name":"_lastPeriodNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStaking"}],"name":"staking","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakingDonationRatio","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transfer","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITreasury"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateAgainstPeriods","inputs":[{"type":"uint256","name":"_newAgainstPeriods","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateAirdropV3","inputs":[{"type":"address","name":"_newAirdropV3","internalType":"contract IAirdropV3"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateClaimDelay","inputs":[{"type":"uint256","name":"_newClaimDelay","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCommunityDonationRatio","inputs":[{"type":"uint256","name":"_newCommunityDonationRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMicrocredit","inputs":[{"type":"address","name":"_newMicrocredit","internalType":"contract IMicrocredit"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRecurringCronAddress","inputs":[{"type":"address","name":"_newRecurringCronAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewardPeriodParams","inputs":[{"type":"uint256","name":"_newRewardPeriodSize","internalType":"uint256"},{"type":"uint256","name":"_newDecayNumerator","internalType":"uint256"},{"type":"uint256","name":"_newDecayDenominator","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateStaking","inputs":[{"type":"address","name":"_newStaking","internalType":"contract IStaking"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateStakingDonationRatio","inputs":[{"type":"uint256","name":"_newStakingDonationRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTreasury","inputs":[{"type":"address","name":"_newTreasury","internalType":"contract ITreasury"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50614427806100206000396000f3fe608060405234801561001057600080fd5b506004361061038e5760003560e01c806392ade299116101de578063cf4287951161010f578063e57919d6116100ad578063f2fde38b1161007c578063f2fde38b14610824578063f8626af814610837578063fa865909146108d5578063fef4af86146108e857600080fd5b8063e57919d6146107ed578063ed409ff3146107f5578063efcf98e6146107fe578063f223c9731461081157600080fd5b8063de8f41ba116100e9578063de8f41ba146107a1578063df8fa430146107b4578063e247b8d8146107c7578063e48508df146107da57600080fd5b8063cf4287951461074c578063cf9d0b5f14610786578063de709c941461078e57600080fd5b8063ad3e48c51161017c578063c38474c011610156578063c38474c0146106d3578063c89d1a8e146106dc578063ca0cdea8146106ef578063cd75000c1461073957600080fd5b8063ad3e48c51461069a578063bc4643ee146106ad578063beabacc8146106c057600080fd5b8063a4b01bf5116101b8578063a4b01bf51461066c578063a70e940b1461067f578063a915da5614610688578063ac9e03881461069157600080fd5b806392ade2991461063d57806396990e6e14610646578063a345f38d1461065957600080fd5b806353d5a0cf116102c357806374700428116102615780638901e985116102305780638901e985146105f35780638a15e40f146106065780638da5cb5b1461061957806390cc1d7d1461062a57600080fd5b8063747004281461052e5780637f51bb1f14610541578063821787ec146105545780638252097d1461056757600080fd5b806361d027b31161029d57806361d027b3146104ed5780636cc40c2c146105005780636d0acb4314610513578063715018a61461052657600080fd5b806353d5a0cf146104b157806359d0bfff146104c45780635c975abb146104d757600080fd5b80632bef5eef116103305780633b9a01761161030a5780633b9a01761461043e5780633ddec531146104515780634cf088d91461048b57806353d541c11461049e57600080fd5b80632bef5eef1461041057806336ae5c9814610423578063372500ab1461043657600080fd5b80631569cc951161036c5780631569cc95146103cb5780631c8ec299146103d35780631fccf672146103dc5780632abfab4d1461040757600080fd5b806307ea4e57146103935780630d1e9b4a146103af5780630d8e6e2c146103c4575b600080fd5b61039c60cf5481565b6040519081526020015b60405180910390f35b6103c26103bd366004613eed565b610910565b005b600561039c565b61039c610ab3565b61039c60d45481565b60c9546103ef906001600160a01b031681565b6040516001600160a01b0390911681526020016103a6565b61039c60cd5481565b61039c61041e366004613f7d565b610b0d565b60da546103ef906001600160a01b031681565b6103c2610b3a565b60ca546103ef906001600160a01b031681565b61039c61045f366004613d87565b6001600160a01b0391909116600090815260d36020908152604080832093835260029093019052205490565b60d6546103ef906001600160a01b031681565b61039c6104ac366004613d19565b610c29565b6103c26104bf366004613d19565b610ddb565b6103c26104d2366004613e22565b610e27565b60655460ff1660405190151581526020016103a6565b60cb546103ef906001600160a01b031681565b6103c261050e366004613f4d565b6111a8565b6103c2610521366004613f4d565b6113f8565b6103c2611463565b6103c261053c366004613d19565b611499565b6103c261054f366004613d19565b6114e5565b61039c610562366004613d87565b61156b565b6105b8610575366004613f4d565b60d2602052600090815260409020805460018201546002830154600384015460048501546006860154600787015460089097015495969495939492939192909188565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c083015260e0820152610100016103a6565b6103c2610601366004613f4d565b611690565b6103c2610614366004613d35565b611703565b6033546001600160a01b03166103ef565b60db546103ef906001600160a01b031681565b61039c60d05481565b61039c610654366004613d19565b6118bc565b6103c2610667366004613d19565b6119d9565b6103c261067a366004613f4d565b611a5f565b61039c60d55481565b61039c60d85481565b61039c60d75481565b6103c26106a8366004613db2565b611ad2565b6103c26106bb366004613f7d565b611c7c565b6103c26106ce366004613e37565b611d19565b61039c60ce5481565b61039c6106ea366004613d19565b611dd6565b61071e6106fd366004613d19565b60d36020526000908152604090208054600182015460039092015490919083565b604080519384526020840192909252908201526060016103a6565b61039c610747366004613d19565b611e3f565b61039c61075a366004613f7d565b600082815260d2602090815260408083206001600160a01b0385168452600a0190915290205492915050565b6103c2611e67565b6103c261079c366004613d19565b612029565b6103c26107af366004613f4d565b612075565b6103c26107c2366004613e77565b6121e7565b6103c26107d5366004613f4d565b612564565b6103c26107e8366004613fac565b6125cf565b61039c612688565b61039c60cc5481565b60d9546103ef906001600160a01b031681565b61039c61081f366004613d19565b61280f565b6103c2610832366004613d19565b612823565b610891610845366004613f4d565b60d16020526000908152604090208054600182015460028301546003840154600485015460058601546006909601546001600160a01b0395861696948616959394929391929091169087565b604080516001600160a01b03988916815296881660208801528601949094526060850192909252608084015290921660a082015260c081019190915260e0016103a6565b61039c6108e3366004613d19565b6128be565b6108fb6108f6366004613d19565b612928565b604080519283526020830191909152016103a6565b60655460ff161561093c5760405162461bcd60e51b81526004016109339061405d565b60405180910390fd5b600160005260d26020526000805160206143d2833981519152544310156109755760405162461bcd60e51b815260040161093390614026565b600260975414156109985760405162461bcd60e51b8152600401610933906141b8565b600260975560cb546040516319f3736160e01b81526001600160a01b038581166004830152909116906319f373619060240160206040518083038186803b1580156109e257600080fd5b505afa1580156109f6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1a9190613de6565b610a725760405162461bcd60e51b8152602060048201526024808201527f446f6e6174696f6e4d696e65723a3a646f6e6174653a20496e76616c6964207460448201526337b5b2b760e11b6064820152608401610933565b60cb54610a8e906001600160a01b03858116913391168561297b565b60cb54610aa9908290859085906001600160a01b03166129ec565b5050600160975550565b60ce54600090815260d26020526040812060030154438111610b035760cc54610adc8243614331565b610ae69190614207565b60ce54610af391906141ef565b610afe9060016141ef565b610b07565b60ce545b91505090565b600082815260d2602090815260408083206001600160a01b03851684526005019091529020545b92915050565b60655460ff1615610b5d5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015610b965760405162461bcd60e51b815260040161093390614026565b60026097541415610bb95760405162461bcd60e51b8152600401610933906141b8565b60026097556000610bd133610bcc612c42565b612c89565b60ca54909150610beb906001600160a01b03163383612e06565b60405181815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241906020015b60405180910390a2506001609755565b6001600090815260d26020526000805160206143d283398151915254431015610c645760405162461bcd60e51b815260040161093390614026565b60655460ff1615610c875760405162461bcd60e51b81526004016109339061405d565b600080610c946000612928565b915060009050610ca2612e3b565b905060d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf257600080fd5b505afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a9190613f65565b60d754610d379084614312565b610d4191906141ef565b60d654604051631aefa86d60e21b81526001600160a01b03888116600483015290911690636bbea1b49060240160206040518083038186803b158015610d8657600080fd5b505afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe9190613f65565b610dc89083614312565b610dd29190614207565b95945050505050565b6033546001600160a01b03163314610e055760405162461bcd60e51b815260040161093390614087565b60db80546001600160a01b0319166001600160a01b0392909216919091179055565b60655460ff1615610e4a5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015610e835760405162461bcd60e51b815260040161093390614026565b60026097541415610ea65760405162461bcd60e51b8152600401610933906141b8565b600260975560cb5460408051632fd648bd60e11b815290516000926001600160a01b031691635fac917a916004808301926020929190829003018186803b158015610ef057600080fd5b505afa158015610f04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f289190613e06565b90506001604051633f9409e960e11b81526001600160a01b038781166004830152831690637f2813d29060240160206040518083038186803b158015610f6d57600080fd5b505afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa59190613f2e565b6003811115610fc457634e487b7160e01b600052602160045260246000fd5b146110475760405162461bcd60e51b815260206004820152604760248201527f446f6e6174696f6e4d696e65723a3a646f6e617465546f436f6d6d756e69747960448201527f3a2054686973206973206e6f7420612076616c696420636f6d6d756e697479206064820152666164647265737360c81b608482015260a401610933565b846001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b15801561108057600080fd5b505afa158015611094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b89190613e06565b6001600160a01b0316846001600160a01b0316146111305760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a646f6e617465546f436f6d6d756e69747960448201526e1d1024b73b30b634b2103a37b5b2b760891b6064820152608401610933565b60405163e69d849d60e01b8152336004820152602481018490526001600160a01b0386169063e69d849d90604401600060405180830381600087803b15801561117857600080fd5b505af115801561118c573d6000803e3d6000fd5b5050505061119c828585886129ec565b50506001609755505050565b60655460ff16156111cb5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156112045760405162461bcd60e51b815260040161093390614026565b600260975414156112275760405162461bcd60e51b8152600401610933906141b8565b6002609755611234612ebc565b60ce5481106112be5760405162461bcd60e51b815260206004820152604a60248201527f446f6e6174696f6e4d696e65723a3a7374616b6552657761726473506172746960448201527f616c3a20546869732072657761726420706572696f642069736e277420636c616064820152691a5b58589b19481e595d60b21b608482015260a401610933565b60006112ca3383612c89565b60ca5460d65460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b390604401602060405180830381600087803b15801561131c57600080fd5b505af1158015611330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113549190613de6565b5060d6546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b1580156113a157600080fd5b505af11580156113b5573d6000803e3d6000fd5b50506040518381523392507f7d3a0ab251dfd8c04c691239edd99d2c124cce6971cebc4c2ed96a378d13d50091506020015b60405180910390a250506001609755565b6033546001600160a01b031633146114225760405162461bcd60e51b815260040161093390614087565b60d85460408051918252602082018390527f300b3540c99261403e527f171e281f3dfb0705395e1902af7e9badcddce56e5e910160405180910390a160d855565b6033546001600160a01b0316331461148d5760405162461bcd60e51b815260040161093390614087565b6114976000612ffd565b565b6033546001600160a01b031633146114c35760405162461bcd60e51b815260040161093390614087565b60da80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b0316331461150f5760405162461bcd60e51b815260040161093390614087565b60cb546040516001600160a01b038084169216907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a90600090a360cb80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce54600090815260d2602052604081206003015481904311156115cc5760cc5460ce54600090815260d260205260409020600301546115ab9043614331565b6115b59190614207565b905060ce54816115c591906141ef565b90506115de565b600160ce546115db9190614331565b90505b8083111561167a5760405162461bcd60e51b815260206004820152605e60248201527f446f6e6174696f6e4d696e65723a3a63616c63756c617465436c61696d61626c60448201527f65526577617264734279506572696f644e756d6265723a20546869732072657760648201527f61726420706572696f642069736e277420617661696c61626c65207965740000608482015260a401610933565b6000611686858561304f565b5095945050505050565b6033546001600160a01b031633146116ba5760405162461bcd60e51b815260040161093390614087565b6116c2612ebc565b60d75460408051918252602082018390527fb7ce19da4d8265c844e0fa744e3429c62104c793f8ecb52d1b418b47eb9f8555910160405180910390a160d755565b60db546001600160a01b0316331461172d5760405162461bcd60e51b8152600401610933906140bc565b60655460ff16156117505760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156117895760405162461bcd60e51b815260040161093390614026565b600260975414156117ac5760405162461bcd60e51b8152600401610933906141b8565b600260975560cb546040516319f3736160e01b81526001600160a01b038581166004830152909116906319f373619060240160206040518083038186803b1580156117f657600080fd5b505afa15801561180a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182e9190613de6565b61187a5760405162461bcd60e51b815260206004820152601c60248201527f446f6e6174696f6e4d696e65723a20496e76616c696420746f6b656e000000006044820152606401610933565b60cb54611896906001600160a01b03858116918791168561297b565b60cb546118b1908290859085906001600160a01b03166129ec565b505060016097555050565b6001600090815260d26020526000805160206143d2833981519152544310156118f75760405162461bcd60e51b815260040161093390614026565b60655460ff161561191a5760405162461bcd60e51b81526004016109339061405d565b60d654604051631aefa86d60e21b81526001600160a01b0384811660048301526000921690636bbea1b49060240160206040518083038186803b15801561196057600080fd5b505afa158015611974573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119989190613f65565b9050806119a85750600092915050565b806119b4846000613475565b6119c890694d501c54214bcd300000614312565b6119d29190614207565b9392505050565b6033546001600160a01b03163314611a035760405162461bcd60e51b815260040161093390614087565b60d6546040516001600160a01b038084169216907fcfa056eb826b2a28817aa38ccb94f12ba8a1309598f7ea19bef6fd67fe04b61e90600090a360d680546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314611a895760405162461bcd60e51b815260040161093390614087565b611a91612ebc565b60d55460408051918252602082018390527fd6a28c11ae992e0014e83eaaa6f0023a04c0787848134e8b4e43f44b7d7d8e30910160405180910390a160d555565b60655460ff1615611af55760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015611b2e5760405162461bcd60e51b815260040161093390614026565b60d6546001600160a01b03163314611b885760405162461bcd60e51b815260206004820152601a60248201527f446f6e6174696f6e4d696e65723a204e4f545f5354414b494e470000000000006044820152606401610933565b611b90612ebc565b60ce54600090815260d2602090815260408083206001600160a01b0387168452600981018352818420805460ff19166001179055600a810183528184208690556007810185905560d39092529091206003810154158015611bf357506001810154155b15611c0d57600160ce54611c079190614331565b60038201555b60cb60009054906101000a90046001600160a01b03166001600160a01b0316635093141f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c5d57600080fd5b505af1158015611c71573d6000803e3d6000fd5b505050505050505050565b60655460ff1615611c9f5760405162461bcd60e51b81526004016109339061405d565b60d9546001600160a01b0316331415611cd25760cb54611cce90829060a39085906001600160a01b03166129ec565b5050565b60da546001600160a01b0316331415611d015760cb54611cce90829060c19085906001600160a01b03166129ec565b60405162461bcd60e51b8152600401610933906140bc565b6033546001600160a01b03163314611d435760405162461bcd60e51b815260040161093390614087565b60026097541415611d665760405162461bcd60e51b8152600401610933906141b8565b6002609755611d7f6001600160a01b0384168383612e06565b816001600160a01b0316836001600160a01b03167f9b035625e569d1d2bf54830a290aefba7ab11610ba8490871dc62b86b63a895683604051611dc491815260200190565b60405180910390a35050600160975550565b6001600090815260d26020526000805160206143d283398151915254431015611e115760405162461bcd60e51b815260040161093390614026565b60655460ff1615611e345760405162461bcd60e51b81526004016109339061405d565b610b34826000613475565b600080611e5f836001611e50610ab3565b611e5a9190614331565b61304f565b509392505050565b60655460ff1615611e8a5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015611ec35760405162461bcd60e51b815260040161093390614026565b60026097541415611ee65760405162461bcd60e51b8152600401610933906141b8565b6002609755611ef3612ebc565b6000611f0833600160ce54610bcc9190614331565b60ca5460d65460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b390604401602060405180830381600087803b158015611f5a57600080fd5b505af1158015611f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f929190613de6565b5060d6546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b158015611fdf57600080fd5b505af1158015611ff3573d6000803e3d6000fd5b50506040518381523392507f7d3a0ab251dfd8c04c691239edd99d2c124cce6971cebc4c2ed96a378d13d5009150602001610c19565b6033546001600160a01b031633146120535760405162461bcd60e51b815260040161093390614087565b60d980546001600160a01b0319166001600160a01b0392909216919091179055565b60655460ff16156120985760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156120d15760405162461bcd60e51b815260040161093390614026565b600260975414156120f45760405162461bcd60e51b8152600401610933906141b8565b6002609755612101612c42565b8111156121895760405162461bcd60e51b815260206004820152604a60248201527f446f6e6174696f6e4d696e65723a3a636c61696d52657761726473506172746960448201527f616c3a20546869732072657761726420706572696f642069736e277420636c616064820152691a5b58589b19481e595d60b21b608482015260a401610933565b60006121953383612c89565b60ca549091506121af906001600160a01b03163383612e06565b604080518281526020810184905233917f2233b4bbf378b3d984acd0e36cea96f66bc81012a683e81929ed96df5287ba3d91016113e7565b600054610100900460ff166122025760005460ff1615612206565b303b155b6122695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610933565b600054610100900460ff1615801561228b576000805461ffff19166101011790555b6001600160a01b0389166122f95760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20635553442060448201526e1859191c995cdcc81b9bdd081cd95d608a1b6064820152608401610933565b6001600160a01b0388166123675760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20504143542060448201526e1859191c995cdcc81b9bdd081cd95d608a1b6064820152608401610933565b6001600160a01b0387166123d25760405162461bcd60e51b815260206004820152602c60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20747265617360448201526b1d5c9e57c81b9bdd081cd95d60a21b6064820152608401610933565b856124455760405162461bcd60e51b815260206004820152603760248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20666972737460448201527f526577617264506572426c6f636b206e6f7420736574210000000000000000006064820152608401610933565b836124b85760405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20737461727460448201527f696e67526577617264506572696f64206e6f74207365742100000000000000006064820152608401610933565b846124d55760405162461bcd60e51b815260040161093390614110565b6124dd6134ce565b6124e5613505565b6124ed61353c565b60c980546001600160a01b03808c166001600160a01b03199283161790925560ca80548b841690831617905560cb8054928a169290911691909117905560cc85905560cf83905560d0829055600160ce55612548848761356b565b8015611c71576000805461ff0019169055505050505050505050565b6033546001600160a01b0316331461258e5760405162461bcd60e51b815260040161093390614087565b60d45460408051918252602082018390527f7625e5482008771a414881eb4c957803f2ab46e99e6da60df6e1310f0f009fec910160405180910390a160d455565b6033546001600160a01b031633146125f95760405162461bcd60e51b815260040161093390614087565b826126165760405162461bcd60e51b815260040161093390614110565b61261e612ebc565b60cc5460cf5460d05460408051938452602084019290925282820152606082018590526080820184905260a08201839052517f8fb29c6ced5ce51696c08668df816fab7e60c674a6c36e167d5df9b8a5f499849181900360c00190a160cc9290925560cf5560d055565b6001600090815260d26020526000805160206143d2833981519152544310156126c35760405162461bcd60e51b815260040161093390614026565b60655460ff16156126e65760405162461bcd60e51b81526004016109339061405d565b6000806126f36000612928565b915060009050612701612e3b565b90508060005b61016c81101561274b5760d05460cf546127219085614312565b61272b9190614207565b925061273783836141ef565b9150806127438161438b565b915050612707565b60d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b15801561279957600080fd5b505afa1580156127ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d19190613f65565b60d7546127de9086614312565b6127e891906141ef565b6127fb8368056bc75e2d63100000614312565b6128059190614207565b9550505050505090565b6000610b3482670de0b6b3a76400006135e2565b6033546001600160a01b0316331461284d5760405162461bcd60e51b815260040161093390614087565b6001600160a01b0381166128b25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610933565b6128bb81612ffd565b50565b6001600090815260d26020526000805160206143d2833981519152544310156128f95760405162461bcd60e51b815260040161093390614026565b60655460ff161561291c5760405162461bcd60e51b81526004016109339061405d565b610b348260d554613475565b6000806000612935610ab3565b9050600060d5548211612949576001612956565b60d5546129569083614331565b90508060ce54106129745761296e858260ce54613866565b90945092505b5050915091565b6040516001600160a01b03808516602483015283166044820152606481018290526129e69085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138db565b50505050565b6129f4612ebc565b60cd8054906000612a048361438b565b909155505060cd54600090815260d16020526040902080546001600160a01b038087166001600160a01b031992831617835560018301805485831690841617905543600384015560ce5460028401556005830180548783169316831790556006830185905560c954161480612a8257506001600160a01b03841660a3145b80612a9657506001600160a01b03841660c1145b15612aa75760048101839055612b33565b60cb5460405163f2b8995160e01b81526001600160a01b038681166004830152602482018690529091169063f2b8995190604401602060405180830381600087803b158015612af557600080fd5b505af1158015612b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2d9190613f65565b60048201555b60cb546001600160a01b03838116911614612b605760d8548160040154612b5a9190614207565b60048201555b612b7160ce548683600401546139ad565b612b7a85613a0a565b60cb60009054906101000a90046001600160a01b03166001600160a01b0316635093141f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612bca57600080fd5b505af1158015612bde573d6000803e3d6000fd5b505060cd546004840154604080519182526001600160a01b0389811660208401529082018890528087169450891692507f3d2fa2b84d5f2000d605401d563ba60e2e44f62701fdbe9f9101c59b3c215f299060600160405180910390a45050505050565b6000612c4c612ebc565b60d454612c5a9060016141ef565b60ce5411612c685750600090565b60d454600160ce54612c7a9190614331565b612c849190614331565b905090565b6001600160a01b038216600090815260d3602052604081208180612cad868661304f565b60038501549193509150851115612cc657600383018590555b600085815260d2602090815260408083206001600160a01b038a168452600a01909152902081905581612cfd57509150610b349050565b60ca546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612d4057600080fd5b505afa158015612d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d789190613f65565b821115612dfd5760ca546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612dc257600080fd5b505afa158015612dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfa9190613f65565b91505b50949350505050565b6040516001600160a01b038316602482015260448101829052612e3690849063a9059cbb60e01b906064016129af565b505050565b600080612e46610ab3565b9050600060ce5482612e589190614331565b60d054612e65919061426a565b60ce54612e729084614331565b60cf54612e7f919061426a565b60ce54600090815260d26020526040902054612e9b9190614312565b612ea59190614207565b905060cc5481612eb59190614312565b9250505090565b60ce54600090815260d2602052604090205b43816003015410156128bb5760ce8054906000612eea8361438b565b909155505060ce54600090815260d26020526040902060d55460068201556003820154612f189060016141ef565b6002820181905560cc54600191612f2f91906141ef565b612f399190614331565b600382015560d05460cf548354612f509190614312565b612f5a9190614207565b8082556007808401549083015560d754600883015560cc54600091612f7e91614312565b905060008360060154600160ce54612f969190614331565b11612fa2576001612fc0565b8360060154600160ce54612fb69190614331565b612fc09190614331565b9050612fda81600160ce54612fd59190614331565b613aa3565b612ff0576001840154612fed90836141ef565b91505b5060018201559050612ece565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600090815260d3602052604081206003810154829190829061307c9060016141ef565b905080600114156130a857815460009081526002830160205260409020546130a59060016141ef565b90505b60d26020819052600082815260408120818052909182918291829182917f20791b593a776a2631a28f4a3f62a14ad18db22add38130c4f4a8fdfa463988591908290846130f660018c614331565b8152602001908152602001600020600a0160008f6001600160a01b03166001600160a01b03168152602001908152602001600020549a505b8c8911613464576002820154156132bf576006820154613172576001600160a01b038e16600090815260058301602052604090205460048301549098509650613291565b81600601548360060154141561324f5760068201546131929060016141ef565b8911156132115760d26000836006015460018c6131af9190614331565b6131b99190614331565b815260200190815260200160002090508060050160008f6001600160a01b03166001600160a01b0316815260200190815260200160002054886131fc9190614331565b975080600401548761320e9190614331565b96505b6001600160a01b038e16600090815260058301602052604090205461323690896141ef565b975081600401548761324891906141ef565b9650613291565b816006015489111561327f576132758e83600601548b61326f9190614331565b8b613866565b9098509650613291565b61328b8e60008b613866565b90985096505b816001015495508160070154945060008260080154116132b25760016132b8565b81600801545b93506133a1565b60d5546132cd9060016141ef565b89111561334a5760d2600060d55460018c6132e89190614331565b6132f29190614331565b815260200190815260200160002090508060050160008f6001600160a01b03166001600160a01b0316815260200190815260200160002054886133359190614331565b97508060040154876133479190614331565b96505b6001600160a01b038e16600090815260058301602052604090205461336f90896141ef565b975081600401548761338191906141ef565b965060d05460cf54876133949190614312565b61339e9190614207565b95505b6001600160a01b038e16600090815260098301602052604090205460ff16156133e2576001600160a01b038e166000908152600a830160205260409020549a505b60006133ee8c8a6141ef565b111561343f57846133ff8589614312565b61340991906141ef565b8b613414868b614312565b61341e91906141ef565b6134289088614312565b6134329190614207565b61343c908d6141ef565b9b505b886134498161438b565b600081815260d260205260409020909a5092935061312e9050565b505050505050505050509250929050565b600080613480612e3b565b9050805b83156134c45760d05460cf5461349a9084614312565b6134a49190614207565b91506134b082826141ef565b9050836134bc81614374565b945050613484565b610dd285826135e2565b600054610100900460ff166134f55760405162461bcd60e51b81526004016109339061416d565b6134fd613af9565b611497613b20565b600054610100900460ff1661352c5760405162461bcd60e51b81526004016109339061416d565b613534613af9565b611497613b50565b600054610100900460ff166135635760405162461bcd60e51b81526004016109339061416d565b611497613b83565b6001600081905260d26020526000805160206143d283398151915283905560cc547fb7404ce2b5a52e61a6b5c9b4585ed65d8cb4b8848d3ee262a356d0c2c46c5f3591906135b990856141ef565b6135c39190614331565b600382015581815560cc546135d89083614312565b6001909101555050565b60008060006135f085612928565b60d654604080516319e815f960e01b815290519395509193506000926001600160a01b03909116916319e815f9916004808301926020929190829003018186803b15801561363d57600080fd5b505afa158015613651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136759190613e06565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156136ad57600080fd5b505afa1580156136c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136e59190613f65565b9050801580156136f3575081155b156137045760009350505050610b34565b60008060d7541161371657600161371a565b60d7545b905060d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b15801561376a57600080fd5b505afa15801561377e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a29190613f65565b6137ac8285614312565b6137b691906141ef565b60d654604051631aefa86d60e21b81526001600160a01b038a8116600483015290911690636bbea1b49060240160206040518083038186803b1580156137fb57600080fd5b505afa15801561380f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138339190613f65565b61383d8387614312565b61384791906141ef565b6138519088614312565b61385b9190614207565b979650505050505050565b6000808080855b8581116138ce57600081815260d2602090815260408083206001600160a01b038c16845260058101909252909120546138a690856141ef565b93508060040154836138b891906141ef565b92505080806138c69061438b565b91505061386d565b5090969095509350505050565b6000613930826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613bb19092919063ffffffff16565b805190915015612e36578080602001905181019061394e9190613de6565b612e365760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610933565b600083815260d260205260408120600481018054919284926139d09084906141ef565b90915550506001600160a01b0383166000908152600582016020526040812080548492906139ff9084906141ef565b909155505050505050565b6001600160a01b038116600090815260d36020908152604080832060018101548452600281019092529091205460ce548114613a7157600182018054906000613a528361438b565b909155505060ce54600183015460009081526002840160205260409020555b6003820154158015613a8557506001820154155b15612e3657600160ce54613a999190614331565b6003830155505050565b60005b818311613af057600083815260d2602052604081206007810154600490910154613ad091906141ef565b1115613ade57506001610b34565b82613ae88161438b565b935050613aa6565b50600092915050565b600054610100900460ff166114975760405162461bcd60e51b81526004016109339061416d565b600054610100900460ff16613b475760405162461bcd60e51b81526004016109339061416d565b61149733612ffd565b600054610100900460ff16613b775760405162461bcd60e51b81526004016109339061416d565b6065805460ff19169055565b600054610100900460ff16613baa5760405162461bcd60e51b81526004016109339061416d565b6001609755565b6060613bc08484600085613bc8565b949350505050565b606082471015613c295760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610933565b843b613c775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610933565b600080866001600160a01b03168587604051613c939190613fd7565b60006040518083038185875af1925050503d8060008114613cd0576040519150601f19603f3d011682016040523d82523d6000602084013e613cd5565b606091505b509150915061385b82828660608315613cef5750816119d2565b825115613cff5782518084602001fd5b8160405162461bcd60e51b81526004016109339190613ff3565b600060208284031215613d2a578081fd5b81356119d2816143bc565b60008060008060808587031215613d4a578283fd5b8435613d55816143bc565b93506020850135613d65816143bc565b9250604085013591506060850135613d7c816143bc565b939692955090935050565b60008060408385031215613d99578182fd5b8235613da4816143bc565b946020939093013593505050565b600080600060608486031215613dc6578283fd5b8335613dd1816143bc565b95602085013595506040909401359392505050565b600060208284031215613df7578081fd5b815180151581146119d2578182fd5b600060208284031215613e17578081fd5b81516119d2816143bc565b60008060008060808587031215613d4a578384fd5b600080600060608486031215613e4b578283fd5b8335613e56816143bc565b92506020840135613e66816143bc565b929592945050506040919091013590565b600080600080600080600080610100898b031215613e93578586fd5b8835613e9e816143bc565b97506020890135613eae816143bc565b96506040890135613ebe816143bc565b979a96995096976060810135975060808101359660a0820135965060c0820135955060e0909101359350915050565b600080600060608486031215613f01578081fd5b8335613f0c816143bc565b9250602084013591506040840135613f23816143bc565b809150509250925092565b600060208284031215613f3f578081fd5b8151600481106119d2578182fd5b600060208284031215613f5e578081fd5b5035919050565b600060208284031215613f76578081fd5b5051919050565b60008060408385031215613f8f578182fd5b823591506020830135613fa1816143bc565b809150509250929050565b600080600060608486031215613fc0578081fd5b505081359360208301359350604090920135919050565b60008251613fe9818460208701614348565b9190910192915050565b6020815260008251806020840152614012816040850160208701614348565b601f01601f19169190910160400192915050565b6020808252601e908201527f446f6e6174696f6e4d696e65723a204552525f4e4f545f535441525445440000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526034908201527f446f6e6174696f6e4d696e65723a20596f7520617265206e6f7420616c6c6f77604082015273081d1bc818d85b1b081d1a1a5cc81b595d1a1bd960621b606082015260800190565b60208082526037908201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20726577617260408201527f64506572696f6453697a6520697320696e76616c696421000000000000000000606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115614202576142026143a6565b500190565b60008261422257634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115614262578160001904821115614248576142486143a6565b8085161561425557918102915b93841c939080029061422c565b509250929050565b60006119d2838360008261428057506001610b34565b8161428d57506000610b34565b81600181146142a357600281146142ad576142c9565b6001915050610b34565b60ff8411156142be576142be6143a6565b50506001821b610b34565b5060208310610133831016604e8410600b84101617156142ec575081810a610b34565b6142f68383614227565b806000190482111561430a5761430a6143a6565b029392505050565b600081600019048311821515161561432c5761432c6143a6565b500290565b600082821015614343576143436143a6565b500390565b60005b8381101561436357818101518382015260200161434b565b838111156129e65750506000910152565b600081614383576143836143a6565b506000190190565b600060001982141561439f5761439f6143a6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146128bb57600080fdfeb7404ce2b5a52e61a6b5c9b4585ed65d8cb4b8848d3ee262a356d0c2c46c5f37a26469706673582212201dfd7d8c4eccdcceeb6d5ef33691794cd1b0ecce31f32b6254231b8b97b3d18964736f6c63430008040033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061038e5760003560e01c806392ade299116101de578063cf4287951161010f578063e57919d6116100ad578063f2fde38b1161007c578063f2fde38b14610824578063f8626af814610837578063fa865909146108d5578063fef4af86146108e857600080fd5b8063e57919d6146107ed578063ed409ff3146107f5578063efcf98e6146107fe578063f223c9731461081157600080fd5b8063de8f41ba116100e9578063de8f41ba146107a1578063df8fa430146107b4578063e247b8d8146107c7578063e48508df146107da57600080fd5b8063cf4287951461074c578063cf9d0b5f14610786578063de709c941461078e57600080fd5b8063ad3e48c51161017c578063c38474c011610156578063c38474c0146106d3578063c89d1a8e146106dc578063ca0cdea8146106ef578063cd75000c1461073957600080fd5b8063ad3e48c51461069a578063bc4643ee146106ad578063beabacc8146106c057600080fd5b8063a4b01bf5116101b8578063a4b01bf51461066c578063a70e940b1461067f578063a915da5614610688578063ac9e03881461069157600080fd5b806392ade2991461063d57806396990e6e14610646578063a345f38d1461065957600080fd5b806353d5a0cf116102c357806374700428116102615780638901e985116102305780638901e985146105f35780638a15e40f146106065780638da5cb5b1461061957806390cc1d7d1461062a57600080fd5b8063747004281461052e5780637f51bb1f14610541578063821787ec146105545780638252097d1461056757600080fd5b806361d027b31161029d57806361d027b3146104ed5780636cc40c2c146105005780636d0acb4314610513578063715018a61461052657600080fd5b806353d5a0cf146104b157806359d0bfff146104c45780635c975abb146104d757600080fd5b80632bef5eef116103305780633b9a01761161030a5780633b9a01761461043e5780633ddec531146104515780634cf088d91461048b57806353d541c11461049e57600080fd5b80632bef5eef1461041057806336ae5c9814610423578063372500ab1461043657600080fd5b80631569cc951161036c5780631569cc95146103cb5780631c8ec299146103d35780631fccf672146103dc5780632abfab4d1461040757600080fd5b806307ea4e57146103935780630d1e9b4a146103af5780630d8e6e2c146103c4575b600080fd5b61039c60cf5481565b6040519081526020015b60405180910390f35b6103c26103bd366004613eed565b610910565b005b600561039c565b61039c610ab3565b61039c60d45481565b60c9546103ef906001600160a01b031681565b6040516001600160a01b0390911681526020016103a6565b61039c60cd5481565b61039c61041e366004613f7d565b610b0d565b60da546103ef906001600160a01b031681565b6103c2610b3a565b60ca546103ef906001600160a01b031681565b61039c61045f366004613d87565b6001600160a01b0391909116600090815260d36020908152604080832093835260029093019052205490565b60d6546103ef906001600160a01b031681565b61039c6104ac366004613d19565b610c29565b6103c26104bf366004613d19565b610ddb565b6103c26104d2366004613e22565b610e27565b60655460ff1660405190151581526020016103a6565b60cb546103ef906001600160a01b031681565b6103c261050e366004613f4d565b6111a8565b6103c2610521366004613f4d565b6113f8565b6103c2611463565b6103c261053c366004613d19565b611499565b6103c261054f366004613d19565b6114e5565b61039c610562366004613d87565b61156b565b6105b8610575366004613f4d565b60d2602052600090815260409020805460018201546002830154600384015460048501546006860154600787015460089097015495969495939492939192909188565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c083015260e0820152610100016103a6565b6103c2610601366004613f4d565b611690565b6103c2610614366004613d35565b611703565b6033546001600160a01b03166103ef565b60db546103ef906001600160a01b031681565b61039c60d05481565b61039c610654366004613d19565b6118bc565b6103c2610667366004613d19565b6119d9565b6103c261067a366004613f4d565b611a5f565b61039c60d55481565b61039c60d85481565b61039c60d75481565b6103c26106a8366004613db2565b611ad2565b6103c26106bb366004613f7d565b611c7c565b6103c26106ce366004613e37565b611d19565b61039c60ce5481565b61039c6106ea366004613d19565b611dd6565b61071e6106fd366004613d19565b60d36020526000908152604090208054600182015460039092015490919083565b604080519384526020840192909252908201526060016103a6565b61039c610747366004613d19565b611e3f565b61039c61075a366004613f7d565b600082815260d2602090815260408083206001600160a01b0385168452600a0190915290205492915050565b6103c2611e67565b6103c261079c366004613d19565b612029565b6103c26107af366004613f4d565b612075565b6103c26107c2366004613e77565b6121e7565b6103c26107d5366004613f4d565b612564565b6103c26107e8366004613fac565b6125cf565b61039c612688565b61039c60cc5481565b60d9546103ef906001600160a01b031681565b61039c61081f366004613d19565b61280f565b6103c2610832366004613d19565b612823565b610891610845366004613f4d565b60d16020526000908152604090208054600182015460028301546003840154600485015460058601546006909601546001600160a01b0395861696948616959394929391929091169087565b604080516001600160a01b03988916815296881660208801528601949094526060850192909252608084015290921660a082015260c081019190915260e0016103a6565b61039c6108e3366004613d19565b6128be565b6108fb6108f6366004613d19565b612928565b604080519283526020830191909152016103a6565b60655460ff161561093c5760405162461bcd60e51b81526004016109339061405d565b60405180910390fd5b600160005260d26020526000805160206143d2833981519152544310156109755760405162461bcd60e51b815260040161093390614026565b600260975414156109985760405162461bcd60e51b8152600401610933906141b8565b600260975560cb546040516319f3736160e01b81526001600160a01b038581166004830152909116906319f373619060240160206040518083038186803b1580156109e257600080fd5b505afa1580156109f6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1a9190613de6565b610a725760405162461bcd60e51b8152602060048201526024808201527f446f6e6174696f6e4d696e65723a3a646f6e6174653a20496e76616c6964207460448201526337b5b2b760e11b6064820152608401610933565b60cb54610a8e906001600160a01b03858116913391168561297b565b60cb54610aa9908290859085906001600160a01b03166129ec565b5050600160975550565b60ce54600090815260d26020526040812060030154438111610b035760cc54610adc8243614331565b610ae69190614207565b60ce54610af391906141ef565b610afe9060016141ef565b610b07565b60ce545b91505090565b600082815260d2602090815260408083206001600160a01b03851684526005019091529020545b92915050565b60655460ff1615610b5d5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015610b965760405162461bcd60e51b815260040161093390614026565b60026097541415610bb95760405162461bcd60e51b8152600401610933906141b8565b60026097556000610bd133610bcc612c42565b612c89565b60ca54909150610beb906001600160a01b03163383612e06565b60405181815233907f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241906020015b60405180910390a2506001609755565b6001600090815260d26020526000805160206143d283398151915254431015610c645760405162461bcd60e51b815260040161093390614026565b60655460ff1615610c875760405162461bcd60e51b81526004016109339061405d565b600080610c946000612928565b915060009050610ca2612e3b565b905060d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf257600080fd5b505afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a9190613f65565b60d754610d379084614312565b610d4191906141ef565b60d654604051631aefa86d60e21b81526001600160a01b03888116600483015290911690636bbea1b49060240160206040518083038186803b158015610d8657600080fd5b505afa158015610d9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbe9190613f65565b610dc89083614312565b610dd29190614207565b95945050505050565b6033546001600160a01b03163314610e055760405162461bcd60e51b815260040161093390614087565b60db80546001600160a01b0319166001600160a01b0392909216919091179055565b60655460ff1615610e4a5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015610e835760405162461bcd60e51b815260040161093390614026565b60026097541415610ea65760405162461bcd60e51b8152600401610933906141b8565b600260975560cb5460408051632fd648bd60e11b815290516000926001600160a01b031691635fac917a916004808301926020929190829003018186803b158015610ef057600080fd5b505afa158015610f04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f289190613e06565b90506001604051633f9409e960e11b81526001600160a01b038781166004830152831690637f2813d29060240160206040518083038186803b158015610f6d57600080fd5b505afa158015610f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa59190613f2e565b6003811115610fc457634e487b7160e01b600052602160045260246000fd5b146110475760405162461bcd60e51b815260206004820152604760248201527f446f6e6174696f6e4d696e65723a3a646f6e617465546f436f6d6d756e69747960448201527f3a2054686973206973206e6f7420612076616c696420636f6d6d756e697479206064820152666164647265737360c81b608482015260a401610933565b846001600160a01b0316631fccf6726040518163ffffffff1660e01b815260040160206040518083038186803b15801561108057600080fd5b505afa158015611094573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b89190613e06565b6001600160a01b0316846001600160a01b0316146111305760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a646f6e617465546f436f6d6d756e69747960448201526e1d1024b73b30b634b2103a37b5b2b760891b6064820152608401610933565b60405163e69d849d60e01b8152336004820152602481018490526001600160a01b0386169063e69d849d90604401600060405180830381600087803b15801561117857600080fd5b505af115801561118c573d6000803e3d6000fd5b5050505061119c828585886129ec565b50506001609755505050565b60655460ff16156111cb5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156112045760405162461bcd60e51b815260040161093390614026565b600260975414156112275760405162461bcd60e51b8152600401610933906141b8565b6002609755611234612ebc565b60ce5481106112be5760405162461bcd60e51b815260206004820152604a60248201527f446f6e6174696f6e4d696e65723a3a7374616b6552657761726473506172746960448201527f616c3a20546869732072657761726420706572696f642069736e277420636c616064820152691a5b58589b19481e595d60b21b608482015260a401610933565b60006112ca3383612c89565b60ca5460d65460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b390604401602060405180830381600087803b15801561131c57600080fd5b505af1158015611330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113549190613de6565b5060d6546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b1580156113a157600080fd5b505af11580156113b5573d6000803e3d6000fd5b50506040518381523392507f7d3a0ab251dfd8c04c691239edd99d2c124cce6971cebc4c2ed96a378d13d50091506020015b60405180910390a250506001609755565b6033546001600160a01b031633146114225760405162461bcd60e51b815260040161093390614087565b60d85460408051918252602082018390527f300b3540c99261403e527f171e281f3dfb0705395e1902af7e9badcddce56e5e910160405180910390a160d855565b6033546001600160a01b0316331461148d5760405162461bcd60e51b815260040161093390614087565b6114976000612ffd565b565b6033546001600160a01b031633146114c35760405162461bcd60e51b815260040161093390614087565b60da80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b0316331461150f5760405162461bcd60e51b815260040161093390614087565b60cb546040516001600160a01b038084169216907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a90600090a360cb80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce54600090815260d2602052604081206003015481904311156115cc5760cc5460ce54600090815260d260205260409020600301546115ab9043614331565b6115b59190614207565b905060ce54816115c591906141ef565b90506115de565b600160ce546115db9190614331565b90505b8083111561167a5760405162461bcd60e51b815260206004820152605e60248201527f446f6e6174696f6e4d696e65723a3a63616c63756c617465436c61696d61626c60448201527f65526577617264734279506572696f644e756d6265723a20546869732072657760648201527f61726420706572696f642069736e277420617661696c61626c65207965740000608482015260a401610933565b6000611686858561304f565b5095945050505050565b6033546001600160a01b031633146116ba5760405162461bcd60e51b815260040161093390614087565b6116c2612ebc565b60d75460408051918252602082018390527fb7ce19da4d8265c844e0fa744e3429c62104c793f8ecb52d1b418b47eb9f8555910160405180910390a160d755565b60db546001600160a01b0316331461172d5760405162461bcd60e51b8152600401610933906140bc565b60655460ff16156117505760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156117895760405162461bcd60e51b815260040161093390614026565b600260975414156117ac5760405162461bcd60e51b8152600401610933906141b8565b600260975560cb546040516319f3736160e01b81526001600160a01b038581166004830152909116906319f373619060240160206040518083038186803b1580156117f657600080fd5b505afa15801561180a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182e9190613de6565b61187a5760405162461bcd60e51b815260206004820152601c60248201527f446f6e6174696f6e4d696e65723a20496e76616c696420746f6b656e000000006044820152606401610933565b60cb54611896906001600160a01b03858116918791168561297b565b60cb546118b1908290859085906001600160a01b03166129ec565b505060016097555050565b6001600090815260d26020526000805160206143d2833981519152544310156118f75760405162461bcd60e51b815260040161093390614026565b60655460ff161561191a5760405162461bcd60e51b81526004016109339061405d565b60d654604051631aefa86d60e21b81526001600160a01b0384811660048301526000921690636bbea1b49060240160206040518083038186803b15801561196057600080fd5b505afa158015611974573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119989190613f65565b9050806119a85750600092915050565b806119b4846000613475565b6119c890694d501c54214bcd300000614312565b6119d29190614207565b9392505050565b6033546001600160a01b03163314611a035760405162461bcd60e51b815260040161093390614087565b60d6546040516001600160a01b038084169216907fcfa056eb826b2a28817aa38ccb94f12ba8a1309598f7ea19bef6fd67fe04b61e90600090a360d680546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314611a895760405162461bcd60e51b815260040161093390614087565b611a91612ebc565b60d55460408051918252602082018390527fd6a28c11ae992e0014e83eaaa6f0023a04c0787848134e8b4e43f44b7d7d8e30910160405180910390a160d555565b60655460ff1615611af55760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015611b2e5760405162461bcd60e51b815260040161093390614026565b60d6546001600160a01b03163314611b885760405162461bcd60e51b815260206004820152601a60248201527f446f6e6174696f6e4d696e65723a204e4f545f5354414b494e470000000000006044820152606401610933565b611b90612ebc565b60ce54600090815260d2602090815260408083206001600160a01b0387168452600981018352818420805460ff19166001179055600a810183528184208690556007810185905560d39092529091206003810154158015611bf357506001810154155b15611c0d57600160ce54611c079190614331565b60038201555b60cb60009054906101000a90046001600160a01b03166001600160a01b0316635093141f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611c5d57600080fd5b505af1158015611c71573d6000803e3d6000fd5b505050505050505050565b60655460ff1615611c9f5760405162461bcd60e51b81526004016109339061405d565b60d9546001600160a01b0316331415611cd25760cb54611cce90829060a39085906001600160a01b03166129ec565b5050565b60da546001600160a01b0316331415611d015760cb54611cce90829060c19085906001600160a01b03166129ec565b60405162461bcd60e51b8152600401610933906140bc565b6033546001600160a01b03163314611d435760405162461bcd60e51b815260040161093390614087565b60026097541415611d665760405162461bcd60e51b8152600401610933906141b8565b6002609755611d7f6001600160a01b0384168383612e06565b816001600160a01b0316836001600160a01b03167f9b035625e569d1d2bf54830a290aefba7ab11610ba8490871dc62b86b63a895683604051611dc491815260200190565b60405180910390a35050600160975550565b6001600090815260d26020526000805160206143d283398151915254431015611e115760405162461bcd60e51b815260040161093390614026565b60655460ff1615611e345760405162461bcd60e51b81526004016109339061405d565b610b34826000613475565b600080611e5f836001611e50610ab3565b611e5a9190614331565b61304f565b509392505050565b60655460ff1615611e8a5760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d283398151915254431015611ec35760405162461bcd60e51b815260040161093390614026565b60026097541415611ee65760405162461bcd60e51b8152600401610933906141b8565b6002609755611ef3612ebc565b6000611f0833600160ce54610bcc9190614331565b60ca5460d65460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b390604401602060405180830381600087803b158015611f5a57600080fd5b505af1158015611f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f929190613de6565b5060d6546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b158015611fdf57600080fd5b505af1158015611ff3573d6000803e3d6000fd5b50506040518381523392507f7d3a0ab251dfd8c04c691239edd99d2c124cce6971cebc4c2ed96a378d13d5009150602001610c19565b6033546001600160a01b031633146120535760405162461bcd60e51b815260040161093390614087565b60d980546001600160a01b0319166001600160a01b0392909216919091179055565b60655460ff16156120985760405162461bcd60e51b81526004016109339061405d565b600160005260d26020526000805160206143d2833981519152544310156120d15760405162461bcd60e51b815260040161093390614026565b600260975414156120f45760405162461bcd60e51b8152600401610933906141b8565b6002609755612101612c42565b8111156121895760405162461bcd60e51b815260206004820152604a60248201527f446f6e6174696f6e4d696e65723a3a636c61696d52657761726473506172746960448201527f616c3a20546869732072657761726420706572696f642069736e277420636c616064820152691a5b58589b19481e595d60b21b608482015260a401610933565b60006121953383612c89565b60ca549091506121af906001600160a01b03163383612e06565b604080518281526020810184905233917f2233b4bbf378b3d984acd0e36cea96f66bc81012a683e81929ed96df5287ba3d91016113e7565b600054610100900460ff166122025760005460ff1615612206565b303b155b6122695760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610933565b600054610100900460ff1615801561228b576000805461ffff19166101011790555b6001600160a01b0389166122f95760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20635553442060448201526e1859191c995cdcc81b9bdd081cd95d608a1b6064820152608401610933565b6001600160a01b0388166123675760405162461bcd60e51b815260206004820152602f60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20504143542060448201526e1859191c995cdcc81b9bdd081cd95d608a1b6064820152608401610933565b6001600160a01b0387166123d25760405162461bcd60e51b815260206004820152602c60248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20747265617360448201526b1d5c9e57c81b9bdd081cd95d60a21b6064820152608401610933565b856124455760405162461bcd60e51b815260206004820152603760248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20666972737460448201527f526577617264506572426c6f636b206e6f7420736574210000000000000000006064820152608401610933565b836124b85760405162461bcd60e51b815260206004820152603860248201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20737461727460448201527f696e67526577617264506572696f64206e6f74207365742100000000000000006064820152608401610933565b846124d55760405162461bcd60e51b815260040161093390614110565b6124dd6134ce565b6124e5613505565b6124ed61353c565b60c980546001600160a01b03808c166001600160a01b03199283161790925560ca80548b841690831617905560cb8054928a169290911691909117905560cc85905560cf83905560d0829055600160ce55612548848761356b565b8015611c71576000805461ff0019169055505050505050505050565b6033546001600160a01b0316331461258e5760405162461bcd60e51b815260040161093390614087565b60d45460408051918252602082018390527f7625e5482008771a414881eb4c957803f2ab46e99e6da60df6e1310f0f009fec910160405180910390a160d455565b6033546001600160a01b031633146125f95760405162461bcd60e51b815260040161093390614087565b826126165760405162461bcd60e51b815260040161093390614110565b61261e612ebc565b60cc5460cf5460d05460408051938452602084019290925282820152606082018590526080820184905260a08201839052517f8fb29c6ced5ce51696c08668df816fab7e60c674a6c36e167d5df9b8a5f499849181900360c00190a160cc9290925560cf5560d055565b6001600090815260d26020526000805160206143d2833981519152544310156126c35760405162461bcd60e51b815260040161093390614026565b60655460ff16156126e65760405162461bcd60e51b81526004016109339061405d565b6000806126f36000612928565b915060009050612701612e3b565b90508060005b61016c81101561274b5760d05460cf546127219085614312565b61272b9190614207565b925061273783836141ef565b9150806127438161438b565b915050612707565b60d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b15801561279957600080fd5b505afa1580156127ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d19190613f65565b60d7546127de9086614312565b6127e891906141ef565b6127fb8368056bc75e2d63100000614312565b6128059190614207565b9550505050505090565b6000610b3482670de0b6b3a76400006135e2565b6033546001600160a01b0316331461284d5760405162461bcd60e51b815260040161093390614087565b6001600160a01b0381166128b25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610933565b6128bb81612ffd565b50565b6001600090815260d26020526000805160206143d2833981519152544310156128f95760405162461bcd60e51b815260040161093390614026565b60655460ff161561291c5760405162461bcd60e51b81526004016109339061405d565b610b348260d554613475565b6000806000612935610ab3565b9050600060d5548211612949576001612956565b60d5546129569083614331565b90508060ce54106129745761296e858260ce54613866565b90945092505b5050915091565b6040516001600160a01b03808516602483015283166044820152606481018290526129e69085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138db565b50505050565b6129f4612ebc565b60cd8054906000612a048361438b565b909155505060cd54600090815260d16020526040902080546001600160a01b038087166001600160a01b031992831617835560018301805485831690841617905543600384015560ce5460028401556005830180548783169316831790556006830185905560c954161480612a8257506001600160a01b03841660a3145b80612a9657506001600160a01b03841660c1145b15612aa75760048101839055612b33565b60cb5460405163f2b8995160e01b81526001600160a01b038681166004830152602482018690529091169063f2b8995190604401602060405180830381600087803b158015612af557600080fd5b505af1158015612b09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b2d9190613f65565b60048201555b60cb546001600160a01b03838116911614612b605760d8548160040154612b5a9190614207565b60048201555b612b7160ce548683600401546139ad565b612b7a85613a0a565b60cb60009054906101000a90046001600160a01b03166001600160a01b0316635093141f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612bca57600080fd5b505af1158015612bde573d6000803e3d6000fd5b505060cd546004840154604080519182526001600160a01b0389811660208401529082018890528087169450891692507f3d2fa2b84d5f2000d605401d563ba60e2e44f62701fdbe9f9101c59b3c215f299060600160405180910390a45050505050565b6000612c4c612ebc565b60d454612c5a9060016141ef565b60ce5411612c685750600090565b60d454600160ce54612c7a9190614331565b612c849190614331565b905090565b6001600160a01b038216600090815260d3602052604081208180612cad868661304f565b60038501549193509150851115612cc657600383018590555b600085815260d2602090815260408083206001600160a01b038a168452600a01909152902081905581612cfd57509150610b349050565b60ca546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612d4057600080fd5b505afa158015612d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d789190613f65565b821115612dfd5760ca546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612dc257600080fd5b505afa158015612dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dfa9190613f65565b91505b50949350505050565b6040516001600160a01b038316602482015260448101829052612e3690849063a9059cbb60e01b906064016129af565b505050565b600080612e46610ab3565b9050600060ce5482612e589190614331565b60d054612e65919061426a565b60ce54612e729084614331565b60cf54612e7f919061426a565b60ce54600090815260d26020526040902054612e9b9190614312565b612ea59190614207565b905060cc5481612eb59190614312565b9250505090565b60ce54600090815260d2602052604090205b43816003015410156128bb5760ce8054906000612eea8361438b565b909155505060ce54600090815260d26020526040902060d55460068201556003820154612f189060016141ef565b6002820181905560cc54600191612f2f91906141ef565b612f399190614331565b600382015560d05460cf548354612f509190614312565b612f5a9190614207565b8082556007808401549083015560d754600883015560cc54600091612f7e91614312565b905060008360060154600160ce54612f969190614331565b11612fa2576001612fc0565b8360060154600160ce54612fb69190614331565b612fc09190614331565b9050612fda81600160ce54612fd59190614331565b613aa3565b612ff0576001840154612fed90836141ef565b91505b5060018201559050612ece565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600090815260d3602052604081206003810154829190829061307c9060016141ef565b905080600114156130a857815460009081526002830160205260409020546130a59060016141ef565b90505b60d26020819052600082815260408120818052909182918291829182917f20791b593a776a2631a28f4a3f62a14ad18db22add38130c4f4a8fdfa463988591908290846130f660018c614331565b8152602001908152602001600020600a0160008f6001600160a01b03166001600160a01b03168152602001908152602001600020549a505b8c8911613464576002820154156132bf576006820154613172576001600160a01b038e16600090815260058301602052604090205460048301549098509650613291565b81600601548360060154141561324f5760068201546131929060016141ef565b8911156132115760d26000836006015460018c6131af9190614331565b6131b99190614331565b815260200190815260200160002090508060050160008f6001600160a01b03166001600160a01b0316815260200190815260200160002054886131fc9190614331565b975080600401548761320e9190614331565b96505b6001600160a01b038e16600090815260058301602052604090205461323690896141ef565b975081600401548761324891906141ef565b9650613291565b816006015489111561327f576132758e83600601548b61326f9190614331565b8b613866565b9098509650613291565b61328b8e60008b613866565b90985096505b816001015495508160070154945060008260080154116132b25760016132b8565b81600801545b93506133a1565b60d5546132cd9060016141ef565b89111561334a5760d2600060d55460018c6132e89190614331565b6132f29190614331565b815260200190815260200160002090508060050160008f6001600160a01b03166001600160a01b0316815260200190815260200160002054886133359190614331565b97508060040154876133479190614331565b96505b6001600160a01b038e16600090815260058301602052604090205461336f90896141ef565b975081600401548761338191906141ef565b965060d05460cf54876133949190614312565b61339e9190614207565b95505b6001600160a01b038e16600090815260098301602052604090205460ff16156133e2576001600160a01b038e166000908152600a830160205260409020549a505b60006133ee8c8a6141ef565b111561343f57846133ff8589614312565b61340991906141ef565b8b613414868b614312565b61341e91906141ef565b6134289088614312565b6134329190614207565b61343c908d6141ef565b9b505b886134498161438b565b600081815260d260205260409020909a5092935061312e9050565b505050505050505050509250929050565b600080613480612e3b565b9050805b83156134c45760d05460cf5461349a9084614312565b6134a49190614207565b91506134b082826141ef565b9050836134bc81614374565b945050613484565b610dd285826135e2565b600054610100900460ff166134f55760405162461bcd60e51b81526004016109339061416d565b6134fd613af9565b611497613b20565b600054610100900460ff1661352c5760405162461bcd60e51b81526004016109339061416d565b613534613af9565b611497613b50565b600054610100900460ff166135635760405162461bcd60e51b81526004016109339061416d565b611497613b83565b6001600081905260d26020526000805160206143d283398151915283905560cc547fb7404ce2b5a52e61a6b5c9b4585ed65d8cb4b8848d3ee262a356d0c2c46c5f3591906135b990856141ef565b6135c39190614331565b600382015581815560cc546135d89083614312565b6001909101555050565b60008060006135f085612928565b60d654604080516319e815f960e01b815290519395509193506000926001600160a01b03909116916319e815f9916004808301926020929190829003018186803b15801561363d57600080fd5b505afa158015613651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136759190613e06565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156136ad57600080fd5b505afa1580156136c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136e59190613f65565b9050801580156136f3575081155b156137045760009350505050610b34565b60008060d7541161371657600161371a565b60d7545b905060d660009054906101000a90046001600160a01b03166001600160a01b0316638c58d0a96040518163ffffffff1660e01b815260040160206040518083038186803b15801561376a57600080fd5b505afa15801561377e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a29190613f65565b6137ac8285614312565b6137b691906141ef565b60d654604051631aefa86d60e21b81526001600160a01b038a8116600483015290911690636bbea1b49060240160206040518083038186803b1580156137fb57600080fd5b505afa15801561380f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138339190613f65565b61383d8387614312565b61384791906141ef565b6138519088614312565b61385b9190614207565b979650505050505050565b6000808080855b8581116138ce57600081815260d2602090815260408083206001600160a01b038c16845260058101909252909120546138a690856141ef565b93508060040154836138b891906141ef565b92505080806138c69061438b565b91505061386d565b5090969095509350505050565b6000613930826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613bb19092919063ffffffff16565b805190915015612e36578080602001905181019061394e9190613de6565b612e365760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610933565b600083815260d260205260408120600481018054919284926139d09084906141ef565b90915550506001600160a01b0383166000908152600582016020526040812080548492906139ff9084906141ef565b909155505050505050565b6001600160a01b038116600090815260d36020908152604080832060018101548452600281019092529091205460ce548114613a7157600182018054906000613a528361438b565b909155505060ce54600183015460009081526002840160205260409020555b6003820154158015613a8557506001820154155b15612e3657600160ce54613a999190614331565b6003830155505050565b60005b818311613af057600083815260d2602052604081206007810154600490910154613ad091906141ef565b1115613ade57506001610b34565b82613ae88161438b565b935050613aa6565b50600092915050565b600054610100900460ff166114975760405162461bcd60e51b81526004016109339061416d565b600054610100900460ff16613b475760405162461bcd60e51b81526004016109339061416d565b61149733612ffd565b600054610100900460ff16613b775760405162461bcd60e51b81526004016109339061416d565b6065805460ff19169055565b600054610100900460ff16613baa5760405162461bcd60e51b81526004016109339061416d565b6001609755565b6060613bc08484600085613bc8565b949350505050565b606082471015613c295760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610933565b843b613c775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610933565b600080866001600160a01b03168587604051613c939190613fd7565b60006040518083038185875af1925050503d8060008114613cd0576040519150601f19603f3d011682016040523d82523d6000602084013e613cd5565b606091505b509150915061385b82828660608315613cef5750816119d2565b825115613cff5782518084602001fd5b8160405162461bcd60e51b81526004016109339190613ff3565b600060208284031215613d2a578081fd5b81356119d2816143bc565b60008060008060808587031215613d4a578283fd5b8435613d55816143bc565b93506020850135613d65816143bc565b9250604085013591506060850135613d7c816143bc565b939692955090935050565b60008060408385031215613d99578182fd5b8235613da4816143bc565b946020939093013593505050565b600080600060608486031215613dc6578283fd5b8335613dd1816143bc565b95602085013595506040909401359392505050565b600060208284031215613df7578081fd5b815180151581146119d2578182fd5b600060208284031215613e17578081fd5b81516119d2816143bc565b60008060008060808587031215613d4a578384fd5b600080600060608486031215613e4b578283fd5b8335613e56816143bc565b92506020840135613e66816143bc565b929592945050506040919091013590565b600080600080600080600080610100898b031215613e93578586fd5b8835613e9e816143bc565b97506020890135613eae816143bc565b96506040890135613ebe816143bc565b979a96995096976060810135975060808101359660a0820135965060c0820135955060e0909101359350915050565b600080600060608486031215613f01578081fd5b8335613f0c816143bc565b9250602084013591506040840135613f23816143bc565b809150509250925092565b600060208284031215613f3f578081fd5b8151600481106119d2578182fd5b600060208284031215613f5e578081fd5b5035919050565b600060208284031215613f76578081fd5b5051919050565b60008060408385031215613f8f578182fd5b823591506020830135613fa1816143bc565b809150509250929050565b600080600060608486031215613fc0578081fd5b505081359360208301359350604090920135919050565b60008251613fe9818460208701614348565b9190910192915050565b6020815260008251806020840152614012816040850160208701614348565b601f01601f19169190910160400192915050565b6020808252601e908201527f446f6e6174696f6e4d696e65723a204552525f4e4f545f535441525445440000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526034908201527f446f6e6174696f6e4d696e65723a20596f7520617265206e6f7420616c6c6f77604082015273081d1bc818d85b1b081d1a1a5cc81b595d1a1bd960621b606082015260800190565b60208082526037908201527f446f6e6174696f6e4d696e65723a3a696e697469616c697a653a20726577617260408201527f64506572696f6453697a6520697320696e76616c696421000000000000000000606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115614202576142026143a6565b500190565b60008261422257634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115614262578160001904821115614248576142486143a6565b8085161561425557918102915b93841c939080029061422c565b509250929050565b60006119d2838360008261428057506001610b34565b8161428d57506000610b34565b81600181146142a357600281146142ad576142c9565b6001915050610b34565b60ff8411156142be576142be6143a6565b50506001821b610b34565b5060208310610133831016604e8410600b84101617156142ec575081810a610b34565b6142f68383614227565b806000190482111561430a5761430a6143a6565b029392505050565b600081600019048311821515161561432c5761432c6143a6565b500290565b600082821015614343576143436143a6565b500390565b60005b8381101561436357818101518382015260200161434b565b838111156129e65750506000910152565b600081614383576143836143a6565b506000190190565b600060001982141561439f5761439f6143a6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146128bb57600080fdfeb7404ce2b5a52e61a6b5c9b4585ed65d8cb4b8848d3ee262a356d0c2c46c5f37a26469706673582212201dfd7d8c4eccdcceeb6d5ef33691794cd1b0ecce31f32b6254231b8b97b3d18964736f6c63430008040033