Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- StakeFXVaultV5
- Optimization enabled
- true
- Compiler version
- v0.8.18+commit.87f61d96
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2025-12-08T10:11:35.347280Z
contracts/StakeFXVaultV5.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import {MathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {IVestedFX} from "./interfaces/IVestedFX.sol";
import {IRewardDistributor} from "./interfaces/IRewardDistributor.sol";
import {IWFX} from "./interfaces/IWFX.sol";
import {BaseVault} from "./vaults/BaseVault.sol";
import {PrecompileStaking} from "./imp/PrecompileStaking.sol";
/*
* V5 to support refund PundiAI token to User.
* Add event CompoundWithFees
*/
contract StakeFXVaultV5 is
Initializable,
UUPSUpgradeable,
PrecompileStaking,
ReentrancyGuardUpgradeable,
BaseVault
{
using SafeERC20Upgradeable for IERC20Upgradeable;
using MathUpgradeable for uint256;
uint256 internal constant BIPS_DIVISOR = 10000;
uint256 internal constant PRECISION = 1e30;
address constant WFX = 0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd; // Token name is renamed to WPundiAIFX, WFX mainnet: 0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd; WFX testnet: 0x3452e23F9c4cC62c70B7ADAd699B264AF3549C19
uint256 public pendingFxReward; // FX delegation rewards inside the contract pending for compound
uint256 public feeOnReward; // Compound reward protocol fee
uint256 public feeOnCompounder; // Compound reward compounder fee
uint256 public feeOnWithdrawal; // Withdrawal fee
address public vestedFX; // Contract that stored user's withdrawal info
address public feeTreasury; // Contract that keep compound reward fee
address public distributor; // Reward token distributor
uint256 private MIN_COMPOUND_AMOUNT; // Minimum reward amount to compound when stake happen
uint256 private CAP_STAKE_FX_TARGET; // Cap amount of stFX
uint256 private STAKE_FX_TARGET; // Target stake amount to do whole validator list delegate(Deprecated)
uint256 private UNSTAKE_FX_TARGET; // Target unstake amount to split undelegate(Deprecated)
VaultInfo public vaultInfo; // Vault Info
mapping(uint256 => ValInfo) public valInfo; // Validator info
mapping(address => UserInfo) public userInfo; // User info
mapping(string => bool) public addedValidator; // True if validator is added
struct VaultInfo {
uint256 stakeId;
uint256 unstakeId;
uint256 length;
uint256 totalAllocPoint;
uint256 cumulativeRewardPerToken;
}
struct ValInfo {
uint256 allocPoint;
string validator;
}
struct UserInfo {
uint256 claimableReward;
uint256 previousCumulatedRewardPerToken;
}
event Stake(address indexed user, uint256 amount, uint256 shares);
event Unstake(address indexed user, uint256 amount, uint256 shares);
event Compound(address indexed user, uint256 compoundAmount);
event CompoundWithFees(address indexed user, uint256 compoundAmount, uint256 feeProtocol, uint256 feeCompounder);
event Claim(address receiver, uint256 amount);
event ValidatorAdded(string val, uint256 newAllocPoint);
event ValidatorRemoved(string val);
event ValidatorUpdated(string val, uint256 newAllocPoint);
event VestedFXChanged(address newAddress);
event FeeTreasuryChanged(address newAddress);
event DistributorChanged(address newAddress);
event ValidatorRedelegated(string srcVal, string dstVal, uint256 sharesAmount, uint256 redelegatedShares); // last 2 arguments changed to FxAmount in staking V2
event EmergencyWithdrawVault(uint256 assets, uint256 shares);
receive() external payable {}
modifier onlyVestedFX() {
require(msg.sender == vestedFX, "Only VestedFX can call");
_;
}
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/****************************************** Core External Functions ******************************************/
/**
* @notice user stake FX/WFX to this contract
* @param amount stake amount
* @param native stake FX or WFX token
*/
function stake(uint256 amount, bool native) external payable nonReentrant whenNotPaused {
require(amount > 0, "Stake: 0 amount");
require(msg.value == (native == true ? amount : 0), "!valid");
require(amount + totalAssets() <= CAP_STAKE_FX_TARGET, "Stake: > Cap");
// Skip check delegation reward to save gas
_compound();
_claim(msg.sender, msg.sender);
if(native == false) {
IWFX(WFX).transferFrom(msg.sender, address(this), amount);
IWFX(WFX).withdraw(payable(address(this)), amount);
}
uint256 shares = previewDeposit(amount);
_mint(msg.sender, shares);
_stake(amount);
emit Stake(msg.sender, amount, shares);
}
/**
* @notice user unstake(request undelegate FX)
* @param amount User's fx-LP receipt tokens
*/
function unstake(uint256 amount) external nonReentrant whenNotPaused {
require(amount > 0, "Unstake: 0 amount");
uint256 sharesBalance = balanceOf(msg.sender);
require(sharesBalance >= amount, "Amount > stake");
_compound();
_claim(msg.sender, msg.sender);
uint256 undelegateAmount = previewRedeem(amount);
uint256 undelegateAmountAfterFee = undelegateAmount * (BIPS_DIVISOR - feeOnWithdrawal) / BIPS_DIVISOR;
_burn(msg.sender, amount);
if (undelegateAmountAfterFee > 0) {
_unstake(undelegateAmountAfterFee);
}
emit Unstake(msg.sender, undelegateAmountAfterFee, amount);
}
/**
* @notice transfer user delegation shares to this contract
* @param val validator address
* @param amount Amount of user's delegate shares transferred to this contract
*/
function entrustDelegatedShare(string memory val, uint256 amount) external nonReentrant whenNotPaused {
require(amount > 0, "Entrust: 0 share");
(uint256 sharesAmount, uint256 delegationAmount) = _delegation(val, msg.sender);
require(sharesAmount >= amount, "Not enough share");
_compound();
_claim(msg.sender, msg.sender);
uint256 totalAsset = totalAssets();
uint256 estimateDelegateAmount = amount / sharesAmount * delegationAmount;
require(estimateDelegateAmount + totalAsset <= CAP_STAKE_FX_TARGET, "Stake: > Cap");
uint256 supply = totalSupply();
(uint256 fxAmountToTransfer, uint256 returnReward) = _transferFromShares(val, msg.sender, address(this), amount);
pendingFxReward += returnReward;
uint256 shares = (fxAmountToTransfer == 0 || supply == 0)
? _initialConvertToShares(fxAmountToTransfer, MathUpgradeable.Rounding.Down)
: fxAmountToTransfer.mulDiv(supply, totalAsset, MathUpgradeable.Rounding.Down);
_mint(msg.sender, shares);
emit Stake(msg.sender, fxAmountToTransfer, shares);
}
function claim(address receiver) external nonReentrant returns (uint256) {
return _claim(msg.sender, receiver);
}
/**
* @notice compound delegation rewards
*/
function compound() external nonReentrant whenNotPaused {
_compound();
}
function updateRewards() external nonReentrant {
_updateRewards(address(0));
}
function sendVestedFX(
uint256 safeAmount
) external onlyVestedFX {
address recipient = payable(msg.sender);
(bool success, ) = recipient.call{value: safeAmount}("");
require(success, "Failed to send FX");
}
/**************************************** Internal and Private Functions ****************************************/
/**
* @dev Helper function to delegate FX amount to validators.
* @param amount The amount: FX delegate to validators.
*/
function _stake(uint256 amount) internal {
VaultInfo memory vault = vaultInfo;
uint256 totalAllocPoint = vault.totalAllocPoint;
uint256 index = vault.stakeId;
uint256 valLength = getValLength();
uint256 _totalAssets = totalAssets();
uint256 numValidators = _calculateNumberofValidators(amount);
uint256 amountPerValidator = amount / numValidators;
uint256 remainingAmount = amount;
uint256 delegateAmount;
while (remainingAmount != 0) {
ValInfo memory val = valInfo[index];
uint256 allocPoint = val.allocPoint;
index = (index + 1) % valLength;
if (allocPoint == 0) {
continue;
}
if (_totalAssets >= CAP_STAKE_FX_TARGET) {
delegateAmount = remainingAmount;
} else {
(, uint256 delegationAmount) = _delegation(val.validator, address(this));
uint256 maxValSize = allocPoint * CAP_STAKE_FX_TARGET / totalAllocPoint;
if (delegationAmount >= maxValSize) {
continue;
}
if (remainingAmount <= amountPerValidator) {
delegateAmount = remainingAmount;
} else {
delegateAmount = amountPerValidator;
}
}
// Delegate to the validator
bool result = _delegateV2(val.validator, delegateAmount);
require(result == true, "delegate fail");
_totalAssets += delegateAmount;
remainingAmount -= delegateAmount;
}
vaultInfo.stakeId = index;
}
/**
* @dev Helper function to undelegate FX amount from validators.
* @param amount The amount: FX to unstake from the vault.
*/
function _unstake(uint256 amount) internal {
VaultInfo memory vault = vaultInfo;
uint256 index = vault.unstakeId;
uint256 valLength = getValLength();
uint256 remainingAmount = amount;
uint256 totalReward;
uint256 returnUndelegatedAmount;
uint256 returnReward;
// If contract byte size exceed limit, divide to half part can be removed
if (amount >= UNSTAKE_FX_TARGET) {
uint256 halfOfUndelegateAmount = amount / 2;
(returnUndelegatedAmount) = _toUndelegate(index, halfOfUndelegateAmount);
remainingAmount -= returnUndelegatedAmount;
index = (index + 1) % valLength;
totalReward += returnReward;
}
while (remainingAmount != 0) {
(returnUndelegatedAmount) = _toUndelegate(index, remainingAmount);
remainingAmount -= returnUndelegatedAmount;
index = (index + 1) % valLength;
totalReward += returnReward;
}
IVestedFX(vestedFX).lockWithEndTime(
msg.sender,
amount,
block.timestamp + 21 days
);
vaultInfo.unstakeId = index;
pendingFxReward += totalReward;
}
/**
* @dev Helper function to undelegate FX amount from validators.
* @param index Validator ID in validator list.
* @param remainingAmount Amount to undelegate from validators.
*/
function _toUndelegate(uint256 index, uint256 remainingAmount) internal returns(uint256) {
(, uint256 delegationAmount) = _delegation(valInfo[index].validator, address(this));
uint256 amountToUndelegate;
if (delegationAmount > 0) {
if (delegationAmount >= remainingAmount) {
amountToUndelegate = remainingAmount;
} else {
amountToUndelegate = delegationAmount;
}
bool result = _undelegateV2(valInfo[index].validator, amountToUndelegate);
require(result == true, "delegate fail");
}
return amountToUndelegate;
}
/**
* @dev Helper function to compound FX amount from validators.
*/
function _compound() internal {
_withdrawReward();
uint256 delegateReward = pendingFxReward;
pendingFxReward = 0;
uint256 feeProtocol = (delegateReward * feeOnReward) / BIPS_DIVISOR;
uint256 feeCompounder = (delegateReward * feeOnCompounder) / BIPS_DIVISOR;
delegateReward = delegateReward - feeProtocol - feeCompounder;
_stake(delegateReward);
address treasury = payable(feeTreasury);
address user = payable(msg.sender);
(bool successTreasury, ) = treasury.call{value: feeProtocol}("");
(bool successUser, ) = user.call{value: feeCompounder}("");
require(successTreasury && successUser, "Failed to send FX");
// emit Compound(msg.sender, delegateReward);
emit CompoundWithFees(msg.sender, delegateReward, feeProtocol, feeCompounder);
}
/**
* @dev Helper function to withdraw delegation fx rewards from all validators.
*/
function _withdrawReward() internal {
uint256 reward = 0;
uint256 valLength = getValLength();
for (uint256 i; i < valLength; i++) {
string memory validator = valInfo[i].validator;
uint256 delegationReward = _delegationRewards(validator, address(this));
if(delegationReward > 0) {
uint256 returnReward = _withdraw(validator);
reward += returnReward;
}
}
pendingFxReward += reward;
}
/**
* @dev Helper function to help to calculate number of validator to delegate based on Log10 input amount.
* @param delegateAmount Fx Amount to stake.
* @return Number of validators to delegate.
*/
function _calculateNumberofValidators(
uint256 delegateAmount
) internal view returns (uint256) {
uint256 numValidators;
uint256 delegateAmountInEther = delegateAmount / 10**18;
uint256 valLength = getValLength();
while (delegateAmountInEther >= 10) {
delegateAmountInEther /= 10;
numValidators++;
}
return (numValidators == 0) ? 1 : (numValidators > valLength
? valLength
: numValidators);
}
/**
* @dev Helper function to help to query total FX delegation.
*/
function _getUnderlyingFX() internal view returns (uint256) {
uint256 totalAmount;
uint256 valLength = getValLength();
for (uint256 i; i < valLength; i++) {
string memory validator = valInfo[i].validator;
(, uint256 delegationAmount) = _delegation(validator, address(this));
totalAmount += delegationAmount;
}
return totalAmount;
}
function _claim(address account, address receiver) private returns (uint256) {
_updateRewards(account);
UserInfo storage user = userInfo[account];
uint256 tokenAmount = user.claimableReward;
user.claimableReward = 0;
if (tokenAmount > 0) {
IERC20Upgradeable(rewardToken()).safeTransfer(receiver, tokenAmount);
emit Claim(account, tokenAmount);
}
return tokenAmount;
}
function _updateRewards(address account) private {
uint256 blockReward = IRewardDistributor(distributor).distribute();
uint256 supply = totalSupply();
uint256 _cumulativeRewardPerToken = vaultInfo.cumulativeRewardPerToken;
if (supply > 0 && blockReward > 0) {
_cumulativeRewardPerToken = _cumulativeRewardPerToken + (blockReward * (PRECISION) / (supply));
vaultInfo.cumulativeRewardPerToken = _cumulativeRewardPerToken;
}
// cumulativeRewardPerToken can only increase
// so if cumulativeRewardPerToken is zero, it means there are no rewards yet
if (_cumulativeRewardPerToken == 0) {
return;
}
if (account != address(0)) {
UserInfo storage user = userInfo[account];
uint256 stakedAmount = balanceOf(account);
uint256 accountReward = stakedAmount * (_cumulativeRewardPerToken - (user.previousCumulatedRewardPerToken)) / (PRECISION);
uint256 _claimableReward = user.claimableReward + (accountReward);
user.claimableReward = _claimableReward;
user.previousCumulatedRewardPerToken = _cumulativeRewardPerToken;
}
}
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
whenNotPaused
override
{
_updateRewards(from);
_updateRewards(to);
super._beforeTokenTransfer(from, to, amount);
}
function _authorizeUpgrade(
address
) internal override onlyRole(OWNER_ROLE) {}
/**************************************** Public/External View Functions ****************************************/
/**
* @notice Return total asset(FX) deposited
* @return Amount of asset(FX) deposited
*/
function totalAssets() public view override returns (uint256) {
uint256 underlying = _getUnderlyingFX();
return underlying;
}
function getValLength() public view returns (uint256) {
return vaultInfo.length;
}
/**
* @notice Return validator address and allocPoint
*/
function getValInfo(uint256 index) public view returns (uint256, string memory) {
return (valInfo[index].allocPoint, valInfo[index].validator);
}
/**
* @notice Return total delegation reward
*/
function getTotalDelegationRewards() public view returns (uint256) {
uint256 totalAmount;
uint256 valLength = getValLength();
for (uint256 i; i < valLength; i++) {
string memory validator = valInfo[i].validator;
uint256 delegationReward = _delegationRewards(validator, address(this));
totalAmount += delegationReward;
}
return totalAmount + pendingFxReward;
}
/**
* @notice Return vault config(remove STAKE_FX_TARGET)
*/
function getVaultConfigs() public view returns (uint256, uint256, uint256) {
return (MIN_COMPOUND_AMOUNT, CAP_STAKE_FX_TARGET, UNSTAKE_FX_TARGET);
}
function rewardToken() public view returns (address) {
return IRewardDistributor(distributor).rewardToken();
}
function claimable(address account) public view returns (uint256) {
UserInfo memory user = userInfo[account];
uint256 stakedAmount = balanceOf(account);
if (stakedAmount == 0) {
return user.claimableReward;
}
uint256 supply = totalSupply();
uint256 pendingRewards = IRewardDistributor(distributor).pendingRewards() * (PRECISION);
uint256 nextCumulativeRewardPerToken = vaultInfo.cumulativeRewardPerToken + (pendingRewards / (supply));
return user.claimableReward + (
stakedAmount * (nextCumulativeRewardPerToken - (user.previousCumulatedRewardPerToken)) / (PRECISION));
}
/**************************************** Only Governor Functions ****************************************/
function redelegateValidator(
uint256 srcId,
uint256 dstId,
uint256 redelegateAmount
) external onlyRole(GOVERNOR_ROLE) {
require(srcId < vaultInfo.length && dstId < vaultInfo.length, "Invalid ID");
ValInfo memory srcVal = valInfo[srcId];
ValInfo memory dstVal = valInfo[dstId];
(, uint256 delegationAmount) = _delegation(srcVal.validator, address(this));
require(redelegateAmount <= delegationAmount, "!Amount");
_compound();
bool result = _redelegateV2(srcVal.validator, dstVal.validator, redelegateAmount);
require(result == true, "delegate fail");
emit ValidatorRedelegated(srcVal.validator, dstVal.validator, redelegateAmount, redelegateAmount);
}
function addValidator(
string memory _validator,
uint256 _allocPoint
) external onlyRole(GOVERNOR_ROLE) {
require(addedValidator[_validator] == false, "addedVal");
valInfo[vaultInfo.length].validator = _validator;
valInfo[vaultInfo.length].allocPoint = _allocPoint;
vaultInfo.length++;
vaultInfo.totalAllocPoint += _allocPoint;
addedValidator[_validator]=true;
emit ValidatorAdded(_validator, _allocPoint);
}
/**
* @notice remove validators which has 0 allocPoint and 0 delegation in the list
*/
function removeValidator() external onlyRole(GOVERNOR_ROLE) {
uint256 valLength = getValLength();
for (uint256 i = 0; i < valLength;) {
if (valInfo[i].allocPoint == 0) {
string memory val = valInfo[i].validator;
(uint256 sharesAmount, ) = _delegation(val, address(this));
if (sharesAmount == 0) {
addedValidator[val] = false;
uint256 lastIndex = valLength - 1;
valInfo[i] = valInfo[lastIndex];
delete valInfo[lastIndex];
emit ValidatorRemoved(val);
valLength--;
// Skip if i == 0 to prevent underflow
if (i == 0) {
continue;
} else {
--i;
}
}
}
unchecked {
++i;
}
}
// Reset stakeID, unstakeID, validator length
vaultInfo.stakeId = 0;
vaultInfo.unstakeId = 0;
vaultInfo.length = valLength;
}
function updateValidator(
uint256 id,
uint256 newAllocPoint
) external onlyRole(GOVERNOR_ROLE) {
require(id < vaultInfo.length, "Invalid ID");
uint256 oldAllocPoint = valInfo[id].allocPoint;
vaultInfo.totalAllocPoint = vaultInfo.totalAllocPoint + newAllocPoint - oldAllocPoint;
valInfo[id].allocPoint = newAllocPoint;
emit ValidatorUpdated(valInfo[id].validator, newAllocPoint);
}
/**
* @notice Update vault config(remove STAKE_FX_TARGET)
*/
function updateConfigs(uint256 newMinCompound, uint256 newCapStakeFxTarget, uint256 newUnstakeFxTarget) external onlyRole(GOVERNOR_ROLE) {
MIN_COMPOUND_AMOUNT = newMinCompound;
CAP_STAKE_FX_TARGET = newCapStakeFxTarget;
UNSTAKE_FX_TARGET = newUnstakeFxTarget;
}
/**
* @notice Update compounding fee percentage for protocol and compounder and user withdrawal percentage
* require(newFeeOnReward + newFeeOnCompounder) <= BIPS_DIVISOR && newFeeOnWithdrawal <= BIPS_DIVISOR)
*/
function updateFees(uint256 newFeeOnReward, uint256 newFeeOnCompounder, uint256 newFeeOnWithdrawal) external onlyRole(GOVERNOR_ROLE) {
feeOnReward = newFeeOnReward;
feeOnCompounder = newFeeOnCompounder;
feeOnWithdrawal = newFeeOnWithdrawal;
}
/**************************************** Only Owner Functions ****************************************/
function updateVestedFX(address newAddress) external onlyRole(OWNER_ROLE) {
vestedFX = newAddress;
emit VestedFXChanged(newAddress);
}
function updateFeeTreasury(address newAddress) external onlyRole(OWNER_ROLE) {
feeTreasury = newAddress;
emit FeeTreasuryChanged(newAddress);
}
function updateDistributor(address newAddress) external onlyRole(OWNER_ROLE) {
distributor = newAddress;
emit DistributorChanged(newAddress);
}
function recoverToken(
address token,
uint256 amount,
address _recipient
) external onlyRole(OWNER_ROLE) {
require(_recipient != address(0), "Send to zero address");
if(token != address(0)) {
IERC20Upgradeable(token).safeTransfer(_recipient, amount);
} else {
address recipient = payable(_recipient);
(bool success, ) = recipient.call{value: amount}("");
require(success, "Failed to send FX");
}
}
// @notice Emergency withdraw all LP tokens from purse staking contract
function emergencyWithdrawPundiAI(bool disableDeposits) external onlyRole(OWNER_ROLE) {
uint256 totalAmount;
uint256 returnUndelegatedAmount;
uint256 valLength = getValLength();
// Undelegate all PundiAI balance from all validators
for (uint256 i; i < valLength; i++) {
string memory validator = valInfo[i].validator;
(, uint256 delegationAmount) = _delegation(validator, address(this));
(returnUndelegatedAmount) = _toUndelegate(i, delegationAmount);
totalAmount += delegationAmount;
}
if(disableDeposits == true) {
_pause();
}
emit EmergencyWithdrawVault(totalAmount, totalSupply());
}
/**************************************************************
* @dev Initialize the states
*************************************************************/
function initialize(
address _asset,
address _owner,
address _governor
) public initializer {
__BaseVaultInit(
_asset,
"Staked FX Token",
"StFX",
_owner,
_governor
);
// __Governable_init(_owner, _governor); redundant code
__UUPSUpgradeable_init();
}
}
contracts/interfaces/IVestedFX.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
interface IVestedFX {
struct VestingSchedule {
uint64 startTime;
uint64 endTime;
uint256 quantity;
uint256 vestedQuantity;
}
function lockWithEndTime(address account, uint256 quantity, uint256 endTime) external;
function getVestingSchedules(address account) external view returns (VestingSchedule[] memory);
function accountEscrowedBalance(address account) external view returns (uint256);
function accountVestedBalance(address account) external view returns (uint256);
}
@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.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;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
}
}
@openzeppelin/contracts-upgradeable/utils/math/SignedMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.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._
*/
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
function __ERC1967Upgrade_init() internal onlyInitializing {
}
function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
}
// 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 Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlotUpgradeable.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) {
AddressUpgradeable.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @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 Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlotUpgradeable.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");
StorageSlotUpgradeable.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 Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlotUpgradeable.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) {
AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
contracts/interfaces/IWFX.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
interface IWFX {
function deposit() external payable;
function withdraw(address payable to, uint256 value) external;
function transferFrom(address from, address to, uint256 amount) external;
}
@openzeppelin/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;
}
@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.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 IBeaconUpgradeable {
/**
* @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/interfaces/IPrecompileStaking.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
/**
* @title IPrecompileStaking
*
* @dev Interface to interact to network precompile staking contract functions.
*/
interface IPrecompileStaking {
function delegate(string memory _val) external payable returns (uint256, uint256);
function undelegate(string memory _val, uint256 _shares) external returns (uint256, uint256, uint256);
function withdraw(string memory _val) external returns (uint256);
function transferFromShares(string memory _val, address _from, address _to, uint256 _shares) external returns (uint256, uint256);
function delegation(string memory _val, address _del) external view returns (uint256, uint256);
function delegationRewards(string memory _val, address _del) external view returns (uint256);
function delegateV2(
string memory _val,
uint256 _amount
) external payable returns (bool _result);
function undelegateV2(
string memory _val,
uint256 _amount
) external returns (bool _result);
function redelegateV2(
string memory _valSrc,
string memory _valDst,
uint256 _amount
) external returns (bool _result);
}
@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
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:
* ```solidity
* 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`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlotUpgradeable {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[45] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}
contracts/libraries/Decode.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
library Decode {
function delegate(
bytes memory data
) internal pure returns (uint256, uint256) {
(uint256 shares, uint256 reward) = abi.decode(data, (uint256, uint256));
return (shares, reward);
}
function undelegate(
bytes memory data
) internal pure returns (uint256, uint256, uint256) {
(uint256 amount, uint256 reward, uint256 endTime) = abi.decode(
data,
(uint256, uint256, uint256)
);
return (amount, reward, endTime);
}
function redelegate(bytes memory data) internal pure returns (uint256, uint256, uint256) {
(uint256 _amount, uint256 _reward, uint256 _completionTime) = abi.decode(data, (uint256, uint256, uint256));
return (_amount, _reward, _completionTime);
}
function delegateV2(
bytes memory data
) internal pure returns (bool) {
(bool _result) = abi.decode(data, (bool));
return (_result);
}
function undelegateV2(
bytes memory data
) internal pure returns (bool) {
(bool _result) = abi.decode(
data,
(bool)
);
return (_result);
}
function redelegateV2(bytes memory data) internal pure returns (bool) {
(bool _result) = abi.decode(data, (bool));
return (_result);
}
function withdraw(bytes memory data) internal pure returns (uint256) {
uint256 reward = abi.decode(data, (uint256));
return reward;
}
function transferShares(bytes memory data) internal pure returns (uint256, uint256) {
(uint256 token, uint256 reward) = abi.decode(data, (uint256, uint256));
return (token, reward);
}
function transferFromShares(bytes memory data) internal pure returns (uint256, uint256) {
(uint256 token, uint256 reward) = abi.decode(data, (uint256, uint256));
return (token, reward);
}
function delegation(bytes memory data) internal pure returns (uint256, uint256) {
(uint256 delegateShare, uint256 delegateAmount) = abi.decode(data, (uint256, uint256));
return (delegateShare, delegateAmount);
}
function delegationRewards(bytes memory data) internal pure returns (uint256) {
uint256 rewardAmount = abi.decode(data, (uint256));
return rewardAmount;
}
function allowanceShares(bytes memory data) internal pure returns (uint256) {
uint256 allowanceAmount = abi.decode(data, (uint256));
return allowanceAmount;
}
function ok(
bool _result,
bytes memory _data,
string memory _msg
) internal pure {
if (!_result) {
string memory errMsg = abi.decode(_data, (string));
if (bytes(_msg).length < 1) {
revert(errMsg);
}
revert(string(abi.encodePacked(_msg, ": ", errMsg)));
}
}
}
contracts/interfaces/IRewardDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
interface IRewardDistributor {
function rewardToken() external view returns (address);
function tokensPerInterval() external view returns (uint256);
function pendingRewards() external view returns (uint256);
function distribute() external returns (uint256);
}
contracts/vaults/BaseVault.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {IERC20MetadataUpgradeable, IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import {ERC4626Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol";
import {MathUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import {Governable} from "../common/Governable.sol";
abstract contract BaseVault is Governable, PausableUpgradeable, ERC4626Upgradeable {
using MathUpgradeable for uint256;
function __BaseVaultInit(address _asset, string memory _name, string memory _symbol, address _owner, address _governor) internal{
__ERC4626_init(IERC20MetadataUpgradeable(_asset));
__ERC20_init(_name, _symbol);
__Pausable_init();
__AccessControl_init();
__Governable_init(_owner, _governor);
}
// ============================= Revert functions ================================ //
/**
* @dev See {openzeppelin-IERC4626-deposit}.
*/
function deposit(uint256 , address )
public
override
returns (uint256)
{
revert("disabled");
}
/**
* @dev See {openzeppelin-IERC4626-mint}.
*/
function mint(uint256 , address )
public
override
returns (uint256)
{
revert("disabled");
}
/**
* @dev See {openzeppelin-IERC4626-withdraw}.
*/
function withdraw(uint256 , address , address )
public
override
returns (uint256)
{
revert("disabled");
}
/**
* @dev See {openzeppelin-IERC4626-redeem}.
*/
function redeem(uint256 , address , address )
public
override
returns (uint256)
{
revert("disabled");
}
// ============================= Internal functions ================================ //
/**
* @dev Internal conversion function (from assets to shares) with support for rounding direction.
*
* Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset
* would represent an infinite amount of shares.
*/
function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view override returns (uint256 shares) {
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? _initialConvertToShares(assets, rounding)
: assets.mulDiv(supply, totalAssets(), rounding);
}
/**
* @dev Internal conversion function (from assets to shares) to apply when the vault is empty.
*
* NOTE: Make sure to keep this function consistent with {_initialConvertToAssets} when overriding it.
*/
function _initialConvertToShares(
uint256 assets,
MathUpgradeable.Rounding /*rounding*/
) internal view virtual returns (uint256 shares) {
return assets;
}
/**
* @dev Internal conversion function (from shares to assets) with support for rounding direction.
*/
function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view override returns (uint256 assets) {
uint256 supply = totalSupply();
return
(supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);
}
/**
* @dev Internal conversion function (from shares to assets) to apply when the vault is empty.
*
* NOTE: Make sure to keep this function consistent with {_initialConvertToShares} when overriding it.
*/
function _initialConvertToAssets(
uint256 shares,
MathUpgradeable.Rounding /*rounding*/
) internal view virtual returns (uint256 assets) {
return shares;
}
// ============================= Governable functions ================================ //
function pause() public onlyRole(OWNER_ROLE) {
_pause();
}
function unpause() public onlyRole(OWNER_ROLE) {
_unpause();
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/interfaces/IERC4626Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)
pragma solidity ^0.8.0;
import "../token/ERC20/IERC20Upgradeable.sol";
import "../token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
/**
* @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
*
* _Available since v4.7._
*/
interface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}
contracts/common/Governable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
abstract contract Governable is AccessControlUpgradeable {
bytes32 public constant OWNER_ROLE = bytes32("OWNER_ROLE");
bytes32 public constant GOVERNOR_ROLE = bytes32("GOVERNOR_ROLE");
bytes32 public constant OPERATOR_ROLE = bytes32("OPERATOR_ROLE"); // only contract address
function __Governable_init(address _owner, address _governor) internal {
// Assign roles to the sender.
_grantRole(OWNER_ROLE, _owner);
_grantRole(GOVERNOR_ROLE, _governor);
// Set OWNER_ROLE as the admin of all roles.
_setRoleAdmin(OWNER_ROLE, OWNER_ROLE);
_setRoleAdmin(GOVERNOR_ROLE, OWNER_ROLE);
_setRoleAdmin(OPERATOR_ROLE, OWNER_ROLE);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC4626.sol)
pragma solidity ^0.8.0;
import "../ERC20Upgradeable.sol";
import "../utils/SafeERC20Upgradeable.sol";
import "../../../interfaces/IERC4626Upgradeable.sol";
import "../../../utils/math/MathUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in
* https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].
*
* This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for
* underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends
* the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this
* contract and not the "assets" token which is an independent contract.
*
* [CAUTION]
* ====
* In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning
* with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation
* attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial
* deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may
* similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by
* verifying the amount received is as expected, using a wrapper that performs these checks such as
* https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].
*
* Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()`
* corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault
* decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself
* determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset
* (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's
* donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more
* expensive than it is profitable. More details about the underlying math can be found
* xref:erc4626.adoc#inflation-attack[here].
*
* The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued
* to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets
* will cause the first user to exit to experience reduced losses in detriment to the last users that will experience
* bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the
* `_convertToShares` and `_convertToAssets` functions.
*
* To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide].
* ====
*
* _Available since v4.7._
*/
abstract contract ERC4626Upgradeable is Initializable, ERC20Upgradeable, IERC4626Upgradeable {
using MathUpgradeable for uint256;
IERC20Upgradeable private _asset;
uint8 private _underlyingDecimals;
/**
* @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).
*/
function __ERC4626_init(IERC20Upgradeable asset_) internal onlyInitializing {
__ERC4626_init_unchained(asset_);
}
function __ERC4626_init_unchained(IERC20Upgradeable asset_) internal onlyInitializing {
(bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);
_underlyingDecimals = success ? assetDecimals : 18;
_asset = asset_;
}
/**
* @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.
*/
function _tryGetAssetDecimals(IERC20Upgradeable asset_) private view returns (bool, uint8) {
(bool success, bytes memory encodedDecimals) = address(asset_).staticcall(
abi.encodeWithSelector(IERC20MetadataUpgradeable.decimals.selector)
);
if (success && encodedDecimals.length >= 32) {
uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));
if (returnedDecimals <= type(uint8).max) {
return (true, uint8(returnedDecimals));
}
}
return (false, 0);
}
/**
* @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This
* "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the
* asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals.
*
* See {IERC20Metadata-decimals}.
*/
function decimals() public view virtual override(IERC20MetadataUpgradeable, ERC20Upgradeable) returns (uint8) {
return _underlyingDecimals + _decimalsOffset();
}
/** @dev See {IERC4626-asset}. */
function asset() public view virtual override returns (address) {
return address(_asset);
}
/** @dev See {IERC4626-totalAssets}. */
function totalAssets() public view virtual override returns (uint256) {
return _asset.balanceOf(address(this));
}
/** @dev See {IERC4626-convertToShares}. */
function convertToShares(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4626-convertToAssets}. */
function convertToAssets(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4626-maxDeposit}. */
function maxDeposit(address) public view virtual override returns (uint256) {
return type(uint256).max;
}
/** @dev See {IERC4626-maxMint}. */
function maxMint(address) public view virtual override returns (uint256) {
return type(uint256).max;
}
/** @dev See {IERC4626-maxWithdraw}. */
function maxWithdraw(address owner) public view virtual override returns (uint256) {
return _convertToAssets(balanceOf(owner), MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4626-maxRedeem}. */
function maxRedeem(address owner) public view virtual override returns (uint256) {
return balanceOf(owner);
}
/** @dev See {IERC4626-previewDeposit}. */
function previewDeposit(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4626-previewMint}. */
function previewMint(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Up);
}
/** @dev See {IERC4626-previewWithdraw}. */
function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {
return _convertToShares(assets, MathUpgradeable.Rounding.Up);
}
/** @dev See {IERC4626-previewRedeem}. */
function previewRedeem(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, MathUpgradeable.Rounding.Down);
}
/** @dev See {IERC4626-deposit}. */
function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {
require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max");
uint256 shares = previewDeposit(assets);
_deposit(_msgSender(), receiver, assets, shares);
return shares;
}
/** @dev See {IERC4626-mint}.
*
* As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero.
* In this case, the shares will be minted without requiring any assets to be deposited.
*/
function mint(uint256 shares, address receiver) public virtual override returns (uint256) {
require(shares <= maxMint(receiver), "ERC4626: mint more than max");
uint256 assets = previewMint(shares);
_deposit(_msgSender(), receiver, assets, shares);
return assets;
}
/** @dev See {IERC4626-withdraw}. */
function withdraw(uint256 assets, address receiver, address owner) public virtual override returns (uint256) {
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return shares;
}
/** @dev See {IERC4626-redeem}. */
function redeem(uint256 shares, address receiver, address owner) public virtual override returns (uint256) {
require(shares <= maxRedeem(owner), "ERC4626: redeem more than max");
uint256 assets = previewRedeem(shares);
_withdraw(_msgSender(), receiver, owner, assets, shares);
return assets;
}
/**
* @dev Internal conversion function (from assets to shares) with support for rounding direction.
*/
function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256) {
return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding);
}
/**
* @dev Internal conversion function (from shares to assets) with support for rounding direction.
*/
function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256) {
return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding);
}
/**
* @dev Deposit/mint common workflow.
*/
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual {
// If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
// calls the vault, which is assumed not malicious.
//
// Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
// assets are transferred and before the shares are minted, which is a valid state.
// slither-disable-next-line reentrancy-no-eth
SafeERC20Upgradeable.safeTransferFrom(_asset, caller, address(this), assets);
_mint(receiver, shares);
emit Deposit(caller, receiver, assets, shares);
}
/**
* @dev Withdraw/redeem common workflow.
*/
function _withdraw(
address caller,
address receiver,
address owner,
uint256 assets,
uint256 shares
) internal virtual {
if (caller != owner) {
_spendAllowance(owner, caller, shares);
}
// If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
// `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
// calls the vault, which is assumed not malicious.
//
// Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
// shares are burned and after the assets are transferred, which is a valid state.
_burn(owner, shares);
SafeERC20Upgradeable.safeTransfer(_asset, receiver, assets);
emit Withdraw(caller, receiver, owner, assets, shares);
}
function _decimalsOffset() internal view virtual returns (uint8) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
contracts/libraries/Encode.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
library Encode {
function delegate(
string memory _validator
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("delegate(string)", _validator);
}
function undelegate(
string memory _validator,
uint256 _shares
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("undelegate(string,uint256)", _validator, _shares);
}
function redelegate(
string memory _valSrc,
string memory _valDst,
uint256 _shares
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("redelegate(string,string,uint256)", _valSrc, _valDst, _shares);
}
function delegateV2(
string memory _validator,
uint256 _amount
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("delegate(string, uint256)", _validator, _amount);
}
function undelegateV2(
string memory _validator,
uint256 _amount
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("undelegate(string,uint256)", _validator, _amount);
}
function redelegateV2(
string memory _valSrc,
string memory _valDst,
uint256 _amount
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("redelegate(string,string,uint256)", _valSrc, _valDst, _amount);
}
function withdraw(
string memory _validator
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("withdraw(string)", _validator);
}
function transferShares(
string memory _validator,
address _to,
uint256 _shares
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("transferFromShares(string,address,uint256)", _validator, _to, _shares);
}
function transferFromShares(
string memory _validator,
address _from,
address _to,
uint256 _shares
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("transferFromShares(string,address,address,uint256)", _validator, _from, _to, _shares);
}
function delegation(
string memory _validator,
address _delegate
) internal pure returns (bytes memory) {
return abi.encodeWithSignature("delegation(string,address)", _validator, _delegate);
}
function delegationRewards(
string memory _validator,
address _delegate) internal pure returns (bytes memory) {
return abi.encodeWithSignature("delegationRewards(string,address)", _validator, _delegate);
}
function allowanceShares(
string memory _validator,
address _owner,
address _spender) internal pure returns (bytes memory) {
return abi.encodeWithSignature("allowanceShares(string,address,address)", _validator, _owner, _spender);
}
}
contracts/imp/PrecompileStaking.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import {Encode} from "../libraries/Encode.sol";
import {Decode} from "../libraries/Decode.sol";
import {IPrecompileStaking} from "../interfaces/IPrecompileStaking.sol";
/**
* @title PrecompileStaking
*
* @dev Interface to interact to network precompile staking contract functions.
*/
abstract contract PrecompileStaking {
address private constant _stakingAddress = address(0x0000000000000000000000000000000000001003);
/**************************************** Precompile Staking Internal Functions ****************************************/
function _delegate(string memory _val, uint256 _amount) internal returns (uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.call{value: _amount}(Encode.delegate(_val));
Decode.ok(result, data, "delegate failed");
return Decode.delegate(data);
}
function _undelegate(string memory _val, uint256 _shares) internal returns (uint256, uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.call(Encode.undelegate(_val, _shares));
Decode.ok(result, data, "undelegate failed");
return Decode.undelegate(data);
}
function _redelegate(string memory _valSrc, string memory _valDst, uint256 _shares) internal returns (uint256, uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.call(Encode.redelegate(_valSrc, _valDst, _shares));
Decode.ok(result, data, "redelegate failed");
return Decode.redelegate(data);
}
function _delegateV2(string memory _val, uint256 _amount) internal returns (bool _result) {
require(address(this).balance >= _amount, "insufficient balance");
return IPrecompileStaking(_stakingAddress).delegateV2(_val, _amount);
}
function _undelegateV2(string memory _val, uint256 _amount) internal returns (bool _result) {
return IPrecompileStaking(_stakingAddress).undelegateV2(_val,_amount);
}
function _redelegateV2(string memory _valSrc, string memory _valDst, uint256 _amount) internal returns (bool _result) {
return IPrecompileStaking(_stakingAddress).redelegateV2(_valSrc, _valDst, _amount);
}
function _withdraw(string memory _val) internal returns (uint256) {
(bool result, bytes memory data) = _stakingAddress.call(Encode.withdraw(_val));
Decode.ok(result, data, "withdraw failed");
return Decode.withdraw(data);
}
function _transferShares(string memory _val, address _to, uint256 _shares) internal returns (uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.call(Encode.transferShares(_val, _to, _shares));
Decode.ok(result, data, "transferShares failed");
return Decode.transferShares(data);
}
function _transferFromShares(string memory _val, address _from, address _to, uint256 _shares) internal returns (uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.call(Encode.transferFromShares(_val, _from, _to, _shares));
Decode.ok(result, data, "transferFromShares failed");
return Decode.transferFromShares(data);
}
function _delegation(string memory _val, address _del) internal view returns (uint256, uint256) {
(bool result, bytes memory data) = _stakingAddress.staticcall(Encode.delegation(_val, _del));
Decode.ok(result, data, "delegation failed");
return Decode.delegation(data);
}
function _delegationRewards(string memory _val, address _del) internal view returns (uint256) {
(bool result, bytes memory data) = _stakingAddress.staticcall(Encode.delegationRewards(_val, _del));
Decode.ok(result, data, "delegationRewards failed");
return Decode.delegationRewards(data);
}
function _allowanceShares(string memory _val, address _owner, address _spender) internal view returns (uint256) {
(bool result, bytes memory data) = _stakingAddress.staticcall(Encode.allowanceShares(_val, _owner, _spender));
Decode.ok(result, data, "allowanceShares failed");
return Decode.allowanceShares(data);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967Upgradeable {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","storageLayout"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Claim","inputs":[{"type":"address","name":"receiver","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Compound","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"compoundAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CompoundWithFees","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"compoundAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"feeProtocol","internalType":"uint256","indexed":false},{"type":"uint256","name":"feeCompounder","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"uint256","name":"assets","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DistributorChanged","inputs":[{"type":"address","name":"newAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"EmergencyWithdrawVault","inputs":[{"type":"uint256","name":"assets","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeeTreasuryChanged","inputs":[{"type":"address","name":"newAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Stake","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unstake","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ValidatorAdded","inputs":[{"type":"string","name":"val","internalType":"string","indexed":false},{"type":"uint256","name":"newAllocPoint","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ValidatorRedelegated","inputs":[{"type":"string","name":"srcVal","internalType":"string","indexed":false},{"type":"string","name":"dstVal","internalType":"string","indexed":false},{"type":"uint256","name":"sharesAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"redelegatedShares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ValidatorRemoved","inputs":[{"type":"string","name":"val","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"ValidatorUpdated","inputs":[{"type":"string","name":"val","internalType":"string","indexed":false},{"type":"uint256","name":"newAllocPoint","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"VestedFXChanged","inputs":[{"type":"address","name":"newAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"receiver","internalType":"address","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"uint256","name":"assets","internalType":"uint256","indexed":false},{"type":"uint256","name":"shares","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"GOVERNOR_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"OPERATOR_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"OWNER_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addValidator","inputs":[{"type":"string","name":"_validator","internalType":"string"},{"type":"uint256","name":"_allocPoint","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addedValidator","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"asset","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claim","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimable","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"compound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"convertToAssets","inputs":[{"type":"uint256","name":"shares","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"convertToShares","inputs":[{"type":"uint256","name":"assets","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"deposit","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"distributor","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdrawPundiAI","inputs":[{"type":"bool","name":"disableDeposits","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"entrustDelegatedShare","inputs":[{"type":"string","name":"val","internalType":"string"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeOnCompounder","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeOnReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeOnWithdrawal","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeTreasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalDelegationRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"string","name":"","internalType":"string"}],"name":"getValInfo","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getValLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVaultConfigs","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_asset","internalType":"address"},{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_governor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxDeposit","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxMint","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxRedeem","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxWithdraw","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"mint","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingFxReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewDeposit","inputs":[{"type":"uint256","name":"assets","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewMint","inputs":[{"type":"uint256","name":"shares","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewRedeem","inputs":[{"type":"uint256","name":"shares","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previewWithdraw","inputs":[{"type":"uint256","name":"assets","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recoverToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"_recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeem","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"redelegateValidator","inputs":[{"type":"uint256","name":"srcId","internalType":"uint256"},{"type":"uint256","name":"dstId","internalType":"uint256"},{"type":"uint256","name":"redelegateAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeValidator","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sendVestedFX","inputs":[{"type":"uint256","name":"safeAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bool","name":"native","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalAssets","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateConfigs","inputs":[{"type":"uint256","name":"newMinCompound","internalType":"uint256"},{"type":"uint256","name":"newCapStakeFxTarget","internalType":"uint256"},{"type":"uint256","name":"newUnstakeFxTarget","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateDistributor","inputs":[{"type":"address","name":"newAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateFeeTreasury","inputs":[{"type":"address","name":"newAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateFees","inputs":[{"type":"uint256","name":"newFeeOnReward","internalType":"uint256"},{"type":"uint256","name":"newFeeOnCompounder","internalType":"uint256"},{"type":"uint256","name":"newFeeOnWithdrawal","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateValidator","inputs":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint256","name":"newAllocPoint","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateVestedFX","inputs":[{"type":"address","name":"newAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"claimableReward","internalType":"uint256"},{"type":"uint256","name":"previousCumulatedRewardPerToken","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"string","name":"validator","internalType":"string"}],"name":"valInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"stakeId","internalType":"uint256"},{"type":"uint256","name":"unstakeId","internalType":"uint256"},{"type":"uint256","name":"length","internalType":"uint256"},{"type":"uint256","name":"totalAllocPoint","internalType":"uint256"},{"type":"uint256","name":"cumulativeRewardPerToken","internalType":"uint256"}],"name":"vaultInfo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vestedFX","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdraw","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e7565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051615e816200011f6000396000818161161001528181611650015281816118a1015281816118e10152611a7b0152615e816000f3fe60806040526004361061046c5760003560e01c80636e553f651161024a578063c0c53b8b11610139578063d905777e116100b6578063f5b541a61161007a578063f5b541a614610d5a578063f69e204614610d7e578063f7beef1114610d93578063f7c618c114610db3578063fe1b482a14610dc857600080fd5b8063d905777e14610cc5578063dd62ed3e14610ce5578063e58378bb14610d05578063ef8b30f714610be1578063f4536afc14610d2657600080fd5b8063ce96cb77116100fd578063ce96cb7714610c25578063d04323c514610c45578063d4a0d4c614610c65578063d547741f14610c85578063d8e392f514610ca557600080fd5b8063c0c53b8b14610ba0578063c3e17dc814610bc0578063c63d75b614610817578063c6e6f59214610be1578063ccc5749014610c0157600080fd5b8063a217fddf116101c7578063b44d29c31161018b578063b44d29c314610b2d578063b460af9414610b44578063ba08765214610b44578063bc30a61814610b5f578063bfe1092814610b7f57600080fd5b8063a217fddf14610aa5578063a457c2d714610aba578063a9059cbb14610ada578063abe50f1914610afa578063b3d7f6b914610b0d57600080fd5b80638e512acb1161020e5780638e512acb14610a1457806391d1485414610a3457806394bf804d1461099357806395d89b4114610a545780639c783aae14610a6957600080fd5b80636e553f651461099357806370a08231146109b35780637f77403d146109d357806380cdf6e7146109e85780638456cb59146109ff57600080fd5b806336568abe116103665780634f1ef286116102e357806354651a78116102a757806354651a781461090c5780635c975abb1461092257806360dc23401461093b57806365a545f41461095c578063684d6fdf1461097c57600080fd5b80634f1ef286146108505780634f9e380514610863578063501ec738146108835780635128823a146108d757806352d1902d146108f757600080fd5b80633f4ba83a1161032a5780633f4ba83a146107e2578063402914f5146107f7578063402d267d1461081757806346ab150e146108395780634cdad506146104f257600080fd5b806336568abe1461073a5780633659cfe61461075a57806338d52e0f1461077a57806339509351146107ad5780633e158b0c146107cd57600080fd5b80631959a002116103f4578063248a9ca3116103b8578063248a9ca3146106825780632d82b70b146106b35780632e17de78146106d35780632f2ff15d146106f3578063313ce5671461071357600080fd5b80631959a002146105b85780631d07b544146106025780631e83409a14610622578063224290851461064257806323b872dd1461066257600080fd5b8063095ea7b31161043b578063095ea7b3146105125780630a28a47714610532578063102dbefe14610552578063156be05a1461058057806318160ddd146105a257600080fd5b806301e1d1141461047857806301ffc9a7146104a057806306fdde03146104d057806307a2d13a146104f257600080fd5b3661047357005b600080fd5b34801561048457600080fd5b5061048d610ddd565b6040519081526020015b60405180910390f35b3480156104ac57600080fd5b506104c06104bb3660046151d0565b610dee565b6040519015158152602001610497565b3480156104dc57600080fd5b506104e5610e23565b604051610497919061524a565b3480156104fe57600080fd5b5061048d61050d36600461525d565b610eb6565b34801561051e57600080fd5b506104c061052d36600461528b565b610ec3565b34801561053e57600080fd5b5061048d61054d36600461525d565b610edb565b34801561055e57600080fd5b5061057261056d36600461525d565b610ee8565b6040516104979291906152b7565b34801561058c57600080fd5b506105a061059b36600461539d565b610f8e565b005b3480156105ae57600080fd5b506101c35461048d565b3480156105c457600080fd5b506105ed6105d33660046153e2565b610267602052600090815260409020805460019091015482565b60408051928352602083019190915201610497565b34801561060e57600080fd5b5061057261061d36600461525d565b6110e0565b34801561062e57600080fd5b5061048d61063d3660046153e2565b611191565b34801561064e57600080fd5b506105a061065d3660046153ff565b6111b6565b34801561066e57600080fd5b506104c061067d36600461542b565b6111e2565b34801561068e57600080fd5b5061048d61069d36600461525d565b600090815261012c602052604090206001015490565b3480156106bf57600080fd5b506105a06106ce36600461539d565b611208565b3480156106df57600080fd5b506105a06106ee36600461525d565b6113ef565b3480156106ff57600080fd5b506105a061070e36600461546c565b611541565b34801561071f57600080fd5b5061072861156c565b60405160ff9091168152602001610497565b34801561074657600080fd5b506105a061075536600461546c565b61158c565b34801561076657600080fd5b506105a06107753660046153e2565b611606565b34801561078657600080fd5b506101f3546001600160a01b03165b6040516001600160a01b039091168152602001610497565b3480156107b957600080fd5b506104c06107c836600461528b565b6116e2565b3480156107d957600080fd5b506105a0611704565b3480156107ee57600080fd5b506105a0611722565b34801561080357600080fd5b5061048d6108123660046153e2565b611741565b34801561082357600080fd5b5061048d6108323660046153e2565b5060001990565b34801561084557600080fd5b5061048d6102575481565b6105a061085e36600461549c565b611897565b34801561086f57600080fd5b506105a061087e3660046153ff565b611963565b34801561088f57600080fd5b5061026154610262546102635461026454610265546108af949392919085565b604080519586526020860194909452928401919091526060830152608082015260a001610497565b3480156108e357600080fd5b506105a06108f2366004615500565b61198f565b34801561090357600080fd5b5061048d611a6e565b34801561091857600080fd5b506102635461048d565b34801561092e57600080fd5b5061018f5460ff166104c0565b34801561094757600080fd5b5061025b54610795906001600160a01b031681565b34801561096857600080fd5b506105a06109773660046153e2565b611b21565b34801561098857600080fd5b5061048d6102565481565b34801561099f57600080fd5b5061048d6109ae36600461546c565b611b8f565b3480156109bf57600080fd5b5061048d6109ce3660046153e2565b611bc5565b3480156109df57600080fd5b506105a0611be1565b3480156109f457600080fd5b5061048d6102595481565b348015610a0b57600080fd5b506105a0611df2565b348015610a2057600080fd5b506105a0610a2f3660046153ff565b611e11565b348015610a4057600080fd5b506104c0610a4f36600461546c565b6120d3565b348015610a6057600080fd5b506104e56120ff565b348015610a7557600080fd5b506104c0610a84366004615522565b80516020818301810180516102688252928201919093012091525460ff1681565b348015610ab157600080fd5b5061048d600081565b348015610ac657600080fd5b506104c0610ad536600461528b565b61210f565b348015610ae657600080fd5b506104c0610af536600461528b565b612195565b6105a0610b08366004615565565b6121a3565b348015610b1957600080fd5b5061048d610b2836600461525d565b6123f2565b348015610b3957600080fd5b5061048d6102585481565b348015610b5057600080fd5b5061048d6109ae36600461558a565b348015610b6b57600080fd5b506105a0610b7a3660046153e2565b6123ff565b348015610b8b57600080fd5b5061025c54610795906001600160a01b031681565b348015610bac57600080fd5b506105a0610bbb3660046155cc565b612465565b348015610bcc57600080fd5b5061025a54610795906001600160a01b031681565b348015610bed57600080fd5b5061048d610bfc36600461525d565b6125c5565b348015610c0d57600080fd5b5061048d6c474f5645524e4f525f524f4c4560981b81565b348015610c3157600080fd5b5061048d610c403660046153e2565b6125d2565b348015610c5157600080fd5b506105a0610c603660046155fc565b6125e7565b348015610c7157600080fd5b506105a0610c803660046153e2565b6126ee565b348015610c9157600080fd5b506105a0610ca036600461546c565b612754565b348015610cb157600080fd5b506105a0610cc036600461525d565b61277a565b348015610cd157600080fd5b5061048d610ce03660046153e2565b612838565b348015610cf157600080fd5b5061048d610d00366004615633565b612843565b348015610d1157600080fd5b5061048d694f574e45525f524f4c4560b01b81565b348015610d3257600080fd5b5061025d5461025e546102605460408051938452602084019290925290820152606001610497565b348015610d6657600080fd5b5061048d6c4f50455241544f525f524f4c4560981b81565b348015610d8a57600080fd5b506105a061286f565b348015610d9f57600080fd5b506105a0610dae366004615661565b612887565b348015610dbf57600080fd5b506107956129f1565b348015610dd457600080fd5b5061048d612a60565b600080610de8612b5e565b92915050565b60006001600160e01b03198216637965db0b60e01b1480610de857506301ffc9a760e01b6001600160e01b0319831614610de8565b60606101c48054610e339061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5f9061567e565b8015610eac5780601f10610e8157610100808354040283529160200191610eac565b820191906000526020600020905b815481529060010190602001808311610e8f57829003601f168201915b5050505050905090565b6000610de8826000612c50565b600033610ed1818585612c88565b5060019392505050565b6000610de8826001612dad565b6102666020526000908152604090208054600182018054919291610f0b9061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f379061567e565b8015610f845780601f10610f5957610100808354040283529160200191610f84565b820191906000526020600020905b815481529060010190602001808311610f6757829003601f168201915b5050505050905082565b6c474f5645524e4f525f524f4c4560981b610fa881612de0565b61026883604051610fb991906156b8565b9081526040519081900360200190205460ff16156110095760405162461bcd60e51b8152602060048201526008602482015267185919195915985b60c21b60448201526064015b60405180910390fd5b61026354600090815261026660205260409020600101611029848261571a565b5061026380546000908152610266602052604081208490558154919061104e836157f0565b91905055508161026160030160008282546110699190615809565b9250508190555060016102688460405161108391906156b8565b908152604051908190036020018120805492151560ff19909316929092179091557f629f58e50ce5bc6c5368883b59192dea9abbda8c1590556929289ed147daa075906110d3908590859061581c565b60405180910390a1505050565b600081815261026660205260408120805460019091018054606092919081906111089061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546111349061567e565b80156111815780601f1061115657610100808354040283529160200191611181565b820191906000526020600020905b81548152906001019060200180831161116457829003601f168201915b5050505050905091509150915091565b600061119b612dea565b6111a53383612e43565b90506111b16001609655565b919050565b6c474f5645524e4f525f524f4c4560981b6111d081612de0565b50610257929092556102585561025955565b6000336111f0858285612eda565b6111fb858585612f4e565b60019150505b9392505050565b611210612dea565b611218613106565b6000811161125b5760405162461bcd60e51b815260206004820152601060248201526f456e74727573743a203020736861726560801b6044820152606401611000565b600080611268843361314d565b91509150828210156112af5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420656e6f75676820736861726560801b6044820152606401611000565b6112b76131fb565b6112c13333612e43565b5060006112cc610ddd565b90506000826112db8587615854565b6112e59190615868565b61025e549091506112f68383615809565b11156113335760405162461bcd60e51b815260206004820152600c60248201526b05374616b653a203e204361760a41b6044820152606401611000565b600061133f6101c35490565b90506000806113508933308b613394565b915091508061025660008282546113679190615809565b909155506000905082158061137a575083155b6113905761138b8385886000613454565b611392565b825b905061139e33826134b1565b604080518481526020810183905233917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6910160405180910390a250505050505050506113eb6001609655565b5050565b6113f7612dea565b6113ff613106565b600081116114435760405162461bcd60e51b8152602060048201526011602482015270155b9cdd185ad94e880c08185b5bdd5b9d607a1b6044820152606401611000565b600061144e33611bc5565b9050818110156114915760405162461bcd60e51b815260206004820152600e60248201526d416d6f756e74203e207374616b6560901b6044820152606401611000565b6114996131fb565b6114a33333612e43565b5060006114af83610eb6565b90506000612710610259546127106114c7919061587f565b6114d19084615868565b6114db9190615854565b90506114e73385613580565b80156114f6576114f6816136c3565b604080518281526020810186905233917ff960dbf9e5d0682f7a298ed974e33a28b4464914b7a2bfac12ae419a9afeb280910160405180910390a250505061153e6001609655565b50565b600082815261012c602052604090206001015461155d81612de0565b6115678383613856565b505050565b6000806101f3546115879190600160a01b900460ff16615892565b905090565b6001600160a01b03811633146115fc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611000565b6113eb82826138dd565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361164e5760405162461bcd60e51b8152600401611000906158ab565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611697600080516020615e05833981519152546001600160a01b031690565b6001600160a01b0316146116bd5760405162461bcd60e51b8152600401611000906158f7565b6116c681613945565b6040805160008082526020820190925261153e9183919061395c565b600033610ed18185856116f58383612843565b6116ff9190615809565b612c88565b61170c612dea565b6117166000613ac7565b6117206001609655565b565b694f574e45525f524f4c4560b01b61173981612de0565b61153e613c2d565b6001600160a01b03811660009081526102676020908152604080832081518083019092528054825260010154918101919091528161177e84611bc5565b90508060000361179057505192915050565b600061179c6101c35490565b905060006c0c9f2c9cd04674edea4000000061025c60009054906101000a90046001600160a01b03166001600160a01b031663eded3fda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611802573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118269190615943565b6118309190615868565b9050600061183e8383615854565b6102655461184c9190615809565b90506c0c9f2c9cd04674edea4000000085602001518261186c919061587f565b6118769086615868565b6118809190615854565b855161188c9190615809565b979650505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036118df5760405162461bcd60e51b8152600401611000906158ab565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611928600080516020615e05833981519152546001600160a01b031690565b6001600160a01b03161461194e5760405162461bcd60e51b8152600401611000906158f7565b61195782613945565b6113eb8282600161395c565b6c474f5645524e4f525f524f4c4560981b61197d81612de0565b5061025d9290925561025e5561026055565b6c474f5645524e4f525f524f4c4560981b6119a981612de0565b6102635483106119e85760405162461bcd60e51b815260206004820152600a602482015269125b9d985b1a5908125160b21b6044820152606401611000565b60008381526102666020526040902054610264548190611a09908590615809565b611a13919061587f565b61026455600084815261026660205260409081902084815590517f772c4dd6aa65f9df35ad1651832145634a54ecbc75b6409a0f982e7dc88e45d491611a6091600190910190869061595c565b60405180910390a150505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611b0e5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611000565b50600080516020615e0583398151915290565b694f574e45525f524f4c4560b01b611b3881612de0565b61025a80546001600160a01b0319166001600160a01b0384169081179091556040519081527f699887cd555c0c7e02df97f2ac6fe2db97cd0418f47a782b7ffa6fcfa0c96743906020015b60405180910390a15050565b60405162461bcd60e51b8152602060048201526008602482015267191a5cd8589b195960c21b6044820152600090606401611000565b6001600160a01b031660009081526101c1602052604090205490565b6c474f5645524e4f525f524f4c4560981b611bfb81612de0565b6000611c076102635490565b905060005b81811015611dde57600081815261026660205260408120549003611dd6576000818152610266602052604081206001018054611c479061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611c739061567e565b8015611cc05780601f10611c9557610100808354040283529160200191611cc0565b820191906000526020600020905b815481529060010190602001808311611ca357829003601f168201915b505050505090506000611cd3823061314d565b50905080600003611dd357600061026883604051611cf191906156b8565b908152604051908190036020019020805491151560ff199092169190911790556000611d1e60018661587f565b6000818152610266602052604080822087835291208154815591925090600180820190611d4d908401826159f0565b50505060008181526102666020526040812081815590611d706001830182615182565b50507f53344ca00b011ca20d3dc9f1bb71ed60e097b598b9f35482879138cc15f28ef983604051611da1919061524a565b60405180910390a184611db381615ac3565b95505083600003611dc657505050611c0c565b611dcf84615ac3565b9350505b50505b600101611c0c565b506000610261819055610262556102635550565b694f574e45525f524f4c4560b01b611e0981612de0565b61153e613c80565b6c474f5645524e4f525f524f4c4560981b611e2b81612de0565b6102635484108015611e3f57506102635483105b611e785760405162461bcd60e51b815260206004820152600a602482015269125b9d985b1a5908125160b21b6044820152606401611000565b6000610266600086815260200190815260200160002060405180604001604052908160008201548152602001600182018054611eb39061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611edf9061567e565b8015611f2c5780601f10611f0157610100808354040283529160200191611f2c565b820191906000526020600020905b815481529060010190602001808311611f0f57829003601f168201915b50505050508152505090506000610266600086815260200190815260200160002060405180604001604052908160008201548152602001600182018054611f729061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611f9e9061567e565b8015611feb5780601f10611fc057610100808354040283529160200191611feb565b820191906000526020600020905b815481529060010190602001808311611fce57829003601f168201915b5050505050815250509050600061200683602001513061314d565b915050808511156120435760405162461bcd60e51b815260206004820152600760248201526608505b5bdd5b9d60ca1b6044820152606401611000565b61204b6131fb565b60006120608460200151846020015188613cbe565b90506001811515146120845760405162461bcd60e51b815260040161100090615ada565b7f4b81c788046a326390b0432cf535dffbfc0ba3b5f1bf9bfbf9f5b1533d335cb98460200151846020015188896040516120c19493929190615b01565b60405180910390a15050505050505050565b600091825261012c602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606101c58054610e339061567e565b6000338161211d8286612843565b90508381101561217d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611000565b61218a8286868403612c88565b506001949350505050565b600033610ed1818585612f4e565b6121ab612dea565b6121b3613106565b600082116121f55760405162461bcd60e51b815260206004820152600f60248201526e14dd185ad94e880c08185b5bdd5b9d608a1b6044820152606401611000565b600181151514612206576000612208565b815b341461223f5760405162461bcd60e51b8152602060048201526006602482015265085d985b1a5960d21b6044820152606401611000565b61025e5461224b610ddd565b6122559084615809565b11156122925760405162461bcd60e51b815260206004820152600c60248201526b05374616b653a203e204361760a41b6044820152606401611000565b61229a6131fb565b6122a43333612e43565b5080151560000361238c576040516323b872dd60e01b8152336004820152306024820152604481018390527380b5a32e4f032b2a058b4f29ec95eefeeb87adcd906323b872dd90606401600060405180830381600087803b15801561230857600080fd5b505af115801561231c573d6000803e3d6000fd5b505060405163f3fef3a360e01b8152306004820152602481018590527380b5a32e4f032b2a058b4f29ec95eefeeb87adcd925063f3fef3a39150604401600060405180830381600087803b15801561237357600080fd5b505af1158015612387573d6000803e3d6000fd5b505050505b6000612397836125c5565b90506123a333826134b1565b6123ac83613d2d565b604080518481526020810183905233917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6910160405180910390a2506113eb6001609655565b6000610de8826001612c50565b694f574e45525f524f4c4560b01b61241681612de0565b61025c80546001600160a01b0319166001600160a01b0384169081179091556040519081527fe37acc13f5ed9d0cc83c2842e093fe5a494d5b8fb5b1db06356b327081832f5290602001611b83565b600054610100900460ff16158080156124855750600054600160ff909116105b8061249f5750303b15801561249f575060005460ff166001145b6125025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611000565b6000805460ff191660011790558015612525576000805461ff0019166101001790555b612575846040518060400160405280600f81526020016e29ba30b5b2b210232c102a37b5b2b760891b815250604051806040016040528060048152602001630a6e88cb60e31b8152508686613f52565b61257d613f86565b80156125bf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001611a60565b50505050565b6000610de8826000612dad565b6000610de86125e083611bc5565b6000612c50565b694f574e45525f524f4c4560b01b6125fe81612de0565b6001600160a01b03821661264b5760405162461bcd60e51b815260206004820152601460248201527353656e6420746f207a65726f206164647265737360601b6044820152606401611000565b6001600160a01b038416156126735761266e6001600160a01b0385168385613fad565b6125bf565b60405182906000906001600160a01b0383169086908381818185875af1925050503d80600081146126c0576040519150601f19603f3d011682016040523d82523d6000602084013e6126c5565b606091505b50509050806126e65760405162461bcd60e51b815260040161100090615b3a565b505050505050565b694f574e45525f524f4c4560b01b61270581612de0565b61025b80546001600160a01b0319166001600160a01b0384169081179091556040519081527ff30aa7cab072f507cbc1b4906dcc281e649884fded6a818238e407dee53bf0ba90602001611b83565b600082815261012c602052604090206001015461277081612de0565b61156783836138dd565b61025a546001600160a01b031633146127ce5760405162461bcd60e51b815260206004820152601660248201527513db9b1e4815995cdd195911960818d85b8818d85b1b60521b6044820152606401611000565b6040513390600090829084908381818185875af1925050503d8060008114612812576040519150601f19603f3d011682016040523d82523d6000602084013e612817565b606091505b50509050806115675760405162461bcd60e51b815260040161100090615b3a565b6000610de882611bc5565b6001600160a01b0391821660009081526101c26020908152604080832093909416825291909152205490565b612877612dea565b61287f613106565b6117166131fb565b694f574e45525f524f4c4560b01b61289e81612de0565b60008060006128ad6102635490565b905060005b818110156129935760008181526102666020526040812060010180546128d79061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546129039061567e565b80156129505780601f1061292557610100808354040283529160200191612950565b820191906000526020600020905b81548152906001019060200180831161293357829003601f168201915b505050505090506000612963823061314d565b9150506129708382613fff565b945061297c8187615809565b95505050808061298b906157f0565b9150506128b2565b508415156001036129a6576129a6613c80565b7f1e0f68802bf96eff15f2012f51d490baa38adf7bbb90bc1a8160620137bdd0c7836129d26101c35490565b6040805192835260208301919091520160405180910390a15050505050565b61025c546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa158015612a3c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115879190615b65565b6000806000612a6f6102635490565b905060005b81811015612b48576000818152610266602052604081206001018054612a999061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054612ac59061567e565b8015612b125780601f10612ae757610100808354040283529160200191612b12565b820191906000526020600020905b815481529060010190602001808311612af557829003601f168201915b505050505090506000612b258230614196565b9050612b318186615809565b945050508080612b40906157f0565b915050612a74565b5061025654612b579083615809565b9250505090565b6000806000612b6d6102635490565b905060005b81811015612c48576000818152610266602052604081206001018054612b979061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054612bc39061567e565b8015612c105780601f10612be557610100808354040283529160200191612c10565b820191906000526020600020905b815481529060010190602001808311612bf357829003601f168201915b505050505090506000612c23823061314d565b9150612c3190508186615809565b945050508080612c40906157f0565b915050612b72565b509092915050565b600080612c5d6101c35490565b90508015612c7e57612c79612c70610ddd565b85908386613454565b612c80565b835b949350505050565b6001600160a01b038316612cea5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611000565b6001600160a01b038216612d4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611000565b6001600160a01b0383811660008181526101c2602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080612dba6101c35490565b9050831580612dc7575080155b612c7e57612c7981612dd7610ddd565b86919086613454565b61153e8133614242565b600260965403612e3c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611000565b6002609655565b6000612e4e83613ac7565b6001600160a01b0383166000908152610267602052604081208054918155908015612c8057612e908482612e806129f1565b6001600160a01b03169190613fad565b604080516001600160a01b0387168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a1949350505050565b6000612ee68484612843565b905060001981146125bf5781811015612f415760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611000565b6125bf8484848403612c88565b6001600160a01b038316612fb25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611000565b6001600160a01b0382166130145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611000565b61301f83838361429b565b6001600160a01b03831660009081526101c16020526040902054818110156130985760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611000565b6001600160a01b0380851660008181526101c1602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906130f99086815260200190565b60405180910390a36125bf565b61018f5460ff16156117205760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611000565b600080808061100361315f87876142b5565b60405161316c91906156b8565b600060405180830381855afa9150503d80600081146131a7576040519150601f19603f3d011682016040523d82523d6000602084013e6131ac565b606091505b50915091506131e582826040518060400160405280601181526020017019195b1959d85d1a5bdb8819985a5b1959607a1b8152506142fc565b6131ee81614350565b9350935050509250929050565b613203614376565b610256805460009182905561025754909190612710906132239084615868565b61322d9190615854565b9050600061271061025854846132439190615868565b61324d9190615854565b90508061325a838561587f565b613264919061587f565b925061326f83613d2d565b61025b546040516001600160a01b03909116903390600090839086908381818185875af1925050503d80600081146132c3576040519150601f19603f3d011682016040523d82523d6000602084013e6132c8565b606091505b505090506000826001600160a01b03168560405160006040518083038185875af1925050503d8060008114613319576040519150601f19603f3d011682016040523d82523d6000602084013e61331e565b606091505b5050905081801561332c5750805b6133485760405162461bcd60e51b815260040161100090615b3a565b604080518881526020810188905290810186905233907f26d9e92b9fa4eb064465ecae8eb30c511a5f35fc85e1128cb964013f336fee939060600160405180910390a250505050505050565b60008080806110036133a88989898961448e565b6040516133b591906156b8565b6000604051808303816000865af19150503d80600081146133f2576040519150601f19603f3d011682016040523d82523d6000602084013e6133f7565b606091505b509150915061343c82826040518060400160405280601981526020017f7472616e7366657246726f6d536861726573206661696c6564000000000000008152506142fc565b61344581614350565b93509350505094509492505050565b6000806134628686866144db565b9050600183600281111561347857613478615b82565b1480156134955750600084806134905761349061583e565b868809115b156134a8576134a5600182615809565b90505b95945050505050565b6001600160a01b0382166135075760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611000565b6135136000838361429b565b806101c360008282546135269190615809565b90915550506001600160a01b03821660008181526101c160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166135e05760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611000565b6135ec8260008361429b565b6001600160a01b03821660009081526101c16020526040902054818110156136615760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611000565b6001600160a01b03831660008181526101c16020908152604080832086860390556101c380548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040805160a08101825261026154815261026254602082018190526102635492820183905261026454606083015261026554608083015290916000849050600080600061026054881061375d57600061371d60028a615854565b90506137298782613fff565b9250613735838661587f565b945085613743886001615809565b61374d9190615b98565b96506137598285615809565b9350505b83156137a45761376d8685613fff565b9150613779828561587f565b935084613787876001615809565b6137919190615b98565b955061379d8184615809565b925061375d565b61025a546001600160a01b031663285c7317338a6137c542621baf80615809565b6040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561381357600080fd5b505af1158015613827573d6000803e3d6000fd5b505050610262879055506102568054849190600090613847908490615809565b90915550505050505050505050565b61386082826120d3565b6113eb57600082815261012c602090815260408083206001600160a01b03851684529091529020805460ff191660011790556138993390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6138e782826120d3565b156113eb57600082815261012c602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b694f574e45525f524f4c4560b01b6113eb81612de0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561398f57611567836145c5565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156139e9575060408051601f3d908101601f191682019092526139e691810190615943565b60015b613a4c5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611000565b600080516020615e058339815191528114613abb5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611000565b50611567838383614661565b61025c546040805163e4fc6b6d60e01b815290516000926001600160a01b03169163e4fc6b6d916004808301926020929190829003018187875af1158015613b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b379190615943565b90506000613b456101c35490565b610265549091508115801590613b5b5750600083115b15613b955781613b786c0c9f2c9cd04674edea4000000085615868565b613b829190615854565b613b8c9082615809565b61026581905590505b80600003613ba35750505050565b6001600160a01b038416156125bf576001600160a01b03841660009081526102676020526040812090613bd586611bc5565b905060006c0c9f2c9cd04674edea40000000836001015485613bf7919061587f565b613c019084615868565b613c0b9190615854565b90506000818460000154613c1f9190615809565b845550505060010155505050565b613c35614686565b61018f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b613c88613106565b61018f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613c633390565b604051637711363360e11b81526000906110039063ee226c6690613cea90879087908790600401615bac565b6020604051808303816000875af1158015613d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c809190615be2565b6040805160a0810182526102615480825261026254602083015261026354928201839052610264546060830181905261026554608084015291926000613d71610ddd565b90506000613d7e876146d0565b90506000613d8c8289615854565b90508760005b8115613f40576000610266600089815260200190815260200160002060405180604001604052908160008201548152602001600182018054613dd39061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054613dff9061567e565b8015613e4c5780601f10613e2157610100808354040283529160200191613e4c565b820191906000526020600020905b815481529060010190602001808311613e2f57829003601f168201915b5050509190925250508151919250889050613e688a6001615809565b613e729190615b98565b985080600003613e83575050613d92565b61025e548710613e9557839250613eec565b6000613ea583602001513061314d565b91505060008b61025e5484613eba9190615868565b613ec49190615854565b9050808210613ed65750505050613d92565b868611613ee557859450613ee9565b8694505b50505b6000613efc836020015185614742565b9050600181151514613f205760405162461bcd60e51b815260040161100090615ada565b613f2a8489615809565b9750613f36848661587f565b9450505050613d92565b50505061026193909355505050505050565b613f5b856147f5565b613f658484614825565b613f6d614856565b613f75613f86565b613f7f8282614885565b5050505050565b600054610100900460ff166117205760405162461bcd60e51b815260040161100090615bff565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261156790849061491b565b600082815261026660205260408120600101805482916140a6916140229061567e565b80601f016020809104026020016040519081016040528092919081815260200182805461404e9061567e565b801561409b5780601f106140705761010080835404028352916020019161409b565b820191906000526020600020905b81548152906001019060200180831161407e57829003601f168201915b50505050503061314d565b9150600090508115612c80578382106140c05750826140c3565b50805b600085815261026660205260408120600101805461416991906140e59061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546141119061567e565b801561415e5780601f106141335761010080835404028352916020019161415e565b820191906000526020600020905b81548152906001019060200180831161414157829003601f168201915b5050505050836149f0565b905060018115151461418d5760405162461bcd60e51b815260040161100090615ada565b50949350505050565b600080806110036141a78686614a1a565b6040516141b491906156b8565b600060405180830381855afa9150503d80600081146141ef576040519150601f19603f3d011682016040523d82523d6000602084013e6141f4565b606091505b509150915061423982826040518060400160405280601881526020017f64656c65676174696f6e52657761726473206661696c656400000000000000008152506142fc565b6134a881614a61565b61424c82826120d3565b6113eb5761425981614a78565b614264836020614a8a565b604051602001614275929190615c4a565b60408051601f198184030181529082905262461bcd60e51b82526110009160040161524a565b6142a3613106565b6142ac83613ac7565b61156782613ac7565b606082826040516024016142ca929190615cbf565b60408051601f198184030181529190526020810180516001600160e01b031663d5c498eb60e01b179052905092915050565b82611567576000828060200190518101906143179190615ce9565b905060018251101561433d578060405162461bcd60e51b8152600401611000919061524a565b8181604051602001614275929190615d57565b6000806000808480602001905181019061436a9190615d94565b90969095509350505050565b6000806143836102635490565b905060005b818110156144715760008181526102666020526040812060010180546143ad9061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546143d99061567e565b80156144265780601f106143fb57610100808354040283529160200191614426565b820191906000526020600020905b81548152906001019060200180831161440957829003601f168201915b5050505050905060006144398230614196565b9050801561445c57600061444c83614c26565b90506144588187615809565b9550505b50508080614469906157f0565b915050614388565b508161025660008282546144859190615809565b90915550505050565b6060848484846040516024016144a79493929190615db8565b60408051601f198184030181529190526020810180516001600160e01b031663dc6ffc7d60e01b1790529050949350505050565b60008080600019858709858702925082811083820303915050806000036145155783828161450b5761450b61583e565b0492505050611201565b80841161455c5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401611000565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6001600160a01b0381163b6146325760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611000565b600080516020615e0583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61466a83614cc5565b6000825111806146775750805b15611567576125bf8383614d05565b61018f5460ff166117205760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611000565b600080806146e6670de0b6b3a764000085615854565b905060006146f46102635490565b90505b600a821061471e5761470a600a83615854565b915082614716816157f0565b9350506146f7565b82156147375780831161473157826134a8565b806134a8565b600195945050505050565b60008147101561478b5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611000565b604051636d78803560e01b815261100390636d788035906147b2908690869060040161581c565b6020604051808303816000875af11580156147d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112019190615be2565b600054610100900460ff1661481c5760405162461bcd60e51b815260040161100090615bff565b61153e81614d2a565b600054610100900460ff1661484c5760405162461bcd60e51b815260040161100090615bff565b6113eb8282614db0565b600054610100900460ff1661487d5760405162461bcd60e51b815260040161100090615bff565b611720614df2565b61489c694f574e45525f524f4c4560b01b83613856565b6148b66c474f5645524e4f525f524f4c4560981b82613856565b6148cd694f574e45525f524f4c4560b01b80614e26565b6148f46c474f5645524e4f525f524f4c4560981b694f574e45525f524f4c4560b01b614e26565b6113eb6c4f50455241544f525f524f4c4560981b694f574e45525f524f4c4560b01b614e26565b6000614970826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614e729092919063ffffffff16565b90508051600014806149915750808060200190518101906149919190615be2565b6115675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611000565b60405163de2b345160e01b81526000906110039063de2b3451906147b2908690869060040161581c565b60608282604051602401614a2f929190615cbf565b60408051601f198184030181529190526020810180516001600160e01b03166328d7a89d60e11b179052905092915050565b600080828060200190518101906112019190615943565b6060610de86001600160a01b03831660145b60606000614a99836002615868565b614aa4906002615809565b67ffffffffffffffff811115614abc57614abc6152d0565b6040519080825280601f01601f191660200182016040528015614ae6576020820181803683370190505b509050600360fc1b81600081518110614b0157614b01615dee565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614b3057614b30615dee565b60200101906001600160f81b031916908160001a9053506000614b54846002615868565b614b5f906001615809565b90505b6001811115614bd7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614b9357614b93615dee565b1a60f81b828281518110614ba957614ba9615dee565b60200101906001600160f81b031916908160001a90535060049490941c93614bd081615ac3565b9050614b62565b5083156112015760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611000565b60008080611003614c3685614e81565b604051614c4391906156b8565b6000604051808303816000865af19150503d8060008114614c80576040519150601f19603f3d011682016040523d82523d6000602084013e614c85565b606091505b5091509150614cbc82826040518060400160405280600f81526020016e1dda5d1a191c985dc819985a5b1959608a1b8152506142fc565b612c8081614a61565b614cce816145c5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606112018383604051806060016040528060278152602001615e2560279139614ec4565b600054610100900460ff16614d515760405162461bcd60e51b815260040161100090615bff565b600080614d5d83614f3c565b9150915081614d6d576012614d6f565b805b6101f380546001600160a01b039095166001600160a01b031960ff93909316600160a01b02929092166001600160a81b031990951694909417179092555050565b600054610100900460ff16614dd75760405162461bcd60e51b815260040161100090615bff565b6101c4614de4838261571a565b506101c5611567828261571a565b600054610100900460ff16614e195760405162461bcd60e51b815260040161100090615bff565b61018f805460ff19169055565b600082815261012c6020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6060612c808484600085615018565b606081604051602401614e94919061524a565b60408051601f198184030181529190526020810180516001600160e01b03166318fdb3e160e11b17905292915050565b6060600080856001600160a01b031685604051614ee191906156b8565b600060405180830381855af49150503d8060008114614f1c576040519150601f19603f3d011682016040523d82523d6000602084013e614f21565b606091505b5091509150614f32868383876150e4565b9695505050505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691614f83916156b8565b600060405180830381855afa9150503d8060008114614fbe576040519150601f19603f3d011682016040523d82523d6000602084013e614fc3565b606091505b5091509150818015614fd757506020815110155b1561500b57600081806020019051810190614ff29190615943565b905060ff8111615009576001969095509350505050565b505b5060009485945092505050565b6060824710156150795760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611000565b600080866001600160a01b0316858760405161509591906156b8565b60006040518083038185875af1925050503d80600081146150d2576040519150601f19603f3d011682016040523d82523d6000602084013e6150d7565b606091505b509150915061188c878383875b6060831561515357825160000361514c576001600160a01b0385163b61514c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611000565b5081612c80565b612c8083838151156151685781518083602001fd5b8060405162461bcd60e51b8152600401611000919061524a565b50805461518e9061567e565b6000825580601f1061519e575050565b601f01602090049060005260206000209081019061153e91905b808211156151cc57600081556001016151b8565b5090565b6000602082840312156151e257600080fd5b81356001600160e01b03198116811461120157600080fd5b60005b838110156152155781810151838201526020016151fd565b50506000910152565b600081518084526152368160208601602086016151fa565b601f01601f19169290920160200192915050565b602081526000611201602083018461521e565b60006020828403121561526f57600080fd5b5035919050565b6001600160a01b038116811461153e57600080fd5b6000806040838503121561529e57600080fd5b82356152a981615276565b946020939093013593505050565b828152604060208201526000612c80604083018461521e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561530f5761530f6152d0565b604052919050565b600067ffffffffffffffff821115615331576153316152d0565b50601f01601f191660200190565b600061535261534d84615317565b6152e6565b905082815283838301111561536657600080fd5b828260208301376000602084830101529392505050565b600082601f83011261538e57600080fd5b6112018383356020850161533f565b600080604083850312156153b057600080fd5b823567ffffffffffffffff8111156153c757600080fd5b6153d38582860161537d565b95602094909401359450505050565b6000602082840312156153f457600080fd5b813561120181615276565b60008060006060848603121561541457600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561544057600080fd5b833561544b81615276565b9250602084013561545b81615276565b929592945050506040919091013590565b6000806040838503121561547f57600080fd5b82359150602083013561549181615276565b809150509250929050565b600080604083850312156154af57600080fd5b82356154ba81615276565b9150602083013567ffffffffffffffff8111156154d657600080fd5b8301601f810185136154e757600080fd5b6154f68582356020840161533f565b9150509250929050565b6000806040838503121561551357600080fd5b50508035926020909101359150565b60006020828403121561553457600080fd5b813567ffffffffffffffff81111561554b57600080fd5b612c808482850161537d565b801515811461153e57600080fd5b6000806040838503121561557857600080fd5b82359150602083013561549181615557565b60008060006060848603121561559f57600080fd5b8335925060208401356155b181615276565b915060408401356155c181615276565b809150509250925092565b6000806000606084860312156155e157600080fd5b83356155ec81615276565b925060208401356155b181615276565b60008060006060848603121561561157600080fd5b833561561c81615276565b92506020840135915060408401356155c181615276565b6000806040838503121561564657600080fd5b823561565181615276565b9150602083013561549181615276565b60006020828403121561567357600080fd5b813561120181615557565b600181811c9082168061569257607f821691505b6020821081036156b257634e487b7160e01b600052602260045260246000fd5b50919050565b600082516156ca8184602087016151fa565b9190910192915050565b601f82111561156757600081815260208120601f850160051c810160208610156156fb5750805b601f850160051c820191505b818110156126e657828155600101615707565b815167ffffffffffffffff811115615734576157346152d0565b61574881615742845461567e565b846156d4565b602080601f83116001811461577d57600084156157655750858301515b600019600386901b1c1916600185901b1785556126e6565b600085815260208120601f198616915b828110156157ac5788860151825594840194600190910190840161578d565b50858210156157ca5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600060018201615802576158026157da565b5060010190565b80820180821115610de857610de86157da565b60408152600061582f604083018561521e565b90508260208301529392505050565b634e487b7160e01b600052601260045260246000fd5b6000826158635761586361583e565b500490565b8082028115828204841417610de857610de86157da565b81810381811115610de857610de86157da565b60ff8181168382160190811115610de857610de86157da565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561595557600080fd5b5051919050565b60408152600080845461596e8161567e565b806040860152606060018084166000811461599057600181146159aa576159db565b60ff1985168884015283151560051b8801830195506159db565b8960005260208060002060005b868110156159d25781548b82018701529084019082016159b7565b8a018501975050505b50505050506020929092019290925292915050565b8181036159fb575050565b615a05825461567e565b67ffffffffffffffff811115615a1d57615a1d6152d0565b615a2b81615742845461567e565b6000601f821160018114615a5f5760008315615a475750848201545b600019600385901b1c1916600184901b178455613f7f565b600085815260209020601f19841690600086815260209020845b83811015615a995782860154825560019586019590910190602001615a79565b50858310156157ca5793015460001960f8600387901b161c19169092555050600190811b01905550565b600081615ad257615ad26157da565b506000190190565b6020808252600d908201526c19195b1959d85d194819985a5b609a1b604082015260600190565b608081526000615b14608083018761521e565b8281036020840152615b26818761521e565b604084019590955250506060015292915050565b60208082526011908201527008cc2d2d8cac840e8de40e6cadcc8408cb607b1b604082015260600190565b600060208284031215615b7757600080fd5b815161120181615276565b634e487b7160e01b600052602160045260246000fd5b600082615ba757615ba761583e565b500690565b606081526000615bbf606083018661521e565b8281036020840152615bd1818661521e565b915050826040830152949350505050565b600060208284031215615bf457600080fd5b815161120181615557565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615c828160178501602088016151fa565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615cb38160288401602088016151fa565b01602801949350505050565b604081526000615cd2604083018561521e565b905060018060a01b03831660208301529392505050565b600060208284031215615cfb57600080fd5b815167ffffffffffffffff811115615d1257600080fd5b8201601f81018413615d2357600080fd5b8051615d3161534d82615317565b818152856020838501011115615d4657600080fd5b6134a88260208301602086016151fa565b60008351615d698184602088016151fa565b6101d160f51b9083019081528351615d888160028401602088016151fa565b01600201949350505050565b60008060408385031215615da757600080fd5b505080516020909101519092909150565b608081526000615dcb608083018761521e565b6001600160a01b0395861660208401529390941660408201526060015292915050565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220434e1395d462b8c41e1eb9d923e2a60fb87cf8fc1bec915084dd74ec6fa91fd764736f6c63430008120033
Deployed ByteCode
0x60806040526004361061046c5760003560e01c80636e553f651161024a578063c0c53b8b11610139578063d905777e116100b6578063f5b541a61161007a578063f5b541a614610d5a578063f69e204614610d7e578063f7beef1114610d93578063f7c618c114610db3578063fe1b482a14610dc857600080fd5b8063d905777e14610cc5578063dd62ed3e14610ce5578063e58378bb14610d05578063ef8b30f714610be1578063f4536afc14610d2657600080fd5b8063ce96cb77116100fd578063ce96cb7714610c25578063d04323c514610c45578063d4a0d4c614610c65578063d547741f14610c85578063d8e392f514610ca557600080fd5b8063c0c53b8b14610ba0578063c3e17dc814610bc0578063c63d75b614610817578063c6e6f59214610be1578063ccc5749014610c0157600080fd5b8063a217fddf116101c7578063b44d29c31161018b578063b44d29c314610b2d578063b460af9414610b44578063ba08765214610b44578063bc30a61814610b5f578063bfe1092814610b7f57600080fd5b8063a217fddf14610aa5578063a457c2d714610aba578063a9059cbb14610ada578063abe50f1914610afa578063b3d7f6b914610b0d57600080fd5b80638e512acb1161020e5780638e512acb14610a1457806391d1485414610a3457806394bf804d1461099357806395d89b4114610a545780639c783aae14610a6957600080fd5b80636e553f651461099357806370a08231146109b35780637f77403d146109d357806380cdf6e7146109e85780638456cb59146109ff57600080fd5b806336568abe116103665780634f1ef286116102e357806354651a78116102a757806354651a781461090c5780635c975abb1461092257806360dc23401461093b57806365a545f41461095c578063684d6fdf1461097c57600080fd5b80634f1ef286146108505780634f9e380514610863578063501ec738146108835780635128823a146108d757806352d1902d146108f757600080fd5b80633f4ba83a1161032a5780633f4ba83a146107e2578063402914f5146107f7578063402d267d1461081757806346ab150e146108395780634cdad506146104f257600080fd5b806336568abe1461073a5780633659cfe61461075a57806338d52e0f1461077a57806339509351146107ad5780633e158b0c146107cd57600080fd5b80631959a002116103f4578063248a9ca3116103b8578063248a9ca3146106825780632d82b70b146106b35780632e17de78146106d35780632f2ff15d146106f3578063313ce5671461071357600080fd5b80631959a002146105b85780631d07b544146106025780631e83409a14610622578063224290851461064257806323b872dd1461066257600080fd5b8063095ea7b31161043b578063095ea7b3146105125780630a28a47714610532578063102dbefe14610552578063156be05a1461058057806318160ddd146105a257600080fd5b806301e1d1141461047857806301ffc9a7146104a057806306fdde03146104d057806307a2d13a146104f257600080fd5b3661047357005b600080fd5b34801561048457600080fd5b5061048d610ddd565b6040519081526020015b60405180910390f35b3480156104ac57600080fd5b506104c06104bb3660046151d0565b610dee565b6040519015158152602001610497565b3480156104dc57600080fd5b506104e5610e23565b604051610497919061524a565b3480156104fe57600080fd5b5061048d61050d36600461525d565b610eb6565b34801561051e57600080fd5b506104c061052d36600461528b565b610ec3565b34801561053e57600080fd5b5061048d61054d36600461525d565b610edb565b34801561055e57600080fd5b5061057261056d36600461525d565b610ee8565b6040516104979291906152b7565b34801561058c57600080fd5b506105a061059b36600461539d565b610f8e565b005b3480156105ae57600080fd5b506101c35461048d565b3480156105c457600080fd5b506105ed6105d33660046153e2565b610267602052600090815260409020805460019091015482565b60408051928352602083019190915201610497565b34801561060e57600080fd5b5061057261061d36600461525d565b6110e0565b34801561062e57600080fd5b5061048d61063d3660046153e2565b611191565b34801561064e57600080fd5b506105a061065d3660046153ff565b6111b6565b34801561066e57600080fd5b506104c061067d36600461542b565b6111e2565b34801561068e57600080fd5b5061048d61069d36600461525d565b600090815261012c602052604090206001015490565b3480156106bf57600080fd5b506105a06106ce36600461539d565b611208565b3480156106df57600080fd5b506105a06106ee36600461525d565b6113ef565b3480156106ff57600080fd5b506105a061070e36600461546c565b611541565b34801561071f57600080fd5b5061072861156c565b60405160ff9091168152602001610497565b34801561074657600080fd5b506105a061075536600461546c565b61158c565b34801561076657600080fd5b506105a06107753660046153e2565b611606565b34801561078657600080fd5b506101f3546001600160a01b03165b6040516001600160a01b039091168152602001610497565b3480156107b957600080fd5b506104c06107c836600461528b565b6116e2565b3480156107d957600080fd5b506105a0611704565b3480156107ee57600080fd5b506105a0611722565b34801561080357600080fd5b5061048d6108123660046153e2565b611741565b34801561082357600080fd5b5061048d6108323660046153e2565b5060001990565b34801561084557600080fd5b5061048d6102575481565b6105a061085e36600461549c565b611897565b34801561086f57600080fd5b506105a061087e3660046153ff565b611963565b34801561088f57600080fd5b5061026154610262546102635461026454610265546108af949392919085565b604080519586526020860194909452928401919091526060830152608082015260a001610497565b3480156108e357600080fd5b506105a06108f2366004615500565b61198f565b34801561090357600080fd5b5061048d611a6e565b34801561091857600080fd5b506102635461048d565b34801561092e57600080fd5b5061018f5460ff166104c0565b34801561094757600080fd5b5061025b54610795906001600160a01b031681565b34801561096857600080fd5b506105a06109773660046153e2565b611b21565b34801561098857600080fd5b5061048d6102565481565b34801561099f57600080fd5b5061048d6109ae36600461546c565b611b8f565b3480156109bf57600080fd5b5061048d6109ce3660046153e2565b611bc5565b3480156109df57600080fd5b506105a0611be1565b3480156109f457600080fd5b5061048d6102595481565b348015610a0b57600080fd5b506105a0611df2565b348015610a2057600080fd5b506105a0610a2f3660046153ff565b611e11565b348015610a4057600080fd5b506104c0610a4f36600461546c565b6120d3565b348015610a6057600080fd5b506104e56120ff565b348015610a7557600080fd5b506104c0610a84366004615522565b80516020818301810180516102688252928201919093012091525460ff1681565b348015610ab157600080fd5b5061048d600081565b348015610ac657600080fd5b506104c0610ad536600461528b565b61210f565b348015610ae657600080fd5b506104c0610af536600461528b565b612195565b6105a0610b08366004615565565b6121a3565b348015610b1957600080fd5b5061048d610b2836600461525d565b6123f2565b348015610b3957600080fd5b5061048d6102585481565b348015610b5057600080fd5b5061048d6109ae36600461558a565b348015610b6b57600080fd5b506105a0610b7a3660046153e2565b6123ff565b348015610b8b57600080fd5b5061025c54610795906001600160a01b031681565b348015610bac57600080fd5b506105a0610bbb3660046155cc565b612465565b348015610bcc57600080fd5b5061025a54610795906001600160a01b031681565b348015610bed57600080fd5b5061048d610bfc36600461525d565b6125c5565b348015610c0d57600080fd5b5061048d6c474f5645524e4f525f524f4c4560981b81565b348015610c3157600080fd5b5061048d610c403660046153e2565b6125d2565b348015610c5157600080fd5b506105a0610c603660046155fc565b6125e7565b348015610c7157600080fd5b506105a0610c803660046153e2565b6126ee565b348015610c9157600080fd5b506105a0610ca036600461546c565b612754565b348015610cb157600080fd5b506105a0610cc036600461525d565b61277a565b348015610cd157600080fd5b5061048d610ce03660046153e2565b612838565b348015610cf157600080fd5b5061048d610d00366004615633565b612843565b348015610d1157600080fd5b5061048d694f574e45525f524f4c4560b01b81565b348015610d3257600080fd5b5061025d5461025e546102605460408051938452602084019290925290820152606001610497565b348015610d6657600080fd5b5061048d6c4f50455241544f525f524f4c4560981b81565b348015610d8a57600080fd5b506105a061286f565b348015610d9f57600080fd5b506105a0610dae366004615661565b612887565b348015610dbf57600080fd5b506107956129f1565b348015610dd457600080fd5b5061048d612a60565b600080610de8612b5e565b92915050565b60006001600160e01b03198216637965db0b60e01b1480610de857506301ffc9a760e01b6001600160e01b0319831614610de8565b60606101c48054610e339061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5f9061567e565b8015610eac5780601f10610e8157610100808354040283529160200191610eac565b820191906000526020600020905b815481529060010190602001808311610e8f57829003601f168201915b5050505050905090565b6000610de8826000612c50565b600033610ed1818585612c88565b5060019392505050565b6000610de8826001612dad565b6102666020526000908152604090208054600182018054919291610f0b9061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f379061567e565b8015610f845780601f10610f5957610100808354040283529160200191610f84565b820191906000526020600020905b815481529060010190602001808311610f6757829003601f168201915b5050505050905082565b6c474f5645524e4f525f524f4c4560981b610fa881612de0565b61026883604051610fb991906156b8565b9081526040519081900360200190205460ff16156110095760405162461bcd60e51b8152602060048201526008602482015267185919195915985b60c21b60448201526064015b60405180910390fd5b61026354600090815261026660205260409020600101611029848261571a565b5061026380546000908152610266602052604081208490558154919061104e836157f0565b91905055508161026160030160008282546110699190615809565b9250508190555060016102688460405161108391906156b8565b908152604051908190036020018120805492151560ff19909316929092179091557f629f58e50ce5bc6c5368883b59192dea9abbda8c1590556929289ed147daa075906110d3908590859061581c565b60405180910390a1505050565b600081815261026660205260408120805460019091018054606092919081906111089061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546111349061567e565b80156111815780601f1061115657610100808354040283529160200191611181565b820191906000526020600020905b81548152906001019060200180831161116457829003601f168201915b5050505050905091509150915091565b600061119b612dea565b6111a53383612e43565b90506111b16001609655565b919050565b6c474f5645524e4f525f524f4c4560981b6111d081612de0565b50610257929092556102585561025955565b6000336111f0858285612eda565b6111fb858585612f4e565b60019150505b9392505050565b611210612dea565b611218613106565b6000811161125b5760405162461bcd60e51b815260206004820152601060248201526f456e74727573743a203020736861726560801b6044820152606401611000565b600080611268843361314d565b91509150828210156112af5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420656e6f75676820736861726560801b6044820152606401611000565b6112b76131fb565b6112c13333612e43565b5060006112cc610ddd565b90506000826112db8587615854565b6112e59190615868565b61025e549091506112f68383615809565b11156113335760405162461bcd60e51b815260206004820152600c60248201526b05374616b653a203e204361760a41b6044820152606401611000565b600061133f6101c35490565b90506000806113508933308b613394565b915091508061025660008282546113679190615809565b909155506000905082158061137a575083155b6113905761138b8385886000613454565b611392565b825b905061139e33826134b1565b604080518481526020810183905233917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6910160405180910390a250505050505050506113eb6001609655565b5050565b6113f7612dea565b6113ff613106565b600081116114435760405162461bcd60e51b8152602060048201526011602482015270155b9cdd185ad94e880c08185b5bdd5b9d607a1b6044820152606401611000565b600061144e33611bc5565b9050818110156114915760405162461bcd60e51b815260206004820152600e60248201526d416d6f756e74203e207374616b6560901b6044820152606401611000565b6114996131fb565b6114a33333612e43565b5060006114af83610eb6565b90506000612710610259546127106114c7919061587f565b6114d19084615868565b6114db9190615854565b90506114e73385613580565b80156114f6576114f6816136c3565b604080518281526020810186905233917ff960dbf9e5d0682f7a298ed974e33a28b4464914b7a2bfac12ae419a9afeb280910160405180910390a250505061153e6001609655565b50565b600082815261012c602052604090206001015461155d81612de0565b6115678383613856565b505050565b6000806101f3546115879190600160a01b900460ff16615892565b905090565b6001600160a01b03811633146115fc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611000565b6113eb82826138dd565b6001600160a01b037f00000000000000000000000092e60aabacf4e06f517b46876a58bb41a8c135ef16300361164e5760405162461bcd60e51b8152600401611000906158ab565b7f00000000000000000000000092e60aabacf4e06f517b46876a58bb41a8c135ef6001600160a01b0316611697600080516020615e05833981519152546001600160a01b031690565b6001600160a01b0316146116bd5760405162461bcd60e51b8152600401611000906158f7565b6116c681613945565b6040805160008082526020820190925261153e9183919061395c565b600033610ed18185856116f58383612843565b6116ff9190615809565b612c88565b61170c612dea565b6117166000613ac7565b6117206001609655565b565b694f574e45525f524f4c4560b01b61173981612de0565b61153e613c2d565b6001600160a01b03811660009081526102676020908152604080832081518083019092528054825260010154918101919091528161177e84611bc5565b90508060000361179057505192915050565b600061179c6101c35490565b905060006c0c9f2c9cd04674edea4000000061025c60009054906101000a90046001600160a01b03166001600160a01b031663eded3fda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611802573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118269190615943565b6118309190615868565b9050600061183e8383615854565b6102655461184c9190615809565b90506c0c9f2c9cd04674edea4000000085602001518261186c919061587f565b6118769086615868565b6118809190615854565b855161188c9190615809565b979650505050505050565b6001600160a01b037f00000000000000000000000092e60aabacf4e06f517b46876a58bb41a8c135ef1630036118df5760405162461bcd60e51b8152600401611000906158ab565b7f00000000000000000000000092e60aabacf4e06f517b46876a58bb41a8c135ef6001600160a01b0316611928600080516020615e05833981519152546001600160a01b031690565b6001600160a01b03161461194e5760405162461bcd60e51b8152600401611000906158f7565b61195782613945565b6113eb8282600161395c565b6c474f5645524e4f525f524f4c4560981b61197d81612de0565b5061025d9290925561025e5561026055565b6c474f5645524e4f525f524f4c4560981b6119a981612de0565b6102635483106119e85760405162461bcd60e51b815260206004820152600a602482015269125b9d985b1a5908125160b21b6044820152606401611000565b60008381526102666020526040902054610264548190611a09908590615809565b611a13919061587f565b61026455600084815261026660205260409081902084815590517f772c4dd6aa65f9df35ad1651832145634a54ecbc75b6409a0f982e7dc88e45d491611a6091600190910190869061595c565b60405180910390a150505050565b6000306001600160a01b037f00000000000000000000000092e60aabacf4e06f517b46876a58bb41a8c135ef1614611b0e5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611000565b50600080516020615e0583398151915290565b694f574e45525f524f4c4560b01b611b3881612de0565b61025a80546001600160a01b0319166001600160a01b0384169081179091556040519081527f699887cd555c0c7e02df97f2ac6fe2db97cd0418f47a782b7ffa6fcfa0c96743906020015b60405180910390a15050565b60405162461bcd60e51b8152602060048201526008602482015267191a5cd8589b195960c21b6044820152600090606401611000565b6001600160a01b031660009081526101c1602052604090205490565b6c474f5645524e4f525f524f4c4560981b611bfb81612de0565b6000611c076102635490565b905060005b81811015611dde57600081815261026660205260408120549003611dd6576000818152610266602052604081206001018054611c479061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611c739061567e565b8015611cc05780601f10611c9557610100808354040283529160200191611cc0565b820191906000526020600020905b815481529060010190602001808311611ca357829003601f168201915b505050505090506000611cd3823061314d565b50905080600003611dd357600061026883604051611cf191906156b8565b908152604051908190036020019020805491151560ff199092169190911790556000611d1e60018661587f565b6000818152610266602052604080822087835291208154815591925090600180820190611d4d908401826159f0565b50505060008181526102666020526040812081815590611d706001830182615182565b50507f53344ca00b011ca20d3dc9f1bb71ed60e097b598b9f35482879138cc15f28ef983604051611da1919061524a565b60405180910390a184611db381615ac3565b95505083600003611dc657505050611c0c565b611dcf84615ac3565b9350505b50505b600101611c0c565b506000610261819055610262556102635550565b694f574e45525f524f4c4560b01b611e0981612de0565b61153e613c80565b6c474f5645524e4f525f524f4c4560981b611e2b81612de0565b6102635484108015611e3f57506102635483105b611e785760405162461bcd60e51b815260206004820152600a602482015269125b9d985b1a5908125160b21b6044820152606401611000565b6000610266600086815260200190815260200160002060405180604001604052908160008201548152602001600182018054611eb39061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611edf9061567e565b8015611f2c5780601f10611f0157610100808354040283529160200191611f2c565b820191906000526020600020905b815481529060010190602001808311611f0f57829003601f168201915b50505050508152505090506000610266600086815260200190815260200160002060405180604001604052908160008201548152602001600182018054611f729061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054611f9e9061567e565b8015611feb5780601f10611fc057610100808354040283529160200191611feb565b820191906000526020600020905b815481529060010190602001808311611fce57829003601f168201915b5050505050815250509050600061200683602001513061314d565b915050808511156120435760405162461bcd60e51b815260206004820152600760248201526608505b5bdd5b9d60ca1b6044820152606401611000565b61204b6131fb565b60006120608460200151846020015188613cbe565b90506001811515146120845760405162461bcd60e51b815260040161100090615ada565b7f4b81c788046a326390b0432cf535dffbfc0ba3b5f1bf9bfbf9f5b1533d335cb98460200151846020015188896040516120c19493929190615b01565b60405180910390a15050505050505050565b600091825261012c602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606101c58054610e339061567e565b6000338161211d8286612843565b90508381101561217d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611000565b61218a8286868403612c88565b506001949350505050565b600033610ed1818585612f4e565b6121ab612dea565b6121b3613106565b600082116121f55760405162461bcd60e51b815260206004820152600f60248201526e14dd185ad94e880c08185b5bdd5b9d608a1b6044820152606401611000565b600181151514612206576000612208565b815b341461223f5760405162461bcd60e51b8152602060048201526006602482015265085d985b1a5960d21b6044820152606401611000565b61025e5461224b610ddd565b6122559084615809565b11156122925760405162461bcd60e51b815260206004820152600c60248201526b05374616b653a203e204361760a41b6044820152606401611000565b61229a6131fb565b6122a43333612e43565b5080151560000361238c576040516323b872dd60e01b8152336004820152306024820152604481018390527380b5a32e4f032b2a058b4f29ec95eefeeb87adcd906323b872dd90606401600060405180830381600087803b15801561230857600080fd5b505af115801561231c573d6000803e3d6000fd5b505060405163f3fef3a360e01b8152306004820152602481018590527380b5a32e4f032b2a058b4f29ec95eefeeb87adcd925063f3fef3a39150604401600060405180830381600087803b15801561237357600080fd5b505af1158015612387573d6000803e3d6000fd5b505050505b6000612397836125c5565b90506123a333826134b1565b6123ac83613d2d565b604080518481526020810183905233917f5af417134f72a9d41143ace85b0a26dce6f550f894f2cbc1eeee8810603d91b6910160405180910390a2506113eb6001609655565b6000610de8826001612c50565b694f574e45525f524f4c4560b01b61241681612de0565b61025c80546001600160a01b0319166001600160a01b0384169081179091556040519081527fe37acc13f5ed9d0cc83c2842e093fe5a494d5b8fb5b1db06356b327081832f5290602001611b83565b600054610100900460ff16158080156124855750600054600160ff909116105b8061249f5750303b15801561249f575060005460ff166001145b6125025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611000565b6000805460ff191660011790558015612525576000805461ff0019166101001790555b612575846040518060400160405280600f81526020016e29ba30b5b2b210232c102a37b5b2b760891b815250604051806040016040528060048152602001630a6e88cb60e31b8152508686613f52565b61257d613f86565b80156125bf576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001611a60565b50505050565b6000610de8826000612dad565b6000610de86125e083611bc5565b6000612c50565b694f574e45525f524f4c4560b01b6125fe81612de0565b6001600160a01b03821661264b5760405162461bcd60e51b815260206004820152601460248201527353656e6420746f207a65726f206164647265737360601b6044820152606401611000565b6001600160a01b038416156126735761266e6001600160a01b0385168385613fad565b6125bf565b60405182906000906001600160a01b0383169086908381818185875af1925050503d80600081146126c0576040519150601f19603f3d011682016040523d82523d6000602084013e6126c5565b606091505b50509050806126e65760405162461bcd60e51b815260040161100090615b3a565b505050505050565b694f574e45525f524f4c4560b01b61270581612de0565b61025b80546001600160a01b0319166001600160a01b0384169081179091556040519081527ff30aa7cab072f507cbc1b4906dcc281e649884fded6a818238e407dee53bf0ba90602001611b83565b600082815261012c602052604090206001015461277081612de0565b61156783836138dd565b61025a546001600160a01b031633146127ce5760405162461bcd60e51b815260206004820152601660248201527513db9b1e4815995cdd195911960818d85b8818d85b1b60521b6044820152606401611000565b6040513390600090829084908381818185875af1925050503d8060008114612812576040519150601f19603f3d011682016040523d82523d6000602084013e612817565b606091505b50509050806115675760405162461bcd60e51b815260040161100090615b3a565b6000610de882611bc5565b6001600160a01b0391821660009081526101c26020908152604080832093909416825291909152205490565b612877612dea565b61287f613106565b6117166131fb565b694f574e45525f524f4c4560b01b61289e81612de0565b60008060006128ad6102635490565b905060005b818110156129935760008181526102666020526040812060010180546128d79061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546129039061567e565b80156129505780601f1061292557610100808354040283529160200191612950565b820191906000526020600020905b81548152906001019060200180831161293357829003601f168201915b505050505090506000612963823061314d565b9150506129708382613fff565b945061297c8187615809565b95505050808061298b906157f0565b9150506128b2565b508415156001036129a6576129a6613c80565b7f1e0f68802bf96eff15f2012f51d490baa38adf7bbb90bc1a8160620137bdd0c7836129d26101c35490565b6040805192835260208301919091520160405180910390a15050505050565b61025c546040805163f7c618c160e01b815290516000926001600160a01b03169163f7c618c19160048083019260209291908290030181865afa158015612a3c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115879190615b65565b6000806000612a6f6102635490565b905060005b81811015612b48576000818152610266602052604081206001018054612a999061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054612ac59061567e565b8015612b125780601f10612ae757610100808354040283529160200191612b12565b820191906000526020600020905b815481529060010190602001808311612af557829003601f168201915b505050505090506000612b258230614196565b9050612b318186615809565b945050508080612b40906157f0565b915050612a74565b5061025654612b579083615809565b9250505090565b6000806000612b6d6102635490565b905060005b81811015612c48576000818152610266602052604081206001018054612b979061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054612bc39061567e565b8015612c105780601f10612be557610100808354040283529160200191612c10565b820191906000526020600020905b815481529060010190602001808311612bf357829003601f168201915b505050505090506000612c23823061314d565b9150612c3190508186615809565b945050508080612c40906157f0565b915050612b72565b509092915050565b600080612c5d6101c35490565b90508015612c7e57612c79612c70610ddd565b85908386613454565b612c80565b835b949350505050565b6001600160a01b038316612cea5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611000565b6001600160a01b038216612d4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611000565b6001600160a01b0383811660008181526101c2602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600080612dba6101c35490565b9050831580612dc7575080155b612c7e57612c7981612dd7610ddd565b86919086613454565b61153e8133614242565b600260965403612e3c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611000565b6002609655565b6000612e4e83613ac7565b6001600160a01b0383166000908152610267602052604081208054918155908015612c8057612e908482612e806129f1565b6001600160a01b03169190613fad565b604080516001600160a01b0387168152602081018390527f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4910160405180910390a1949350505050565b6000612ee68484612843565b905060001981146125bf5781811015612f415760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611000565b6125bf8484848403612c88565b6001600160a01b038316612fb25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611000565b6001600160a01b0382166130145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611000565b61301f83838361429b565b6001600160a01b03831660009081526101c16020526040902054818110156130985760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611000565b6001600160a01b0380851660008181526101c1602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906130f99086815260200190565b60405180910390a36125bf565b61018f5460ff16156117205760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611000565b600080808061100361315f87876142b5565b60405161316c91906156b8565b600060405180830381855afa9150503d80600081146131a7576040519150601f19603f3d011682016040523d82523d6000602084013e6131ac565b606091505b50915091506131e582826040518060400160405280601181526020017019195b1959d85d1a5bdb8819985a5b1959607a1b8152506142fc565b6131ee81614350565b9350935050509250929050565b613203614376565b610256805460009182905561025754909190612710906132239084615868565b61322d9190615854565b9050600061271061025854846132439190615868565b61324d9190615854565b90508061325a838561587f565b613264919061587f565b925061326f83613d2d565b61025b546040516001600160a01b03909116903390600090839086908381818185875af1925050503d80600081146132c3576040519150601f19603f3d011682016040523d82523d6000602084013e6132c8565b606091505b505090506000826001600160a01b03168560405160006040518083038185875af1925050503d8060008114613319576040519150601f19603f3d011682016040523d82523d6000602084013e61331e565b606091505b5050905081801561332c5750805b6133485760405162461bcd60e51b815260040161100090615b3a565b604080518881526020810188905290810186905233907f26d9e92b9fa4eb064465ecae8eb30c511a5f35fc85e1128cb964013f336fee939060600160405180910390a250505050505050565b60008080806110036133a88989898961448e565b6040516133b591906156b8565b6000604051808303816000865af19150503d80600081146133f2576040519150601f19603f3d011682016040523d82523d6000602084013e6133f7565b606091505b509150915061343c82826040518060400160405280601981526020017f7472616e7366657246726f6d536861726573206661696c6564000000000000008152506142fc565b61344581614350565b93509350505094509492505050565b6000806134628686866144db565b9050600183600281111561347857613478615b82565b1480156134955750600084806134905761349061583e565b868809115b156134a8576134a5600182615809565b90505b95945050505050565b6001600160a01b0382166135075760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611000565b6135136000838361429b565b806101c360008282546135269190615809565b90915550506001600160a01b03821660008181526101c160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166135e05760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611000565b6135ec8260008361429b565b6001600160a01b03821660009081526101c16020526040902054818110156136615760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611000565b6001600160a01b03831660008181526101c16020908152604080832086860390556101c380548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040805160a08101825261026154815261026254602082018190526102635492820183905261026454606083015261026554608083015290916000849050600080600061026054881061375d57600061371d60028a615854565b90506137298782613fff565b9250613735838661587f565b945085613743886001615809565b61374d9190615b98565b96506137598285615809565b9350505b83156137a45761376d8685613fff565b9150613779828561587f565b935084613787876001615809565b6137919190615b98565b955061379d8184615809565b925061375d565b61025a546001600160a01b031663285c7317338a6137c542621baf80615809565b6040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561381357600080fd5b505af1158015613827573d6000803e3d6000fd5b505050610262879055506102568054849190600090613847908490615809565b90915550505050505050505050565b61386082826120d3565b6113eb57600082815261012c602090815260408083206001600160a01b03851684529091529020805460ff191660011790556138993390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6138e782826120d3565b156113eb57600082815261012c602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b694f574e45525f524f4c4560b01b6113eb81612de0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561398f57611567836145c5565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156139e9575060408051601f3d908101601f191682019092526139e691810190615943565b60015b613a4c5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611000565b600080516020615e058339815191528114613abb5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611000565b50611567838383614661565b61025c546040805163e4fc6b6d60e01b815290516000926001600160a01b03169163e4fc6b6d916004808301926020929190829003018187875af1158015613b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b379190615943565b90506000613b456101c35490565b610265549091508115801590613b5b5750600083115b15613b955781613b786c0c9f2c9cd04674edea4000000085615868565b613b829190615854565b613b8c9082615809565b61026581905590505b80600003613ba35750505050565b6001600160a01b038416156125bf576001600160a01b03841660009081526102676020526040812090613bd586611bc5565b905060006c0c9f2c9cd04674edea40000000836001015485613bf7919061587f565b613c019084615868565b613c0b9190615854565b90506000818460000154613c1f9190615809565b845550505060010155505050565b613c35614686565b61018f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b613c88613106565b61018f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613c633390565b604051637711363360e11b81526000906110039063ee226c6690613cea90879087908790600401615bac565b6020604051808303816000875af1158015613d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c809190615be2565b6040805160a0810182526102615480825261026254602083015261026354928201839052610264546060830181905261026554608084015291926000613d71610ddd565b90506000613d7e876146d0565b90506000613d8c8289615854565b90508760005b8115613f40576000610266600089815260200190815260200160002060405180604001604052908160008201548152602001600182018054613dd39061567e565b80601f0160208091040260200160405190810160405280929190818152602001828054613dff9061567e565b8015613e4c5780601f10613e2157610100808354040283529160200191613e4c565b820191906000526020600020905b815481529060010190602001808311613e2f57829003601f168201915b5050509190925250508151919250889050613e688a6001615809565b613e729190615b98565b985080600003613e83575050613d92565b61025e548710613e9557839250613eec565b6000613ea583602001513061314d565b91505060008b61025e5484613eba9190615868565b613ec49190615854565b9050808210613ed65750505050613d92565b868611613ee557859450613ee9565b8694505b50505b6000613efc836020015185614742565b9050600181151514613f205760405162461bcd60e51b815260040161100090615ada565b613f2a8489615809565b9750613f36848661587f565b9450505050613d92565b50505061026193909355505050505050565b613f5b856147f5565b613f658484614825565b613f6d614856565b613f75613f86565b613f7f8282614885565b5050505050565b600054610100900460ff166117205760405162461bcd60e51b815260040161100090615bff565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261156790849061491b565b600082815261026660205260408120600101805482916140a6916140229061567e565b80601f016020809104026020016040519081016040528092919081815260200182805461404e9061567e565b801561409b5780601f106140705761010080835404028352916020019161409b565b820191906000526020600020905b81548152906001019060200180831161407e57829003601f168201915b50505050503061314d565b9150600090508115612c80578382106140c05750826140c3565b50805b600085815261026660205260408120600101805461416991906140e59061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546141119061567e565b801561415e5780601f106141335761010080835404028352916020019161415e565b820191906000526020600020905b81548152906001019060200180831161414157829003601f168201915b5050505050836149f0565b905060018115151461418d5760405162461bcd60e51b815260040161100090615ada565b50949350505050565b600080806110036141a78686614a1a565b6040516141b491906156b8565b600060405180830381855afa9150503d80600081146141ef576040519150601f19603f3d011682016040523d82523d6000602084013e6141f4565b606091505b509150915061423982826040518060400160405280601881526020017f64656c65676174696f6e52657761726473206661696c656400000000000000008152506142fc565b6134a881614a61565b61424c82826120d3565b6113eb5761425981614a78565b614264836020614a8a565b604051602001614275929190615c4a565b60408051601f198184030181529082905262461bcd60e51b82526110009160040161524a565b6142a3613106565b6142ac83613ac7565b61156782613ac7565b606082826040516024016142ca929190615cbf565b60408051601f198184030181529190526020810180516001600160e01b031663d5c498eb60e01b179052905092915050565b82611567576000828060200190518101906143179190615ce9565b905060018251101561433d578060405162461bcd60e51b8152600401611000919061524a565b8181604051602001614275929190615d57565b6000806000808480602001905181019061436a9190615d94565b90969095509350505050565b6000806143836102635490565b905060005b818110156144715760008181526102666020526040812060010180546143ad9061567e565b80601f01602080910402602001604051908101604052809291908181526020018280546143d99061567e565b80156144265780601f106143fb57610100808354040283529160200191614426565b820191906000526020600020905b81548152906001019060200180831161440957829003601f168201915b5050505050905060006144398230614196565b9050801561445c57600061444c83614c26565b90506144588187615809565b9550505b50508080614469906157f0565b915050614388565b508161025660008282546144859190615809565b90915550505050565b6060848484846040516024016144a79493929190615db8565b60408051601f198184030181529190526020810180516001600160e01b031663dc6ffc7d60e01b1790529050949350505050565b60008080600019858709858702925082811083820303915050806000036145155783828161450b5761450b61583e565b0492505050611201565b80841161455c5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401611000565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6001600160a01b0381163b6146325760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611000565b600080516020615e0583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61466a83614cc5565b6000825111806146775750805b15611567576125bf8383614d05565b61018f5460ff166117205760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611000565b600080806146e6670de0b6b3a764000085615854565b905060006146f46102635490565b90505b600a821061471e5761470a600a83615854565b915082614716816157f0565b9350506146f7565b82156147375780831161473157826134a8565b806134a8565b600195945050505050565b60008147101561478b5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611000565b604051636d78803560e01b815261100390636d788035906147b2908690869060040161581c565b6020604051808303816000875af11580156147d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112019190615be2565b600054610100900460ff1661481c5760405162461bcd60e51b815260040161100090615bff565b61153e81614d2a565b600054610100900460ff1661484c5760405162461bcd60e51b815260040161100090615bff565b6113eb8282614db0565b600054610100900460ff1661487d5760405162461bcd60e51b815260040161100090615bff565b611720614df2565b61489c694f574e45525f524f4c4560b01b83613856565b6148b66c474f5645524e4f525f524f4c4560981b82613856565b6148cd694f574e45525f524f4c4560b01b80614e26565b6148f46c474f5645524e4f525f524f4c4560981b694f574e45525f524f4c4560b01b614e26565b6113eb6c4f50455241544f525f524f4c4560981b694f574e45525f524f4c4560b01b614e26565b6000614970826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614e729092919063ffffffff16565b90508051600014806149915750808060200190518101906149919190615be2565b6115675760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611000565b60405163de2b345160e01b81526000906110039063de2b3451906147b2908690869060040161581c565b60608282604051602401614a2f929190615cbf565b60408051601f198184030181529190526020810180516001600160e01b03166328d7a89d60e11b179052905092915050565b600080828060200190518101906112019190615943565b6060610de86001600160a01b03831660145b60606000614a99836002615868565b614aa4906002615809565b67ffffffffffffffff811115614abc57614abc6152d0565b6040519080825280601f01601f191660200182016040528015614ae6576020820181803683370190505b509050600360fc1b81600081518110614b0157614b01615dee565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614b3057614b30615dee565b60200101906001600160f81b031916908160001a9053506000614b54846002615868565b614b5f906001615809565b90505b6001811115614bd7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614b9357614b93615dee565b1a60f81b828281518110614ba957614ba9615dee565b60200101906001600160f81b031916908160001a90535060049490941c93614bd081615ac3565b9050614b62565b5083156112015760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611000565b60008080611003614c3685614e81565b604051614c4391906156b8565b6000604051808303816000865af19150503d8060008114614c80576040519150601f19603f3d011682016040523d82523d6000602084013e614c85565b606091505b5091509150614cbc82826040518060400160405280600f81526020016e1dda5d1a191c985dc819985a5b1959608a1b8152506142fc565b612c8081614a61565b614cce816145c5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606112018383604051806060016040528060278152602001615e2560279139614ec4565b600054610100900460ff16614d515760405162461bcd60e51b815260040161100090615bff565b600080614d5d83614f3c565b9150915081614d6d576012614d6f565b805b6101f380546001600160a01b039095166001600160a01b031960ff93909316600160a01b02929092166001600160a81b031990951694909417179092555050565b600054610100900460ff16614dd75760405162461bcd60e51b815260040161100090615bff565b6101c4614de4838261571a565b506101c5611567828261571a565b600054610100900460ff16614e195760405162461bcd60e51b815260040161100090615bff565b61018f805460ff19169055565b600082815261012c6020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6060612c808484600085615018565b606081604051602401614e94919061524a565b60408051601f198184030181529190526020810180516001600160e01b03166318fdb3e160e11b17905292915050565b6060600080856001600160a01b031685604051614ee191906156b8565b600060405180830381855af49150503d8060008114614f1c576040519150601f19603f3d011682016040523d82523d6000602084013e614f21565b606091505b5091509150614f32868383876150e4565b9695505050505050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691614f83916156b8565b600060405180830381855afa9150503d8060008114614fbe576040519150601f19603f3d011682016040523d82523d6000602084013e614fc3565b606091505b5091509150818015614fd757506020815110155b1561500b57600081806020019051810190614ff29190615943565b905060ff8111615009576001969095509350505050565b505b5060009485945092505050565b6060824710156150795760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611000565b600080866001600160a01b0316858760405161509591906156b8565b60006040518083038185875af1925050503d80600081146150d2576040519150601f19603f3d011682016040523d82523d6000602084013e6150d7565b606091505b509150915061188c878383875b6060831561515357825160000361514c576001600160a01b0385163b61514c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611000565b5081612c80565b612c8083838151156151685781518083602001fd5b8060405162461bcd60e51b8152600401611000919061524a565b50805461518e9061567e565b6000825580601f1061519e575050565b601f01602090049060005260206000209081019061153e91905b808211156151cc57600081556001016151b8565b5090565b6000602082840312156151e257600080fd5b81356001600160e01b03198116811461120157600080fd5b60005b838110156152155781810151838201526020016151fd565b50506000910152565b600081518084526152368160208601602086016151fa565b601f01601f19169290920160200192915050565b602081526000611201602083018461521e565b60006020828403121561526f57600080fd5b5035919050565b6001600160a01b038116811461153e57600080fd5b6000806040838503121561529e57600080fd5b82356152a981615276565b946020939093013593505050565b828152604060208201526000612c80604083018461521e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561530f5761530f6152d0565b604052919050565b600067ffffffffffffffff821115615331576153316152d0565b50601f01601f191660200190565b600061535261534d84615317565b6152e6565b905082815283838301111561536657600080fd5b828260208301376000602084830101529392505050565b600082601f83011261538e57600080fd5b6112018383356020850161533f565b600080604083850312156153b057600080fd5b823567ffffffffffffffff8111156153c757600080fd5b6153d38582860161537d565b95602094909401359450505050565b6000602082840312156153f457600080fd5b813561120181615276565b60008060006060848603121561541457600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561544057600080fd5b833561544b81615276565b9250602084013561545b81615276565b929592945050506040919091013590565b6000806040838503121561547f57600080fd5b82359150602083013561549181615276565b809150509250929050565b600080604083850312156154af57600080fd5b82356154ba81615276565b9150602083013567ffffffffffffffff8111156154d657600080fd5b8301601f810185136154e757600080fd5b6154f68582356020840161533f565b9150509250929050565b6000806040838503121561551357600080fd5b50508035926020909101359150565b60006020828403121561553457600080fd5b813567ffffffffffffffff81111561554b57600080fd5b612c808482850161537d565b801515811461153e57600080fd5b6000806040838503121561557857600080fd5b82359150602083013561549181615557565b60008060006060848603121561559f57600080fd5b8335925060208401356155b181615276565b915060408401356155c181615276565b809150509250925092565b6000806000606084860312156155e157600080fd5b83356155ec81615276565b925060208401356155b181615276565b60008060006060848603121561561157600080fd5b833561561c81615276565b92506020840135915060408401356155c181615276565b6000806040838503121561564657600080fd5b823561565181615276565b9150602083013561549181615276565b60006020828403121561567357600080fd5b813561120181615557565b600181811c9082168061569257607f821691505b6020821081036156b257634e487b7160e01b600052602260045260246000fd5b50919050565b600082516156ca8184602087016151fa565b9190910192915050565b601f82111561156757600081815260208120601f850160051c810160208610156156fb5750805b601f850160051c820191505b818110156126e657828155600101615707565b815167ffffffffffffffff811115615734576157346152d0565b61574881615742845461567e565b846156d4565b602080601f83116001811461577d57600084156157655750858301515b600019600386901b1c1916600185901b1785556126e6565b600085815260208120601f198616915b828110156157ac5788860151825594840194600190910190840161578d565b50858210156157ca5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600060018201615802576158026157da565b5060010190565b80820180821115610de857610de86157da565b60408152600061582f604083018561521e565b90508260208301529392505050565b634e487b7160e01b600052601260045260246000fd5b6000826158635761586361583e565b500490565b8082028115828204841417610de857610de86157da565b81810381811115610de857610de86157da565b60ff8181168382160190811115610de857610de86157da565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60006020828403121561595557600080fd5b5051919050565b60408152600080845461596e8161567e565b806040860152606060018084166000811461599057600181146159aa576159db565b60ff1985168884015283151560051b8801830195506159db565b8960005260208060002060005b868110156159d25781548b82018701529084019082016159b7565b8a018501975050505b50505050506020929092019290925292915050565b8181036159fb575050565b615a05825461567e565b67ffffffffffffffff811115615a1d57615a1d6152d0565b615a2b81615742845461567e565b6000601f821160018114615a5f5760008315615a475750848201545b600019600385901b1c1916600184901b178455613f7f565b600085815260209020601f19841690600086815260209020845b83811015615a995782860154825560019586019590910190602001615a79565b50858310156157ca5793015460001960f8600387901b161c19169092555050600190811b01905550565b600081615ad257615ad26157da565b506000190190565b6020808252600d908201526c19195b1959d85d194819985a5b609a1b604082015260600190565b608081526000615b14608083018761521e565b8281036020840152615b26818761521e565b604084019590955250506060015292915050565b60208082526011908201527008cc2d2d8cac840e8de40e6cadcc8408cb607b1b604082015260600190565b600060208284031215615b7757600080fd5b815161120181615276565b634e487b7160e01b600052602160045260246000fd5b600082615ba757615ba761583e565b500690565b606081526000615bbf606083018661521e565b8281036020840152615bd1818661521e565b915050826040830152949350505050565b600060208284031215615bf457600080fd5b815161120181615557565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351615c828160178501602088016151fa565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615cb38160288401602088016151fa565b01602801949350505050565b604081526000615cd2604083018561521e565b905060018060a01b03831660208301529392505050565b600060208284031215615cfb57600080fd5b815167ffffffffffffffff811115615d1257600080fd5b8201601f81018413615d2357600080fd5b8051615d3161534d82615317565b818152856020838501011115615d4657600080fd5b6134a88260208301602086016151fa565b60008351615d698184602088016151fa565b6101d160f51b9083019081528351615d888160028401602088016151fa565b01600201949350505050565b60008060408385031215615da757600080fd5b505080516020909101519092909150565b608081526000615dcb608083018761521e565b6001600160a01b0395861660208401529390941660408201526060015292915050565b634e487b7160e01b600052603260045260246000fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220434e1395d462b8c41e1eb9d923e2a60fb87cf8fc1bec915084dd74ec6fa91fd764736f6c63430008120033