Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ReaperVaultV2
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./interfaces/IERC4626Events.sol";
import "./interfaces/IStrategy.sol";
import "./libraries/ReaperMathUtils.sol";
import "./mixins/ReaperAccessControl.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
/**
* @notice Implementation of a vault to deposit funds for yield optimizing.
* This is the contract that receives funds and that users interface with.
* The yield optimizing strategy itself is implemented in a separate 'Strategy.sol' contract.
*/
contract ReaperVaultV2 is ReaperAccessControl, ERC20, IERC4626Events, AccessControlEnumerable, ReentrancyGuard {
using ReaperMathUtils for uint256;
using SafeERC20 for IERC20Metadata;
struct StrategyParams {
uint256 activation; // Activation block.timestamp
uint256 feeBPS; // Performance fee taken from profit, in BPS
uint256 allocBPS; // Allocation in BPS of vault's total assets
uint256 allocated; // Amount of capital allocated to this strategy
uint256 gains; // Total returns that Strategy has realized for Vault
uint256 losses; // Total losses that Strategy has realized for Vault
uint256 lastReport; // block.timestamp of the last time a report occured
}
mapping(address => StrategyParams) public strategies;
// Ordering that `withdraw` uses to determine which strategies to pull funds from
address[] public withdrawalQueue;
uint256 public constant PERCENT_DIVISOR = 10000;
uint256 public tvlCap;
uint256 public totalIdle; // Amount of tokens in the vault
uint256 public totalAllocBPS; // Sum of allocBPS across all strategies (in BPS, <= 10k)
uint256 public totalAllocated; // Amount of tokens that have been allocated to all strategies
uint256 public lastReport; // block.timestamp of last report from any strategy
uint256 public immutable constructionTime;
bool public emergencyShutdown;
// The token the vault accepts and looks to maximize.
IERC20Metadata public immutable token;
// Max slippage(loss) allowed when withdrawing, in BPS (0.01%)
uint256 public withdrawMaxLoss = 1;
/**
* Reaper Roles in increasing order of privilege.
* {DEPOSITOR} - Role conferred to EOAs/contracts that are allowed to deposit in the vault.
* {STRATEGIST} - Role conferred to authors of the strategy, allows for tweaking non-critical params.
* {GUARDIAN} - Multisig requiring 2 signatures for invoking emergency measures.
* {ADMIN}- Multisig requiring 3 signatures for deactivating emergency measures and changing TVL cap.
*
* The DEFAULT_ADMIN_ROLE (in-built access control role) will be granted to a multisig requiring 4
* signatures. This role would have the ability to add strategies, as well as the ability to grant any other
* roles.
*
* Also note that roles are cascading. So any higher privileged role should be able to perform all the functions
* of any lower privileged role.
*/
bytes32 public constant DEPOSITOR = keccak256("DEPOSITOR");
bytes32 public constant STRATEGIST = keccak256("STRATEGIST");
bytes32 public constant GUARDIAN = keccak256("GUARDIAN");
bytes32 public constant ADMIN = keccak256("ADMIN");
address public treasury; // address to whom performance fee is remitted in the form of vault shares
event StrategyAdded(address indexed strategy, uint256 feeBPS, uint256 allocBPS);
event StrategyFeeBPSUpdated(address indexed strategy, uint256 feeBPS);
event StrategyAllocBPSUpdated(address indexed strategy, uint256 allocBPS);
event StrategyRevoked(address indexed strategy);
event UpdateWithdrawalQueue(address[] withdrawalQueue);
event WithdrawMaxLossUpdated(uint256 withdrawMaxLoss);
event EmergencyShutdown(bool active);
event InCaseTokensGetStuckCalled(address token, uint256 amount);
event TvlCapUpdated(uint256 newTvlCap);
event LockedProfitDegradationUpdated(uint256 degradation);
event StrategyReported(
address indexed strategy,
uint256 gain,
uint256 loss,
uint256 debtPaid,
uint256 gains,
uint256 losses,
uint256 allocated,
uint256 allocationAdded,
uint256 allocBPS
);
/**
* @notice Initializes the vault's own 'RF' token.
* This token is minted when someone does a deposit. It is burned in order
* to withdraw the corresponding portion of the underlying assets.
* @param _token the token to maximize.
* @param _name the name of the vault token.
* @param _symbol the symbol of the vault token.
* @param _tvlCap initial deposit cap for scaling TVL safely
*/
constructor(
address _token,
string memory _name,
string memory _symbol,
uint256 _tvlCap,
address _treasury,
address[] memory _strategists,
address[] memory _multisigRoles
) ERC20(string(_name), string(_symbol)) {
token = IERC20Metadata(_token);
constructionTime = block.timestamp;
lastReport = block.timestamp;
tvlCap = _tvlCap;
treasury = _treasury;
uint256 numStrategists = _strategists.length;
for (uint256 i = 0; i < numStrategists; i = i.uncheckedInc()) {
_grantRole(STRATEGIST, _strategists[i]);
}
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(DEFAULT_ADMIN_ROLE, _multisigRoles[0]);
_grantRole(ADMIN, _multisigRoles[1]);
_grantRole(GUARDIAN, _multisigRoles[2]);
}
/**
* @notice Adds a new strategy to the vault with a given allocation amount in basis points.
* @param _strategy The strategy to add.
* @param _feeBPS The performance fee (taken from profit) in basis points
* @param _allocBPS The strategy allocation in basis points
*/
function addStrategy(
address _strategy,
uint256 _feeBPS,
uint256 _allocBPS
) external {
_atLeastRole(DEFAULT_ADMIN_ROLE);
require(!emergencyShutdown, "Cannot add strategy during emergency shutdown");
require(_strategy != address(0), "Invalid strategy address");
require(strategies[_strategy].activation == 0, "Strategy already added");
require(address(this) == IStrategy(_strategy).vault(), "Strategy's vault does not match");
require(address(token) == IStrategy(_strategy).want(), "Strategy's want does not match");
require(_feeBPS <= PERCENT_DIVISOR / 5, "Fee cannot be higher than 20 BPS");
require(_allocBPS + totalAllocBPS <= PERCENT_DIVISOR, "Invalid allocBPS value");
strategies[_strategy] = StrategyParams({
activation: block.timestamp,
feeBPS: _feeBPS,
allocBPS: _allocBPS,
allocated: 0,
gains: 0,
losses: 0,
lastReport: block.timestamp
});
totalAllocBPS += _allocBPS;
withdrawalQueue.push(_strategy);
emit StrategyAdded(_strategy, _feeBPS, _allocBPS);
}
/**
* @notice Updates the strategy's performance fee.
* @param _strategy The strategy to update.
* @param _feeBPS The new performance fee in basis points.
*/
function updateStrategyFeeBPS(address _strategy, uint256 _feeBPS) external {
_atLeastRole(ADMIN);
require(strategies[_strategy].activation != 0, "Invalid strategy address");
require(_feeBPS <= PERCENT_DIVISOR / 5, "Fee cannot be higher than 20 BPS");
strategies[_strategy].feeBPS = _feeBPS;
emit StrategyFeeBPSUpdated(_strategy, _feeBPS);
}
/**
* @notice Updates the allocation points for a given strategy.
* @param _strategy The strategy to update.
* @param _allocBPS The strategy allocation in basis points
*/
function updateStrategyAllocBPS(address _strategy, uint256 _allocBPS) external {
require(strategies[_strategy].activation != 0, "Invalid strategy address");
uint256 currentStrategyAllocBPS = strategies[_strategy].allocBPS;
if (currentStrategyAllocBPS != 0) {
_atLeastRole(STRATEGIST);
} else {
// prevent STRATEGIST/GUARDIAN from re-allocating to potentially revoked strategy
_atLeastRole(ADMIN);
}
totalAllocBPS -= currentStrategyAllocBPS;
strategies[_strategy].allocBPS = _allocBPS;
totalAllocBPS += _allocBPS;
require(totalAllocBPS <= PERCENT_DIVISOR, "Invalid BPS value");
emit StrategyAllocBPSUpdated(_strategy, _allocBPS);
}
/**
* @notice Removes any allocation to a given strategy.
* @param _strategy The strategy to revoke.
*/
function revokeStrategy(address _strategy) external {
if (msg.sender != _strategy) {
_atLeastRole(GUARDIAN);
}
if (strategies[_strategy].allocBPS == 0) {
return;
}
totalAllocBPS -= strategies[_strategy].allocBPS;
strategies[_strategy].allocBPS = 0;
emit StrategyRevoked(_strategy);
}
/**
* @notice Called by a strategy to determine the amount of capital that the vault is
* able to provide it. A positive amount means that vault has excess capital to provide
* the strategy, while a negative amount means that the strategy has a balance owing to
* the vault.
*/
function availableCapital() public view returns (int256) {
address stratAddr = msg.sender;
if (totalAllocBPS == 0 || emergencyShutdown) {
return -int256(strategies[stratAddr].allocated);
}
uint256 stratMaxAllocation = (strategies[stratAddr].allocBPS * balance()) / PERCENT_DIVISOR;
uint256 stratCurrentAllocation = strategies[stratAddr].allocated;
if (stratCurrentAllocation > stratMaxAllocation) {
return -int256(stratCurrentAllocation - stratMaxAllocation);
} else if (stratCurrentAllocation < stratMaxAllocation) {
uint256 vaultMaxAllocation = (totalAllocBPS * balance()) / PERCENT_DIVISOR;
uint256 vaultCurrentAllocation = totalAllocated;
if (vaultCurrentAllocation >= vaultMaxAllocation) {
return 0;
}
uint256 available = stratMaxAllocation - stratCurrentAllocation;
available = Math.min(available, vaultMaxAllocation - vaultCurrentAllocation);
available = Math.min(available, totalIdle);
return int256(available);
} else {
return 0;
}
}
/**
* @notice Updates the withdrawalQueue to match the addresses and order specified.
* @param _withdrawalQueue The new withdrawalQueue to update to.
*/
function setWithdrawalQueue(address[] memory _withdrawalQueue) external {
_atLeastRole(ADMIN);
uint256 queueLength = _withdrawalQueue.length;
require(queueLength != 0, "Queue must not be empty");
delete withdrawalQueue;
for (uint256 i = 0; i < queueLength; i = i.uncheckedInc()) {
address strategy = _withdrawalQueue[i];
StrategyParams storage params = strategies[strategy];
require(params.activation != 0, "Invalid strategy address");
withdrawalQueue.push(strategy);
}
emit UpdateWithdrawalQueue(_withdrawalQueue);
}
/**
* @dev It calculates the total underlying value of {token} held by the system.
* It takes into account the vault contract idle funds, and the capital deployed across
* all the strategies.
*/
function balance() public view returns (uint256) {
return totalIdle + totalAllocated;
}
/**
* @dev Function for various UIs to display the current value of one of our yield tokens.
* Returns an uint256 with 18 decimals of how much underlying asset one vault share represents.
*/
function getPricePerFullShare() public view returns (uint256) {
return totalSupply() == 0 ? 10**decimals() : (balance() * 10**decimals()) / totalSupply();
}
/**
* @dev A helper function to call deposit() with all the sender's funds.
*/
function depositAll() external {
_deposit(token.balanceOf(msg.sender), msg.sender);
}
/**
* @notice The entrypoint of funds into the system. People deposit with this function
* into the vault.
* @param _amount The amount of assets to deposit
*/
function deposit(uint256 _amount) external {
_deposit(_amount, msg.sender);
}
// Internal helper function to deposit {_amount} of assets and mint corresponding
// shares to {_receiver}. Returns the number of shares that were minted.
function _deposit(uint256 _amount, address _receiver) internal nonReentrant returns (uint256 shares) {
_atLeastRole(DEPOSITOR);
require(!emergencyShutdown, "Cannot deposit during emergency shutdown");
require(_amount != 0, "Invalid amount");
uint256 pool = balance();
require(pool + _amount <= tvlCap, "Vault is full");
uint256 supply = totalSupply();
if (supply == 0) {
shares = _amount;
} else {
shares = (_amount * supply) / pool;
}
_mint(_receiver, shares);
totalIdle += _amount;
token.safeTransferFrom(msg.sender, address(this), _amount);
emit Deposit(msg.sender, _receiver, _amount, shares);
}
/**
* @dev A helper function to call withdraw() with all the sender's funds.
*/
function withdrawAll() external {
_withdraw(balanceOf(msg.sender), msg.sender, msg.sender);
}
/**
* @notice Function to exit the system. The vault will withdraw the required tokens
* from the strategies and pay up the token holder. A proportional number of IOU
* tokens are burned in the process.
* @param _shares the number of shares to burn
*/
function withdraw(uint256 _shares) external {
_withdraw(_shares, msg.sender, msg.sender);
}
// Internal helper function to burn {_shares} of vault shares belonging to {_owner}
// and return corresponding assets to {_receiver}. Returns the number of assets that were returned.
function _withdraw(
uint256 _shares,
address _receiver,
address _owner
) internal nonReentrant returns (uint256 value) {
require(_shares != 0, "Invalid amount");
value = (balance() * _shares) / totalSupply();
uint256 vaultBalance = totalIdle;
if (value > vaultBalance) {
uint256 totalLoss = 0;
uint256 queueLength = withdrawalQueue.length;
for (uint256 i = 0; i < queueLength; i = i.uncheckedInc()) {
if (value <= vaultBalance) {
break;
}
address stratAddr = withdrawalQueue[i];
uint256 strategyBal = strategies[stratAddr].allocated;
if (strategyBal == 0) {
continue;
}
uint256 remaining = value - vaultBalance;
uint256 preWithdrawBal = token.balanceOf(address(this));
uint256 loss = IStrategy(stratAddr).withdraw(Math.min(remaining, strategyBal));
uint256 actualWithdrawn = token.balanceOf(address(this)) - preWithdrawBal;
vaultBalance += actualWithdrawn;
// Withdrawer incurs any losses from withdrawing as reported by strat
if (loss != 0) {
value -= loss;
totalLoss += loss;
_reportLoss(stratAddr, loss);
}
strategies[stratAddr].allocated -= actualWithdrawn;
totalAllocated -= actualWithdrawn;
}
totalIdle = vaultBalance;
if (value > vaultBalance) {
value = vaultBalance;
_shares = ((value + totalLoss) * totalSupply()) / balance();
}
require(
totalLoss <= ((value + totalLoss) * withdrawMaxLoss) / PERCENT_DIVISOR,
"Withdraw loss exceeds slippage"
);
}
_burn(_owner, _shares);
totalIdle -= value;
token.safeTransfer(_receiver, value);
emit Withdraw(msg.sender, _receiver, _owner, value, _shares);
}
/**
* @notice Helper function to report a loss by a given strategy.
* @param strategy The strategy to report the loss for.
* @param loss The amount lost.
*/
function _reportLoss(address strategy, uint256 loss) internal {
StrategyParams storage stratParams = strategies[strategy];
// Loss can only be up the amount of capital allocated to the strategy
uint256 allocation = stratParams.allocated;
require(loss <= allocation, "Strategy loss cannot be greater than allocation");
if (totalAllocBPS != 0) {
// reduce strat's allocBPS proportional to loss
uint256 bpsChange = Math.min((loss * totalAllocBPS) / totalAllocated, stratParams.allocBPS);
// If the loss is too small, bpsChange will be 0
if (bpsChange != 0) {
stratParams.allocBPS -= bpsChange;
totalAllocBPS -= bpsChange;
}
}
// Finally, adjust our strategy's parameters by the loss
stratParams.losses += loss;
stratParams.allocated -= loss;
totalAllocated -= loss;
}
/**
* @notice Helper function to charge fees from the gain reported by a strategy.
* Fees is charged by issuing the corresponding amount of vault shares to the treasury.
* @param strategy The strategy that reported gain.
* @param gain The amount of profit reported.
* @return The fee amount in assets.
*/
function _chargeFees(address strategy, uint256 gain) internal returns (uint256) {
uint256 performanceFee = (gain * strategies[strategy].feeBPS) / PERCENT_DIVISOR;
if (performanceFee != 0) {
uint256 supply = totalSupply();
uint256 shares = supply == 0 ? performanceFee : (performanceFee * supply) / balance();
_mint(treasury, shares);
}
return performanceFee;
}
// To avoid "stack too deep" errors
struct LocalVariables_report {
address stratAddr;
uint256 loss;
uint256 gain;
uint256 fees;
int256 available;
uint256 debt;
uint256 credit;
uint256 debtPayment;
uint256 freeWantInStrat;
}
/**
* @notice Main contact point where each strategy interacts with the vault during its harvest
* to report profit/loss as well as any repayment of debt.
* @param _roi The return on investment (positive or negative) given as the total amount
* gained or lost from the harvest.
* @param _repayment The repayment of debt by the strategy.
*/
function report(int256 _roi, uint256 _repayment) external returns (uint256) {
LocalVariables_report memory vars;
vars.stratAddr = msg.sender;
StrategyParams storage strategy = strategies[vars.stratAddr];
require(strategy.activation != 0, "Unauthorized strategy");
if (_roi < 0) {
vars.loss = uint256(-_roi);
_reportLoss(vars.stratAddr, vars.loss);
} else if (_roi > 0) {
vars.gain = uint256(_roi);
vars.fees = _chargeFees(vars.stratAddr, vars.gain);
strategy.gains += vars.gain;
}
vars.available = availableCapital();
if (vars.available < 0) {
vars.debt = uint256(-vars.available);
vars.debtPayment = Math.min(vars.debt, _repayment);
if (vars.debtPayment != 0) {
strategy.allocated -= vars.debtPayment;
totalAllocated -= vars.debtPayment;
vars.debt -= vars.debtPayment; // tracked for return value
}
} else if (vars.available > 0) {
vars.credit = uint256(vars.available);
strategy.allocated += vars.credit;
totalAllocated += vars.credit;
}
vars.freeWantInStrat = vars.gain + vars.debtPayment;
if (vars.credit > vars.freeWantInStrat) {
totalIdle -= (vars.credit - vars.freeWantInStrat);
token.safeTransfer(vars.stratAddr, vars.credit - vars.freeWantInStrat);
} else if (vars.credit < vars.freeWantInStrat) {
totalIdle += (vars.freeWantInStrat - vars.credit);
token.safeTransferFrom(vars.stratAddr, address(this), vars.freeWantInStrat - vars.credit);
}
strategy.lastReport = block.timestamp;
lastReport = block.timestamp;
emit StrategyReported(
vars.stratAddr,
vars.gain,
vars.loss,
vars.debtPayment,
strategy.gains,
strategy.losses,
strategy.allocated,
vars.credit,
strategy.allocBPS
);
if (strategy.allocBPS == 0 || emergencyShutdown) {
return IStrategy(vars.stratAddr).balanceOf();
}
return vars.debt;
}
/**
* @notice Updates the withdrawMaxLoss which is the maximum allowed slippage.
* @param _withdrawMaxLoss The new value, in basis points.
*/
function updateWithdrawMaxLoss(uint256 _withdrawMaxLoss) external {
_atLeastRole(STRATEGIST);
require(_withdrawMaxLoss <= PERCENT_DIVISOR, "Invalid BPS value");
withdrawMaxLoss = _withdrawMaxLoss;
emit WithdrawMaxLossUpdated(_withdrawMaxLoss);
}
/**
* @notice Updates the vault tvl cap (the max amount of assets held by the vault).
* @dev pass in max value of uint to effectively remove TVL cap.
* @param _newTvlCap The new tvl cap.
*/
function updateTvlCap(uint256 _newTvlCap) public {
_atLeastRole(ADMIN);
tvlCap = _newTvlCap;
emit TvlCapUpdated(tvlCap);
}
/**
* @dev helper function to remove TVL cap
*/
function removeTvlCap() external {
updateTvlCap(type(uint256).max);
}
/**
* Activates or deactivates Vault mode where all Strategies go into full
* withdrawal.
* During Emergency Shutdown:
* 1. No Users may deposit into the Vault (but may withdraw as usual.)
* 2. New Strategies may not be added.
* 3. Each Strategy must pay back their debt as quickly as reasonable to
* minimally affect their position.
*
* If true, the Vault goes into Emergency Shutdown. If false, the Vault
* goes back into Normal Operation.
*/
function setEmergencyShutdown(bool _active) external {
if (_active) {
_atLeastRole(GUARDIAN);
} else {
_atLeastRole(ADMIN);
}
emergencyShutdown = _active;
emit EmergencyShutdown(_active);
}
/**
* @notice Only DEFAULT_ADMIN_ROLE can update treasury address.
*/
function updateTreasury(address newTreasury) external {
_atLeastRole(DEFAULT_ADMIN_ROLE);
require(newTreasury != address(0), "Invalid address");
treasury = newTreasury;
}
/**
* @dev Rescues random funds stuck that the strat can't handle.
* @param _token address of the token to rescue.
*/
function inCaseTokensGetStuck(address _token) external {
_atLeastRole(ADMIN);
uint256 amount = IERC20Metadata(_token).balanceOf(address(this));
if (_token == address(token)) {
amount -= totalIdle;
}
require(amount != 0, "Zero amount");
IERC20Metadata(_token).safeTransfer(msg.sender, amount);
emit InCaseTokensGetStuckCalled(_token, amount);
}
/**
* @dev Overrides the default 18 decimals for the vault ERC20 to
* match the same decimals as the underlying token used
*/
function decimals() public view override returns (uint8) {
return token.decimals();
}
/**
* @dev Returns an array of all the relevant roles arranged in descending order of privilege.
* Subclasses should override this to specify their unique roles arranged in the correct
* order, for example, [SUPER-ADMIN, ADMIN, GUARDIAN, STRATEGIST].
*/
function _cascadingAccessRoles() internal pure override returns (bytes32[] memory) {
bytes32[] memory cascadingAccessRoles = new bytes32[](5);
cascadingAccessRoles[0] = DEFAULT_ADMIN_ROLE;
cascadingAccessRoles[1] = ADMIN;
cascadingAccessRoles[2] = GUARDIAN;
cascadingAccessRoles[3] = STRATEGIST;
cascadingAccessRoles[4] = DEPOSITOR;
return cascadingAccessRoles;
}
/**
* @dev Returns {true} if {_account} has been granted {_role}. Subclasses should override
* this to specify their unique role-checking criteria.
*/
function _hasRole(bytes32 _role, address _account) internal view override returns (bool) {
return hasRole(_role, _account);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => 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(IAccessControl).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 ",
Strings.toHexString(account),
" is missing role ",
Strings.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());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.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(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @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(IERC20 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(IERC20 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. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 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(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
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(IERC20 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))) && Address.isContract(address(token));
}
}// 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 Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* 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);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
}// 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 IAccessControl {
/**
* @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;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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 ERC20 is Context, IERC20, IERC20Metadata {
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.
*/
constructor(string memory name_, string memory symbol_) {
_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 {}
}// 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 IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
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 = Math.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(SignedMath.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, Math.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));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.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 ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// 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 IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[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);
}// 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 Math {
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);
}
}
}// 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 SignedMath {
/**
* @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);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
interface IERC4626Events {
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
);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
interface IStrategy {
//vault only - withdraws funds from the strategy
function withdraw(uint256 _amount) external returns (uint256 loss);
//claims rewards, charges fees, and re-deposits; returns roi (+ve for profit, -ve for loss).
function harvest() external returns (int256 roi);
//returns the balance of all tokens managed by the strategy
function balanceOf() external view returns (uint256);
//returns the address of the vault that the strategy is serving
function vault() external view returns (address);
//returns the address of the token that the strategy needs to operate
function want() external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
library ReaperMathUtils {
/**
* @notice For doing an unchecked increment of an index for gas optimization purposes
* @param _i - The number to increment
* @return The incremented number
*/
function uncheckedInc(uint256 _i) internal pure returns (uint256) {
unchecked {
return _i + 1;
}
}
}// SPDX-License-Identifier: BUSL-1.1
import "../libraries/ReaperMathUtils.sol";
pragma solidity ^0.8.0;
/**
* A mixin to provide access control to a variety of roles. Designed to be compatible
* with both upgradeable and non-upgradble contracts. HAS NO STORAGE.
*/
abstract contract ReaperAccessControl {
using ReaperMathUtils for uint256;
/**
* @notice Checks cascading role privileges to ensure that caller has at least role {_role}.
* Any higher privileged role should be able to perform all the functions of any lower privileged role.
* This is accomplished using the {cascadingAccess} array that lists all roles from most privileged
* to least privileged.
* @param _role - The role in bytes from the keccak256 hash of the role name
*/
function _atLeastRole(bytes32 _role) internal view {
bytes32[] memory cascadingAccessRoles = _cascadingAccessRoles();
uint256 numRoles = cascadingAccessRoles.length;
bool specifiedRoleFound = false;
bool senderHighestRoleFound = false;
// {_role} must be found in the {cascadingAccessRoles} array.
// Also, msg.sender's highest role index <= specified role index.
for (uint256 i = 0; i < numRoles; i = i.uncheckedInc()) {
if (!senderHighestRoleFound && _hasRole(cascadingAccessRoles[i], msg.sender)) {
senderHighestRoleFound = true;
}
if (_role == cascadingAccessRoles[i]) {
specifiedRoleFound = true;
break;
}
}
require(specifiedRoleFound && senderHighestRoleFound, "Unauthorized access");
}
/**
* @dev Returns an array of all the relevant roles arranged in descending order of privilege.
* Subclasses should override this to specify their unique roles arranged in the correct
* order, for example, [SUPER-ADMIN, ADMIN, GUARDIAN, STRATEGIST].
*/
function _cascadingAccessRoles() internal view virtual returns (bytes32[] memory);
/**
* @dev Returns {true} if {_account} has been granted {_role}. Subclasses should override
* this to specify their unique role-checking criteria.
*/
function _hasRole(bytes32 _role, address _account) internal view virtual returns (bool);
}{
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_tvlCap","type":"uint256"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address[]","name":"_strategists","type":"address[]"},{"internalType":"address[]","name":"_multisigRoles","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"active","type":"bool"}],"name":"EmergencyShutdown","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"InCaseTokensGetStuckCalled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"degradation","type":"uint256"}],"name":"LockedProfitDegradationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeBPS","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocBPS","type":"uint256"}],"name":"StrategyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocBPS","type":"uint256"}],"name":"StrategyAllocBPSUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeBPS","type":"uint256"}],"name":"StrategyFeeBPSUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"gain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"loss","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"debtPaid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gains","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"losses","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocationAdded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocBPS","type":"uint256"}],"name":"StrategyReported","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"}],"name":"StrategyRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTvlCap","type":"uint256"}],"name":"TvlCapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"withdrawalQueue","type":"address[]"}],"name":"UpdateWithdrawalQueue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawMaxLoss","type":"uint256"}],"name":"WithdrawMaxLossUpdated","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSITOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARDIAN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STRATEGIST","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"uint256","name":"_feeBPS","type":"uint256"},{"internalType":"uint256","name":"_allocBPS","type":"uint256"}],"name":"addStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableCapital","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"constructionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyShutdown","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastReport","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeTvlCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_roi","type":"int256"},{"internalType":"uint256","name":"_repayment","type":"uint256"}],"name":"report","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"revokeStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setEmergencyShutdown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_withdrawalQueue","type":"address[]"}],"name":"setWithdrawalQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategies","outputs":[{"internalType":"uint256","name":"activation","type":"uint256"},{"internalType":"uint256","name":"feeBPS","type":"uint256"},{"internalType":"uint256","name":"allocBPS","type":"uint256"},{"internalType":"uint256","name":"allocated","type":"uint256"},{"internalType":"uint256","name":"gains","type":"uint256"},{"internalType":"uint256","name":"losses","type":"uint256"},{"internalType":"uint256","name":"lastReport","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalIdle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tvlCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"uint256","name":"_allocBPS","type":"uint256"}],"name":"updateStrategyAllocBPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"uint256","name":"_feeBPS","type":"uint256"}],"name":"updateStrategyFeeBPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"updateTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTvlCap","type":"uint256"}],"name":"updateTvlCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawMaxLoss","type":"uint256"}],"name":"updateWithdrawMaxLoss","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMaxLoss","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawalQueue","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c060405260016010553480156200001657600080fd5b50604051620045e6380380620045e68339810160408190526200003991620004a1565b8585600362000049838262000618565b50600462000058828262000618565b50506001600755506001600160a01b0387811660a052426080819052600e55600a859055601180546001600160a01b031916918516919091179055815160005b818110156200010d57620000ef7fb17d0a42cc710456bf9c3efb785dcd0cb93a0ac358113307b5c64b285b516b5c858381518110620000db57620000db620006e4565b6020026020010151620001bd60201b60201c565b62000105816200020060201b62001f061760201c565b905062000098565b506200011b600033620001bd565b620001396000801b83600081518110620000db57620000db620006e4565b620001747fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4283600181518110620000db57620000db620006e4565b620001af7f8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe883600281518110620000db57620000db620006e4565b5050505050505050620006fa565b620001d482826200020660201b62001f0c1760201c565b6000828152600660209081526040909120620001fb91839062001f92620002ab821b17901c565b505050565b60010190565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620002a75760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002663390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000620002c2836001600160a01b038416620002cb565b90505b92915050565b60008181526001830160205260408120546200031457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620002c5565b506000620002c5565b80516001600160a01b03811681146200033557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200037b576200037b6200033a565b604052919050565b600082601f8301126200039557600080fd5b81516001600160401b03811115620003b157620003b16200033a565b6020620003c7601f8301601f1916820162000350565b8281528582848701011115620003dc57600080fd5b60005b83811015620003fc578581018301518282018401528201620003df565b506000928101909101919091529392505050565b600082601f8301126200042257600080fd5b815160206001600160401b038211156200044057620004406200033a565b8160051b6200045182820162000350565b92835284810182019282810190878511156200046c57600080fd5b83870192505b84831015620004965762000486836200031d565b8252918301919083019062000472565b979650505050505050565b600080600080600080600060e0888a031215620004bd57600080fd5b620004c8886200031d565b60208901519097506001600160401b0380821115620004e657600080fd5b620004f48b838c0162000383565b975060408a01519150808211156200050b57600080fd5b620005198b838c0162000383565b965060608a015195506200053060808b016200031d565b945060a08a01519150808211156200054757600080fd5b620005558b838c0162000410565b935060c08a01519150808211156200056c57600080fd5b506200057b8a828b0162000410565b91505092959891949750929550565b600181811c908216806200059f57607f821691505b602082108103620005c057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001fb57600081815260208120601f850160051c81016020861015620005ef5750805b601f850160051c820191505b818110156200061057828155600101620005fb565b505050505050565b81516001600160401b038111156200063457620006346200033a565b6200064c816200064584546200058a565b84620005c6565b602080601f8311600181146200068457600084156200066b5750858301515b600019600386901b1c1916600185901b17855562000610565b600085815260208120601f198616915b82811015620006b55788860151825594840194600190910190840162000694565b5085821015620006d45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b60805160a051613e8062000766600039600081816107ee01528181610bbb01528181610c4b01528181610fde015281816118c9015281816119c801528181611cc701528181612793015281816128a101528181612a870152612cf2015260006107b40152613e806000f3fe608060405234801561001057600080fd5b50600436106103775760003560e01c806370a08231116101d3578063ac579b7711610104578063d547741f116100a2578063def68a9c1161007c578063def68a9c1461079c578063f06c5610146107af578063fa34d611146107d6578063fc0c546a146107e957600080fd5b8063d547741f1461076e578063dd62ed3e14610781578063de5f62681461079457600080fd5b8063bb994d48116100de578063bb994d481461072c578063c3535b521461073f578063c822adda14610748578063ca15c8731461075b57600080fd5b8063ac579b77146106fe578063b69ef8a814610711578063b6b55f251461071957600080fd5b806391d14854116101715780639cfdede31161014b5780639cfdede3146106bb578063a217fddf146106d0578063a457c2d7146106d8578063a9059cbb146106eb57600080fd5b806391d148541461069757806395d89b41146106aa5780639aa7df94146106b257600080fd5b80637d6205be116101ad5780637d6205be146106565780637f51bb1f14610669578063853828b61461067c5780639010d07c1461068457600080fd5b806370a0823114610610578063724c184c1461063957806377c7b8fc1461064e57600080fd5b80632f2ff15d116102ad57806345f7f2491161024b5780634870dd9a116102255780634870dd9a146105c05780635f3d3a0e146105c957806361d027b3146105dc5780636f9c94a81461060757600080fd5b806345f7f2491461059b578063462f82f4146105a4578063483b6031146105b757600080fd5b806336568abe1161028757806336568abe146104ec57806339509351146104ff57806339ebf823146105125780633f23fa1a1461059257600080fd5b80632f2ff15d146104b2578063313ce567146104c55780633403c2fc146104df57600080fd5b806318160ddd1161031a578063248a9ca3116102f4578063248a9ca31461045f57806329b9d694146104825780632a0acc6a1461048a5780632e1a7d4d1461049f57600080fd5b806318160ddd1461043c578063199cb7d81461044457806323b872dd1461044c57600080fd5b8063095ea7b311610356578063095ea7b3146103ce5780630f3d249d146103e157806314c644021461040257806316ad25a51461041557600080fd5b8062272d811461037c57806301ffc9a71461039157806306fdde03146103b9575b600080fd5b61038f61038a36600461375a565b610810565b005b6103a461039f366004613773565b610863565b60405190151581526020015b60405180910390f35b6103c161088e565b6040516103b091906137c1565b6103a46103dc366004613819565b610920565b6103f46103ef366004613845565b610938565b6040519081526020016103b0565b61038f610410366004613875565b610da6565b6103f47fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f33681565b6002546103f4565b6103f4610e20565b6103a461045a366004613892565b610f6e565b6103f461046d36600461375a565b60009081526005602052604090206001015490565b61038f610f94565b6103f4600080516020613e0b83398151915281565b61038f6104ad36600461375a565b610fa1565b61038f6104c03660046138d3565b610fb0565b6104cd610fda565b60405160ff90911681526020016103b0565b600f546103a49060ff1681565b61038f6104fa3660046138d3565b611063565b6103a461050d366004613819565b6110dd565b61055d610520366004613903565b6008602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919087565b604080519788526020880196909652948601939093526060850191909152608084015260a083015260c082015260e0016103b0565b6103f4600a5481565b6103f4600d5481565b61038f6105b236600461375a565b6110ff565b6103f460105481565b6103f461271081565b61038f6105d7366004613819565b611191565b6011546105ef906001600160a01b031681565b6040516001600160a01b0390911681526020016103b0565b6103f4600c5481565b6103f461061e366004613903565b6001600160a01b031660009081526020819052604090205490565b6103f4600080516020613deb83398151915281565b6103f46112f9565b61038f610664366004613819565b61134e565b61038f610677366004613903565b611454565b61038f6114c8565b6105ef610692366004613845565b6114e5565b6103a46106a53660046138d3565b6114fd565b6103c1611528565b6103f4600b5481565b6103f4600080516020613e2b83398151915281565b6103f4600081565b6103a46106e6366004613819565b611537565b6103a46106f9366004613819565b6115bd565b61038f61070c366004613936565b6115cb565b6103f461173c565b61038f61072736600461375a565b61174e565b61038f61073a366004613903565b611758565b6103f4600e5481565b6105ef61075636600461375a565b61181f565b6103f461076936600461375a565b611849565b61038f61077c3660046138d3565b611860565b6103f461078f3660046139fb565b611885565b61038f6118b0565b61038f6107aa366004613903565b611942565b6103f47f000000000000000000000000000000000000000000000000000000000000000081565b61038f6107e4366004613a29565b611aa0565b6105ef7f000000000000000000000000000000000000000000000000000000000000000081565b610827600080516020613e0b833981519152611fa7565b600a8190556040518181527f2923cecec41b7140eaf657a035af4abb23ed61d16b1fc20a986838eb3ad99bd0906020015b60405180910390a150565b60006001600160e01b03198216635a05180f60e01b148061088857506108888261207e565b92915050565b60606003805461089d90613a5e565b80601f01602080910402602001604051908101604052809291908181526020018280546108c990613a5e565b80156109165780601f106108eb57610100808354040283529160200191610916565b820191906000526020600020905b8154815290600101906020018083116108f957829003601f168201915b5050505050905090565b60003361092e8185856120b3565b5060019392505050565b600061099260405180610120016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b33808252600090815260086020526040812080549091036109f25760405162461bcd60e51b8152602060048201526015602482015274556e617574686f72697a656420737472617465677960581b60448201526064015b60405180910390fd5b6000851215610a1b57610a0485613aae565b602083018190528251610a16916121d7565b610a5b565b6000851315610a5b57604082018590528151610a37908661231e565b60608301526040820151600482018054600090610a55908490613aca565b90915550505b610a63610e20565b6080830181905260001315610af5578160800151610a8090613aae565b60a08301819052610a9190856123b6565b60e0830181905215610af0578160e00151816003016000828254610ab59190613add565b909155505060e0820151600d8054600090610ad1908490613add565b909155505060e082015160a083018051610aec908390613add565b9052505b610b44565b600082608001511315610b4457608082015160c08301819052600382018054600090610b22908490613aca565b909155505060c0820151600d8054600090610b3e908490613aca565b90915550505b8160e001518260400151610b589190613aca565b610100830181905260c08301511115610be7578161010001518260c00151610b809190613add565b600b6000828254610b919190613add565b9091555050815161010083015160c0840151610be29291610bb191613add565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691906123cc565b610c73565b8161010001518260c001511015610c73578160c00151826101000151610c0d9190613add565b600b6000828254610c1e9190613aca565b9091555050815160c0830151610100840151610c7392913091610c419190613add565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692919061242f565b4260068201819055600e55815160408084015160208086015160e0808801516004880154600589015460038a015460c0808d015160028d01548b519a8b52988a0197909752888a01949094526060880192909252608087015260a086015284019190915282015290516001600160a01b03909216917f67f96d2854a335a4cadb49f84fd3ca6f990744ddb3feceeb4b349d2d53d32ad3918190036101000190a260028101541580610d265750600f5460ff165b15610d9a5781600001516001600160a01b031663722713f76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190613af0565b92505050610888565b5060a001519392505050565b8015610dc857610dc3600080516020613deb833981519152611fa7565b610ddf565b610ddf600080516020613e0b833981519152611fa7565b600f805460ff19168215159081179091556040519081527fba40372a3a724dca3c57156128ef1e896724b65b37a17f190b1ad5de68f3a4f390602001610858565b600c5460009033901580610e365750600f5460ff165b15610e66576001600160a01b038116600090815260086020526040902060030154610e6090613aae565b91505090565b6000612710610e7361173c565b6001600160a01b038416600090815260086020526040902060020154610e999190613b09565b610ea39190613b20565b6001600160a01b03831660009081526008602052604090206003015490915081811115610ee557610ed48282613add565b610edd90613aae565b935050505090565b81811015610f64576000612710610efa61173c565b600c54610f079190613b09565b610f119190613b20565b600d54909150818110610f2a5760009550505050505090565b6000610f368486613add565b9050610f4b81610f468486613add565b6123b6565b9050610f5981600b546123b6565b979650505050505050565b6000935050505090565b600033610f7c85828561246d565b610f878585856124e1565b60019150505b9392505050565b610f9f600019610810565b565b610fac813333612685565b5050565b600082815260056020526040902060010154610fcb81612b04565b610fd58383612b0e565b505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561103a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105e9190613b42565b905090565b6001600160a01b03811633146110d35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109e9565b610fac8282612b30565b60003361092e8185856110f08383611885565b6110fa9190613aca565b6120b3565b611116600080516020613e2b833981519152611fa7565b61271081111561115c5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964204250532076616c756560781b60448201526064016109e9565b60108190556040518181527f23e1382e62459214e4b3240fe95817b36865752f45f7569957018fe5a105f7b590602001610858565b6001600160a01b03821660009081526008602052604081205490036111c85760405162461bcd60e51b81526004016109e990613b65565b6001600160a01b038216600090815260086020526040902060020154801561120657611201600080516020613e2b833981519152611fa7565b61121d565b61121d600080516020613e0b833981519152611fa7565b80600c600082825461122f9190613add565b90915550506001600160a01b0383166000908152600860205260408120600201839055600c8054849290611264908490613aca565b9091555050600c5461271010156112b15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964204250532076616c756560781b60448201526064016109e9565b826001600160a01b03167f437afd93b1abdad7ff741b69dde7efdd15dba7fb6999ba3471db17fd029dced9836040516112ec91815260200190565b60405180910390a2505050565b600061130460025490565b1561133b57600254611314610fda565b61131f90600a613c80565b61132761173c565b6113319190613b09565b61105e9190613b20565b611343610fda565b61105e90600a613c80565b611365600080516020613e0b833981519152611fa7565b6001600160a01b038216600090815260086020526040812054900361139c5760405162461bcd60e51b81526004016109e990613b65565b6113a96005612710613b20565b8111156113f85760405162461bcd60e51b815260206004820181905260248201527f4665652063616e6e6f7420626520686967686572207468616e2032302042505360448201526064016109e9565b6001600160a01b03821660008181526008602052604090819020600101839055517f8281ff4064168f20aa9abde7f62b8b72efb10b48e7e838af54dcabff3131474a906114489084815260200190565b60405180910390a25050565b61145e6000611fa7565b6001600160a01b0381166114a65760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016109e9565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b336000818152602081905260409020546114e29180612685565b50565b6000828152600660205260408120610f8d9083612b52565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461089d90613a5e565b600033816115458286611885565b9050838110156115a55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016109e9565b6115b282868684036120b3565b506001949350505050565b60003361092e8185856124e1565b6115e2600080516020613e0b833981519152611fa7565b805160008190036116355760405162461bcd60e51b815260206004820152601760248201527f5175657565206d757374206e6f7420626520656d70747900000000000000000060448201526064016109e9565b61164160096000613728565b60005b8181101561170057600083828151811061166057611660613c8f565b6020908102919091018101516001600160a01b0381166000908152600890925260408220805491935091036116a75760405162461bcd60e51b81526004016109e990613b65565b5060098054600180820183556000929092527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b03939093169290921790915501611644565b507fe159a1b5cb3e0bbe2f0caa53bcf2cd9ea0bc25a8c7b8302b1ac510f29cac8baa826040516117309190613ca5565b60405180910390a15050565b6000600d54600b5461105e9190613aca565b610fac8133612b5e565b336001600160a01b0382161461177f5761177f600080516020613deb833981519152611fa7565b6001600160a01b03811660009081526008602052604081206002015490036117a45750565b6001600160a01b038116600090815260086020526040812060020154600c8054919290916117d3908490613add565b90915550506001600160a01b038116600081815260086020526040808220600201829055517f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a9190a250565b6009818154811061182f57600080fd5b6000918252602090912001546001600160a01b0316905081565b600081815260066020526040812061088890612d6c565b60008281526005602052604090206001015461187b81612b04565b610fd58383612b30565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6040516370a0823160e01b81523360048201526114e2907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193c9190613af0565b33612b5e565b611959600080516020613e0b833981519152611fa7565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156119a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c49190613af0565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031603611a0f57600b54611a0c9082613add565b90505b80600003611a4d5760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b60448201526064016109e9565b611a616001600160a01b03831633836123cc565b604080516001600160a01b0384168152602081018390527f741ee845808813887c0b0d54aa20a3d0f670bebce7b6a1face577afbc00d1d6c9101611730565b611aaa6000611fa7565b600f5460ff1615611b135760405162461bcd60e51b815260206004820152602d60248201527f43616e6e6f742061646420737472617465677920647572696e6720656d65726760448201526c32b731bc9039b43aba3237bbb760991b60648201526084016109e9565b6001600160a01b038316611b395760405162461bcd60e51b81526004016109e990613b65565b6001600160a01b03831660009081526008602052604090205415611b985760405162461bcd60e51b815260206004820152601660248201527514dd1c985d1959de48185b1c9958591e48185919195960521b60448201526064016109e9565b826001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bfa9190613cf2565b6001600160a01b0316306001600160a01b031614611c5a5760405162461bcd60e51b815260206004820152601f60248201527f53747261746567792773207661756c7420646f6573206e6f74206d617463680060448201526064016109e9565b826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc9190613cf2565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614611d3c5760405162461bcd60e51b815260206004820152601e60248201527f537472617465677927732077616e7420646f6573206e6f74206d61746368000060448201526064016109e9565b611d496005612710613b20565b821115611d985760405162461bcd60e51b815260206004820181905260248201527f4665652063616e6e6f7420626520686967686572207468616e2032302042505360448201526064016109e9565b612710600c5482611da99190613aca565b1115611df05760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420616c6c6f634250532076616c756560501b60448201526064016109e9565b6040805160e0810182524280825260208083018681528385018681526000606086018181526080870182815260a0880183815260c089019788526001600160a01b038d1684526008909652978220965187559251600187015590516002860155905160038501559351600484015551600583015551600690910155600c8054839290611e7d908490613aca565b9091555050600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b03851690811790915560408051848152602081018490527f45bb3eed5cd098efb0a286413fb1f3c11841762610cefbabae6a772963e916ba91016112ec565b60010190565b611f1682826114fd565b610fac5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611f4e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610f8d836001600160a01b038416612d76565b6000611fb1612dc5565b8051909150600080805b8381101561202a5781158015611fef5750611fef858281518110611fe157611fe1613c8f565b602002602001015133612edd565b15611ff957600191505b84818151811061200b5761200b613c8f565b60200260200101518603612022576001925061202a565b600101611fbb565b508180156120355750805b6120775760405162461bcd60e51b8152602060048201526013602482015272556e617574686f72697a65642061636365737360681b60448201526064016109e9565b5050505050565b60006001600160e01b03198216637965db0b60e01b148061088857506301ffc9a760e01b6001600160e01b0319831614610888565b6001600160a01b0383166121155760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016109e9565b6001600160a01b0382166121765760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016109e9565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038216600090815260086020526040902060038101548083111561225c5760405162461bcd60e51b815260206004820152602f60248201527f5374726174656779206c6f73732063616e6e6f7420626520677265617465722060448201526e3a3430b71030b63637b1b0ba34b7b760891b60648201526084016109e9565b600c54156122cb57600061228e600d54600c548661227a9190613b09565b6122849190613b20565b84600201546123b6565b905080156122c957808360020160008282546122aa9190613add565b9250508190555080600c60008282546122c39190613add565b90915550505b505b828260050160008282546122df9190613aca565b92505081905550828260030160008282546122fa9190613add565b9250508190555082600d60008282546123139190613add565b909155505050505050565b6001600160a01b03821660009081526008602052604081206001015481906127109061234a9085613b09565b6123549190613b20565b90508015610f8d57600061236760025490565b9050600081156123925761237961173c565b6123838385613b09565b61238d9190613b20565b612394565b825b6011549091506123ad906001600160a01b031682612ee9565b50509392505050565b60008183106123c55781610f8d565b5090919050565b6040516001600160a01b038316602482015260448101829052610fd590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612fa8565b6040516001600160a01b03808516602483015283166044820152606481018290526124679085906323b872dd60e01b906084016123f8565b50505050565b60006124798484611885565b9050600019811461246757818110156124d45760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016109e9565b61246784848484036120b3565b6001600160a01b0383166125455760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016109e9565b6001600160a01b0382166125a75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109e9565b6001600160a01b0383166000908152602081905260409020548181101561261f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016109e9565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3612467565b600061268f61307d565b836000036126d05760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109e9565b600254846126dc61173c565b6126e69190613b09565b6126f09190613b20565b600b5490915080821115612a5857600954600090815b818110156129a457838511156129a45760006009828154811061272b5761272b613c8f565b60009182526020808320909101546001600160a01b0316808352600890915260408220600301549092509081900361276457505061299c565b60006127708789613add565b6040516370a0823160e01b81523060048201529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156127da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127fe9190613af0565b90506000846001600160a01b0316632e1a7d4d61281b85876123b6565b6040518263ffffffff1660e01b815260040161283991815260200190565b6020604051808303816000875af1158015612858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061287c9190613af0565b6040516370a0823160e01b815230600482015290915060009083906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156128e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290c9190613af0565b6129169190613add565b9050612922818b613aca565b9950811561294c57612934828c613add565b9a50612940828a613aca565b985061294c86836121d7565b6001600160a01b03861660009081526008602052604081206003018054839290612977908490613add565b9250508190555080600d60008282546129909190613add565b90915550505050505050505b600101612706565b50600b839055828411156129e1578293506129bd61173c565b6002546129ca8487613aca565b6129d49190613b09565b6129de9190613b20565b96505b601054612710906129f28487613aca565b6129fc9190613b09565b612a069190613b20565b821115612a555760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177206c6f7373206578636565647320736c697070616765000060448201526064016109e9565b50505b612a6283866130d6565b81600b6000828254612a749190613add565b90915550612aae90506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001685846123cc565b60408051838152602081018790526001600160a01b03808616929087169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450610f8d6001600755565b6114e28133613208565b612b188282611f0c565b6000828152600660205260409020610fd59082611f92565b612b3a8282613261565b6000828152600660205260409020610fd590826132c8565b6000610f8d83836132dd565b6000612b6861307d565b612b917fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f336611fa7565b600f5460ff1615612bf55760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f74206465706f73697420647572696e6720656d657267656e63792060448201526739b43aba3237bbb760c11b60648201526084016109e9565b82600003612c365760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109e9565b6000612c4061173c565b600a54909150612c508583613aca565b1115612c8e5760405162461bcd60e51b815260206004820152600d60248201526c15985d5b1d081a5cc8199d5b1b609a1b60448201526064016109e9565b6000612c9960025490565b905080600003612cab57849250612cc3565b81612cb68287613b09565b612cc09190613b20565b92505b612ccd8484612ee9565b84600b6000828254612cdf9190613aca565b90915550612d1a90506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308861242f565b60408051868152602081018590526001600160a01b0386169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a350506108886001600755565b6000610888825490565b6000818152600183016020526040812054612dbd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610888565b506000610888565b60408051600580825260c08201909252606091600091906020820160a0803683370190505090506000801b81600081518110612e0357612e03613c8f565b602002602001018181525050600080516020613e0b83398151915281600181518110612e3157612e31613c8f565b602002602001018181525050600080516020613deb83398151915281600281518110612e5f57612e5f613c8f565b602002602001018181525050600080516020613e2b83398151915281600381518110612e8d57612e8d613c8f565b6020026020010181815250507fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f33681600481518110612ecd57612ecd613c8f565b6020908102919091010152919050565b6000610f8d83836114fd565b6001600160a01b038216612f3f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109e9565b8060026000828254612f519190613aca565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000612ffd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133079092919063ffffffff16565b905080516000148061301e57508080602001905181019061301e9190613d0f565b610fd55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109e9565b6002600754036130cf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109e9565b6002600755565b6001600160a01b0382166131365760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016109e9565b6001600160a01b038216600090815260208190526040902054818110156131aa5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016109e9565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61321282826114fd565b610fac5761321f8161331e565b61322a836020613330565b60405160200161323b929190613d2c565b60408051601f198184030181529082905262461bcd60e51b82526109e9916004016137c1565b61326b82826114fd565b15610fac5760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610f8d836001600160a01b0384166134cc565b60008260000182815481106132f4576132f4613c8f565b9060005260206000200154905092915050565b606061331684846000856135bf565b949350505050565b60606108886001600160a01b03831660145b6060600061333f836002613b09565b61334a906002613aca565b67ffffffffffffffff81111561336257613362613920565b6040519080825280601f01601f19166020018201604052801561338c576020820181803683370190505b509050600360fc1b816000815181106133a7576133a7613c8f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106133d6576133d6613c8f565b60200101906001600160f81b031916908160001a90535060006133fa846002613b09565b613405906001613aca565b90505b600181111561347d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061343957613439613c8f565b1a60f81b82828151811061344f5761344f613c8f565b60200101906001600160f81b031916908160001a90535060049490941c9361347681613da1565b9050613408565b508315610f8d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e9565b600081815260018301602052604081205480156135b55760006134f0600183613add565b855490915060009061350490600190613add565b905081811461356957600086600001828154811061352457613524613c8f565b906000526020600020015490508087600001848154811061354757613547613c8f565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061357a5761357a613db8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610888565b6000915050610888565b6060824710156136205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109e9565b600080866001600160a01b0316858760405161363c9190613dce565b60006040518083038185875af1925050503d8060008114613679576040519150601f19603f3d011682016040523d82523d6000602084013e61367e565b606091505b5091509150610f5987838387606083156136f95782516000036136f2576001600160a01b0385163b6136f25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109e9565b5081613316565b613316838381511561370e5781518083602001fd5b8060405162461bcd60e51b81526004016109e991906137c1565b50805460008255906000526020600020908101906114e291905b808211156137565760008155600101613742565b5090565b60006020828403121561376c57600080fd5b5035919050565b60006020828403121561378557600080fd5b81356001600160e01b031981168114610f8d57600080fd5b60005b838110156137b85781810151838201526020016137a0565b50506000910152565b60208152600082518060208401526137e081604085016020870161379d565b601f01601f19169190910160400192915050565b6001600160a01b03811681146114e257600080fd5b8035613814816137f4565b919050565b6000806040838503121561382c57600080fd5b8235613837816137f4565b946020939093013593505050565b6000806040838503121561385857600080fd5b50508035926020909101359150565b80151581146114e257600080fd5b60006020828403121561388757600080fd5b8135610f8d81613867565b6000806000606084860312156138a757600080fd5b83356138b2816137f4565b925060208401356138c2816137f4565b929592945050506040919091013590565b600080604083850312156138e657600080fd5b8235915060208301356138f8816137f4565b809150509250929050565b60006020828403121561391557600080fd5b8135610f8d816137f4565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561394957600080fd5b823567ffffffffffffffff8082111561396157600080fd5b818501915085601f83011261397557600080fd5b81358181111561398757613987613920565b8060051b604051601f19603f830116810181811085821117156139ac576139ac613920565b6040529182528482019250838101850191888311156139ca57600080fd5b938501935b828510156139ef576139e085613809565b845293850193928501926139cf565b98975050505050505050565b60008060408385031215613a0e57600080fd5b8235613a19816137f4565b915060208301356138f8816137f4565b600080600060608486031215613a3e57600080fd5b8335613a49816137f4565b95602085013595506040909401359392505050565b600181811c90821680613a7257607f821691505b602082108103613a9257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000600160ff1b8201613ac357613ac3613a98565b5060000390565b8082018082111561088857610888613a98565b8181038181111561088857610888613a98565b600060208284031215613b0257600080fd5b5051919050565b808202811582820484141761088857610888613a98565b600082613b3d57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613b5457600080fd5b815160ff81168114610f8d57600080fd5b60208082526018908201527f496e76616c696420737472617465677920616464726573730000000000000000604082015260600190565b600181815b80851115613bd7578160001904821115613bbd57613bbd613a98565b80851615613bca57918102915b93841c9390800290613ba1565b509250929050565b600082613bee57506001610888565b81613bfb57506000610888565b8160018114613c115760028114613c1b57613c37565b6001915050610888565b60ff841115613c2c57613c2c613a98565b50506001821b610888565b5060208310610133831016604e8410600b8410161715613c5a575081810a610888565b613c648383613b9c565b8060001904821115613c7857613c78613a98565b029392505050565b6000610f8d60ff841683613bdf565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015613ce65783516001600160a01b031683529284019291840191600101613cc1565b50909695505050505050565b600060208284031215613d0457600080fd5b8151610f8d816137f4565b600060208284031215613d2157600080fd5b8151610f8d81613867565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613d6481601785016020880161379d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613d9581602884016020880161379d565b01602801949350505050565b600081613db057613db0613a98565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251613de081846020870161379d565b919091019291505056fe8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe8df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42b17d0a42cc710456bf9c3efb785dcd0cb93a0ac358113307b5c64b285b516b5ca2646970667358221220995b1ec3a76a734d93d5052de6cfd3a8398ecaadbee8091e49ccab035a2534be64736f6c63430008120033000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead111100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000e61d01d25046c45ccdafa80870339a36fdf07105000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000013417572656c6975732057455448205661756c7400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a617572656c2d574554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000001e71aee6081f62053123140aacc7a06021d7734800000000000000000000000081876677843d00a7d792e1617459ac2e932025760000000000000000000000004c3490df15edfa178333445ce568ec6d99b5d71c000000000000000000000000b26cd6633db6b0c9ae919049c1437271ae496d1500000000000000000000000060bc5e0440c867eeb4cbce84bb1123fad2b262b100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000dfedcef9519b24f4de5d3275804aaff5a41705f0000000000000000000000001b526b8298f14fb172f5842aacdce18bc9cb61920000000000000000000000006bdbdca65d3a2e353798fa7a16eeb54974a51848
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103775760003560e01c806370a08231116101d3578063ac579b7711610104578063d547741f116100a2578063def68a9c1161007c578063def68a9c1461079c578063f06c5610146107af578063fa34d611146107d6578063fc0c546a146107e957600080fd5b8063d547741f1461076e578063dd62ed3e14610781578063de5f62681461079457600080fd5b8063bb994d48116100de578063bb994d481461072c578063c3535b521461073f578063c822adda14610748578063ca15c8731461075b57600080fd5b8063ac579b77146106fe578063b69ef8a814610711578063b6b55f251461071957600080fd5b806391d14854116101715780639cfdede31161014b5780639cfdede3146106bb578063a217fddf146106d0578063a457c2d7146106d8578063a9059cbb146106eb57600080fd5b806391d148541461069757806395d89b41146106aa5780639aa7df94146106b257600080fd5b80637d6205be116101ad5780637d6205be146106565780637f51bb1f14610669578063853828b61461067c5780639010d07c1461068457600080fd5b806370a0823114610610578063724c184c1461063957806377c7b8fc1461064e57600080fd5b80632f2ff15d116102ad57806345f7f2491161024b5780634870dd9a116102255780634870dd9a146105c05780635f3d3a0e146105c957806361d027b3146105dc5780636f9c94a81461060757600080fd5b806345f7f2491461059b578063462f82f4146105a4578063483b6031146105b757600080fd5b806336568abe1161028757806336568abe146104ec57806339509351146104ff57806339ebf823146105125780633f23fa1a1461059257600080fd5b80632f2ff15d146104b2578063313ce567146104c55780633403c2fc146104df57600080fd5b806318160ddd1161031a578063248a9ca3116102f4578063248a9ca31461045f57806329b9d694146104825780632a0acc6a1461048a5780632e1a7d4d1461049f57600080fd5b806318160ddd1461043c578063199cb7d81461044457806323b872dd1461044c57600080fd5b8063095ea7b311610356578063095ea7b3146103ce5780630f3d249d146103e157806314c644021461040257806316ad25a51461041557600080fd5b8062272d811461037c57806301ffc9a71461039157806306fdde03146103b9575b600080fd5b61038f61038a36600461375a565b610810565b005b6103a461039f366004613773565b610863565b60405190151581526020015b60405180910390f35b6103c161088e565b6040516103b091906137c1565b6103a46103dc366004613819565b610920565b6103f46103ef366004613845565b610938565b6040519081526020016103b0565b61038f610410366004613875565b610da6565b6103f47fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f33681565b6002546103f4565b6103f4610e20565b6103a461045a366004613892565b610f6e565b6103f461046d36600461375a565b60009081526005602052604090206001015490565b61038f610f94565b6103f4600080516020613e0b83398151915281565b61038f6104ad36600461375a565b610fa1565b61038f6104c03660046138d3565b610fb0565b6104cd610fda565b60405160ff90911681526020016103b0565b600f546103a49060ff1681565b61038f6104fa3660046138d3565b611063565b6103a461050d366004613819565b6110dd565b61055d610520366004613903565b6008602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919087565b604080519788526020880196909652948601939093526060850191909152608084015260a083015260c082015260e0016103b0565b6103f4600a5481565b6103f4600d5481565b61038f6105b236600461375a565b6110ff565b6103f460105481565b6103f461271081565b61038f6105d7366004613819565b611191565b6011546105ef906001600160a01b031681565b6040516001600160a01b0390911681526020016103b0565b6103f4600c5481565b6103f461061e366004613903565b6001600160a01b031660009081526020819052604090205490565b6103f4600080516020613deb83398151915281565b6103f46112f9565b61038f610664366004613819565b61134e565b61038f610677366004613903565b611454565b61038f6114c8565b6105ef610692366004613845565b6114e5565b6103a46106a53660046138d3565b6114fd565b6103c1611528565b6103f4600b5481565b6103f4600080516020613e2b83398151915281565b6103f4600081565b6103a46106e6366004613819565b611537565b6103a46106f9366004613819565b6115bd565b61038f61070c366004613936565b6115cb565b6103f461173c565b61038f61072736600461375a565b61174e565b61038f61073a366004613903565b611758565b6103f4600e5481565b6105ef61075636600461375a565b61181f565b6103f461076936600461375a565b611849565b61038f61077c3660046138d3565b611860565b6103f461078f3660046139fb565b611885565b61038f6118b0565b61038f6107aa366004613903565b611942565b6103f47f0000000000000000000000000000000000000000000000000000000065b2fd6381565b61038f6107e4366004613a29565b611aa0565b6105ef7f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead111181565b610827600080516020613e0b833981519152611fa7565b600a8190556040518181527f2923cecec41b7140eaf657a035af4abb23ed61d16b1fc20a986838eb3ad99bd0906020015b60405180910390a150565b60006001600160e01b03198216635a05180f60e01b148061088857506108888261207e565b92915050565b60606003805461089d90613a5e565b80601f01602080910402602001604051908101604052809291908181526020018280546108c990613a5e565b80156109165780601f106108eb57610100808354040283529160200191610916565b820191906000526020600020905b8154815290600101906020018083116108f957829003601f168201915b5050505050905090565b60003361092e8185856120b3565b5060019392505050565b600061099260405180610120016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b33808252600090815260086020526040812080549091036109f25760405162461bcd60e51b8152602060048201526015602482015274556e617574686f72697a656420737472617465677960581b60448201526064015b60405180910390fd5b6000851215610a1b57610a0485613aae565b602083018190528251610a16916121d7565b610a5b565b6000851315610a5b57604082018590528151610a37908661231e565b60608301526040820151600482018054600090610a55908490613aca565b90915550505b610a63610e20565b6080830181905260001315610af5578160800151610a8090613aae565b60a08301819052610a9190856123b6565b60e0830181905215610af0578160e00151816003016000828254610ab59190613add565b909155505060e0820151600d8054600090610ad1908490613add565b909155505060e082015160a083018051610aec908390613add565b9052505b610b44565b600082608001511315610b4457608082015160c08301819052600382018054600090610b22908490613aca565b909155505060c0820151600d8054600090610b3e908490613aca565b90915550505b8160e001518260400151610b589190613aca565b610100830181905260c08301511115610be7578161010001518260c00151610b809190613add565b600b6000828254610b919190613add565b9091555050815161010083015160c0840151610be29291610bb191613add565b6001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11111691906123cc565b610c73565b8161010001518260c001511015610c73578160c00151826101000151610c0d9190613add565b600b6000828254610c1e9190613aca565b9091555050815160c0830151610100840151610c7392913091610c419190613add565b6001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11111692919061242f565b4260068201819055600e55815160408084015160208086015160e0808801516004880154600589015460038a015460c0808d015160028d01548b519a8b52988a0197909752888a01949094526060880192909252608087015260a086015284019190915282015290516001600160a01b03909216917f67f96d2854a335a4cadb49f84fd3ca6f990744ddb3feceeb4b349d2d53d32ad3918190036101000190a260028101541580610d265750600f5460ff165b15610d9a5781600001516001600160a01b031663722713f76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190613af0565b92505050610888565b5060a001519392505050565b8015610dc857610dc3600080516020613deb833981519152611fa7565b610ddf565b610ddf600080516020613e0b833981519152611fa7565b600f805460ff19168215159081179091556040519081527fba40372a3a724dca3c57156128ef1e896724b65b37a17f190b1ad5de68f3a4f390602001610858565b600c5460009033901580610e365750600f5460ff165b15610e66576001600160a01b038116600090815260086020526040902060030154610e6090613aae565b91505090565b6000612710610e7361173c565b6001600160a01b038416600090815260086020526040902060020154610e999190613b09565b610ea39190613b20565b6001600160a01b03831660009081526008602052604090206003015490915081811115610ee557610ed48282613add565b610edd90613aae565b935050505090565b81811015610f64576000612710610efa61173c565b600c54610f079190613b09565b610f119190613b20565b600d54909150818110610f2a5760009550505050505090565b6000610f368486613add565b9050610f4b81610f468486613add565b6123b6565b9050610f5981600b546123b6565b979650505050505050565b6000935050505090565b600033610f7c85828561246d565b610f878585856124e1565b60019150505b9392505050565b610f9f600019610810565b565b610fac813333612685565b5050565b600082815260056020526040902060010154610fcb81612b04565b610fd58383612b0e565b505050565b60007f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11116001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561103a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105e9190613b42565b905090565b6001600160a01b03811633146110d35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109e9565b610fac8282612b30565b60003361092e8185856110f08383611885565b6110fa9190613aca565b6120b3565b611116600080516020613e2b833981519152611fa7565b61271081111561115c5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964204250532076616c756560781b60448201526064016109e9565b60108190556040518181527f23e1382e62459214e4b3240fe95817b36865752f45f7569957018fe5a105f7b590602001610858565b6001600160a01b03821660009081526008602052604081205490036111c85760405162461bcd60e51b81526004016109e990613b65565b6001600160a01b038216600090815260086020526040902060020154801561120657611201600080516020613e2b833981519152611fa7565b61121d565b61121d600080516020613e0b833981519152611fa7565b80600c600082825461122f9190613add565b90915550506001600160a01b0383166000908152600860205260408120600201839055600c8054849290611264908490613aca565b9091555050600c5461271010156112b15760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964204250532076616c756560781b60448201526064016109e9565b826001600160a01b03167f437afd93b1abdad7ff741b69dde7efdd15dba7fb6999ba3471db17fd029dced9836040516112ec91815260200190565b60405180910390a2505050565b600061130460025490565b1561133b57600254611314610fda565b61131f90600a613c80565b61132761173c565b6113319190613b09565b61105e9190613b20565b611343610fda565b61105e90600a613c80565b611365600080516020613e0b833981519152611fa7565b6001600160a01b038216600090815260086020526040812054900361139c5760405162461bcd60e51b81526004016109e990613b65565b6113a96005612710613b20565b8111156113f85760405162461bcd60e51b815260206004820181905260248201527f4665652063616e6e6f7420626520686967686572207468616e2032302042505360448201526064016109e9565b6001600160a01b03821660008181526008602052604090819020600101839055517f8281ff4064168f20aa9abde7f62b8b72efb10b48e7e838af54dcabff3131474a906114489084815260200190565b60405180910390a25050565b61145e6000611fa7565b6001600160a01b0381166114a65760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064016109e9565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b336000818152602081905260409020546114e29180612685565b50565b6000828152600660205260408120610f8d9083612b52565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461089d90613a5e565b600033816115458286611885565b9050838110156115a55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016109e9565b6115b282868684036120b3565b506001949350505050565b60003361092e8185856124e1565b6115e2600080516020613e0b833981519152611fa7565b805160008190036116355760405162461bcd60e51b815260206004820152601760248201527f5175657565206d757374206e6f7420626520656d70747900000000000000000060448201526064016109e9565b61164160096000613728565b60005b8181101561170057600083828151811061166057611660613c8f565b6020908102919091018101516001600160a01b0381166000908152600890925260408220805491935091036116a75760405162461bcd60e51b81526004016109e990613b65565b5060098054600180820183556000929092527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b03939093169290921790915501611644565b507fe159a1b5cb3e0bbe2f0caa53bcf2cd9ea0bc25a8c7b8302b1ac510f29cac8baa826040516117309190613ca5565b60405180910390a15050565b6000600d54600b5461105e9190613aca565b610fac8133612b5e565b336001600160a01b0382161461177f5761177f600080516020613deb833981519152611fa7565b6001600160a01b03811660009081526008602052604081206002015490036117a45750565b6001600160a01b038116600090815260086020526040812060020154600c8054919290916117d3908490613add565b90915550506001600160a01b038116600081815260086020526040808220600201829055517f4201c688d84c01154d321afa0c72f1bffe9eef53005c9de9d035074e71e9b32a9190a250565b6009818154811061182f57600080fd5b6000918252602090912001546001600160a01b0316905081565b600081815260066020526040812061088890612d6c565b60008281526005602052604090206001015461187b81612b04565b610fd58383612b30565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6040516370a0823160e01b81523360048201526114e2907f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11116001600160a01b0316906370a0823190602401602060405180830381865afa158015611918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193c9190613af0565b33612b5e565b611959600080516020613e0b833981519152611fa7565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156119a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c49190613af0565b90507f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11116001600160a01b0316826001600160a01b031603611a0f57600b54611a0c9082613add565b90505b80600003611a4d5760405162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b60448201526064016109e9565b611a616001600160a01b03831633836123cc565b604080516001600160a01b0384168152602081018390527f741ee845808813887c0b0d54aa20a3d0f670bebce7b6a1face577afbc00d1d6c9101611730565b611aaa6000611fa7565b600f5460ff1615611b135760405162461bcd60e51b815260206004820152602d60248201527f43616e6e6f742061646420737472617465677920647572696e6720656d65726760448201526c32b731bc9039b43aba3237bbb760991b60648201526084016109e9565b6001600160a01b038316611b395760405162461bcd60e51b81526004016109e990613b65565b6001600160a01b03831660009081526008602052604090205415611b985760405162461bcd60e51b815260206004820152601660248201527514dd1c985d1959de48185b1c9958591e48185919195960521b60448201526064016109e9565b826001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bfa9190613cf2565b6001600160a01b0316306001600160a01b031614611c5a5760405162461bcd60e51b815260206004820152601f60248201527f53747261746567792773207661756c7420646f6573206e6f74206d617463680060448201526064016109e9565b826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc9190613cf2565b6001600160a01b03167f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11116001600160a01b031614611d3c5760405162461bcd60e51b815260206004820152601e60248201527f537472617465677927732077616e7420646f6573206e6f74206d61746368000060448201526064016109e9565b611d496005612710613b20565b821115611d985760405162461bcd60e51b815260206004820181905260248201527f4665652063616e6e6f7420626520686967686572207468616e2032302042505360448201526064016109e9565b612710600c5482611da99190613aca565b1115611df05760405162461bcd60e51b8152602060048201526016602482015275496e76616c696420616c6c6f634250532076616c756560501b60448201526064016109e9565b6040805160e0810182524280825260208083018681528385018681526000606086018181526080870182815260a0880183815260c089019788526001600160a01b038d1684526008909652978220965187559251600187015590516002860155905160038501559351600484015551600583015551600690910155600c8054839290611e7d908490613aca565b9091555050600980546001810182556000919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319166001600160a01b03851690811790915560408051848152602081018490527f45bb3eed5cd098efb0a286413fb1f3c11841762610cefbabae6a772963e916ba91016112ec565b60010190565b611f1682826114fd565b610fac5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611f4e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610f8d836001600160a01b038416612d76565b6000611fb1612dc5565b8051909150600080805b8381101561202a5781158015611fef5750611fef858281518110611fe157611fe1613c8f565b602002602001015133612edd565b15611ff957600191505b84818151811061200b5761200b613c8f565b60200260200101518603612022576001925061202a565b600101611fbb565b508180156120355750805b6120775760405162461bcd60e51b8152602060048201526013602482015272556e617574686f72697a65642061636365737360681b60448201526064016109e9565b5050505050565b60006001600160e01b03198216637965db0b60e01b148061088857506301ffc9a760e01b6001600160e01b0319831614610888565b6001600160a01b0383166121155760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016109e9565b6001600160a01b0382166121765760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016109e9565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038216600090815260086020526040902060038101548083111561225c5760405162461bcd60e51b815260206004820152602f60248201527f5374726174656779206c6f73732063616e6e6f7420626520677265617465722060448201526e3a3430b71030b63637b1b0ba34b7b760891b60648201526084016109e9565b600c54156122cb57600061228e600d54600c548661227a9190613b09565b6122849190613b20565b84600201546123b6565b905080156122c957808360020160008282546122aa9190613add565b9250508190555080600c60008282546122c39190613add565b90915550505b505b828260050160008282546122df9190613aca565b92505081905550828260030160008282546122fa9190613add565b9250508190555082600d60008282546123139190613add565b909155505050505050565b6001600160a01b03821660009081526008602052604081206001015481906127109061234a9085613b09565b6123549190613b20565b90508015610f8d57600061236760025490565b9050600081156123925761237961173c565b6123838385613b09565b61238d9190613b20565b612394565b825b6011549091506123ad906001600160a01b031682612ee9565b50509392505050565b60008183106123c55781610f8d565b5090919050565b6040516001600160a01b038316602482015260448101829052610fd590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612fa8565b6040516001600160a01b03808516602483015283166044820152606481018290526124679085906323b872dd60e01b906084016123f8565b50505050565b60006124798484611885565b9050600019811461246757818110156124d45760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016109e9565b61246784848484036120b3565b6001600160a01b0383166125455760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016109e9565b6001600160a01b0382166125a75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016109e9565b6001600160a01b0383166000908152602081905260409020548181101561261f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016109e9565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3612467565b600061268f61307d565b836000036126d05760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109e9565b600254846126dc61173c565b6126e69190613b09565b6126f09190613b20565b600b5490915080821115612a5857600954600090815b818110156129a457838511156129a45760006009828154811061272b5761272b613c8f565b60009182526020808320909101546001600160a01b0316808352600890915260408220600301549092509081900361276457505061299c565b60006127708789613add565b6040516370a0823160e01b81523060048201529091506000906001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead111116906370a0823190602401602060405180830381865afa1580156127da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127fe9190613af0565b90506000846001600160a01b0316632e1a7d4d61281b85876123b6565b6040518263ffffffff1660e01b815260040161283991815260200190565b6020604051808303816000875af1158015612858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061287c9190613af0565b6040516370a0823160e01b815230600482015290915060009083906001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead111116906370a0823190602401602060405180830381865afa1580156128e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290c9190613af0565b6129169190613add565b9050612922818b613aca565b9950811561294c57612934828c613add565b9a50612940828a613aca565b985061294c86836121d7565b6001600160a01b03861660009081526008602052604081206003018054839290612977908490613add565b9250508190555080600d60008282546129909190613add565b90915550505050505050505b600101612706565b50600b839055828411156129e1578293506129bd61173c565b6002546129ca8487613aca565b6129d49190613b09565b6129de9190613b20565b96505b601054612710906129f28487613aca565b6129fc9190613b09565b612a069190613b20565b821115612a555760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177206c6f7373206578636565647320736c697070616765000060448201526064016109e9565b50505b612a6283866130d6565b81600b6000828254612a749190613add565b90915550612aae90506001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11111685846123cc565b60408051838152602081018790526001600160a01b03808616929087169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a450610f8d6001600755565b6114e28133613208565b612b188282611f0c565b6000828152600660205260409020610fd59082611f92565b612b3a8282613261565b6000828152600660205260409020610fd590826132c8565b6000610f8d83836132dd565b6000612b6861307d565b612b917fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f336611fa7565b600f5460ff1615612bf55760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f74206465706f73697420647572696e6720656d657267656e63792060448201526739b43aba3237bbb760c11b60648201526084016109e9565b82600003612c365760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016109e9565b6000612c4061173c565b600a54909150612c508583613aca565b1115612c8e5760405162461bcd60e51b815260206004820152600d60248201526c15985d5b1d081a5cc8199d5b1b609a1b60448201526064016109e9565b6000612c9960025490565b905080600003612cab57849250612cc3565b81612cb68287613b09565b612cc09190613b20565b92505b612ccd8484612ee9565b84600b6000828254612cdf9190613aca565b90915550612d1a90506001600160a01b037f000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead11111633308861242f565b60408051868152602081018590526001600160a01b0386169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a350506108886001600755565b6000610888825490565b6000818152600183016020526040812054612dbd57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610888565b506000610888565b60408051600580825260c08201909252606091600091906020820160a0803683370190505090506000801b81600081518110612e0357612e03613c8f565b602002602001018181525050600080516020613e0b83398151915281600181518110612e3157612e31613c8f565b602002602001018181525050600080516020613deb83398151915281600281518110612e5f57612e5f613c8f565b602002602001018181525050600080516020613e2b83398151915281600381518110612e8d57612e8d613c8f565b6020026020010181815250507fe16b3d8fc79140c62874442c8b523e98592b429e73c0db67686a5b378b29f33681600481518110612ecd57612ecd613c8f565b6020908102919091010152919050565b6000610f8d83836114fd565b6001600160a01b038216612f3f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109e9565b8060026000828254612f519190613aca565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000612ffd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133079092919063ffffffff16565b905080516000148061301e57508080602001905181019061301e9190613d0f565b610fd55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109e9565b6002600754036130cf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109e9565b6002600755565b6001600160a01b0382166131365760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016109e9565b6001600160a01b038216600090815260208190526040902054818110156131aa5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016109e9565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b61321282826114fd565b610fac5761321f8161331e565b61322a836020613330565b60405160200161323b929190613d2c565b60408051601f198184030181529082905262461bcd60e51b82526109e9916004016137c1565b61326b82826114fd565b15610fac5760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610f8d836001600160a01b0384166134cc565b60008260000182815481106132f4576132f4613c8f565b9060005260206000200154905092915050565b606061331684846000856135bf565b949350505050565b60606108886001600160a01b03831660145b6060600061333f836002613b09565b61334a906002613aca565b67ffffffffffffffff81111561336257613362613920565b6040519080825280601f01601f19166020018201604052801561338c576020820181803683370190505b509050600360fc1b816000815181106133a7576133a7613c8f565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106133d6576133d6613c8f565b60200101906001600160f81b031916908160001a90535060006133fa846002613b09565b613405906001613aca565b90505b600181111561347d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061343957613439613c8f565b1a60f81b82828151811061344f5761344f613c8f565b60200101906001600160f81b031916908160001a90535060049490941c9361347681613da1565b9050613408565b508315610f8d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e9565b600081815260018301602052604081205480156135b55760006134f0600183613add565b855490915060009061350490600190613add565b905081811461356957600086600001828154811061352457613524613c8f565b906000526020600020015490508087600001848154811061354757613547613c8f565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061357a5761357a613db8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610888565b6000915050610888565b6060824710156136205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109e9565b600080866001600160a01b0316858760405161363c9190613dce565b60006040518083038185875af1925050503d8060008114613679576040519150601f19603f3d011682016040523d82523d6000602084013e61367e565b606091505b5091509150610f5987838387606083156136f95782516000036136f2576001600160a01b0385163b6136f25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109e9565b5081613316565b613316838381511561370e5781518083602001fd5b8060405162461bcd60e51b81526004016109e991906137c1565b50805460008255906000526020600020908101906114e291905b808211156137565760008155600101613742565b5090565b60006020828403121561376c57600080fd5b5035919050565b60006020828403121561378557600080fd5b81356001600160e01b031981168114610f8d57600080fd5b60005b838110156137b85781810151838201526020016137a0565b50506000910152565b60208152600082518060208401526137e081604085016020870161379d565b601f01601f19169190910160400192915050565b6001600160a01b03811681146114e257600080fd5b8035613814816137f4565b919050565b6000806040838503121561382c57600080fd5b8235613837816137f4565b946020939093013593505050565b6000806040838503121561385857600080fd5b50508035926020909101359150565b80151581146114e257600080fd5b60006020828403121561388757600080fd5b8135610f8d81613867565b6000806000606084860312156138a757600080fd5b83356138b2816137f4565b925060208401356138c2816137f4565b929592945050506040919091013590565b600080604083850312156138e657600080fd5b8235915060208301356138f8816137f4565b809150509250929050565b60006020828403121561391557600080fd5b8135610f8d816137f4565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561394957600080fd5b823567ffffffffffffffff8082111561396157600080fd5b818501915085601f83011261397557600080fd5b81358181111561398757613987613920565b8060051b604051601f19603f830116810181811085821117156139ac576139ac613920565b6040529182528482019250838101850191888311156139ca57600080fd5b938501935b828510156139ef576139e085613809565b845293850193928501926139cf565b98975050505050505050565b60008060408385031215613a0e57600080fd5b8235613a19816137f4565b915060208301356138f8816137f4565b600080600060608486031215613a3e57600080fd5b8335613a49816137f4565b95602085013595506040909401359392505050565b600181811c90821680613a7257607f821691505b602082108103613a9257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000600160ff1b8201613ac357613ac3613a98565b5060000390565b8082018082111561088857610888613a98565b8181038181111561088857610888613a98565b600060208284031215613b0257600080fd5b5051919050565b808202811582820484141761088857610888613a98565b600082613b3d57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215613b5457600080fd5b815160ff81168114610f8d57600080fd5b60208082526018908201527f496e76616c696420737472617465677920616464726573730000000000000000604082015260600190565b600181815b80851115613bd7578160001904821115613bbd57613bbd613a98565b80851615613bca57918102915b93841c9390800290613ba1565b509250929050565b600082613bee57506001610888565b81613bfb57506000610888565b8160018114613c115760028114613c1b57613c37565b6001915050610888565b60ff841115613c2c57613c2c613a98565b50506001821b610888565b5060208310610133831016604e8410600b8410161715613c5a575081810a610888565b613c648383613b9c565b8060001904821115613c7857613c78613a98565b029392505050565b6000610f8d60ff841683613bdf565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015613ce65783516001600160a01b031683529284019291840191600101613cc1565b50909695505050505050565b600060208284031215613d0457600080fd5b8151610f8d816137f4565b600060208284031215613d2157600080fd5b8151610f8d81613867565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613d6481601785016020880161379d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613d9581602884016020880161379d565b01602801949350505050565b600081613db057613db0613a98565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251613de081846020870161379d565b919091019291505056fe8b5b16d04624687fcf0d0228f19993c9157c1ed07b41d8d430fd9100eb099fe8df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42b17d0a42cc710456bf9c3efb785dcd0cb93a0ac358113307b5c64b285b516b5ca2646970667358221220995b1ec3a76a734d93d5052de6cfd3a8398ecaadbee8091e49ccab035a2534be64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead111100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000e61d01d25046c45ccdafa80870339a36fdf07105000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000013417572656c6975732057455448205661756c7400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a617572656c2d574554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000001e71aee6081f62053123140aacc7a06021d7734800000000000000000000000081876677843d00a7d792e1617459ac2e932025760000000000000000000000004c3490df15edfa178333445ce568ec6d99b5d71c000000000000000000000000b26cd6633db6b0c9ae919049c1437271ae496d1500000000000000000000000060bc5e0440c867eeb4cbce84bb1123fad2b262b100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000dfedcef9519b24f4de5d3275804aaff5a41705f0000000000000000000000001b526b8298f14fb172f5842aacdce18bc9cb61920000000000000000000000006bdbdca65d3a2e353798fa7a16eeb54974a51848
-----Decoded View---------------
Arg [0] : _token (address): 0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111
Arg [1] : _name (string): Aurelius WETH Vault
Arg [2] : _symbol (string): aurel-WETH
Arg [3] : _tvlCap (uint256): 115792089237316195423570985008687907853269984665640564039457584007913129639935
Arg [4] : _treasury (address): 0xE61d01d25046c45ccDAFA80870339a36fdf07105
Arg [5] : _strategists (address[]): 0x1E71AEE6081f62053123140aacC7a06021D77348,0x81876677843D00a7D792E1617459aC2E93202576,0x4C3490dF15edFa178333445ce568EC6D99b5d71c,0xB26cd6633dB6B0C9AE919049c1437271Ae496D15,0x60BC5E0440C867eEb4CbcE84bB1123fad2b262B1
Arg [6] : _multisigRoles (address[]): 0x0DfedCeF9519B24f4dE5D3275804aaff5a41705F,0x1B526b8298F14Fb172f5842AACDcE18bC9cB6192,0x6BdbDCA65d3A2E353798fA7a16eEb54974A51848
-----Encoded View---------------
21 Constructor Arguments found :
Arg [0] : 000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead1111
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [3] : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Arg [4] : 000000000000000000000000e61d01d25046c45ccdafa80870339a36fdf07105
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [8] : 417572656c6975732057455448205661756c7400000000000000000000000000
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [10] : 617572656c2d5745544800000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [12] : 0000000000000000000000001e71aee6081f62053123140aacc7a06021d77348
Arg [13] : 00000000000000000000000081876677843d00a7d792e1617459ac2e93202576
Arg [14] : 0000000000000000000000004c3490df15edfa178333445ce568ec6d99b5d71c
Arg [15] : 000000000000000000000000b26cd6633db6b0c9ae919049c1437271ae496d15
Arg [16] : 00000000000000000000000060bc5e0440c867eeb4cbce84bb1123fad2b262b1
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [18] : 0000000000000000000000000dfedcef9519b24f4de5d3275804aaff5a41705f
Arg [19] : 0000000000000000000000001b526b8298f14fb172f5842aacdce18bc9cb6192
Arg [20] : 0000000000000000000000006bdbdca65d3a2e353798fa7a16eeb54974a51848
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.