Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Staking
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Initializable} from "openzeppelin-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlEnumerableUpgradeable} from
"openzeppelin-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import {Math} from "openzeppelin/utils/math/Math.sol";
import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20Upgradeable} from "openzeppelin-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import {ProtocolEvents} from "./interfaces/ProtocolEvents.sol";
import {IDepositContract} from "./interfaces/IDepositContract.sol";
import {IMETH} from "./interfaces/IMETH.sol";
import {IOracleReadRecord, OracleRecord} from "./interfaces/IOracle.sol";
import {IPauserRead} from "./interfaces/IPauser.sol";
import {IStaking, IStakingReturnsWrite, IStakingInitiationRead} from "./interfaces/IStaking.sol";
import {UnstakeRequest, IUnstakeRequestsManager} from "./interfaces/IUnstakeRequestsManager.sol";
import {ILiquidityBuffer} from "./liquidityBuffer/interfaces/ILiquidityBuffer.sol";
/// @notice Events emitted by the staking contract.
interface StakingEvents {
/// @notice Emitted when a user stakes ETH and receives mETH.
/// @param staker The address of the user staking ETH.
/// @param ethAmount The amount of ETH staked.
/// @param mETHAmount The amount of mETH received.
event Staked(address indexed staker, uint256 ethAmount, uint256 mETHAmount);
/// @notice Emitted when a user unstakes mETH in exchange for ETH.
/// @param id The ID of the unstake request.
/// @param staker The address of the user unstaking mETH.
/// @param ethAmount The amount of ETH that the staker will receive.
/// @param mETHLocked The amount of mETH that will be burned.
event UnstakeRequested(uint256 indexed id, address indexed staker, uint256 ethAmount, uint256 mETHLocked);
/// @notice Emitted when a user claims their unstake request.
/// @param id The ID of the unstake request.
/// @param staker The address of the user claiming their unstake request.
event UnstakeRequestClaimed(uint256 indexed id, address indexed staker);
/// @notice Emitted when a validator has been initiated (i.e. the protocol has deposited into the deposit contract).
/// @param id The ID of the validator which is the hash of its pubkey.
/// @param operatorID The ID of the node operator to which the validator belongs to.
/// @param pubkey The pubkey of the validator.
/// @param amountDeposited The amount of ETH deposited into the deposit contract for that validator.
event ValidatorInitiated(bytes32 indexed id, uint256 indexed operatorID, bytes pubkey, uint256 amountDeposited);
/// @notice Emitted when the protocol has allocated ETH to the UnstakeRequestsManager.
/// @param amount The amount of ETH allocated to the UnstakeRequestsManager.
event AllocatedETHToUnstakeRequestsManager(uint256 amount);
/// @notice Emitted when the protocol has allocated ETH to use for deposits into the deposit contract.
/// @param amount The amount of ETH allocated to deposits.
event AllocatedETHToDeposits(uint256 amount);
/// @notice Emitted when the protocol has received returns from the returns aggregator.
/// @param amount The amount of ETH received.
event ReturnsReceived(uint256 amount);
/// @notice Emitted when the protocol has received returns from the returns aggregator.
/// @param amount The amount of ETH received.
event ReturnsReceivedFromLiquidityBuffer(uint256 amount);
/// @notice Emitted when the protocol has allocated ETH to the liquidity buffer.
/// @param amount The amount of ETH allocated to the liquidity buffer.
event AllocatedETHToLiquidityBuffer(uint256 amount);
}
/// @title Staking
/// @notice Manages stake and unstake requests by users, keeps track of the total amount of ETH controlled by the
/// protocol, and initiates new validators.
contract Staking is Initializable, AccessControlEnumerableUpgradeable, IStaking, StakingEvents, ProtocolEvents {
// Errors.
error DoesNotReceiveETH();
error InvalidConfiguration();
error MaximumValidatorDepositExceeded();
error MaximumMETHSupplyExceeded();
error MinimumStakeBoundNotSatisfied();
error MinimumUnstakeBoundNotSatisfied();
error MinimumValidatorDepositNotSatisfied();
error NotEnoughDepositETH();
error NotEnoughUnallocatedETH();
error NotReturnsAggregator();
error NotLiquidityBuffer();
error NotUnstakeRequestsManager();
error Paused();
error PreviouslyUsedValidator();
error ZeroAddress();
error InvalidDepositRoot(bytes32);
error StakeBelowMinimumMETHAmount(uint256 methAmount, uint256 expectedMinimum);
error UnstakeBelowMinimumETHAmount(uint256 ethAmount, uint256 expectedMinimum);
error InvalidWithdrawalCredentialsWrongLength(uint256);
error InvalidWithdrawalCredentialsNotETH1(bytes12);
error InvalidWithdrawalCredentialsWrongAddress(address);
/// @notice Role allowed trigger administrative tasks such as allocating funds to / withdrawing surplusses from the
/// UnstakeRequestsManager and setting various parameters on the contract.
bytes32 public constant STAKING_MANAGER_ROLE = keccak256("STAKING_MANAGER_ROLE");
/// @notice Role allowed to allocate funds to unstake requests manager and reserve funds to deposit into the
/// validators.
bytes32 public constant ALLOCATOR_SERVICE_ROLE = keccak256("ALLOCATER_SERVICE_ROLE");
/// @notice Role allowed to initiate new validators by sending funds from the allocatedETHForDeposits balance
/// to the beacon chain deposit contract.
bytes32 public constant INITIATOR_SERVICE_ROLE = keccak256("INITIATOR_SERVICE_ROLE");
/// @notice Role to manage the staking allowlist.
bytes32 public constant STAKING_ALLOWLIST_MANAGER_ROLE = keccak256("STAKING_ALLOWLIST_MANAGER_ROLE");
/// @notice Role allowed to stake ETH when allowlist is enabled.
bytes32 public constant STAKING_ALLOWLIST_ROLE = keccak256("STAKING_ALLOWLIST_ROLE");
/// @notice Role allowed to top up the unallocated ETH in the protocol.
bytes32 public constant TOP_UP_ROLE = keccak256("TOP_UP_ROLE");
/// @notice Payload struct submitted for validator initiation.
/// @dev See also {initiateValidatorsWithDeposits}.
struct ValidatorParams {
uint256 operatorID;
uint256 depositAmount;
bytes pubkey;
bytes withdrawalCredentials;
bytes signature;
bytes32 depositDataRoot;
}
/// @notice Keeps track of already initiated validators.
/// @dev This is tracked to ensure that we never deposit for the same validator public key twice, which is a base
/// assumption of this contract and the related off-chain accounting.
mapping(bytes pubkey => bool exists) public usedValidators;
/// @inheritdoc IStakingInitiationRead
/// @dev This is needed to account for ETH that is still in flight, i.e. that has been sent to the deposit contract
/// but has not been processed by the beacon chain yet. Once the off-chain oracle detects those deposits, they are
/// recorded as `totalDepositsProcessed` in the oracle contract to avoid double counting. See also
/// {totalControlled}.
uint256 public totalDepositedInValidators;
/// @inheritdoc IStakingInitiationRead
uint256 public numInitiatedValidators;
/// @notice The amount of ETH that is used to allocate to deposits and fill the pending unstake requests.
uint256 public unallocatedETH;
/// @notice The amount of ETH that is used deposit into validators.
uint256 public allocatedETHForDeposits;
/// @notice The minimum amount of ETH users can stake.
uint256 public minimumStakeBound;
/// @notice The minimum amount of mETH users can unstake.
uint256 public minimumUnstakeBound;
/// @notice When staking on Ethereum, validators must go through an entry queue to bring money into the system, and
/// an exit queue to bring it back out. The entry queue increases in size as more people want to stake. While the
/// money is in the entry queue, it is not earning any rewards. When a validator is active, or in the exit queue, it
/// is earning rewards. Once a validator enters the entry queue, the only way that the money can be retrieved is by
/// waiting for it to become active and then to exit it again. As of July 2023, the entry queue is approximately 40
/// days and the exit queue is 0 days (with ~6 days of processing time).
///
/// In a non-optimal scenario for the protocol, a user could stake (for example) 32 ETH to receive mETH, wait
/// until a validator enters the queue, and then request to unstake to recover their 32 ETH. Now we have 32 ETH in
/// the system which affects the exchange rate, but is not earning rewards.
///
/// In this case, the 'fair' thing to do would be to make the user wait for the queue processing to finish before
/// returning their funds. Because the tokens are fungible however, we have no way of matching 'pending' stakes to a
/// particular user. This means that in order to fulfill unstake requests quickly, we must exit a different
/// validator to return the user's funds. If we exit a validator, we can return the funds after ~5 days, but the
/// original 32 ETH will not be earning for another 35 days, leading to a small but repeatable socialised loss of
/// efficiency for the protocol. As we can only exit validators in chunks of 32 ETH, this case is also exacerbated
/// by a user unstaking smaller amounts of ETH.
///
/// To compensate for the fact that these two queues differ in length, we apply an adjustment to the exchange rate
/// to reflect the difference and mitigate its effect on the protocol. This protects the protocol from the case
/// above, and also from griefing attacks following the same principle. Essentially, when you stake you are
/// receiving a value of mETH that discounts ~35 days worth of rewards in return for being able to access your
/// money without waiting the full 40 days when unstaking. As the adjustment is applied to the exchange rate, this
/// results in a small 'improvement' to the rate for all existing stakers (i.e. it is not a fee levied by the
/// protocol itself).
///
/// As the adjustment is applied to the exchange rate, the result is reflected in any user interface which shows the
/// amount of mETH received when staking, meaning there is no surprise for users when staking or unstaking.
/// @dev The value is in basis points (1/10000).
uint16 public exchangeAdjustmentRate;
/// @dev A basis point (often denoted as bp, 1bp = 0.01%) is a unit of measure used in finance to describe
/// the percentage change in a financial instrument. This is a constant value set as 10000 which represents
/// 100% in basis point terms.
uint16 internal constant _BASIS_POINTS_DENOMINATOR = 10_000;
/// @notice The maximum amount the exchange adjustment rate (10%) that can be set by the admin.
uint16 internal constant _MAX_EXCHANGE_ADJUSTMENT_RATE = _BASIS_POINTS_DENOMINATOR / 10; // 10%
/// @notice The minimum amount of ETH that the staking contract can send to the deposit contract to initiate new
/// validators.
/// @dev This is used as an additional safeguard to prevent sending deposits that would result in non-activated
/// validators (since we don't do top-ups), that would need to be exited again to get the ETH back.
uint256 public minimumDepositAmount;
/// @notice The maximum amount of ETH that the staking contract can send to the deposit contract to initiate new
/// validators.
/// @dev This is used as an additional safeguard to prevent sending too large deposits. While this is not a critical
/// issue as any surplus >32 ETH (at the time of writing) will automatically be withdrawn again at some point, it is
/// still undesireable as it locks up not-earning ETH for the duration of the round trip decreasing the efficiency
/// of the protocol.
uint256 public maximumDepositAmount;
/// @notice The beacon chain deposit contract.
/// @dev ETH will be sent there during validator initiation.
IDepositContract public depositContract;
/// @notice The mETH token contract.
/// @dev Tokens will be minted / burned during staking / unstaking.
IMETH public mETH;
/// @notice The oracle contract.
/// @dev Tracks ETH on the beacon chain and other accounting relevant quantities.
IOracleReadRecord public oracle;
/// @notice The pauser contract.
/// @dev Keeps the pause state across the protocol.
IPauserRead public pauser;
/// @notice The contract tracking unstake requests and related allocation and claim operations.
IUnstakeRequestsManager public unstakeRequestsManager;
/// @notice The address to receive beacon chain withdrawals (i.e. validator rewards and exits).
/// @dev Changing this variable will not have an immediate effect as all exisiting validators will still have the
/// original value set.
address public withdrawalWallet;
/// @notice The address for the returns aggregator contract to push funds.
/// @dev See also {receiveReturns}.
address public returnsAggregator;
/// @notice The staking allowlist flag which, when enabled, allows staking only for addresses in allowlist.
bool public isStakingAllowlist;
/// @inheritdoc IStakingInitiationRead
/// @dev This will be used to give off-chain services a sensible point in time to start their analysis from.
uint256 public initializationBlockNumber;
/// @notice The maximum amount of mETH that can be minted during the staking process.
/// @dev This is used as an additional safeguard to create a maximum stake amount in the protocol. As the protocol
/// scales up this value will be increased to allow for more staking.
uint256 public maximumMETHSupply;
/// @notice The address for the liquidity buffer contract to push funds.
/// @dev See also {receiveReturnsFromLiquidityBuffer}.
ILiquidityBuffer public liquidityBuffer;
/// @notice Configuration for contract initialization.
struct Init {
address admin;
address manager;
address allocatorService;
address initiatorService;
address returnsAggregator;
address withdrawalWallet;
IMETH mETH;
IDepositContract depositContract;
IOracleReadRecord oracle;
IPauserRead pauser;
IUnstakeRequestsManager unstakeRequestsManager;
}
constructor() {
_disableInitializers();
}
/// @notice Inititalizes the contract.
/// @dev MUST be called during the contract upgrade to set up the proxies state.
function initialize(Init memory init) external initializer {
__AccessControlEnumerable_init();
_grantRole(DEFAULT_ADMIN_ROLE, init.admin);
_grantRole(STAKING_MANAGER_ROLE, init.manager);
_grantRole(ALLOCATOR_SERVICE_ROLE, init.allocatorService);
_grantRole(INITIATOR_SERVICE_ROLE, init.initiatorService);
// Intentionally does not set anyone as the TOP_UP_ROLE as it will only be granted
// in the off-chance that the top up functionality is required.
// Set up roles for the staking allowlist. Intentionally do not grant anyone the
// STAKING_ALLOWLIST_MANAGER_ROLE as it will only be granted later.
_setRoleAdmin(STAKING_ALLOWLIST_MANAGER_ROLE, STAKING_MANAGER_ROLE);
_setRoleAdmin(STAKING_ALLOWLIST_ROLE, STAKING_ALLOWLIST_MANAGER_ROLE);
mETH = init.mETH;
depositContract = init.depositContract;
oracle = init.oracle;
pauser = init.pauser;
returnsAggregator = init.returnsAggregator;
unstakeRequestsManager = init.unstakeRequestsManager;
withdrawalWallet = init.withdrawalWallet;
minimumStakeBound = 0.1 ether;
minimumUnstakeBound = 0.01 ether;
minimumDepositAmount = 32 ether;
maximumDepositAmount = 32 ether;
isStakingAllowlist = true;
initializationBlockNumber = block.number;
// Set the maximum mETH supply to some sensible amount which is expected to be changed as the
// protocol ramps up.
maximumMETHSupply = 1024 ether;
}
function initializeV2(ILiquidityBuffer lb) public reinitializer(2) notZeroAddress(address(lb)) {
liquidityBuffer = lb;
}
/// @notice Interface for users to stake their ETH with the protocol. Note: when allowlist is enabled, only users
/// with the allowlist can stake.
/// @dev Mints the corresponding amount of mETH (relative to the stake's share in the total ETH controlled by the
/// protocol) to the user.
/// @param minMETHAmount The minimum amount of mETH that the user expects to receive in return.
function stake(uint256 minMETHAmount) external payable {
if (pauser.isStakingPaused()) {
revert Paused();
}
if (isStakingAllowlist) {
_checkRole(STAKING_ALLOWLIST_ROLE);
}
if (msg.value < minimumStakeBound) {
revert MinimumStakeBoundNotSatisfied();
}
uint256 mETHMintAmount = ethToMETH(msg.value);
if (mETHMintAmount + mETH.totalSupply() > maximumMETHSupply) {
revert MaximumMETHSupplyExceeded();
}
if (mETHMintAmount < minMETHAmount) {
revert StakeBelowMinimumMETHAmount(mETHMintAmount, minMETHAmount);
}
// Increment unallocated ETH after calculating the exchange rate to ensure
// a consistent rate.
unallocatedETH += msg.value;
emit Staked(msg.sender, msg.value, mETHMintAmount);
mETH.mint(msg.sender, mETHMintAmount);
}
/// @notice Interface for users to submit a request to unstake.
/// @dev Transfers the specified amount of mETH to the staking contract and locks it there until it is burned on
/// request claim. The staking contract must therefore be approved to move the user's mETH on their behalf.
/// @param methAmount The amount of mETH to unstake.
/// @param minETHAmount The minimum amount of ETH that the user expects to receive.
/// @return The request ID.
function unstakeRequest(uint128 methAmount, uint128 minETHAmount) external returns (uint256) {
return _unstakeRequest(methAmount, minETHAmount);
}
/// @notice Interface for users to submit a request to unstake with an ERC20 permit.
/// @dev Transfers the specified amount of mETH to the staking contract and locks it there until it is burned on
/// request claim. The permit must therefore allow the staking contract to move the user's mETH on their behalf.
/// @return The request ID.
function unstakeRequestWithPermit(
uint128 methAmount,
uint128 minETHAmount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256) {
SafeERC20Upgradeable.safePermit(mETH, msg.sender, address(this), methAmount, deadline, v, r, s);
return _unstakeRequest(methAmount, minETHAmount);
}
/// @notice Processes a user's request to unstake by transferring the corresponding mETH to the staking contract
/// and creating the request on the unstake requests manager.
/// @param methAmount The amount of mETH to unstake.
/// @param minETHAmount The minimum amount of ETH that the user expects to receive.
function _unstakeRequest(uint128 methAmount, uint128 minETHAmount) internal returns (uint256) {
if (pauser.isUnstakeRequestsAndClaimsPaused()) {
revert Paused();
}
if (methAmount < minimumUnstakeBound) {
revert MinimumUnstakeBoundNotSatisfied();
}
uint128 ethAmount = uint128(mETHToETH(methAmount));
if (ethAmount < minETHAmount) {
revert UnstakeBelowMinimumETHAmount(ethAmount, minETHAmount);
}
uint256 requestID =
unstakeRequestsManager.create({requester: msg.sender, mETHLocked: methAmount, ethRequested: ethAmount});
emit UnstakeRequested({id: requestID, staker: msg.sender, ethAmount: ethAmount, mETHLocked: methAmount});
SafeERC20Upgradeable.safeTransferFrom(mETH, msg.sender, address(unstakeRequestsManager), methAmount);
return requestID;
}
/// @notice Interface for users to claim their finalized and filled unstaking requests.
/// @dev See also {UnstakeRequestsManager} for a more detailed explanation of finalization and request filling.
function claimUnstakeRequest(uint256 unstakeRequestID) external {
if (pauser.isUnstakeRequestsAndClaimsPaused()) {
revert Paused();
}
emit UnstakeRequestClaimed(unstakeRequestID, msg.sender);
unstakeRequestsManager.claim(unstakeRequestID, msg.sender);
}
/// @notice Returns the status of the request whether it is finalized and how much ETH has been filled.
/// See also {UnstakeRequestsManager.requestInfo} for a more detailed explanation of finalization and request
/// filling.
/// @param unstakeRequestID The ID of the unstake request.
/// @return bool indicating if the unstake request is finalized, and the amount of ETH that has been filled.
function unstakeRequestInfo(uint256 unstakeRequestID) external view returns (bool, uint256) {
return unstakeRequestsManager.requestInfo(unstakeRequestID);
}
/// @notice Withdraws any surplus from the unstake requests manager.
/// @dev The request manager is expected to return the funds by pushing them using
/// {receiveFromUnstakeRequestsManager}.
function reclaimAllocatedETHSurplus() external onlyRole(STAKING_MANAGER_ROLE) {
// Calls the receiveFromUnstakeRequestsManager() where we perform
// the accounting.
unstakeRequestsManager.withdrawAllocatedETHSurplus();
}
/// @notice Allocates ETH from the unallocatedETH balance to the unstake requests manager to fill pending requests
/// and adds to the allocatedETHForDeposits balance that is used to initiate new validators.
function allocateETH(uint256 allocateToUnstakeRequestsManager, uint256 allocateToDeposits, uint256 allocateToLiquidityBuffer)
external
onlyRole(ALLOCATOR_SERVICE_ROLE)
{
if (pauser.isAllocateETHPaused()) {
revert Paused();
}
if (allocateToUnstakeRequestsManager + allocateToDeposits + allocateToLiquidityBuffer > unallocatedETH) {
revert NotEnoughUnallocatedETH();
}
unallocatedETH -= allocateToUnstakeRequestsManager + allocateToDeposits + allocateToLiquidityBuffer;
if (allocateToDeposits > 0) {
allocatedETHForDeposits += allocateToDeposits;
emit AllocatedETHToDeposits(allocateToDeposits);
}
if (allocateToUnstakeRequestsManager > 0) {
emit AllocatedETHToUnstakeRequestsManager(allocateToUnstakeRequestsManager);
unstakeRequestsManager.allocateETH{value: allocateToUnstakeRequestsManager}();
}
if (allocateToLiquidityBuffer > 0) {
emit AllocatedETHToLiquidityBuffer(allocateToLiquidityBuffer);
liquidityBuffer.depositETH{value: allocateToLiquidityBuffer}();
}
}
/// @notice Initiates new validators by sending ETH to the beacon chain deposit contract.
/// @dev Cannot initiate the same validator (public key) twice. Since BLS signatures cannot be feasibly verified on
/// the EVM, the caller must carefully make sure that the sent payloads (public keys + signatures) are correct,
/// otherwise the sent ETH will be lost.
function initiateValidatorsWithDeposits(ValidatorParams[] calldata validators, bytes32 expectedDepositRoot)
external
onlyRole(INITIATOR_SERVICE_ROLE)
{
if (pauser.isInitiateValidatorsPaused()) {
revert Paused();
}
if (validators.length == 0) {
return;
}
// Check that the deposit root matches the given value. This ensures that the deposit contract state
// has not changed since the transaction was submitted, which means that a rogue node operator cannot
// front-run deposit transactions.
bytes32 actualRoot = depositContract.get_deposit_root();
if (expectedDepositRoot != actualRoot) {
revert InvalidDepositRoot(actualRoot);
}
// First loop is to check that all validators are valid according to our constraints and we record the
// validators and how much we have deposited.
uint256 amountDeposited = 0;
for (uint256 i = 0; i < validators.length; ++i) {
ValidatorParams calldata validator = validators[i];
if (usedValidators[validator.pubkey]) {
revert PreviouslyUsedValidator();
}
if (validator.depositAmount < minimumDepositAmount) {
revert MinimumValidatorDepositNotSatisfied();
}
if (validator.depositAmount > maximumDepositAmount) {
revert MaximumValidatorDepositExceeded();
}
_requireProtocolWithdrawalAccount(validator.withdrawalCredentials);
usedValidators[validator.pubkey] = true;
amountDeposited += validator.depositAmount;
emit ValidatorInitiated({
id: keccak256(validator.pubkey),
operatorID: validator.operatorID,
pubkey: validator.pubkey,
amountDeposited: validator.depositAmount
});
}
if (amountDeposited > allocatedETHForDeposits) {
revert NotEnoughDepositETH();
}
allocatedETHForDeposits -= amountDeposited;
totalDepositedInValidators += amountDeposited;
numInitiatedValidators += validators.length;
// Second loop is to send the deposits to the deposit contract. Keeps external calls to the deposit contract
// separate from state changes.
for (uint256 i = 0; i < validators.length; ++i) {
ValidatorParams calldata validator = validators[i];
depositContract.deposit{value: validator.depositAmount}({
pubkey: validator.pubkey,
withdrawal_credentials: validator.withdrawalCredentials,
signature: validator.signature,
deposit_data_root: validator.depositDataRoot
});
}
}
/// @inheritdoc IStakingReturnsWrite
/// @dev Intended to be the called in the same transaction initiated by reclaimAllocatedETHSurplus().
/// This should only be called in emergency scenarios, e.g. if the unstake requests manager has cancelled
/// unfinalized requests and there is a surplus balance.
/// Adds the received funds to the unallocated balance.
function receiveFromUnstakeRequestsManager() external payable onlyUnstakeRequestsManager {
unallocatedETH += msg.value;
}
/// @notice Tops up the unallocated ETH balance to increase the amount of ETH in the protocol.
/// @dev Bypasses the returns aggregator fee collection to inject ETH directly into the protocol.
function topUp() external payable onlyRole(TOP_UP_ROLE) {
unallocatedETH += msg.value;
}
/// @notice Converts from mETH to ETH using the current exchange rate.
/// The exchange rate is given by the total supply of mETH and total ETH controlled by the protocol.
function ethToMETH(uint256 ethAmount) public view returns (uint256) {
// 1:1 exchange rate on the first stake.
// Using `METH.totalSupply` over `totalControlled` to check if the protocol is in its bootstrap phase since
// the latter can be manipulated, for example by transferring funds to the `ExecutionLayerReturnsReceiver`, and
// therefore be non-zero by the time the first stake is made
if (mETH.totalSupply() == 0) {
return ethAmount;
}
// deltaMETH = (1 - exchangeAdjustmentRate) * (mETHSupply / totalControlled) * ethAmount
// This rounds down to zero in the case of `(1 - exchangeAdjustmentRate) * ethAmount * mETHSupply <
// totalControlled`.
// While this scenario is theoretically possible, it can only be realised feasibly during the protocol's
// bootstrap phase and if `totalControlled` and `mETHSupply` can be changed independently of each other. Since
// the former is permissioned, and the latter is not permitted by the protocol, this cannot be exploited by an
// attacker.
return Math.mulDiv(
ethAmount,
mETH.totalSupply() * uint256(_BASIS_POINTS_DENOMINATOR - exchangeAdjustmentRate),
totalControlled() * uint256(_BASIS_POINTS_DENOMINATOR)
);
}
/// @notice Converts from ETH to mETH using the current exchange rate.
/// The exchange rate is given by the total supply of mETH and total ETH controlled by the protocol.
function mETHToETH(uint256 mETHAmount) public view returns (uint256) {
// 1:1 exchange rate on the first stake.
// Using `METH.totalSupply` over `totalControlled` to check if the protocol is in its bootstrap phase since
// the latter can be manipulated, for example by transferring funds to the `ExecutionLayerReturnsReceiver`, and
// therefore be non-zero by the time the first stake is made
if (mETH.totalSupply() == 0) {
return mETHAmount;
}
// deltaETH = (totalControlled / mETHSupply) * mETHAmount
// This rounds down to zero in the case of `mETHAmount * totalControlled < mETHSupply`.
// While this scenario is theoretically possible, it can only be realised feasibly during the protocol's
// bootstrap phase and if `totalControlled` and `mETHSupply` can be changed independently of each other. Since
// the former is permissioned, and the latter is not permitted by the protocol, this cannot be exploited by an
// attacker.
return Math.mulDiv(mETHAmount, totalControlled(), mETH.totalSupply());
}
/// @notice The total amount of ETH controlled by the protocol.
/// @dev Sums over the balances of various contracts and the beacon chain information from the oracle.
function totalControlled() public view returns (uint256) {
OracleRecord memory record = oracle.latestRecord();
uint256 total = 0;
total += unallocatedETH;
total += allocatedETHForDeposits;
/// The total ETH deposited to the beacon chain must be decreased by the deposits processed by the off-chain
/// oracle since it will be accounted for in the currentTotalValidatorBalance from that point onwards.
total += totalDepositedInValidators - record.cumulativeProcessedDepositAmount;
total += record.currentTotalValidatorBalance;
total += liquidityBuffer.getAvailableBalance();
total -= liquidityBuffer.cumulativeDrawdown();
total += unstakeRequestsManager.balance();
return total;
}
/// @notice Checks if the given withdrawal credentials are a valid 0x01 prefixed withdrawal address.
/// @dev See also
/// https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/validator.md#eth1_address_withdrawal_prefix
function _requireProtocolWithdrawalAccount(bytes calldata withdrawalCredentials) internal view {
if (withdrawalCredentials.length != 32) {
revert InvalidWithdrawalCredentialsWrongLength(withdrawalCredentials.length);
}
// Check the ETH1_ADDRESS_WITHDRAWAL_PREFIX and that all other bytes are zero.
bytes12 prefixAndPadding = bytes12(withdrawalCredentials[:12]);
if (prefixAndPadding != 0x010000000000000000000000) {
revert InvalidWithdrawalCredentialsNotETH1(prefixAndPadding);
}
address addr = address(bytes20(withdrawalCredentials[12:32]));
if (addr != withdrawalWallet) {
revert InvalidWithdrawalCredentialsWrongAddress(addr);
}
}
/// @inheritdoc IStakingReturnsWrite
/// @dev Adds the received funds to the unallocated balance.
function receiveReturns() external payable onlyReturnsAggregator {
emit ReturnsReceived(msg.value);
unallocatedETH += msg.value;
}
/// @dev Adds the received funds to the unallocated balance.
function receiveReturnsFromLiquidityBuffer() external payable onlyLiquidityBuffer {
emit ReturnsReceivedFromLiquidityBuffer(msg.value);
unallocatedETH += msg.value;
}
/// @notice Ensures that the caller is the returns aggregator.
modifier onlyReturnsAggregator() {
if (msg.sender != returnsAggregator) {
revert NotReturnsAggregator();
}
_;
}
/// @notice Ensures that the caller is the returns aggregator.
modifier onlyLiquidityBuffer() {
if (msg.sender != address(liquidityBuffer)) {
revert NotLiquidityBuffer();
}
_;
}
/// @notice Ensures that the caller is the unstake requests manager.
modifier onlyUnstakeRequestsManager() {
if (msg.sender != address(unstakeRequestsManager)) {
revert NotUnstakeRequestsManager();
}
_;
}
/// @notice Ensures that the given address is not the zero address.
modifier notZeroAddress(address addr) {
if (addr == address(0)) {
revert ZeroAddress();
}
_;
}
/// @notice Sets the minimum amount of ETH users can stake.
function setMinimumStakeBound(uint256 minimumStakeBound_) external onlyRole(STAKING_MANAGER_ROLE) {
minimumStakeBound = minimumStakeBound_;
emit ProtocolConfigChanged(
this.setMinimumStakeBound.selector, "setMinimumStakeBound(uint256)", abi.encode(minimumStakeBound_)
);
}
/// @notice Sets the minimum amount of mETH users can unstake.
function setMinimumUnstakeBound(uint256 minimumUnstakeBound_) external onlyRole(STAKING_MANAGER_ROLE) {
minimumUnstakeBound = minimumUnstakeBound_;
emit ProtocolConfigChanged(
this.setMinimumUnstakeBound.selector, "setMinimumUnstakeBound(uint256)", abi.encode(minimumUnstakeBound_)
);
}
/// @notice Sets the staking adjust rate.
function setExchangeAdjustmentRate(uint16 exchangeAdjustmentRate_) external onlyRole(STAKING_MANAGER_ROLE) {
if (exchangeAdjustmentRate_ > _MAX_EXCHANGE_ADJUSTMENT_RATE) {
revert InvalidConfiguration();
}
// even though this check is redundant with the one above, this function will be rarely used so we keep it as a
// reminder for future upgrades that this must never be violated.
assert(exchangeAdjustmentRate_ <= _BASIS_POINTS_DENOMINATOR);
exchangeAdjustmentRate = exchangeAdjustmentRate_;
emit ProtocolConfigChanged(
this.setExchangeAdjustmentRate.selector,
"setExchangeAdjustmentRate(uint16)",
abi.encode(exchangeAdjustmentRate_)
);
}
/// @notice Sets the minimum amount of ETH that the staking contract can send to the deposit contract to initiate
/// new validators.
function setMinimumDepositAmount(uint256 minimumDepositAmount_) external onlyRole(STAKING_MANAGER_ROLE) {
minimumDepositAmount = minimumDepositAmount_;
emit ProtocolConfigChanged(
this.setMinimumDepositAmount.selector, "setMinimumDepositAmount(uint256)", abi.encode(minimumDepositAmount_)
);
}
/// @notice Sets the maximum amount of ETH that the staking contract can send to the deposit contract to initiate
/// new validators.
function setMaximumDepositAmount(uint256 maximumDepositAmount_) external onlyRole(STAKING_MANAGER_ROLE) {
maximumDepositAmount = maximumDepositAmount_;
emit ProtocolConfigChanged(
this.setMaximumDepositAmount.selector, "setMaximumDepositAmount(uint256)", abi.encode(maximumDepositAmount_)
);
}
/// @notice Sets the maximumMETHSupply variable.
/// Note: We intentionally allow this to be set lower than the current totalSupply so that the amount can be
/// adjusted downwards by unstaking.
/// See also {maximumMETHSupply}.
function setMaximumMETHSupply(uint256 maximumMETHSupply_) external onlyRole(STAKING_MANAGER_ROLE) {
maximumMETHSupply = maximumMETHSupply_;
emit ProtocolConfigChanged(
this.setMaximumMETHSupply.selector, "setMaximumMETHSupply(uint256)", abi.encode(maximumMETHSupply_)
);
}
/// @notice Sets the address to receive beacon chain withdrawals (i.e. validator rewards and exits).
/// @dev Changing this variable will not have an immediate effect as all exisiting validators will still have the
/// original value set.
function setWithdrawalWallet(address withdrawalWallet_)
external
onlyRole(STAKING_MANAGER_ROLE)
notZeroAddress(withdrawalWallet_)
{
withdrawalWallet = withdrawalWallet_;
emit ProtocolConfigChanged(
this.setWithdrawalWallet.selector, "setWithdrawalWallet(address)", abi.encode(withdrawalWallet_)
);
}
/// @notice Sets the staking allowlist flag.
function setStakingAllowlist(bool isStakingAllowlist_) external onlyRole(STAKING_MANAGER_ROLE) {
isStakingAllowlist = isStakingAllowlist_;
emit ProtocolConfigChanged(
this.setStakingAllowlist.selector, "setStakingAllowlist(bool)", abi.encode(isStakingAllowlist_)
);
}
receive() external payable {
revert DoesNotReceiveETH();
}
fallback() external payable {
revert DoesNotReceiveETH();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerableUpgradeable).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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/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.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20Upgradeable {
using AddressUpgradeable for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface ProtocolEvents {
/// @notice Emitted when a protocol configuration has been updated.
/// @param setterSelector The selector of the function that updated the configuration.
/// @param setterSignature The signature of the function that updated the configuration.
/// @param value The abi-encoded data passed to the function that updated the configuration. Since this event will
/// only be emitted by setters, this data corresponds to the updated values in the protocol configuration.
event ProtocolConfigChanged(bytes4 indexed setterSelector, string setterSignature, bytes value);
}// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━
// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓
// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛
// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃��━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━
// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓
// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//
// From: https://github.com/ethereum/consensus-specs/blob/dev/solidity_deposit_contract/deposit_contract.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;
// This interface is designed to be compatible with the Vyper version.
/// @notice This is the Ethereum 2.0 deposit contract interface.
/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs
interface IDepositContract {
/// @notice A processed deposit event.
event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);
/// @notice Submit a Phase 0 DepositData object.
/// @param pubkey A BLS12-381 public key.
/// @param withdrawal_credentials Commitment to a public key for withdrawals.
/// @param signature A BLS12-381 signature.
/// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.
/// Used as a protection against malformed input.
function deposit(
bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature,
bytes32 deposit_data_root
) external payable;
/// @notice Query the current deposit root hash.
/// @return The deposit root hash.
function get_deposit_root() external view returns (bytes32);
/// @notice Query the current deposit count.
/// @return The deposit count encoded as a little endian 64-bit number.
function get_deposit_count() external view returns (bytes memory);
}
// Based on official specification in https://eips.ethereum.org/EIPS/eip-165
interface ERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceId The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `interfaceId` and
/// `interfaceId` is not 0xffffffff, `false` otherwise
function supportsInterface(bytes4 interfaceId) external pure returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20Upgradeable} from "openzeppelin-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {IERC20PermitUpgradeable} from "openzeppelin-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol";
interface IMETH is IERC20Upgradeable, IERC20PermitUpgradeable {
/// @notice Mint mETH to the staker.
/// @param staker The address of the staker.
/// @param amount The amount of tokens to mint.
function mint(address staker, uint256 amount) external;
/// @notice Burn mETH from the msg.sender.
/// @param amount The amount of tokens to burn.
function burn(uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/// @notice The records stored by the oracle contract informing the protocol about consensus layer activity. It is
/// computed and reported by off-chain oracle services.
/// @dev "current" quantities refer to the state at the `updateEndBlock` block number.
/// @dev "cumulative" quantities refer to sums up to the `updateEndBlock` block number.
/// @dev "window" quantities refer to sums over the block window between the `updateStartBlock` and `updateEndBlock`.
/// @param updateStartBlock The start of the oracle record block window. This should be 1 higher than the
/// updateEndBlock of the previous oracle record.
/// @param updateEndBlock The block number up to which this oracle record was computed (inclusive).
/// @param currentNumValidatorsNotWithdrawable The number of our validators that do not have the withdrawable status.
/// @param cumulativeNumValidatorsWithdrawable The total number of our validators that have the withdrawable status.
/// These validators have either the status `withdrawal_possible` or `withdrawal_done`. Note: validators can
/// fluctuate between the two statuses due to top ups.
/// @param windowWithdrawnPrincipalAmount The amount of principal that has been withdrawn from the consensus layer in
/// the analyzed block window.
/// @param windowWithdrawnRewardAmount The amount of rewards that has been withdrawn from the consensus layer in the
/// analysed block window.
/// @param currentTotalValidatorBalance The total amount of ETH in the consensus layer (i.e. the sum of all validator
/// balances). This is one of the major quantities to compute the total value controlled by the protocol.
/// @param cumulativeProcessedDepositAmount The total amount of ETH that has been deposited into and processed by the
/// consensus layer. This is used to prevent double counting of the ETH deposited to the consensus layer.
struct OracleRecord {
uint64 updateStartBlock;
uint64 updateEndBlock;
uint64 currentNumValidatorsNotWithdrawable;
uint64 cumulativeNumValidatorsWithdrawable;
uint128 windowWithdrawnPrincipalAmount;
uint128 windowWithdrawnRewardAmount;
uint128 currentTotalValidatorBalance;
uint128 cumulativeProcessedDepositAmount;
}
interface IOracleWrite {
/// @notice Pushes a new record to the oracle.
function receiveRecord(OracleRecord calldata record) external;
}
interface IOracleReadRecord {
/// @notice Returns the latest validated record.
/// @return `OracleRecord` The latest validated record.
function latestRecord() external view returns (OracleRecord calldata);
/// @notice Returns the record at the given index.
/// @param idx The index of the record to retrieve.
/// @return `OracleRecord` The record at the given index.
function recordAt(uint256 idx) external view returns (OracleRecord calldata);
/// @notice Returns the number of records in the oracle.
/// @return `uint256` The number of records in the oracle.
function numRecords() external view returns (uint256);
}
interface IOracleReadPending {
/// @notice Returns the pending update.
/// @return `OracleRecord` The pending update.
function pendingUpdate() external view returns (OracleRecord calldata);
/// @notice Indicates whether an oracle update is pending, i.e. if it was rejected by `_sanityCheckUpdate`.
function hasPendingUpdate() external view returns (bool);
}
interface IOracleRead is IOracleReadRecord, IOracleReadPending {}
interface IOracleManager {
/// @notice Sets the new oracle updater for the contract.
/// @param newUpdater The new oracle updater.
function setOracleUpdater(address newUpdater) external;
}
interface IOracle is IOracleWrite, IOracleRead, IOracleManager {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IPauserRead {
/// @notice Flag indicating if staking is paused.
function isStakingPaused() external view returns (bool);
/// @notice Flag indicating if unstake requests are paused.
function isUnstakeRequestsAndClaimsPaused() external view returns (bool);
/// @notice Flag indicating if initiate validators is paused
function isInitiateValidatorsPaused() external view returns (bool);
/// @notice Flag indicating if submit oracle records is paused.
function isSubmitOracleRecordsPaused() external view returns (bool);
/// @notice Flag indicating if allocate ETH is paused.
function isAllocateETHPaused() external view returns (bool);
/// @notice Flag indicating if liquidity buffer is paused.
function isLiquidityBufferPaused() external view returns (bool);
}
interface IPauserWrite {
/// @notice Pauses all actions.
function pauseAll() external;
}
interface IPauser is IPauserRead, IPauserWrite {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IStakingInitiationRead {
/// @notice The total amount of ETH sent to the beacon chain deposit contract.
function totalDepositedInValidators() external view returns (uint256);
/// @notice The number of validators initiated by the staking contract.
function numInitiatedValidators() external view returns (uint256);
/// @notice The block number at which the staking contract has been initialised.
function initializationBlockNumber() external view returns (uint256);
}
interface IStakingReturnsWrite {
/// @notice Accepts funds sent by the returns aggregator.
function receiveReturns() external payable;
/// @notice Accepts funds sent by the unstake requests manager.
function receiveFromUnstakeRequestsManager() external payable;
/// @notice Accepts funds sent by the liquidity buffer.
function receiveReturnsFromLiquidityBuffer() external payable;
/// @notice Top up staking contract.
function topUp() external payable;
}
interface IStaking is IStakingInitiationRead, IStakingReturnsWrite {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Staking} from "../Staking.sol";
/// @notice An unstake request is stored in the UnstakeRequestsManager and records the information required to
/// fulfill an unstake request claim.
/// @param id The unique ID of the unstake request.
/// @param requester The address of the user that requested the unstake.
/// @param mETHLocked The amount of mETH that was locked when the unstake request was created. The amount of mETH
/// will be burned once the request has been claimed.
/// @param ethRequested The amount of ETH that was requested when the unstake request was created.
/// @param cumulativeETHRequested The cumulative amount of ETH that had been requested in this request and all unstake
/// requests before this one.
/// @param blockNumber The block number at which the unstake request was created.
struct UnstakeRequest {
uint64 blockNumber;
address requester;
uint128 id;
uint128 mETHLocked;
uint128 ethRequested;
uint128 cumulativeETHRequested;
}
interface IUnstakeRequestsManagerWrite {
/// @notice Creates a new unstake request and adds it to the unstake requests array.
/// @param requester The address of the entity making the unstake request.
/// @param mETHLocked The amount of mETH tokens currently locked in the contract.
/// @param ethRequested The amount of ETH being requested for unstake.
/// @return The ID of the new unstake request.
function create(address requester, uint128 mETHLocked, uint128 ethRequested) external returns (uint256);
/// @notice Allows the requester to claim their unstake request after it has been finalized.
/// @param requestID The ID of the unstake request to claim.
/// @param requester The address of the entity claiming the unstake request.
function claim(uint256 requestID, address requester) external;
/// @notice Cancels a batch of the latest unfinalized unstake requests.
/// @param maxCancel The maximum number of requests to cancel.
/// @return A boolean indicating if there are more unstake requests to cancel.
function cancelUnfinalizedRequests(uint256 maxCancel) external returns (bool);
/// @notice Allocate ether into the contract.
function allocateETH() external payable;
/// @notice Withdraws surplus ETH from the allocatedETHForClaims.
function withdrawAllocatedETHSurplus() external;
}
interface IUnstakeRequestsManagerRead {
/// @notice Retrieves a specific unstake request based on its ID.
/// @param requestID The ID of the unstake request to fetch.
/// @return The UnstakeRequest struct corresponding to the given ID.
function requestByID(uint256 requestID) external view returns (UnstakeRequest memory);
/// @notice Returns the status of the request whether it is finalized and how much ETH that has been filled.
/// @param requestID The ID of the unstake request.
/// @return bool indicating if the request is finalized, and the amount of ETH that has been filled.
function requestInfo(uint256 requestID) external view returns (bool, uint256);
/// @notice Calculates the amount of ether allocated in the contract exceeding the total required to pay unclaimed.
/// @return The amount of surplus allocatedETH.
function allocatedETHSurplus() external view returns (uint256);
/// @notice Calculates the amount of ether that is needed to fulfill the unstake requests.
/// @return The amount of allocatedETH deficit.
function allocatedETHDeficit() external view returns (uint256);
/// @notice Calculates the amount of ether that has been allocated but not yet claimed.
/// @return The total amount of ether that is waiting to be claimed.
function balance() external view returns (uint256);
}
interface IUnstakeRequestsManager is IUnstakeRequestsManagerRead, IUnstakeRequestsManagerWrite {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title ILiquidityBuffer
* @notice Interface for LiquidityBuffer contract that manages liquidity allocation to position managers
*/
interface ILiquidityBuffer {
struct PositionManagerConfig {
address managerAddress; // position manager contract address
uint256 allocationCap; // maximum allocation limit for this manager
bool isActive; // whether the position manager is operational
}
struct PositionAccountant {
uint256 allocatedBalance; // total allocated balance to this manager
uint256 interestClaimedFromManager; // total interest claimed from this manager
}
/// @notice Deposit funds from staking contract
function depositETH() external payable;
/// @notice Receive funds from position manager
function receiveETHFromPositionManager() external payable;
/// @notice Get available principal balance for allocation
/// @dev Formula: totalFundsReceived - totalFundsReturned
function getAvailableBalance() external view returns (uint256);
function cumulativeDrawdown() external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
/**
* @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) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// 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 EnumerableSetUpgradeable {
// 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: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[45] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin/=lib/openzeppelin-contracts/contracts/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin-contracts-v5/=lib/openzeppelin-contracts-v5/",
"aave-v3/=lib/aave-v3-origin/src/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts-v5/contracts/",
"aave-v3-origin/=lib/aave-v3-origin/",
"halmos-cheatcodes/=lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DoesNotReceiveETH","type":"error"},{"inputs":[],"name":"InvalidConfiguration","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"InvalidDepositRoot","type":"error"},{"inputs":[{"internalType":"bytes12","name":"","type":"bytes12"}],"name":"InvalidWithdrawalCredentialsNotETH1","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"InvalidWithdrawalCredentialsWrongAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"InvalidWithdrawalCredentialsWrongLength","type":"error"},{"inputs":[],"name":"MaximumMETHSupplyExceeded","type":"error"},{"inputs":[],"name":"MaximumValidatorDepositExceeded","type":"error"},{"inputs":[],"name":"MinimumStakeBoundNotSatisfied","type":"error"},{"inputs":[],"name":"MinimumUnstakeBoundNotSatisfied","type":"error"},{"inputs":[],"name":"MinimumValidatorDepositNotSatisfied","type":"error"},{"inputs":[],"name":"NotEnoughDepositETH","type":"error"},{"inputs":[],"name":"NotEnoughUnallocatedETH","type":"error"},{"inputs":[],"name":"NotLiquidityBuffer","type":"error"},{"inputs":[],"name":"NotReturnsAggregator","type":"error"},{"inputs":[],"name":"NotUnstakeRequestsManager","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"PreviouslyUsedValidator","type":"error"},{"inputs":[{"internalType":"uint256","name":"methAmount","type":"uint256"},{"internalType":"uint256","name":"expectedMinimum","type":"uint256"}],"name":"StakeBelowMinimumMETHAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"},{"internalType":"uint256","name":"expectedMinimum","type":"uint256"}],"name":"UnstakeBelowMinimumETHAmount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AllocatedETHToDeposits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AllocatedETHToLiquidityBuffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AllocatedETHToUnstakeRequestsManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"setterSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"setterSignature","type":"string"},{"indexed":false,"internalType":"bytes","name":"value","type":"bytes"}],"name":"ProtocolConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReturnsReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReturnsReceivedFromLiquidityBuffer","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":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mETHAmount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"}],"name":"UnstakeRequestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mETHLocked","type":"uint256"}],"name":"UnstakeRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"operatorID","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"pubkey","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amountDeposited","type":"uint256"}],"name":"ValidatorInitiated","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ALLOCATOR_SERVICE_ROLE","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":"INITIATOR_SERVICE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_ALLOWLIST_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_ALLOWLIST_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOP_UP_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"allocateToUnstakeRequestsManager","type":"uint256"},{"internalType":"uint256","name":"allocateToDeposits","type":"uint256"},{"internalType":"uint256","name":"allocateToLiquidityBuffer","type":"uint256"}],"name":"allocateETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allocatedETHForDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"unstakeRequestID","type":"uint256"}],"name":"claimUnstakeRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositContract","outputs":[{"internalType":"contract IDepositContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"}],"name":"ethToMETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeAdjustmentRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":[],"name":"initializationBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"allocatorService","type":"address"},{"internalType":"address","name":"initiatorService","type":"address"},{"internalType":"address","name":"returnsAggregator","type":"address"},{"internalType":"address","name":"withdrawalWallet","type":"address"},{"internalType":"contract IMETH","name":"mETH","type":"address"},{"internalType":"contract IDepositContract","name":"depositContract","type":"address"},{"internalType":"contract IOracleReadRecord","name":"oracle","type":"address"},{"internalType":"contract IPauserRead","name":"pauser","type":"address"},{"internalType":"contract IUnstakeRequestsManager","name":"unstakeRequestsManager","type":"address"}],"internalType":"struct Staking.Init","name":"init","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILiquidityBuffer","name":"lb","type":"address"}],"name":"initializeV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"operatorID","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"withdrawalCredentials","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"internalType":"struct Staking.ValidatorParams[]","name":"validators","type":"tuple[]"},{"internalType":"bytes32","name":"expectedDepositRoot","type":"bytes32"}],"name":"initiateValidatorsWithDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isStakingAllowlist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityBuffer","outputs":[{"internalType":"contract ILiquidityBuffer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mETH","outputs":[{"internalType":"contract IMETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mETHAmount","type":"uint256"}],"name":"mETHToETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximumDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximumMETHSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumStakeBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumUnstakeBound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numInitiatedValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracleReadRecord","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauser","outputs":[{"internalType":"contract IPauserRead","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiveFromUnstakeRequestsManager","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"receiveReturns","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"receiveReturnsFromLiquidityBuffer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"reclaimAllocatedETHSurplus","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":[],"name":"returnsAggregator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"exchangeAdjustmentRate_","type":"uint16"}],"name":"setExchangeAdjustmentRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maximumDepositAmount_","type":"uint256"}],"name":"setMaximumDepositAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maximumMETHSupply_","type":"uint256"}],"name":"setMaximumMETHSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minimumDepositAmount_","type":"uint256"}],"name":"setMinimumDepositAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minimumStakeBound_","type":"uint256"}],"name":"setMinimumStakeBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minimumUnstakeBound_","type":"uint256"}],"name":"setMinimumUnstakeBound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isStakingAllowlist_","type":"bool"}],"name":"setStakingAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"withdrawalWallet_","type":"address"}],"name":"setWithdrawalWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minMETHAmount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"topUp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"totalControlled","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDepositedInValidators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unallocatedETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"methAmount","type":"uint128"},{"internalType":"uint128","name":"minETHAmount","type":"uint128"}],"name":"unstakeRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"unstakeRequestID","type":"uint256"}],"name":"unstakeRequestInfo","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"methAmount","type":"uint128"},{"internalType":"uint128","name":"minETHAmount","type":"uint128"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"unstakeRequestWithPermit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstakeRequestsManager","outputs":[{"internalType":"contract IUnstakeRequestsManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"}],"name":"usedValidators","outputs":[{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801562000010575f80fd5b506200001b62000021565b620000df565b5f54610100900460ff16156200008d5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff90811614620000dd575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61517480620000ed5f395ff3fe6080604052600436106103a4575f3560e01c806375796f76116101e6578063b064d4611161010c578063d547741f1161009f578063e94ad65b1161006e578063e94ad65b14610ba9578063ea452b6d14610bd5578063ec96e93c14610bea578063f1ec1e9714610c09576103db565b8063d547741f14610b30578063d70a6f3114610b4f578063dc29f1de14610b6e578063e55d6cc014610b76576103db565b8063bc3950c5116100db578063bc3950c514610abe578063c151aa7214610add578063ca15c87314610ae5578063cc3f4e2014610b04576103db565b8063b064d46114610a60578063b12de58614610a7f578063b91590b214610a94578063bb635c6514610aa9576103db565b806389e80ed3116101845780639fd0506d116101535780639fd0506d146109ef578063a217fddf14610a1b578063a694fc3a14610a2e578063aab483d614610a41576103db565b806389e80ed31461092d5780639010d07c1461096057806391d148541461097f57806399dd1deb146109d0576103db565b80637dfcdd29116101c05780637dfcdd29146108c5578063808d663f146108da578063854a63f6146108e2578063891ef43e1461090e576103db565b806375796f761461086557806378abb49b146108845780637dc0d1d014610899576103db565b80633101d910116102cb5780634a7d80b3116102695780635940d90b116102385780635940d90b146107ea57806360a0f628146107fe5780636fce8ab214610813578063729d533414610846576103db565b80634a7d80b31461075057806353e105fc1461077c5780635890c11c146107915780635915ded1146107b0576103db565b80633937c0b3116102a55780633937c0b3146106a15780633f550b3a146106d457806342d3915d146107005780634461ff0514610731576103db565b80633101d9101461063a57806335ead2a41461066d57806336568abe14610682576103db565b80631943190d1161034357806329d487041161031257806329d487041461058c57806329e84867146105ab5780632bf67650146105fc5780632f2ff15d1461061b576103db565b80631943190d146104f857806319efd5c71461050c578063248a9ca31461053f57806329b6eca91461056d576103db565b806304f36cc21161037f57806304f36cc2146104815780630633af76146104a0578063080c279a146104cd5780631103f1d3146104f0576103db565b80628db05b1461040d57806301ffc9a71461042e5780630208e4b514610462576103db565b366103db576040517f34352c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f34352c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b348015610418575f80fd5b5061042c61042736600461440a565b610c3f565b005b348015610439575f80fd5b5061044d610448366004614421565b610d01565b60405190151581526020015b60405180910390f35b34801561046d575f80fd5b5061042c61047c366004614460565b610d5c565b34801561048c575f80fd5b5061042c61049b3660046144e1565b6112b4565b3480156104ab575f80fd5b5060d0546104ba9061ffff1681565b60405161ffff9091168152602001610459565b3480156104d8575f80fd5b506104e260d15481565b604051908152602001610459565b61042c6113b6565b348015610503575f80fd5b5061042c611453565b348015610517575f80fd5b506104e27fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee1181565b34801561054a575f80fd5b506104e261055936600461440a565b5f9081526065602052604090206001015490565b348015610578575f80fd5b5061042c61058736600461451d565b6114fc565b348015610597575f80fd5b5061042c6105a6366004614538565b6116c9565b3480156105b6575f80fd5b5060d4546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610459565b348015610607575f80fd5b5061042c61061636600461440a565b611811565b348015610626575f80fd5b5061042c610635366004614569565b611971565b348015610645575f80fd5b506104e27fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c529181565b348015610678575f80fd5b506104e260cf5481565b34801561068d575f80fd5b5061042c61069c366004614569565b61199a565b3480156106ac575f80fd5b506104e27fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b81565b3480156106df575f80fd5b5060d9546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b34801561070b575f80fd5b5060d95461044d9074010000000000000000000000000000000000000000900460ff1681565b34801561073c575f80fd5b506104e261074b36600461440a565b611a4d565b34801561075b575f80fd5b5060d8546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610787575f80fd5b506104e260db5481565b34801561079c575f80fd5b506104e26107ab36600461440a565b611bb7565b3480156107bb575f80fd5b5061044d6107ca3660046145ee565b805160208183018101805160c98252928201919093012091525460ff1681565b3480156107f5575f80fd5b506104e2611cec565b348015610809575f80fd5b506104e260ca5481565b34801561081e575f80fd5b506104e27f5e4bd437d29fad01c10cdcfff414f0d6b0e84b96d2dade88d780d45b5630696b81565b348015610851575f80fd5b5061042c61086036600461440a565b611fc7565b348015610870575f80fd5b5061042c61087f36600461451d565b61207e565b34801561088f575f80fd5b506104e260d25481565b3480156108a4575f80fd5b5060d5546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b3480156108d0575f80fd5b506104e260cc5481565b61042c6121cf565b3480156108ed575f80fd5b5060d7546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610919575f80fd5b506104e26109283660046146d4565b612250565b348015610938575f80fd5b506104e27fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e7955981565b34801561096b575f80fd5b506105d761097a366004614700565b61225b565b34801561098a575f80fd5b5061044d610999366004614569565b5f91825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156109db575f80fd5b5061042c6109ea36600461440a565b612272565b3480156109fa575f80fd5b5060d6546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610a26575f80fd5b506104e25f81565b61042c610a3c36600461440a565b612329565b348015610a4c575f80fd5b5061042c610a5b36600461440a565b612673565b348015610a6b575f80fd5b506104e2610a7a366004614720565b61272a565b348015610a8a575f80fd5b506104e260ce5481565b348015610a9f575f80fd5b506104e260da5481565b348015610ab4575f80fd5b506104e260cb5481565b348015610ac9575f80fd5b5061042c610ad8366004614786565b61277c565b61042c612b63565b348015610af0575f80fd5b506104e2610aff36600461440a565b612bc5565b348015610b0f575f80fd5b5060dc546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610b3b575f80fd5b5061042c610b4a366004614569565b612bdb565b348015610b5a575f80fd5b5061042c610b6936600461440a565b612bff565b61042c612cb6565b348015610b81575f80fd5b506104e27f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd1681565b348015610bb4575f80fd5b5060d3546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610be0575f80fd5b506104e260cd5481565b348015610bf5575f80fd5b5061042c610c0436600461485e565b612cf9565b348015610c14575f80fd5b50610c28610c2336600461440a565b613027565b604080519215158352602083019190915201610459565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b610c69816130c4565b60ce82905560408051602081018490527e8db05b00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf5916148f2565b60405180910390a25050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610d565750610d56826130d1565b92915050565b7fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee11610d86816130c4565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eea12ab66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e149190614938565b15610e4b576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82156112ae5760d354604080517fc5f2892f00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff169163c5f2892f9160048083019260209291908290030181865afa158015610ebe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ee29190614953565b9050808314610f25576040517f1497ae93000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b5f805b858110156111425736878783818110610f4357610f4361496a565b9050602002810190610f559190614997565b905060c9610f6660408301836149d3565b604051610f74929190614a3b565b9081526040519081900360200190205460ff1615610fbe576040517f932c5b0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d15481602001351015610ffe576040517f172b315400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d2548160200135111561103e576040517f184a72de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61105361104e60608301836149d3565b613167565b600160c961106460408401846149d3565b604051611072929190614a3b565b9081526040516020918190038201902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016921515929092179091556110bd9082013584614a77565b925080356110ce60408301836149d3565b6040516110dc929190614a3b565b60405180910390207f15f16c2e13e50235799a97b981bf4a66c8cd86051f06aca745c5ff26f39b330e83806040019061111591906149d3565b856020013560405161112993929190614ad1565b60405180910390a35061113b81614af4565b9050610f28565b5060cd5481111561117f576040517f1eecaf5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060cd5f8282546111909190614b2b565b925050819055508060ca5f8282546111a89190614a77565b909155505060cb80548691905f906111c1908490614a77565b909155505f90505b858110156112aa57368787838181106111e4576111e461496a565b90506020028101906111f69190614997565b60d35490915073ffffffffffffffffffffffffffffffffffffffff166322895118602083013561122960408501856149d3565b61123660608701876149d3565b61124360808901896149d3565b8960a001356040518963ffffffff1660e01b815260040161126a9796959493929190614b3e565b5f604051808303818588803b158015611281575f80fd5b505af1158015611293573d5f803e3d5ffd5b505050505050806112a390614af4565b90506111c9565b5050505b50505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6112de816130c4565b60d9805483151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9091161790556040517f04f36cc200000000000000000000000000000000000000000000000000000000907f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749061137e908590602001901515815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614b8e565b60dc5473ffffffffffffffffffffffffffffffffffffffff163314611407576040517f26df550c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513481527fdbc324463c07bdb2a814fd79ec8d5159e2e1f1efec51a70fbda9ba820023d89a906020015b60405180910390a13460cc5f82825461144c9190614a77565b9091555050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61147d816130c4565b60d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b2d42b466040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156114e3575f80fd5b505af11580156114f5573d5f803e3d5ffd5b5050505050565b5f54600290610100900460ff1615801561151c57505f5460ff8083169116105b6115a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610f1c565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660ff8316176101001790558173ffffffffffffffffffffffffffffffffffffffff8116611626576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060dc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6116f3816130c4565b611700600a612710614c01565b61ffff168261ffff161115611741576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61271061ffff8316111561175757611757614c46565b60d080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84169081179091556040805160208101929092527f29d4870400000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614c73565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b61391a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061189f9190614938565b156118d6576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051339082907fbac6b2cb68f9205537fb1489571de5d98c9492cd5e1c7581b81cbb5932753aa8905f90a360d7546040517fddd5e1b20000000000000000000000000000000000000000000000000000000081526004810183905233602482015273ffffffffffffffffffffffffffffffffffffffff9091169063ddd5e1b2906044015f604051808303815f87803b1580156114e3575f80fd5b5f8281526065602052604090206001015461198b816130c4565b61199583836132e5565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314611a3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610f1c565b611a498282613306565b5050565b60d454604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff16916318160ddd9160048083019260209291908290030181865afa158015611aba573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ade9190614953565b5f03611ae8575090565b60d054610d56908390611b019061ffff16612710614cdf565b61ffff1660d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b939190614953565b611b9d9190614cfa565b612710611ba8611cec565b611bb29190614cfa565b613327565b60d454604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff16916318160ddd9160048083019260209291908290030181865afa158015611c24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c489190614953565b5f03611c52575090565b610d5682611c5e611cec565b60d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cc8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb29190614953565b5f8060d55f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3a009a06040518163ffffffff1660e01b815260040161010060405180830381865afa158015611d59573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d7d9190614d33565b90505f60cc5481611d8e9190614a77565b905060cd5481611d9e9190614a77565b90508160e001516fffffffffffffffffffffffffffffffff1660ca54611dc49190614b2b565b611dce9082614a77565b90508160c001516fffffffffffffffffffffffffffffffff1681611df29190614a77565b905060dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663809dab6a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e5e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e829190614953565b611e8c9082614a77565b905060dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315d5c6cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ef8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f1c9190614953565b611f269082614b2b565b905060d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b69ef8a86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fb69190614953565b611fc09082614a77565b9392505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b611ff1816130c4565b60db82905560408051602081018490527f729d533400000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614dfb565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6120a8816130c4565b8173ffffffffffffffffffffffffffffffffffffffff81166120f6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040805160208101929092527f75796f7600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526121c291614e41565b60405180910390a2505050565b60d95473ffffffffffffffffffffffffffffffffffffffff163314612220576040517f031886f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513481527f4cbb9d73b003a252cee3f2ee51d8d65a562af35eebb23730dd4a76d68127b37090602001611433565b5f611fc0838361344c565b5f828152609760205260408120611fc09083613744565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61229c816130c4565b60cf82905560408051602081018490527f99dd1deb00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614e87565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015612393573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123b79190614938565b156123ee576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d95474010000000000000000000000000000000000000000900460ff161561243a5761243a7fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e795596130c4565b60ce54341015612476576040517f2c2843b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61248034611a4d565b905060db5460d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124ef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125139190614953565b61251d9083614a77565b1115612555576040517f273ad0e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81811015612599576040517fb5903eca0000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610f1c565b3460cc5f8282546125aa9190614a77565b9091555050604080513481526020810183905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90910160405180910390a260d4546040517f40c10f190000000000000000000000000000000000000000000000000000000081523360048201526024810183905273ffffffffffffffffffffffffffffffffffffffff909116906340c10f19906044015f604051808303815f87803b158015612659575f80fd5b505af115801561266b573d5f803e3d5ffd5b505050505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61269d816130c4565b60d182905560408051602081018490527faab483d600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614ecd565b60d4545f906127679073ffffffffffffffffffffffffffffffffffffffff1633306fffffffffffffffffffffffffffffffff8b168989898961374f565b612771878761344c565b979650505050505050565b5f54610100900460ff161580801561279a57505f54600160ff909116105b806127b35750303b1580156127b357505f5460ff166001145b61283f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610f1c565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561289b575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6128a36139c4565b81516128b0905f906132e5565b6128de7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b83602001516132e5565b61290c7fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c529183604001516132e5565b61293a7fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee1183606001516132e5565b6129847f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd167fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b613a5c565b6129ce7fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e795597f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd16613a5c565b60c082015160d480547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560e084015160d38054831691841691909117905561010084015160d58054831691841691909117905561012084015160d680548316918416919091179055608084015160d9805461014087015160d78054861691871691909117905560a087015160d880549095169086161790935567016345785d8a000060ce55662386f26fc1000060cf556801bc16d674ec80000060d181905560d25574010000000000000000000000000000000000000000919093167fffffffffffffffffffffff000000000000000000000000000000000000000000909216919091171790554360da55683782dace9d9000000060db558015611a49575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016116bd565b60d75473ffffffffffffffffffffffffffffffffffffffff163314612bb4576040517f7154fc4300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3460cc5f82825461144c9190614a77565b5f818152609760205260408120610d5690613aa6565b5f82815260656020526040902060010154612bf5816130c4565b6119958383613306565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b612c29816130c4565b60d282905560408051602081018490527fd70a6f3100000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614f13565b7f5e4bd437d29fad01c10cdcfff414f0d6b0e84b96d2dade88d780d45b5630696b612ce0816130c4565b3460cc5f828254612cf19190614a77565b909155505050565b7fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c5291612d23816130c4565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fdcada5e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d8d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612db19190614938565b15612de8576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60cc5482612df68587614a77565b612e009190614a77565b1115612e38576040517f96b0c75100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81612e438486614a77565b612e4d9190614a77565b60cc5f828254612e5d9190614b2b565b90915550508215612eb2578260cd5f828254612e799190614a77565b90915550506040518381527f9d04ecb465d2c8754acb798a22293dd26215a1c2f7a2a56607afa215c1aadc779060200160405180910390a15b8315612f6a576040518481527ffe89805cf5299ef9fbd1d1ddefb8dcc3fa9408064d2ea31e3fca6565768f52179060200160405180910390a160d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634d13bfa6856040518263ffffffff1660e01b81526004015f604051808303818588803b158015612f52575f80fd5b505af1158015612f64573d5f803e3d5ffd5b50505050505b81156112ae576040518281527f9ad8dfd80f6133e7b25d5bea633a9c94aa5cb4bcbc56fb2738a7dc4b067338849060200160405180910390a160dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6326fb3836040518263ffffffff1660e01b81526004015f604051808303818588803b15801561300a575f80fd5b505af115801561301c573d5f803e3d5ffd5b505050505050505050565b60d7546040517f4f588bf1000000000000000000000000000000000000000000000000000000008152600481018390525f91829173ffffffffffffffffffffffffffffffffffffffff90911690634f588bf1906024016040805180830381865afa158015613097573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130bb9190614f59565b91509150915091565b6130ce8133613aaf565b50565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610d5657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610d56565b602081146131a4576040517f9b0ec52700000000000000000000000000000000000000000000000000000000815260048101829052602401610f1c565b5f6131b2600c828486614f85565b6131bb91614fac565b90507f01000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffff000000000000000000000000000000000000000082161461325c576040517f08ebf5650000000000000000000000000000000000000000000000000000000081527fffffffffffffffffffffffff000000000000000000000000000000000000000082166004820152602401610f1c565b5f61326b6020600c8587614f85565b61327491614ff4565b60d85460609190911c915073ffffffffffffffffffffffffffffffffffffffff1681146112ae576040517f1b4d561900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610f1c565b6132ef8282613b68565b5f8281526097602052604090206119959082613c5a565b6133108282613c7b565b5f8281526097602052604090206119959082613d34565b5f80807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050805f0361337d5783828161337357613373614bd4565b0492505050611fc0565b8084116133e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152606401610f1c565b5f84868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203025f889003889004909101858311909403939093029303949094049190911702949350505050565b60d654604080517f8b61391a00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff1691638b61391a9160048083019260209291908290030181865afa1580156134b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134dd9190614938565b15613514576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60cf54836fffffffffffffffffffffffffffffffff161015613562576040517f3b8dd38000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61357e846fffffffffffffffffffffffffffffffff16611bb7565b9050826fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff1610156135fa576040517f3aff96a90000000000000000000000000000000000000000000000000000000081526fffffffffffffffffffffffffffffffff808316600483015284166024820152604401610f1c565b60d7546040517fb5475cf60000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff8087166024830152831660448201525f9173ffffffffffffffffffffffffffffffffffffffff169063b5475cf6906064016020604051808303815f875af1158015613687573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136ab9190614953565b604080516fffffffffffffffffffffffffffffffff808616825288166020820152919250339183917fcbb10a3603d92dc1f9db6996b88539fbd521bb4144891e34c75b05c341c18379910160405180910390a360d45460d75461373c9173ffffffffffffffffffffffffffffffffffffffff908116913391166fffffffffffffffffffffffffffffffff8916613d55565b949350505050565b5f611fc08383613dea565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301525f91908a1690637ecebe0090602401602060405180830381865afa1580156137bc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137e09190614953565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e4015f604051808303815f87803b158015613877575f80fd5b505af1158015613889573d5f803e3d5ffd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301525f93508c169150637ecebe0090602401602060405180830381865afa1580156138f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061391d9190614953565b905061392a826001614a77565b81146139b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610f1c565b50505050505050505050565b5f54610100900460ff16613a5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610f1c565b565b5f82815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b5f610d56825490565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611a4957613aee81613e10565b613af9836020613e2f565b604051602001613b0a92919061503a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610f1c916004016150ba565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611a49575f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055613bfc3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f611fc08373ffffffffffffffffffffffffffffffffffffffff841661406c565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615611a49575f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f611fc08373ffffffffffffffffffffffffffffffffffffffff84166140b8565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526112ae9085906141a2565b5f825f018281548110613dff57613dff61496a565b905f5260205f200154905092915050565b6060610d5673ffffffffffffffffffffffffffffffffffffffff831660145b60605f613e3d836002614cfa565b613e48906002614a77565b67ffffffffffffffff811115613e6057613e60614597565b6040519080825280601f01601f191660200182016040528015613e8a576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f81518110613ec057613ec061496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613f2257613f2261496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f613f5c846002614cfa565b613f67906001614a77565b90505b6001811115614003577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613fa857613fa861496a565b1a60f81b828281518110613fbe57613fbe61496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c93613ffc816150cc565b9050613f6a565b508315611fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610f1c565b5f8181526001830160205260408120546140b157508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610d56565b505f610d56565b5f8181526001830160205260408120548015614192575f6140da600183614b2b565b85549091505f906140ed90600190614b2b565b905081811461414c575f865f01828154811061410b5761410b61496a565b905f5260205f200154905080875f01848154811061412b5761412b61496a565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061415d5761415d615100565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610d56565b5f915050610d56565b5092915050565b5f614203826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166142af9092919063ffffffff16565b905080515f14806142235750808060200190518101906142239190614938565b611995576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610f1c565b606061373c84845f85855f808673ffffffffffffffffffffffffffffffffffffffff1685876040516142e1919061512d565b5f6040518083038185875af1925050503d805f811461431b576040519150601f19603f3d011682016040523d82523d5f602084013e614320565b606091505b509150915061277187838387606083156143c15782515f036143ba5773ffffffffffffffffffffffffffffffffffffffff85163b6143ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f1c565b508161373c565b61373c83838151156143d65781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1c91906150ba565b5f6020828403121561441a575f80fd5b5035919050565b5f60208284031215614431575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611fc0575f80fd5b5f805f60408486031215614472575f80fd5b833567ffffffffffffffff80821115614489575f80fd5b818601915086601f83011261449c575f80fd5b8135818111156144aa575f80fd5b8760208260051b85010111156144be575f80fd5b6020928301989097509590910135949350505050565b80151581146130ce575f80fd5b5f602082840312156144f1575f80fd5b8135611fc0816144d4565b73ffffffffffffffffffffffffffffffffffffffff811681146130ce575f80fd5b5f6020828403121561452d575f80fd5b8135611fc0816144fc565b5f60208284031215614548575f80fd5b813561ffff81168114611fc0575f80fd5b8035614564816144fc565b919050565b5f806040838503121561457a575f80fd5b82359150602083013561458c816144fc565b809150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051610160810167ffffffffffffffff811182821017156145e8576145e8614597565b60405290565b5f602082840312156145fe575f80fd5b813567ffffffffffffffff80821115614615575f80fd5b818401915084601f830112614628575f80fd5b81358181111561463a5761463a614597565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561468057614680614597565b81604052828152876020848701011115614698575f80fd5b826020860160208301375f928101602001929092525095945050505050565b6fffffffffffffffffffffffffffffffff811681146130ce575f80fd5b5f80604083850312156146e5575f80fd5b82356146f0816146b7565b9150602083013561458c816146b7565b5f8060408385031215614711575f80fd5b50508035926020909101359150565b5f805f805f8060c08789031215614735575f80fd5b8635614740816146b7565b95506020870135614750816146b7565b945060408701359350606087013560ff8116811461476c575f80fd5b9598949750929560808101359460a0909101359350915050565b5f6101608284031215614797575f80fd5b61479f6145c4565b6147a883614559565b81526147b660208401614559565b60208201526147c760408401614559565b60408201526147d860608401614559565b60608201526147e960808401614559565b60808201526147fa60a08401614559565b60a082015261480b60c08401614559565b60c082015261481c60e08401614559565b60e082015261010061482f818501614559565b90820152610120614841848201614559565b90820152610140614853848201614559565b908201529392505050565b5f805f60608486031215614870575f80fd5b505081359360208301359350604090920135919050565b5f5b838110156148a1578181015183820152602001614889565b50505f910152565b5f81518084526148c0816020860160208601614887565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60408152601d60408201527f7365744d696e696d756d5374616b65426f756e642875696e74323536290000006060820152608060208201525f611fc060808301846148a9565b5f60208284031215614948575f80fd5b8151611fc0816144d4565b5f60208284031215614963575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff418336030181126149c9575f80fd5b9190910192915050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614a06575f80fd5b83018035915067ffffffffffffffff821115614a20575f80fd5b602001915036819003821315614a34575f80fd5b9250929050565b818382375f9101908152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610d5657610d56614a4a565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b604081525f614ae4604083018587614a8a565b9050826020830152949350505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614b2457614b24614a4a565b5060010190565b81810381811115610d5657610d56614a4a565b608081525f614b5160808301898b614a8a565b8281036020840152614b6481888a614a8a565b90508281036040840152614b79818688614a8a565b91505082606083015298975050505050505050565b60408152601960408201527f7365745374616b696e67416c6c6f776c69737428626f6f6c29000000000000006060820152608060208201525f611fc060808301846148a9565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61ffff80841680614c3a577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b92169190910492915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b60408152602160408201527f73657445786368616e676541646a7573746d656e74526174652875696e74313660608201527f2900000000000000000000000000000000000000000000000000000000000000608082015260a060208201525f611fc060a08301846148a9565b61ffff82811682821603908082111561419b5761419b614a4a565b8082028115828204841417610d5657610d56614a4a565b805167ffffffffffffffff81168114614564575f80fd5b8051614564816146b7565b5f610100808385031215614d45575f80fd5b6040519081019067ffffffffffffffff82118183101715614d6857614d68614597565b81604052614d7584614d11565b8152614d8360208501614d11565b6020820152614d9460408501614d11565b6040820152614da560608501614d11565b606082015260808401519150614dba826146b7565b816080820152614dcc60a08501614d28565b60a0820152614ddd60c08501614d28565b60c0820152614dee60e08501614d28565b60e0820152949350505050565b60408152601d60408201527f7365744d6178696d756d4d455448537570706c792875696e74323536290000006060820152608060208201525f611fc060808301846148a9565b60408152601c60408201527f7365745769746864726177616c57616c6c6574286164647265737329000000006060820152608060208201525f611fc060808301846148a9565b60408152601f60408201527f7365744d696e696d756d556e7374616b65426f756e642875696e7432353629006060820152608060208201525f611fc060808301846148a9565b60408152602060408201527f7365744d696e696d756d4465706f736974416d6f756e742875696e74323536296060820152608060208201525f611fc060808301846148a9565b60408152602060408201527f7365744d6178696d756d4465706f736974416d6f756e742875696e74323536296060820152608060208201525f611fc060808301846148a9565b5f8060408385031215614f6a575f80fd5b8251614f75816144d4565b6020939093015192949293505050565b5f8085851115614f93575f80fd5b83861115614f9f575f80fd5b5050820193919092039150565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000813581811691600c851015614fec57808186600c0360031b1b83161692505b505092915050565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008135818116916014851015614fec5760149490940360031b84901b1690921692915050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351615071816017850160208801614887565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516150ae816028840160208801614887565b01602801949350505050565b602081525f611fc060208301846148a9565b5f816150da576150da614a4a565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b5f82516149c981846020870161488756fea2646970667358221220629a49457e2b840fac74071096e17148f45dee30ba0d910df7dd844756a463c264736f6c63430008140033
Deployed Bytecode
0x6080604052600436106103a4575f3560e01c806375796f76116101e6578063b064d4611161010c578063d547741f1161009f578063e94ad65b1161006e578063e94ad65b14610ba9578063ea452b6d14610bd5578063ec96e93c14610bea578063f1ec1e9714610c09576103db565b8063d547741f14610b30578063d70a6f3114610b4f578063dc29f1de14610b6e578063e55d6cc014610b76576103db565b8063bc3950c5116100db578063bc3950c514610abe578063c151aa7214610add578063ca15c87314610ae5578063cc3f4e2014610b04576103db565b8063b064d46114610a60578063b12de58614610a7f578063b91590b214610a94578063bb635c6514610aa9576103db565b806389e80ed3116101845780639fd0506d116101535780639fd0506d146109ef578063a217fddf14610a1b578063a694fc3a14610a2e578063aab483d614610a41576103db565b806389e80ed31461092d5780639010d07c1461096057806391d148541461097f57806399dd1deb146109d0576103db565b80637dfcdd29116101c05780637dfcdd29146108c5578063808d663f146108da578063854a63f6146108e2578063891ef43e1461090e576103db565b806375796f761461086557806378abb49b146108845780637dc0d1d014610899576103db565b80633101d910116102cb5780634a7d80b3116102695780635940d90b116102385780635940d90b146107ea57806360a0f628146107fe5780636fce8ab214610813578063729d533414610846576103db565b80634a7d80b31461075057806353e105fc1461077c5780635890c11c146107915780635915ded1146107b0576103db565b80633937c0b3116102a55780633937c0b3146106a15780633f550b3a146106d457806342d3915d146107005780634461ff0514610731576103db565b80633101d9101461063a57806335ead2a41461066d57806336568abe14610682576103db565b80631943190d1161034357806329d487041161031257806329d487041461058c57806329e84867146105ab5780632bf67650146105fc5780632f2ff15d1461061b576103db565b80631943190d146104f857806319efd5c71461050c578063248a9ca31461053f57806329b6eca91461056d576103db565b806304f36cc21161037f57806304f36cc2146104815780630633af76146104a0578063080c279a146104cd5780631103f1d3146104f0576103db565b80628db05b1461040d57806301ffc9a71461042e5780630208e4b514610462576103db565b366103db576040517f34352c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f34352c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b348015610418575f80fd5b5061042c61042736600461440a565b610c3f565b005b348015610439575f80fd5b5061044d610448366004614421565b610d01565b60405190151581526020015b60405180910390f35b34801561046d575f80fd5b5061042c61047c366004614460565b610d5c565b34801561048c575f80fd5b5061042c61049b3660046144e1565b6112b4565b3480156104ab575f80fd5b5060d0546104ba9061ffff1681565b60405161ffff9091168152602001610459565b3480156104d8575f80fd5b506104e260d15481565b604051908152602001610459565b61042c6113b6565b348015610503575f80fd5b5061042c611453565b348015610517575f80fd5b506104e27fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee1181565b34801561054a575f80fd5b506104e261055936600461440a565b5f9081526065602052604090206001015490565b348015610578575f80fd5b5061042c61058736600461451d565b6114fc565b348015610597575f80fd5b5061042c6105a6366004614538565b6116c9565b3480156105b6575f80fd5b5060d4546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610459565b348015610607575f80fd5b5061042c61061636600461440a565b611811565b348015610626575f80fd5b5061042c610635366004614569565b611971565b348015610645575f80fd5b506104e27fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c529181565b348015610678575f80fd5b506104e260cf5481565b34801561068d575f80fd5b5061042c61069c366004614569565b61199a565b3480156106ac575f80fd5b506104e27fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b81565b3480156106df575f80fd5b5060d9546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b34801561070b575f80fd5b5060d95461044d9074010000000000000000000000000000000000000000900460ff1681565b34801561073c575f80fd5b506104e261074b36600461440a565b611a4d565b34801561075b575f80fd5b5060d8546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610787575f80fd5b506104e260db5481565b34801561079c575f80fd5b506104e26107ab36600461440a565b611bb7565b3480156107bb575f80fd5b5061044d6107ca3660046145ee565b805160208183018101805160c98252928201919093012091525460ff1681565b3480156107f5575f80fd5b506104e2611cec565b348015610809575f80fd5b506104e260ca5481565b34801561081e575f80fd5b506104e27f5e4bd437d29fad01c10cdcfff414f0d6b0e84b96d2dade88d780d45b5630696b81565b348015610851575f80fd5b5061042c61086036600461440a565b611fc7565b348015610870575f80fd5b5061042c61087f36600461451d565b61207e565b34801561088f575f80fd5b506104e260d25481565b3480156108a4575f80fd5b5060d5546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b3480156108d0575f80fd5b506104e260cc5481565b61042c6121cf565b3480156108ed575f80fd5b5060d7546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610919575f80fd5b506104e26109283660046146d4565b612250565b348015610938575f80fd5b506104e27fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e7955981565b34801561096b575f80fd5b506105d761097a366004614700565b61225b565b34801561098a575f80fd5b5061044d610999366004614569565b5f91825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156109db575f80fd5b5061042c6109ea36600461440a565b612272565b3480156109fa575f80fd5b5060d6546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610a26575f80fd5b506104e25f81565b61042c610a3c36600461440a565b612329565b348015610a4c575f80fd5b5061042c610a5b36600461440a565b612673565b348015610a6b575f80fd5b506104e2610a7a366004614720565b61272a565b348015610a8a575f80fd5b506104e260ce5481565b348015610a9f575f80fd5b506104e260da5481565b348015610ab4575f80fd5b506104e260cb5481565b348015610ac9575f80fd5b5061042c610ad8366004614786565b61277c565b61042c612b63565b348015610af0575f80fd5b506104e2610aff36600461440a565b612bc5565b348015610b0f575f80fd5b5060dc546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610b3b575f80fd5b5061042c610b4a366004614569565b612bdb565b348015610b5a575f80fd5b5061042c610b6936600461440a565b612bff565b61042c612cb6565b348015610b81575f80fd5b506104e27f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd1681565b348015610bb4575f80fd5b5060d3546105d79073ffffffffffffffffffffffffffffffffffffffff1681565b348015610be0575f80fd5b506104e260cd5481565b348015610bf5575f80fd5b5061042c610c0436600461485e565b612cf9565b348015610c14575f80fd5b50610c28610c2336600461440a565b613027565b604080519215158352602083019190915201610459565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b610c69816130c4565b60ce82905560408051602081018490527e8db05b00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf5916148f2565b60405180910390a25050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610d565750610d56826130d1565b92915050565b7fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee11610d86816130c4565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eea12ab66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e149190614938565b15610e4b576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82156112ae5760d354604080517fc5f2892f00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff169163c5f2892f9160048083019260209291908290030181865afa158015610ebe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ee29190614953565b9050808314610f25576040517f1497ae93000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b5f805b858110156111425736878783818110610f4357610f4361496a565b9050602002810190610f559190614997565b905060c9610f6660408301836149d3565b604051610f74929190614a3b565b9081526040519081900360200190205460ff1615610fbe576040517f932c5b0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d15481602001351015610ffe576040517f172b315400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d2548160200135111561103e576040517f184a72de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61105361104e60608301836149d3565b613167565b600160c961106460408401846149d3565b604051611072929190614a3b565b9081526040516020918190038201902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016921515929092179091556110bd9082013584614a77565b925080356110ce60408301836149d3565b6040516110dc929190614a3b565b60405180910390207f15f16c2e13e50235799a97b981bf4a66c8cd86051f06aca745c5ff26f39b330e83806040019061111591906149d3565b856020013560405161112993929190614ad1565b60405180910390a35061113b81614af4565b9050610f28565b5060cd5481111561117f576040517f1eecaf5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060cd5f8282546111909190614b2b565b925050819055508060ca5f8282546111a89190614a77565b909155505060cb80548691905f906111c1908490614a77565b909155505f90505b858110156112aa57368787838181106111e4576111e461496a565b90506020028101906111f69190614997565b60d35490915073ffffffffffffffffffffffffffffffffffffffff166322895118602083013561122960408501856149d3565b61123660608701876149d3565b61124360808901896149d3565b8960a001356040518963ffffffff1660e01b815260040161126a9796959493929190614b3e565b5f604051808303818588803b158015611281575f80fd5b505af1158015611293573d5f803e3d5ffd5b505050505050806112a390614af4565b90506111c9565b5050505b50505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6112de816130c4565b60d9805483151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9091161790556040517f04f36cc200000000000000000000000000000000000000000000000000000000907f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749061137e908590602001901515815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614b8e565b60dc5473ffffffffffffffffffffffffffffffffffffffff163314611407576040517f26df550c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513481527fdbc324463c07bdb2a814fd79ec8d5159e2e1f1efec51a70fbda9ba820023d89a906020015b60405180910390a13460cc5f82825461144c9190614a77565b9091555050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61147d816130c4565b60d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b2d42b466040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156114e3575f80fd5b505af11580156114f5573d5f803e3d5ffd5b5050505050565b5f54600290610100900460ff1615801561151c57505f5460ff8083169116105b6115a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610f1c565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660ff8316176101001790558173ffffffffffffffffffffffffffffffffffffffff8116611626576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060dc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6116f3816130c4565b611700600a612710614c01565b61ffff168261ffff161115611741576040517fc52a9bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61271061ffff8316111561175757611757614c46565b60d080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84169081179091556040805160208101929092527f29d4870400000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614c73565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b61391a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561187b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061189f9190614938565b156118d6576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051339082907fbac6b2cb68f9205537fb1489571de5d98c9492cd5e1c7581b81cbb5932753aa8905f90a360d7546040517fddd5e1b20000000000000000000000000000000000000000000000000000000081526004810183905233602482015273ffffffffffffffffffffffffffffffffffffffff9091169063ddd5e1b2906044015f604051808303815f87803b1580156114e3575f80fd5b5f8281526065602052604090206001015461198b816130c4565b61199583836132e5565b505050565b73ffffffffffffffffffffffffffffffffffffffff81163314611a3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610f1c565b611a498282613306565b5050565b60d454604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff16916318160ddd9160048083019260209291908290030181865afa158015611aba573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ade9190614953565b5f03611ae8575090565b60d054610d56908390611b019061ffff16612710614cdf565b61ffff1660d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b939190614953565b611b9d9190614cfa565b612710611ba8611cec565b611bb29190614cfa565b613327565b60d454604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff16916318160ddd9160048083019260209291908290030181865afa158015611c24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c489190614953565b5f03611c52575090565b610d5682611c5e611cec565b60d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cc8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb29190614953565b5f8060d55f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3a009a06040518163ffffffff1660e01b815260040161010060405180830381865afa158015611d59573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d7d9190614d33565b90505f60cc5481611d8e9190614a77565b905060cd5481611d9e9190614a77565b90508160e001516fffffffffffffffffffffffffffffffff1660ca54611dc49190614b2b565b611dce9082614a77565b90508160c001516fffffffffffffffffffffffffffffffff1681611df29190614a77565b905060dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663809dab6a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e5e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e829190614953565b611e8c9082614a77565b905060dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315d5c6cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ef8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f1c9190614953565b611f269082614b2b565b905060d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b69ef8a86040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f92573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fb69190614953565b611fc09082614a77565b9392505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b611ff1816130c4565b60db82905560408051602081018490527f729d533400000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614dfb565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b6120a8816130c4565b8173ffffffffffffffffffffffffffffffffffffffff81166120f6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040805160208101929092527f75796f7600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526121c291614e41565b60405180910390a2505050565b60d95473ffffffffffffffffffffffffffffffffffffffff163314612220576040517f031886f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513481527f4cbb9d73b003a252cee3f2ee51d8d65a562af35eebb23730dd4a76d68127b37090602001611433565b5f611fc0838361344c565b5f828152609760205260408120611fc09083613744565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61229c816130c4565b60cf82905560408051602081018490527f99dd1deb00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614e87565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015612393573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123b79190614938565b156123ee576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d95474010000000000000000000000000000000000000000900460ff161561243a5761243a7fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e795596130c4565b60ce54341015612476576040517f2c2843b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61248034611a4d565b905060db5460d45f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124ef573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125139190614953565b61251d9083614a77565b1115612555576040517f273ad0e000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81811015612599576040517fb5903eca0000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610f1c565b3460cc5f8282546125aa9190614a77565b9091555050604080513481526020810183905233917f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90910160405180910390a260d4546040517f40c10f190000000000000000000000000000000000000000000000000000000081523360048201526024810183905273ffffffffffffffffffffffffffffffffffffffff909116906340c10f19906044015f604051808303815f87803b158015612659575f80fd5b505af115801561266b573d5f803e3d5ffd5b505050505050565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b61269d816130c4565b60d182905560408051602081018490527faab483d600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614ecd565b60d4545f906127679073ffffffffffffffffffffffffffffffffffffffff1633306fffffffffffffffffffffffffffffffff8b168989898961374f565b612771878761344c565b979650505050505050565b5f54610100900460ff161580801561279a57505f54600160ff909116105b806127b35750303b1580156127b357505f5460ff166001145b61283f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610f1c565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561289b575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6128a36139c4565b81516128b0905f906132e5565b6128de7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b83602001516132e5565b61290c7fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c529183604001516132e5565b61293a7fe30bb2df90b65284acd0e8b5ebe3483bb2bbe65a08e43f0f9e8300fd8607ee1183606001516132e5565b6129847f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd167fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b613a5c565b6129ce7fdec9d30de0821ad67aa5b141b13a539f584a19f99319e6041698a892b0e795597f8ea5b4dbd68db0bf23bf4cda958b61a749f8c5aec6f2912d75a03246753ddd16613a5c565b60c082015160d480547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9384161790915560e084015160d38054831691841691909117905561010084015160d58054831691841691909117905561012084015160d680548316918416919091179055608084015160d9805461014087015160d78054861691871691909117905560a087015160d880549095169086161790935567016345785d8a000060ce55662386f26fc1000060cf556801bc16d674ec80000060d181905560d25574010000000000000000000000000000000000000000919093167fffffffffffffffffffffff000000000000000000000000000000000000000000909216919091171790554360da55683782dace9d9000000060db558015611a49575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016116bd565b60d75473ffffffffffffffffffffffffffffffffffffffff163314612bb4576040517f7154fc4300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3460cc5f82825461144c9190614a77565b5f818152609760205260408120610d5690613aa6565b5f82815260656020526040902060010154612bf5816130c4565b6119958383613306565b7fa6b5d83d32632203555cb9b2c2f68a8d94da48cadd9266ac0d17babedb52ea5b612c29816130c4565b60d282905560408051602081018490527fd70a6f3100000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610cf591614f13565b7f5e4bd437d29fad01c10cdcfff414f0d6b0e84b96d2dade88d780d45b5630696b612ce0816130c4565b3460cc5f828254612cf19190614a77565b909155505050565b7fe6ef7125bfa79685f3bd2e4c4cea243c1e988ebbc0801ab7641ae36b9e2c5291612d23816130c4565b60d65f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fdcada5e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d8d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612db19190614938565b15612de8576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60cc5482612df68587614a77565b612e009190614a77565b1115612e38576040517f96b0c75100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81612e438486614a77565b612e4d9190614a77565b60cc5f828254612e5d9190614b2b565b90915550508215612eb2578260cd5f828254612e799190614a77565b90915550506040518381527f9d04ecb465d2c8754acb798a22293dd26215a1c2f7a2a56607afa215c1aadc779060200160405180910390a15b8315612f6a576040518481527ffe89805cf5299ef9fbd1d1ddefb8dcc3fa9408064d2ea31e3fca6565768f52179060200160405180910390a160d75f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634d13bfa6856040518263ffffffff1660e01b81526004015f604051808303818588803b158015612f52575f80fd5b505af1158015612f64573d5f803e3d5ffd5b50505050505b81156112ae576040518281527f9ad8dfd80f6133e7b25d5bea633a9c94aa5cb4bcbc56fb2738a7dc4b067338849060200160405180910390a160dc5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6326fb3836040518263ffffffff1660e01b81526004015f604051808303818588803b15801561300a575f80fd5b505af115801561301c573d5f803e3d5ffd5b505050505050505050565b60d7546040517f4f588bf1000000000000000000000000000000000000000000000000000000008152600481018390525f91829173ffffffffffffffffffffffffffffffffffffffff90911690634f588bf1906024016040805180830381865afa158015613097573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130bb9190614f59565b91509150915091565b6130ce8133613aaf565b50565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610d5657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610d56565b602081146131a4576040517f9b0ec52700000000000000000000000000000000000000000000000000000000815260048101829052602401610f1c565b5f6131b2600c828486614f85565b6131bb91614fac565b90507f01000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffff000000000000000000000000000000000000000082161461325c576040517f08ebf5650000000000000000000000000000000000000000000000000000000081527fffffffffffffffffffffffff000000000000000000000000000000000000000082166004820152602401610f1c565b5f61326b6020600c8587614f85565b61327491614ff4565b60d85460609190911c915073ffffffffffffffffffffffffffffffffffffffff1681146112ae576040517f1b4d561900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610f1c565b6132ef8282613b68565b5f8281526097602052604090206119959082613c5a565b6133108282613c7b565b5f8281526097602052604090206119959082613d34565b5f80807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050805f0361337d5783828161337357613373614bd4565b0492505050611fc0565b8084116133e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152606401610f1c565b5f84868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203025f889003889004909101858311909403939093029303949094049190911702949350505050565b60d654604080517f8b61391a00000000000000000000000000000000000000000000000000000000815290515f9273ffffffffffffffffffffffffffffffffffffffff1691638b61391a9160048083019260209291908290030181865afa1580156134b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134dd9190614938565b15613514576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60cf54836fffffffffffffffffffffffffffffffff161015613562576040517f3b8dd38000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61357e846fffffffffffffffffffffffffffffffff16611bb7565b9050826fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff1610156135fa576040517f3aff96a90000000000000000000000000000000000000000000000000000000081526fffffffffffffffffffffffffffffffff808316600483015284166024820152604401610f1c565b60d7546040517fb5475cf60000000000000000000000000000000000000000000000000000000081523360048201526fffffffffffffffffffffffffffffffff8087166024830152831660448201525f9173ffffffffffffffffffffffffffffffffffffffff169063b5475cf6906064016020604051808303815f875af1158015613687573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136ab9190614953565b604080516fffffffffffffffffffffffffffffffff808616825288166020820152919250339183917fcbb10a3603d92dc1f9db6996b88539fbd521bb4144891e34c75b05c341c18379910160405180910390a360d45460d75461373c9173ffffffffffffffffffffffffffffffffffffffff908116913391166fffffffffffffffffffffffffffffffff8916613d55565b949350505050565b5f611fc08383613dea565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301525f91908a1690637ecebe0090602401602060405180830381865afa1580156137bc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137e09190614953565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e4015f604051808303815f87803b158015613877575f80fd5b505af1158015613889573d5f803e3d5ffd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b811660048301525f93508c169150637ecebe0090602401602060405180830381865afa1580156138f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061391d9190614953565b905061392a826001614a77565b81146139b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610f1c565b50505050505050505050565b5f54610100900460ff16613a5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610f1c565b565b5f82815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b5f610d56825490565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611a4957613aee81613e10565b613af9836020613e2f565b604051602001613b0a92919061503a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610f1c916004016150ba565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611a49575f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055613bfc3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f611fc08373ffffffffffffffffffffffffffffffffffffffff841661406c565b5f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615611a49575f82815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f611fc08373ffffffffffffffffffffffffffffffffffffffff84166140b8565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526112ae9085906141a2565b5f825f018281548110613dff57613dff61496a565b905f5260205f200154905092915050565b6060610d5673ffffffffffffffffffffffffffffffffffffffff831660145b60605f613e3d836002614cfa565b613e48906002614a77565b67ffffffffffffffff811115613e6057613e60614597565b6040519080825280601f01601f191660200182016040528015613e8a576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f81518110613ec057613ec061496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613f2257613f2261496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f613f5c846002614cfa565b613f67906001614a77565b90505b6001811115614003577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613fa857613fa861496a565b1a60f81b828281518110613fbe57613fbe61496a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c93613ffc816150cc565b9050613f6a565b508315611fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610f1c565b5f8181526001830160205260408120546140b157508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610d56565b505f610d56565b5f8181526001830160205260408120548015614192575f6140da600183614b2b565b85549091505f906140ed90600190614b2b565b905081811461414c575f865f01828154811061410b5761410b61496a565b905f5260205f200154905080875f01848154811061412b5761412b61496a565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061415d5761415d615100565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610d56565b5f915050610d56565b5092915050565b5f614203826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166142af9092919063ffffffff16565b905080515f14806142235750808060200190518101906142239190614938565b611995576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610f1c565b606061373c84845f85855f808673ffffffffffffffffffffffffffffffffffffffff1685876040516142e1919061512d565b5f6040518083038185875af1925050503d805f811461431b576040519150601f19603f3d011682016040523d82523d5f602084013e614320565b606091505b509150915061277187838387606083156143c15782515f036143ba5773ffffffffffffffffffffffffffffffffffffffff85163b6143ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f1c565b508161373c565b61373c83838151156143d65781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1c91906150ba565b5f6020828403121561441a575f80fd5b5035919050565b5f60208284031215614431575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611fc0575f80fd5b5f805f60408486031215614472575f80fd5b833567ffffffffffffffff80821115614489575f80fd5b818601915086601f83011261449c575f80fd5b8135818111156144aa575f80fd5b8760208260051b85010111156144be575f80fd5b6020928301989097509590910135949350505050565b80151581146130ce575f80fd5b5f602082840312156144f1575f80fd5b8135611fc0816144d4565b73ffffffffffffffffffffffffffffffffffffffff811681146130ce575f80fd5b5f6020828403121561452d575f80fd5b8135611fc0816144fc565b5f60208284031215614548575f80fd5b813561ffff81168114611fc0575f80fd5b8035614564816144fc565b919050565b5f806040838503121561457a575f80fd5b82359150602083013561458c816144fc565b809150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051610160810167ffffffffffffffff811182821017156145e8576145e8614597565b60405290565b5f602082840312156145fe575f80fd5b813567ffffffffffffffff80821115614615575f80fd5b818401915084601f830112614628575f80fd5b81358181111561463a5761463a614597565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561468057614680614597565b81604052828152876020848701011115614698575f80fd5b826020860160208301375f928101602001929092525095945050505050565b6fffffffffffffffffffffffffffffffff811681146130ce575f80fd5b5f80604083850312156146e5575f80fd5b82356146f0816146b7565b9150602083013561458c816146b7565b5f8060408385031215614711575f80fd5b50508035926020909101359150565b5f805f805f8060c08789031215614735575f80fd5b8635614740816146b7565b95506020870135614750816146b7565b945060408701359350606087013560ff8116811461476c575f80fd5b9598949750929560808101359460a0909101359350915050565b5f6101608284031215614797575f80fd5b61479f6145c4565b6147a883614559565b81526147b660208401614559565b60208201526147c760408401614559565b60408201526147d860608401614559565b60608201526147e960808401614559565b60808201526147fa60a08401614559565b60a082015261480b60c08401614559565b60c082015261481c60e08401614559565b60e082015261010061482f818501614559565b90820152610120614841848201614559565b90820152610140614853848201614559565b908201529392505050565b5f805f60608486031215614870575f80fd5b505081359360208301359350604090920135919050565b5f5b838110156148a1578181015183820152602001614889565b50505f910152565b5f81518084526148c0816020860160208601614887565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60408152601d60408201527f7365744d696e696d756d5374616b65426f756e642875696e74323536290000006060820152608060208201525f611fc060808301846148a9565b5f60208284031215614948575f80fd5b8151611fc0816144d4565b5f60208284031215614963575f80fd5b5051919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff418336030181126149c9575f80fd5b9190910192915050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614a06575f80fd5b83018035915067ffffffffffffffff821115614a20575f80fd5b602001915036819003821315614a34575f80fd5b9250929050565b818382375f9101908152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b80820180821115610d5657610d56614a4a565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b604081525f614ae4604083018587614a8a565b9050826020830152949350505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614b2457614b24614a4a565b5060010190565b81810381811115610d5657610d56614a4a565b608081525f614b5160808301898b614a8a565b8281036020840152614b6481888a614a8a565b90508281036040840152614b79818688614a8a565b91505082606083015298975050505050505050565b60408152601960408201527f7365745374616b696e67416c6c6f776c69737428626f6f6c29000000000000006060820152608060208201525f611fc060808301846148a9565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61ffff80841680614c3a577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b92169190910492915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b60408152602160408201527f73657445786368616e676541646a7573746d656e74526174652875696e74313660608201527f2900000000000000000000000000000000000000000000000000000000000000608082015260a060208201525f611fc060a08301846148a9565b61ffff82811682821603908082111561419b5761419b614a4a565b8082028115828204841417610d5657610d56614a4a565b805167ffffffffffffffff81168114614564575f80fd5b8051614564816146b7565b5f610100808385031215614d45575f80fd5b6040519081019067ffffffffffffffff82118183101715614d6857614d68614597565b81604052614d7584614d11565b8152614d8360208501614d11565b6020820152614d9460408501614d11565b6040820152614da560608501614d11565b606082015260808401519150614dba826146b7565b816080820152614dcc60a08501614d28565b60a0820152614ddd60c08501614d28565b60c0820152614dee60e08501614d28565b60e0820152949350505050565b60408152601d60408201527f7365744d6178696d756d4d455448537570706c792875696e74323536290000006060820152608060208201525f611fc060808301846148a9565b60408152601c60408201527f7365745769746864726177616c57616c6c6574286164647265737329000000006060820152608060208201525f611fc060808301846148a9565b60408152601f60408201527f7365744d696e696d756d556e7374616b65426f756e642875696e7432353629006060820152608060208201525f611fc060808301846148a9565b60408152602060408201527f7365744d696e696d756d4465706f736974416d6f756e742875696e74323536296060820152608060208201525f611fc060808301846148a9565b60408152602060408201527f7365744d6178696d756d4465706f736974416d6f756e742875696e74323536296060820152608060208201525f611fc060808301846148a9565b5f8060408385031215614f6a575f80fd5b8251614f75816144d4565b6020939093015192949293505050565b5f8085851115614f93575f80fd5b83861115614f9f575f80fd5b5050820193919092039150565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000813581811691600c851015614fec57808186600c0360031b1b83161692505b505092915050565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008135818116916014851015614fec5760149490940360031b84901b1690921692915050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351615071816017850160208801614887565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516150ae816028840160208801614887565b01602801949350505050565b602081525f611fc060208301846148a9565b5f816150da576150da614a4a565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b5f82516149c981846020870161488756fea2646970667358221220629a49457e2b840fac74071096e17148f45dee30ba0d910df7dd844756a463c264736f6c63430008140033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.