Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
SupraFiSonicStaking
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 50 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.27; import {ISFC} from "./interfaces/ISFC.sol"; import {IRateProvider} from "./interfaces/IRateProvider.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import {ERC20BurnableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {ERC20PermitUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; /** * @title SupraFi Staked Sonic * @author SupraFi * * ## Put your $S to work. Stake effortlessly, hold $SS, and watch your rewards grow—while keeping your liquidity intact. * * ## https://suprafi.app * * @notice The contract for SupraFi Staked Sonic (sS) */ contract SupraFiSonicStaking is IRateProvider, Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, ERC20PermitUpgradeable, OwnableUpgradeable, UUPSUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable { bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); bytes32 public constant CLAIM_ROLE = keccak256("CLAIM_ROLE"); uint256 public constant MAX_PROTOCOL_FEE_BIPS = 10_000; uint256 public constant MIN_DEPOSIT = 1e16; uint256 public constant MIN_UNDELEGATE_AMOUNT_SHARES = 1e12; uint256 public constant MIN_DONATION_AMOUNT = 1e12; uint256 public constant MIN_CLAIM_REWARDS_AMOUNT = 1e12; enum WithdrawKind { POOL, VALIDATOR, CLAW_BACK } struct WithdrawRequest { WithdrawKind kind; uint256 validatorId; uint256 assetAmount; bool isWithdrawn; uint256 requestTimestamp; address user; } /** * @dev Each undelegate request is given a unique withdraw id. Once the withdraw delay has passed, the request can be * processed, returning the underlying $S tokens to the user. */ mapping(uint256 withdrawId => WithdrawRequest request) private _allWithdrawRequests; /** * @dev We track all withdraw ids for each user in order to allow for an easier off-chain UX. */ mapping(address user => mapping(uint256 index => uint256 withdrawId)) public userWithdraws; mapping(address user => uint256 numWithdraws) public userNumWithdraws; /** * @dev A reference to the SFC contract */ ISFC public SFC; /** * @dev A reference to the treasury address */ address public treasury; /** * @dev The protocol fee in basis points (BIPS) */ uint256 public protocolFeeBIPS; /** * The delay between undelegation & withdraw */ uint256 public withdrawDelay; /** * @dev When true, no new deposits are allowed */ bool public depositPaused; /** * @dev When true, user undelegations are paused. */ bool public undelegatePaused; /** * @dev When true, user undelegations from pool are paused. */ bool public undelegateFromPoolPaused; /** * @dev When true, no withdraws are allowed */ bool public withdrawPaused; /** * @dev The total assets delegated to validators */ uint256 public totalDelegated; /** * @dev The total assets that is in the pool (undelegated) */ uint256 public totalPool; /** * @dev Pending operator clawbacked asset amounts are stored here to preserve the invariant. Once the withdraw * delay has passed, the assets are returned to the pool. */ uint256 public pendingClawBackAmount; /** * @dev A counter to track the number of withdraws. Used to generate unique withdraw ids. * The current value of the counter is the last withdraw id used. */ uint256 public withdrawCounter; event WithdrawDelaySet(address indexed owner, uint256 delay); event UndelegatePausedUpdated(address indexed owner, bool newValue); event UndelegateFromPoolPausedUpdated(address indexed owner, bool newValue); event WithdrawPausedUpdated(address indexed owner, bool newValue); event DepositPausedUpdated(address indexed owner, bool newValue); event Deposited(address indexed user, uint256 amountAssets, uint256 amountShares); event Delegated(uint256 indexed validatorId, uint256 amountAssets); event Undelegated( address indexed user, uint256 withdrawId, uint256 validatorId, uint256 amountAssets, WithdrawKind kind ); event Withdrawn(address indexed user, uint256 withdrawId, uint256 amountAssets, WithdrawKind kind, bool emergency); event Donated(address indexed user, uint256 amountAssets); event RewardsClaimed(uint256 amountClaimed, uint256 protocolFee); event OperatorClawBackInitiated(uint256 indexed withdrawId, uint256 indexed validatorId, uint256 amountAssets); event OperatorClawBackExecuted(uint256 indexed withdrawId, uint256 amountAssetsWithdrawn, bool indexed emergency); event ProtocolFeeUpdated(address indexed owner, uint256 indexed newFeeBIPS); event TreasuryUpdated(address indexed owner, address indexed newTreasury); error DelegateAmountCannotBeZero(); error UndelegateAmountCannotBeZero(); error NoDelegationForValidator(uint256 validatorId); error UndelegateAmountExceedsDelegated(uint256 validatorId); error WithdrawIdDoesNotExist(uint256 withdrawId); error WithdrawDelayNotElapsed(uint256 withdrawId); error WithdrawAlreadyProcessed(uint256 withdrawId); error UnauthorizedWithdraw(uint256 withdrawId); error TreasuryAddressCannotBeZero(); error SFCAddressCannotBeZero(); error ProtocolFeeTooHigh(); error DepositTooSmall(); error DepositPaused(); error UndelegatePaused(); error UndelegateFromPoolPaused(); error WithdrawsPaused(); error NativeTransferFailed(); error ProtocolFeeTransferFailed(); error PausedValueDidNotChange(); error UndelegateAmountExceedsPool(); error UserWithdrawsSkipTooLarge(); error UserWithdrawsMaxSizeCannotBeZero(); error ArrayLengthMismatch(); error UndelegateAmountTooSmall(); error DonationAmountCannotBeZero(); error DonationAmountTooSmall(); error UnsupportedWithdrawKind(); error RewardsClaimedTooSmall(); error SfcSlashMustBeAccepted(uint256 refundRatio); error SenderNotSFC(); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /** * @notice Initializer * @param _sfc the address of the SFC contract (is NOT modifiable) * @param _treasury The address of the treasury where fees are sent to (is modifiable) */ function initialize(ISFC _sfc, address _treasury) public initializer { __ERC20_init("SupraFi Staked Sonic", "sS"); __ERC20Burnable_init(); __ERC20Permit_init("SupraFi Staked Sonic"); __Ownable_init(msg.sender); __UUPSUpgradeable_init(); __ReentrancyGuard_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); require(address(_sfc) != address(0), SFCAddressCannotBeZero()); require(_treasury != address(0), TreasuryAddressCannotBeZero()); SFC = _sfc; treasury = _treasury; withdrawDelay = 604800 * 2; // 14 days undelegatePaused = false; undelegateFromPoolPaused = false; withdrawPaused = false; depositPaused = false; protocolFeeBIPS = 1000; // 10% withdrawCounter = 100; } /** * @dev This modifier is used to validate a given withdrawId when performing a withdraw. A valid withdraw Id: * - exists * - has not been processed * - has passed the withdraw delay */ modifier withValidWithdrawId(uint256 withdrawId) { WithdrawRequest storage request = _allWithdrawRequests[withdrawId]; uint256 earliestWithdrawTime = request.requestTimestamp + withdrawDelay; require(request.requestTimestamp > 0, WithdrawIdDoesNotExist(withdrawId)); require(_now() >= earliestWithdrawTime, WithdrawDelayNotElapsed(withdrawId)); require(!request.isWithdrawn, WithdrawAlreadyProcessed(withdrawId)); _; } /** * * Getter & helper functions * */ /** * @notice Returns the current asset worth of the protocol * * Considers: * - current staked assets * - current delegated assets * - pending operator withdraws */ function totalAssets() public view returns (uint256) { return totalPool + totalDelegated + pendingClawBackAmount; } /** * @notice Returns the amount of asset equivalent to 1 share (with 18 decimals) * @dev This function is provided for native compatability with balancer pools */ function getRate() public view returns (uint256) { return convertToAssets(1 ether); } /** * @notice Returns the amount of share equivalent to the provided number of assets * @param assetAmount the amount of assets to convert */ function convertToShares(uint256 assetAmount) public view returns (uint256) { uint256 assetsTotal = totalAssets(); uint256 totalShares = totalSupply(); if (assetsTotal == 0 || totalShares == 0) { return assetAmount; } return (assetAmount * totalShares) / assetsTotal; } /** * @notice Returns the amount of asset equivalent to the provided number of shares * @param sharesAmount the amount of shares to convert */ function convertToAssets(uint256 sharesAmount) public view returns (uint256) { uint256 assetsTotal = totalAssets(); uint256 totalShares = totalSupply(); if (assetsTotal == 0 || totalShares == 0) { return sharesAmount; } return (sharesAmount * assetsTotal) / totalShares; } /** * @notice Returns the user's withdraws * @param user the user to get the withdraws for * @param skip the number of withdraws to skip, used for pagination * @param maxSize the maximum number of withdraws to return. It's possible to return less than maxSize. Used for pagination. * @param reverseOrder whether to return the withdraws in reverse order (newest first) */ function getUserWithdraws(address user, uint256 skip, uint256 maxSize, bool reverseOrder) public view returns (WithdrawRequest[] memory) { require(skip < userNumWithdraws[user], UserWithdrawsSkipTooLarge()); require(maxSize > 0, UserWithdrawsMaxSizeCannotBeZero()); uint256 remaining = userNumWithdraws[user] - skip; uint256 size = remaining < maxSize ? remaining : maxSize; WithdrawRequest[] memory items = new WithdrawRequest[](size); for (uint256 i = 0; i < size; i++) { if (!reverseOrder) { // In chronological order we simply skip the first (older) entries items[i] = _allWithdrawRequests[userWithdraws[user][skip + i]]; } else { // In reverse order we go back to front, skipping the last (newer) entries. Note that `remaining` will // equal the total count if `skip` is 0, meaning we'd start with the newest entry. items[i] = _allWithdrawRequests[userWithdraws[user][remaining - 1 - i]]; } } return items; } function getWithdrawRequest(uint256 withdrawId) external view returns (WithdrawRequest memory) { return _allWithdrawRequests[withdrawId]; } /** * * End User Functions * */ /** * @notice Deposit native assets and mint shares of stS. */ function deposit() external payable nonReentrant returns (uint256) { uint256 amount = msg.value; require(amount >= MIN_DEPOSIT, DepositTooSmall()); require(!depositPaused, DepositPaused()); address user = msg.sender; uint256 sharesAmount = convertToShares(amount); // Deposits are added to the pool initially. The assets are delegated to validators by the operator totalPool += amount; _mint(user, sharesAmount); emit Deposited(user, amount, sharesAmount); return sharesAmount; } /** * @notice Undelegate staked assets. The shares are burnt from the msg.sender and a withdraw request is created. * The assets are withdrawable after the `withdrawDelay` has passed. * @param validatorId the validator to undelegate from * @param amountShares the amount of shares to undelegate */ function undelegate(uint256 validatorId, uint256 amountShares) external nonReentrant returns (uint256) { return _undelegate(validatorId, amountShares); } /** * @notice Undelegate staked assets from multiple validators. * @dev This function is provided as a convenience for bulking large undelegation requests across several * validators. This function is not gas optimized as we operate in an environment where gas is less of a concern. * We instead optimize for simpler code that is easier to reason about. * @param validatorIds an array of validator ids to undelegate from * @param amountShares an array of amounts of shares to undelegate */ function undelegateMany(uint256[] calldata validatorIds, uint256[] calldata amountShares) external nonReentrant returns (uint256[] memory withdrawIds) { require(validatorIds.length == amountShares.length, ArrayLengthMismatch()); withdrawIds = new uint256[](validatorIds.length); for (uint256 i = 0; i < validatorIds.length; i++) { withdrawIds[i] = _undelegate(validatorIds[i], amountShares[i]); } } /** * @notice Undelegate from the pool. * @dev While always possible to undelegate from the pool, the standard flow is to undelegate from a validator. * @param amountShares the amount of shares to undelegate */ function undelegateFromPool(uint256 amountShares) external nonReentrant returns (uint256 withdrawId) { require(!undelegateFromPoolPaused, UndelegateFromPoolPaused()); require(amountShares >= MIN_UNDELEGATE_AMOUNT_SHARES, UndelegateAmountTooSmall()); uint256 amountToUndelegate = convertToAssets(amountShares); require(amountToUndelegate <= totalPool, UndelegateAmountExceedsPool()); _burn(msg.sender, amountShares); // The validatorId is ignored for pool withdrawals withdrawId = _createAndPersistWithdrawRequest(WithdrawKind.POOL, 0, amountToUndelegate); // The amount is subtracted from the pool, but the assets stay in this contract. // The user is able to `withdraw` their assets after the `withdrawDelay` has passed. totalPool -= amountToUndelegate; emit Undelegated(msg.sender, withdrawId, 0, amountToUndelegate, WithdrawKind.POOL); } /** * @notice Withdraw undelegated assets * @param withdrawId the unique withdraw id for the undelegation request * @param emergency flag to withdraw without checking the amount, risk to get less assets than what is owed */ function withdraw(uint256 withdrawId, bool emergency) external nonReentrant returns (uint256) { return _withdraw(withdrawId, emergency); } /** * @notice Withdraw undelegated assets for a list of withdrawIds * @dev This function is provided as a convenience for bulking multiple withdraws into a single tx. * @param withdrawIds the unique withdraw ids for the undelegation requests * @param emergency flag to withdraw without checking the amount, risk to get less assets than what is owed */ function withdrawMany(uint256[] calldata withdrawIds, bool emergency) external nonReentrant returns (uint256[] memory amountsWithdrawn) { amountsWithdrawn = new uint256[](withdrawIds.length); for (uint256 i = 0; i < withdrawIds.length; i++) { amountsWithdrawn[i] = _withdraw(withdrawIds[i], emergency); } } /** * * OPERATOR functions * */ /** * @notice Delegate from the pool to a specific validator * @param validatorId the ID of the validator to delegate to * @param amount the amount of assets to delegate. If an amount greater than the pool is provided, the entire pool * is delegated. */ function delegate(uint256 validatorId, uint256 amount) external nonReentrant onlyRole(OPERATOR_ROLE) returns (uint256) { // To prevent DoS vectors and improve operator UX, if an amount larger than the pool is provided, // we default to the entire pool. if (amount > totalPool) { amount = totalPool; } require(amount > 0, DelegateAmountCannotBeZero()); totalPool -= amount; totalDelegated += amount; SFC.delegate{value: amount}(validatorId); emit Delegated(validatorId, amount); // Return the actual amount delegated since it could be less than the amount provided return amount; } /** * @notice Initiate a claw back of delegated assets to a specific validator, the claw back can be executed after `withdrawDelay` * @param validatorId the validator to claw back from * @param amountAssets the amount of assets to claw back from given validator */ function operatorInitiateClawBack(uint256 validatorId, uint256 amountAssets) external nonReentrant onlyRole(OPERATOR_ROLE) returns (uint256 withdrawId, uint256 actualAmountUndelegated) { require(amountAssets > 0, UndelegateAmountCannotBeZero()); uint256 amountDelegated = SFC.getStake(address(this), validatorId); if (amountAssets > amountDelegated) { amountAssets = amountDelegated; } require(amountDelegated > 0, NoDelegationForValidator(validatorId)); withdrawId = _createAndPersistWithdrawRequest(WithdrawKind.CLAW_BACK, validatorId, amountAssets); totalDelegated -= amountAssets; // The amount clawed back is still considered part of the total assets. // As such, we need to track the pending amount to ensure the invariant is maintained. pendingClawBackAmount += amountAssets; SFC.undelegate(validatorId, withdrawId, amountAssets); emit OperatorClawBackInitiated(withdrawId, validatorId, amountAssets); actualAmountUndelegated = amountAssets; } /** * @notice Execute a claw back, withdrawing assets to the pool * @dev This is the only operation that allows for the rate to decrease. * @param withdrawId the unique withdrawId for the claw back request * @param emergency when true, the operator acknowledges that the amount withdrawn may be less than what is owed, * potentially decreasing the rate. */ function operatorExecuteClawBack(uint256 withdrawId, bool emergency) external nonReentrant onlyRole(OPERATOR_ROLE) withValidWithdrawId(withdrawId) returns (uint256) { WithdrawRequest storage request = _allWithdrawRequests[withdrawId]; require(request.kind == WithdrawKind.CLAW_BACK, UnsupportedWithdrawKind()); // We allow any address with the operator role to execute a pending clawback. // It does not need to be the same operator that initiated the call. request.isWithdrawn = true; // Potential slashing events are handled by _withdrawFromSFC uint256 actualWithdrawnAmount = _withdrawFromSFC(request.validatorId, withdrawId, emergency); // we need to subtract the request amount from the pending amount since that is the value that was added during // the initiate claw back operation. pendingClawBackAmount -= request.assetAmount; // We then account for the actual amount we were able to withdraw // In the instance of a realized slashing event, this will result in a drop in the rate. totalPool += actualWithdrawnAmount; emit OperatorClawBackExecuted(withdrawId, actualWithdrawnAmount, emergency); return actualWithdrawnAmount; } /** * @notice Donate assets to the pool * @dev Donations are added to the pool, causing the rate to increase. Only the operator can donate. */ function donate() external payable onlyRole(OPERATOR_ROLE) { uint256 donationAmount = msg.value; require(donationAmount > 0, DonationAmountCannotBeZero()); // Since convertToAssets is a round down operation, very small donations can cause the rate to not grow. // So, we enforce a minimum donation amount. require(donationAmount >= MIN_DONATION_AMOUNT, DonationAmountTooSmall()); totalPool += donationAmount; emit Donated(msg.sender, donationAmount); } /** * @notice Pause all protocol functions * @dev The operator is given the power to pause the protocol, giving them the power to take action in the case of * an emergency. Enabling the protocol is reserved for the admin. */ function pause() external onlyRole(OPERATOR_ROLE) { _setDepositPaused(true); _setUndelegatePaused(true); _setUndelegateFromPoolPaused(true); _setWithdrawPaused(true); } /** * * DEFAULT_ADMIN_ROLE functions * */ /** * @notice Set withdraw delay * @param delay the new delay */ function setWithdrawDelay(uint256 delay) external onlyRole(DEFAULT_ADMIN_ROLE) { withdrawDelay = delay; emit WithdrawDelaySet(msg.sender, delay); } /** * @notice Pause/unpause user undelegations * @param newValue the desired value of the switch */ function setUndelegatePaused(bool newValue) external onlyRole(DEFAULT_ADMIN_ROLE) { _setUndelegatePaused(newValue); } /** * @notice Pause/unpause user undelegations from pool * @param newValue the desired value of the switch */ function setUndelegateFromPoolPaused(bool newValue) external onlyRole(DEFAULT_ADMIN_ROLE) { _setUndelegateFromPoolPaused(newValue); } /** * @notice Pause/unpause user withdraws * @param newValue the desired value of the switch */ function setWithdrawPaused(bool newValue) external onlyRole(DEFAULT_ADMIN_ROLE) { _setWithdrawPaused(newValue); } /** * @notice Pause/unpause deposit function * @param newValue the desired value of the switch */ function setDepositPaused(bool newValue) external onlyRole(DEFAULT_ADMIN_ROLE) { _setDepositPaused(newValue); } /** * @notice Update the treasury address * @param newTreasury the new treasury address */ function setTreasury(address newTreasury) external onlyRole(DEFAULT_ADMIN_ROLE) { require(newTreasury != address(0), TreasuryAddressCannotBeZero()); treasury = newTreasury; emit TreasuryUpdated(msg.sender, newTreasury); } /** * @notice Update the protocol fee * @param newFeeBIPS the value of the fee (in BIPS) */ function setProtocolFeeBIPS(uint256 newFeeBIPS) external onlyRole(DEFAULT_ADMIN_ROLE) { require(newFeeBIPS <= MAX_PROTOCOL_FEE_BIPS, ProtocolFeeTooHigh()); protocolFeeBIPS = newFeeBIPS; emit ProtocolFeeUpdated(msg.sender, newFeeBIPS); } /** * @notice Claim rewards from all contracts and add them to the pool * @param validatorIds an array of validator IDs to claim rewards from */ function claimRewards(uint256[] calldata validatorIds) external nonReentrant onlyRole(CLAIM_ROLE) { uint256 balanceBefore = address(this).balance; for (uint256 i = 0; i < validatorIds.length; i++) { uint256 rewards = SFC.pendingRewards(address(this), validatorIds[i]); if (rewards > 0) { SFC.claimRewards(validatorIds[i]); } } uint256 totalRewardsClaimed = address(this).balance - balanceBefore; // We enforce a minimum amount to ensure the math stays well behaved require(totalRewardsClaimed > MIN_CLAIM_REWARDS_AMOUNT, RewardsClaimedTooSmall()); uint256 protocolFee = 0; if (protocolFeeBIPS > 0) { protocolFee = (totalRewardsClaimed * protocolFeeBIPS) / MAX_PROTOCOL_FEE_BIPS; totalPool += totalRewardsClaimed - protocolFee; (bool protocolFeesClaimed,) = treasury.call{value: protocolFee}(""); require(protocolFeesClaimed, ProtocolFeeTransferFailed()); } else { totalPool += totalRewardsClaimed; } emit RewardsClaimed(totalRewardsClaimed, protocolFee); } /** * * Internal functions * */ function _undelegate(uint256 validatorId, uint256 amountShares) internal returns (uint256 withdrawId) { require(!undelegatePaused, UndelegatePaused()); require(amountShares >= MIN_UNDELEGATE_AMOUNT_SHARES, UndelegateAmountTooSmall()); uint256 amountAssets = convertToAssets(amountShares); uint256 amountDelegated = SFC.getStake(address(this), validatorId); require(amountAssets <= amountDelegated, UndelegateAmountExceedsDelegated(validatorId)); _burn(msg.sender, amountShares); withdrawId = _createAndPersistWithdrawRequest(WithdrawKind.VALIDATOR, validatorId, amountAssets); totalDelegated -= amountAssets; SFC.undelegate(validatorId, withdrawId, amountAssets); emit Undelegated(msg.sender, withdrawId, validatorId, amountAssets, WithdrawKind.VALIDATOR); } function _withdraw(uint256 withdrawId, bool emergency) internal withValidWithdrawId(withdrawId) returns (uint256) { require(!withdrawPaused, WithdrawsPaused()); // We've already checked that the withdrawId exists and is valid, so we can safely access the request WithdrawRequest storage request = _allWithdrawRequests[withdrawId]; require(msg.sender == request.user, UnauthorizedWithdraw(withdrawId)); // Claw backs can only be executed by the operator via the operatorExecuteClawBack function require(request.kind != WithdrawKind.CLAW_BACK, UnsupportedWithdrawKind()); request.isWithdrawn = true; uint256 amountWithdrawn = 0; if (request.kind == WithdrawKind.POOL) { // An undelegate from the pool only effects the internal accounting of this contract. // The amount has already been subtracted from the pool and the assets were already owned by this contract. // The amount withdrawn is always the same as the request amount. amountWithdrawn = request.assetAmount; } else { //The only WithdrawKind left is VALIDATOR // Potential slashing events are handled by _withdrawFromSFC amountWithdrawn = _withdrawFromSFC(request.validatorId, withdrawId, emergency); } address user = msg.sender; (bool withdrawnToUser,) = user.call{value: amountWithdrawn}(""); require(withdrawnToUser, NativeTransferFailed()); emit Withdrawn(user, withdrawId, amountWithdrawn, request.kind, emergency); // Return the actual amount withdrawn return amountWithdrawn; } function _withdrawFromSFC(uint256 validatorId, uint256 withdrawId, bool emergency) internal returns (uint256 actualAmountWithdrawn) { uint256 balanceBefore = address(this).balance; bool isSlashed = SFC.isSlashed(validatorId); if (isSlashed) { uint256 refundRatio = SFC.slashingRefundRatio(validatorId); // The caller is required to acknowledge they understand their stake has been slashed // by setting emergency to true. require(emergency, SfcSlashMustBeAccepted(refundRatio)); // When a validator isSlashed, a refundRatio of 0 can have two different meanings: // 1. The validator has been slashed but the percentage has not yet been set // 2. The validator has been fully slashed // In either case, a call to SFC.withdraw when isSlashed && refundRatio == 0 will revert with // StakeIsFullySlashed. So, we cannot make the call to SFC.withdraw. // In the instance that isSlashed == true && refundRatio == 0 && emergency == true, the caller is // acknowledging that their delegation has been fully slashed. // In the instance that refundRatio != 0, a slashing refund ratio has been set and can now be realized // by calling SFC.withdraw if (refundRatio != 0) { SFC.withdraw(validatorId, withdrawId); } } else { SFC.withdraw(validatorId, withdrawId); } // The SFC sends native assets to this contract, increasing it's balance. We measure the change // in balance before and after the call to get the actual amount withdrawn. actualAmountWithdrawn = address(this).balance - balanceBefore; } function _createAndPersistWithdrawRequest(WithdrawKind kind, uint256 validatorId, uint256 amount) internal returns (uint256 withdrawId) { address user = msg.sender; withdrawId = _incrementWithdrawCounter(); WithdrawRequest storage request = _allWithdrawRequests[withdrawId]; request.kind = kind; request.requestTimestamp = _now(); request.user = user; request.assetAmount = amount; request.validatorId = validatorId; request.isWithdrawn = false; // We store the user's withdraw ids to allow for easier off-chain processing. userWithdraws[user][userNumWithdraws[user]] = withdrawId; userNumWithdraws[user]++; } function _now() internal view returns (uint256) { return block.timestamp; } /** * @dev Given the size of uint256 and the maximum supply of $S, we can safely assume that this will never overflow * with a 1e18 minimum undelegate amount. */ function _incrementWithdrawCounter() internal returns (uint256) { withdrawCounter++; return withdrawCounter; } function _setUndelegatePaused(bool newValue) internal { require(undelegatePaused != newValue, PausedValueDidNotChange()); undelegatePaused = newValue; emit UndelegatePausedUpdated(msg.sender, newValue); } function _setUndelegateFromPoolPaused(bool newValue) internal { require(undelegateFromPoolPaused != newValue, PausedValueDidNotChange()); undelegateFromPoolPaused = newValue; emit UndelegateFromPoolPausedUpdated(msg.sender, newValue); } function _setWithdrawPaused(bool newValue) internal { require(withdrawPaused != newValue, PausedValueDidNotChange()); withdrawPaused = newValue; emit WithdrawPausedUpdated(msg.sender, newValue); } function _setDepositPaused(bool newValue) internal { require(depositPaused != newValue, PausedValueDidNotChange()); depositPaused = newValue; emit DepositPausedUpdated(msg.sender, newValue); } /** * * OWNER functions * */ function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} /** * @notice To receive native asset rewards from SFC */ receive() external payable { require(msg.sender == address(SFC), SenderNotSFC()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../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, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @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 returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); 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 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 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 `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal initializer { __ERC1967Upgrade_init_unchained(); } function __ERC1967Upgrade_init_unchained() internal initializer { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; _functionDelegateCall( newImplementation, abi.encodeWithSignature( "upgradeTo(address)", oldImplementation ) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _setImplementation(newImplementation); emit Upgraded(newImplementation); } } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require( AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract" ); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /* * @dev 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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev Base contract for building openzeppelin-upgrades compatible implementations for the {ERC1967Proxy}. It includes * publicly available upgrade functions that are called by the plugin and by the secure upgrade mechanism to verify * continuation of the upgradability. * * The {_authorizeUpgrade} function MUST be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal initializer { __ERC1967Upgrade_init_unchained(); __UUPSUpgradeable_init_unchained(); } function __UUPSUpgradeable_init_unchained() internal initializer { } function upgradeTo(address newImplementation) external virtual { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, bytes(""), false); } function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT 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.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of 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}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _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 value {ERC20} uses, unless this function is * 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: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, 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}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), 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}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - 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) { _approve(_msgSender(), spender, _allowances[_msgSender()][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) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is 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: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, 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: * * - `to` 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; _balances[account] += amount; emit Transfer(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"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(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 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 to 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 { } uint256[45] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal initializer { __Context_init_unchained(); __ERC20Burnable_init_unchained(); } function __ERC20Burnable_init_unchained() internal initializer { } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), currentAllowance - amount); _burn(account, amount); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.20; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {ERC20Upgradeable} from "../ERC20Upgradeable.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {EIP712Upgradeable} from "../../../utils/cryptography/EIP712Upgradeable.sol"; import {NoncesUpgradeable} from "../../../utils/NoncesUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. * * Adds the {permit} method, which can be used to change an account's ERC-20 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. */ abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable { bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Permit deadline has expired. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Mismatched signature. */ error ERC2612InvalidSigner(address signer, address owner); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC-20 token name. */ function __ERC20Permit_init(string memory name) internal onlyInitializing { __EIP712_init_unchained(name, "1"); } function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > deadline) { revert ERC2612ExpiredSignature(deadline); } bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); if (signer != owner) { revert ERC2612InvalidSigner(signer, owner); } _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override(IERC20Permit, NoncesUpgradeable) returns (uint256) { return super.nonces(owner); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { return _domainSeparatorV4(); } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT 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 initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. */ abstract contract EIP712Upgradeable is Initializable, IERC5267 { bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @custom:storage-location erc7201:openzeppelin.storage.EIP712 struct EIP712Storage { /// @custom:oz-renamed-from _HASHED_NAME bytes32 _hashedName; /// @custom:oz-renamed-from _HASHED_VERSION bytes32 _hashedVersion; string _name; string _version; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100; function _getEIP712Storage() private pure returns (EIP712Storage storage $) { assembly { $.slot := EIP712StorageLocation } } /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { EIP712Storage storage $ = _getEIP712Storage(); $._name = name; $._version = version; // Reset prior values in storage if upgrading $._hashedName = 0; $._hashedVersion = 0; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(); } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { EIP712Storage storage $ = _getEIP712Storage(); // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized // and the EIP712 domain is not reliable, as it will be missing name and version. require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized"); return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Name() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._name; } /** * @dev The version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Version() internal view virtual returns (string memory) { EIP712Storage storage $ = _getEIP712Storage(); return $._version; } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead. */ function _EIP712NameHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory name = _EIP712Name(); if (bytes(name).length > 0) { return keccak256(bytes(name)); } else { // If the name is empty, the contract may have been upgraded without initializing the new storage. // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design. bytes32 hashedName = $._hashedName; if (hashedName != 0) { return hashedName; } else { return keccak256(""); } } } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead. */ function _EIP712VersionHash() internal view returns (bytes32) { EIP712Storage storage $ = _getEIP712Storage(); string memory version = _EIP712Version(); if (bytes(version).length > 0) { return keccak256(bytes(version)); } else { // If the version is empty, the contract may have been upgraded without initializing the new storage. // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design. bytes32 hashedVersion = $._hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else { return keccak256(""); } } } }
// SPDX-License-Identifier: MIT 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 initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract NoncesUpgradeable is Initializable { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); /// @custom:storage-location erc7201:openzeppelin.storage.Nonces struct NoncesStorage { mapping(address account => uint256) _nonces; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Nonces")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant NoncesStorageLocation = 0x5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00; function _getNoncesStorage() private pure returns (NoncesStorage storage $) { assembly { $.slot := NoncesStorageLocation } } function __Nonces_init() internal onlyInitializing { } function __Nonces_init_unchained() internal onlyInitializing { } /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { NoncesStorage storage $ = _getNoncesStorage(); return $._nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { NoncesStorage storage $ = _getNoncesStorage(); // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return $._nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC-165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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. This account bears the admin role (for the granted role). * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// 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 IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an ERC-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { assembly ("memory-safe") { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an ERC-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an ERC-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { assembly ("memory-safe") { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.27; interface IRateProvider { function getRate() external view returns (uint256 _rate); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.27; /** * @title Special Fee Contract for Sonic network * @notice The SFC maintains a list of validators and delegators and distributes rewards to them. * @custom:security-contact [email protected] */ interface ISFC { error StakeIsFullySlashed(); function currentEpoch() external view returns (uint256); function getStake(address, uint256) external view returns (uint256); function delegate(uint256 toValidatorID) external payable; function undelegate(uint256 toValidatorID, uint256 wrID, uint256 amount) external; function withdraw(uint256 toValidatorID, uint256 wrID) external; function pendingRewards(address delegator, uint256 toValidatorID) external view returns (uint256); function claimRewards(uint256 toValidatorID) external; function getSelfStake(uint256 validatorID) external view returns (uint256); function isSlashed(uint256 validatorID) external view returns (bool); function slashingRefundRatio(uint256 validatorID) external view returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 50 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"DelegateAmountCannotBeZero","type":"error"},{"inputs":[],"name":"DepositPaused","type":"error"},{"inputs":[],"name":"DepositTooSmall","type":"error"},{"inputs":[],"name":"DonationAmountCannotBeZero","type":"error"},{"inputs":[],"name":"DonationAmountTooSmall","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"}],"name":"NoDelegationForValidator","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PausedValueDidNotChange","type":"error"},{"inputs":[],"name":"ProtocolFeeTooHigh","type":"error"},{"inputs":[],"name":"ProtocolFeeTransferFailed","type":"error"},{"inputs":[],"name":"RewardsClaimedTooSmall","type":"error"},{"inputs":[],"name":"SFCAddressCannotBeZero","type":"error"},{"inputs":[],"name":"SenderNotSFC","type":"error"},{"inputs":[{"internalType":"uint256","name":"refundRatio","type":"uint256"}],"name":"SfcSlashMustBeAccepted","type":"error"},{"inputs":[],"name":"TreasuryAddressCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"name":"UnauthorizedWithdraw","type":"error"},{"inputs":[],"name":"UndelegateAmountCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"}],"name":"UndelegateAmountExceedsDelegated","type":"error"},{"inputs":[],"name":"UndelegateAmountExceedsPool","type":"error"},{"inputs":[],"name":"UndelegateAmountTooSmall","type":"error"},{"inputs":[],"name":"UndelegateFromPoolPaused","type":"error"},{"inputs":[],"name":"UndelegatePaused","type":"error"},{"inputs":[],"name":"UnsupportedWithdrawKind","type":"error"},{"inputs":[],"name":"UserWithdrawsMaxSizeCannotBeZero","type":"error"},{"inputs":[],"name":"UserWithdrawsSkipTooLarge","type":"error"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"name":"WithdrawAlreadyProcessed","type":"error"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"name":"WithdrawDelayNotElapsed","type":"error"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"name":"WithdrawIdDoesNotExist","type":"error"},{"inputs":[],"name":"WithdrawsPaused","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"}],"name":"Delegated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"DepositPausedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountShares","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"}],"name":"Donated","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"withdrawId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountAssetsWithdrawn","type":"uint256"},{"indexed":true,"internalType":"bool","name":"emergency","type":"bool"}],"name":"OperatorClawBackExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"withdrawId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"}],"name":"OperatorClawBackInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"newFeeBIPS","type":"uint256"}],"name":"ProtocolFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFee","type":"uint256"}],"name":"RewardsClaimed","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"UndelegateFromPoolPausedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"UndelegatePausedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"},{"indexed":false,"internalType":"enum SupraFiSonicStaking.WithdrawKind","name":"kind","type":"uint8"}],"name":"Undelegated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"delay","type":"uint256"}],"name":"WithdrawDelaySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"WithdrawPausedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountAssets","type":"uint256"},{"indexed":false,"internalType":"enum SupraFiSonicStaking.WithdrawKind","name":"kind","type":"uint8"},{"indexed":false,"internalType":"bool","name":"emergency","type":"bool"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"CLAIM_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":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PROTOCOL_FEE_BIPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CLAIM_REWARDS_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEPOSIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DONATION_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_UNDELEGATE_AMOUNT_SHARES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SFC","outputs":[{"internalType":"contract ISFC","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"validatorIds","type":"uint256[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sharesAmount","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"delegate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"depositPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"donate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"skip","type":"uint256"},{"internalType":"uint256","name":"maxSize","type":"uint256"},{"internalType":"bool","name":"reverseOrder","type":"bool"}],"name":"getUserWithdraws","outputs":[{"components":[{"internalType":"enum SupraFiSonicStaking.WithdrawKind","name":"kind","type":"uint8"},{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"bool","name":"isWithdrawn","type":"bool"},{"internalType":"uint256","name":"requestTimestamp","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"internalType":"struct SupraFiSonicStaking.WithdrawRequest[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"name":"getWithdrawRequest","outputs":[{"components":[{"internalType":"enum SupraFiSonicStaking.WithdrawKind","name":"kind","type":"uint8"},{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"bool","name":"isWithdrawn","type":"bool"},{"internalType":"uint256","name":"requestTimestamp","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"internalType":"struct SupraFiSonicStaking.WithdrawRequest","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISFC","name":"_sfc","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"},{"internalType":"bool","name":"emergency","type":"bool"}],"name":"operatorExecuteClawBack","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"amountAssets","type":"uint256"}],"name":"operatorInitiateClawBack","outputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"},{"internalType":"uint256","name":"actualAmountUndelegated","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingClawBackAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"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":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"protocolFeeBIPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"setDepositPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeBIPS","type":"uint256"}],"name":"setProtocolFeeBIPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"setUndelegateFromPoolPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"setUndelegatePaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"delay","type":"uint256"}],"name":"setWithdrawDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"setWithdrawPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDelegated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"amountShares","type":"uint256"}],"name":"undelegate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountShares","type":"uint256"}],"name":"undelegateFromPool","outputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"undelegateFromPoolPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"validatorIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amountShares","type":"uint256[]"}],"name":"undelegateMany","outputs":[{"internalType":"uint256[]","name":"withdrawIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"undelegatePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userNumWithdraws","outputs":[{"internalType":"uint256","name":"numWithdraws","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"userWithdraws","outputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawId","type":"uint256"},{"internalType":"bool","name":"emergency","type":"bool"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"withdrawIds","type":"uint256[]"},{"internalType":"bool","name":"emergency","type":"bool"}],"name":"withdrawMany","outputs":[{"internalType":"uint256[]","name":"amountsWithdrawn","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052348015600e575f5ffd5b5060156019565b60c9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560685760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b615068806100d65f395ff3fe6080604052600436106103c2575f3560e01c806379cc6790116101ef578063cc0fe4a41161010b578063d9a34952116100a4578063d9a3495214610b9c578063dd62ed3e14610bbb578063e1e158a514610bff578063e882e4ef14610c19578063ecfb49a314610c38578063ed88c68e14610c4e578063f0f4426014610c56578063f2fde38b14610c75578063f475a7ee14610c94578063f5b541a614610ccb575f5ffd5b8063cc0fe4a414610a97578063cc90ef5c14610ac3578063ce213bc914610ae2578063ceaeee5414610af8578063cf5c3eb714610b18578063d02e92a614610b37578063d0e30db014610b56578063d505accf14610b5e578063d547741f14610b7d575f5ffd5b806395d89b411161018857806395d89b411461097d57806398176a0114610991578063a217fddf146109b0578063a457c2d7146109c3578063a9059cbb146109e2578063ac697e3f14610a01578063c6e6f59214610a20578063c9da089214610a3f578063ca16e3eb14610a6b578063cbecf45514610a81575f5ffd5b806379cc6790146108685780637ecebe001461088757806380d04de8146108a65780638456cb59146108bc57806384b0196e146108d057806386c1b4eb146108f75780638da5cb5b1461092a5780639094631e1461093e57806391d148541461095e575f5ffd5b80633659cfe6116102de5780635ab492fd116102775780635ab492fd1461072f5780635eac62391461074e5780635f2b4c091461047f57806361d027b31461076d578063634b91e31461079a578063679aefce146107b957806370a08231146107cd578063715018a61461080157806371bbf3e71461081557806372f0cb3014610849575f5ffd5b80633659cfe61461061757806337d151391461063657806338d0743614610655578063395093511461067457806342966c6814610693578063485cc955146106b25780634f1ef286146106d1578063538dd2f5146106e4578063543f66a414610710575f5ffd5b806315b78a171161035b57806315b78a17146104f657806318160ddd1461050b57806323b872dd1461051f578063248a9ca31461053e5780632f2ff15d1461055d5780632f3cd6721461057c5780632f3ffb9f146105a8578063313ce567146105c95780633644e515146105e457806336568abe146105f8575f5ffd5b806301e1d114146103f957806301ffc9a7146104205780630288a39c1461044f57806302befd241461046557806306036f3a1461047f57806306fdde031461049757806307a2d13a146104b8578063095ea7b3146104d757806313d4d9721461047f575f5ffd5b366103f557610161546001600160a01b031633146103f35760405163e44a287360e01b815260040160405180910390fd5b005b5f5ffd5b348015610404575f5ffd5b5061040d610ceb565b6040519081526020015b60405180910390f35b34801561042b575f5ffd5b5061043f61043a36600461468e565b610d11565b6040519015158152602001610417565b34801561045a575f5ffd5b5061040d6101645481565b348015610470575f5ffd5b506101655461043f9060ff1681565b34801561048a575f5ffd5b5061040d64e8d4a5100081565b3480156104a2575f5ffd5b506104ab610d47565b60405161041791906146e3565b3480156104c3575f5ffd5b5061040d6104d23660046146f5565b610dd7565b3480156104e2575f5ffd5b5061043f6104f1366004614720565b610e24565b348015610501575f5ffd5b5061040d61271081565b348015610516575f5ffd5b5060345461040d565b34801561052a575f5ffd5b5061043f61053936600461474a565b610e39565b348015610549575f5ffd5b5061040d6105583660046146f5565b610eef565b348015610568575f5ffd5b506103f3610577366004614788565b610f0d565b348015610587575f5ffd5b5061059b6105963660046147fd565b610f2f565b60405161041791906148a1565b3480156105b3575f5ffd5b506101655461043f906301000000900460ff1681565b3480156105d4575f5ffd5b5060405160128152602001610417565b3480156105ef575f5ffd5b5061040d611036565b348015610603575f5ffd5b506103f3610612366004614788565b61103f565b348015610622575f5ffd5b506103f36106313660046148b3565b611077565b348015610641575f5ffd5b506103f36106503660046148db565b61109c565b348015610660575f5ffd5b5061040d61066f3660046148f6565b6110b3565b34801561067f575f5ffd5b5061043f61068e366004614720565b6110f4565b34801561069e575f5ffd5b506103f36106ad3660046146f5565b61112a565b3480156106bd575f5ffd5b506103f36106cc366004614919565b611134565b6103f36106df366004614959565b611368565b3480156106ef575f5ffd5b506107036106fe366004614a1c565b61137d565b6040516104179190614ae0565b34801561071b575f5ffd5b506103f361072a3660046148db565b611662565b34801561073a575f5ffd5b506101655461043f90610100900460ff1681565b348015610759575f5ffd5b506103f3610768366004614b2d565b611675565b348015610778575f5ffd5b506101625461078d906001600160a01b031681565b6040516104179190614b6b565b3480156107a5575f5ffd5b5061040d6107b4366004614b7f565b611938565b3480156107c4575f5ffd5b5061040d61196c565b3480156107d8575f5ffd5b5061040d6107e73660046148b3565b6001600160a01b03165f9081526032602052604090205490565b34801561080c575f5ffd5b506103f361197e565b348015610820575f5ffd5b5061083461082f366004614b7f565b611991565b60408051928352602083019190915201610417565b348015610854575f5ffd5b506103f36108633660046146f5565b611b86565b348015610873575f5ffd5b506103f3610882366004614720565b611bd0565b348015610892575f5ffd5b5061040d6108a13660046148b3565b611c52565b3480156108b1575f5ffd5b5061040d6101665481565b3480156108c7575f5ffd5b506103f3611c5c565b3480156108db575f5ffd5b506108e4611c9b565b6040516104179796959493929190614b9f565b348015610902575f5ffd5b5061040d7ff7db13299c8a9e501861f04c20f69a2444829a36a363cfad4b58864709c7556081565b348015610935575f5ffd5b5061078d611d3f565b348015610949575f5ffd5b506101615461078d906001600160a01b031681565b348015610969575f5ffd5b5061043f610978366004614788565b611d59565b348015610988575f5ffd5b506104ab611d8d565b34801561099c575f5ffd5b506103f36109ab3660046146f5565b611d9c565b3480156109bb575f5ffd5b5061040d5f81565b3480156109ce575f5ffd5b5061043f6109dd366004614720565b611dff565b3480156109ed575f5ffd5b5061043f6109fc366004614720565b611e99565b348015610a0c575f5ffd5b5061059b610a1b366004614c0e565b611ea5565b348015610a2b575f5ffd5b5061040d610a3a3660046146f5565b611f73565b348015610a4a575f5ffd5b5061040d610a593660046148b3565b6101606020525f908152604090205481565b348015610a76575f5ffd5b5061040d6101695481565b348015610a8c575f5ffd5b5061040d6101635481565b348015610aa2575f5ffd5b50610ab6610ab13660046146f5565b611fae565b6040516104179190614c60565b348015610ace575f5ffd5b506103f3610add3660046148db565b612042565b348015610aed575f5ffd5b5061040d6101685481565b348015610b03575f5ffd5b506101655461043f9062010000900460ff1681565b348015610b23575f5ffd5b5061040d610b323660046148f6565b612055565b348015610b42575f5ffd5b5061040d610b513660046146f5565b61221f565b61040d612344565b348015610b69575f5ffd5b506103f3610b78366004614c6e565b61243c565b348015610b88575f5ffd5b506103f3610b97366004614788565b612555565b348015610ba7575f5ffd5b5061040d610bb6366004614b7f565b612571565b348015610bc6575f5ffd5b5061040d610bd5366004614919565b6001600160a01b039182165f90815260336020908152604080832093909416825291909152205490565b348015610c0a575f5ffd5b5061040d662386f26fc1000081565b348015610c24575f5ffd5b506103f3610c333660046148db565b6126b8565b348015610c43575f5ffd5b5061040d6101675481565b6103f36126cb565b348015610c61575f5ffd5b506103f3610c703660046148b3565b612770565b348015610c80575f5ffd5b506103f3610c8f3660046148b3565b6127ee565b348015610c9f575f5ffd5b5061040d610cae366004614720565b61015f60209081525f928352604080842090915290825290205481565b348015610cd6575f5ffd5b5061040d5f516020614fcc5f395f51905f5281565b5f610168546101665461016754610d029190614cf3565b610d0c9190614cf3565b905090565b5f6001600160e01b03198216637965db0b60e01b1480610d4157506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060358054610d5690614d06565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8290614d06565b8015610dcd5780601f10610da457610100808354040283529160200191610dcd565b820191905f5260205f20905b815481529060010190602001808311610db057829003601f168201915b5050505050905090565b5f5f610de1610ceb565b90505f610ded60345490565b9050811580610dfa575080155b15610e0757509192915050565b80610e128386614d3e565b610e1c9190614d55565b949350505050565b5f610e30338484612828565b50600192915050565b5f610e4584848461294c565b6001600160a01b0384165f90815260336020908152604080832033845290915290205482811015610ece5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610ee28533610edd8685614d74565b612828565b60019150505b9392505050565b5f5f610ef9612b0f565b5f9384526020525050604090206001015490565b610f1682610eef565b610f1f81612b33565b610f298383612b3d565b50505050565b6060600261012c5403610f545760405162461bcd60e51b8152600401610ec590614d87565b600261012c55838214610f7a5760405163512509d360e11b815260040160405180910390fd5b836001600160401b03811115610f9257610f92614945565b604051908082528060200260200182016040528015610fbb578160200160208202803683370190505b5090505f5b8481101561102757611002868683818110610fdd57610fdd614dbe565b90506020020135858584818110610ff657610ff6614dbe565b90506020020135612bdb565b82828151811061101457611014614dbe565b6020908102919091010152600101610fc0565b50600161012c55949350505050565b5f610d0c612dbd565b6001600160a01b03811633146110685760405163334bd91960e11b815260040160405180910390fd5b6110728282612dc6565b505050565b61108081612e3c565b6110998160405180602001604052805f8152505f612e44565b50565b5f6110a681612b33565b6110af82612fbd565b5050565b5f600261012c54036110d75760405162461bcd60e51b8152600401610ec590614d87565b600261012c556110e7838361304c565b600161012c559392505050565b335f8181526033602090815260408083206001600160a01b03871684529091528120549091610e30918590610edd908690614cf3565b61109933826132a0565b5f61113d6133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156111635750825b90505f826001600160401b0316600114801561117e5750303b155b90508115801561118c575080155b156111aa5760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156111d357845460ff60401b1916600160401b1785555b6112236040518060400160405280601481526020017353757072614669205374616b656420536f6e696360601b81525060405180604001604052806002815260200161735360f01b8152506133fd565b61122b6134dd565b6112606040518060400160405280601481526020017353757072614669205374616b656420536f6e696360601b8152506135ca565b611269336135f5565b6112716134dd565b611279613606565b6112835f33612b3d565b506001600160a01b0387166112ab576040516377edc7f960e11b815260040160405180910390fd5b6001600160a01b0386166112d25760405163dfc4d44d60e01b815260040160405180910390fd5b61016180546001600160a01b03808a166001600160a01b0319928316179092556101628054928916929091169190911790556212750061016455610165805463ffffffff191690556103e861016355606461016955831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b60405180910390a15b50505050505050565b61137182612e3c565b6110af82826001612e44565b6001600160a01b0384165f908152610160602052604090205460609084106113b85760405163f9cc1ec960e01b815260040160405180910390fd5b5f83116113d8576040516308f5521560e21b815260040160405180910390fd5b6001600160a01b0385165f90815261016060205260408120546113fc908690614d74565b90505f84821061140c578461140e565b815b90505f816001600160401b0381111561142957611429614945565b60405190808252806020026020018201604052801561146257816020015b61144f614652565b8152602001906001900390816114475790505b5090505f5b82811015611656578561155d576001600160a01b0389165f90815261015f6020526040812061015e91908161149c858d614cf3565b81526020019081526020015f205481526020019081526020015f206040518060c00160405290815f82015f9054906101000a900460ff1660028111156114e4576114e4614a63565b60028111156114f5576114f5614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a090910152825183908390811061154d5761154d614dbe565b602002602001018190525061164e565b6001600160a01b0389165f90815261015f6020526040812061015e9190818461158760018a614d74565b6115919190614d74565b81526020019081526020015f205481526020019081526020015f206040518060c00160405290815f82015f9054906101000a900460ff1660028111156115d9576115d9614a63565b60028111156115ea576115ea614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a090910152825183908390811061164257611642614dbe565b60200260200101819052505b600101611467565b50979650505050505050565b5f61166c81612b33565b6110af826136ad565b600261012c54036116985760405162461bcd60e51b8152600401610ec590614d87565b600261012c557ff7db13299c8a9e501861f04c20f69a2444829a36a363cfad4b58864709c755606116c881612b33565b475f5b838110156117e557610161545f906001600160a01b0316636099ecb2308888868181106116fa576116fa614dbe565b905060200201356040518363ffffffff1660e01b815260040161171e929190614de6565b602060405180830381865afa158015611739573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061175d9190614dff565b905080156117dc57610161546001600160a01b0316630962ef7987878581811061178957611789614dbe565b905060200201356040518263ffffffff1660e01b81526004016117ae91815260200190565b5f604051808303815f87803b1580156117c5575f5ffd5b505af11580156117d7573d5f5f3e3d5ffd5b505050505b506001016116cb565b505f6117f18247614d74565b905064e8d4a510008111611818576040516322a3f28960e01b815260040160405180910390fd5b610163545f90156118d95761271061016354836118359190614d3e565b61183f9190614d55565b905061184b8183614d74565b6101675f82825461185c9190614cf3565b9091555050610162546040515f916001600160a01b03169083908381818185875af1925050503d805f81146118ac576040519150601f19603f3d011682016040523d82523d5f602084013e6118b1565b606091505b50509050806118d357604051630dbefa6760e41b815260040160405180910390fd5b506118f1565b816101675f8282546118eb9190614cf3565b90915550505b60408051838152602081018390527f38be9b012e428704c0fb2b81dfd53444b76ac4cd45c46cfd2d661f73d97cf47b910160405180910390a15050600161012c5550505050565b5f600261012c540361195c5760405162461bcd60e51b8152600401610ec590614d87565b600261012c556110e78383612bdb565b5f610d0c670de0b6b3a7640000610dd7565b61198661371d565b61198f5f61374f565b565b5f5f600261012c54036119b65760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f526119d381612b33565b5f84116119f357604051638f8de2cf60e01b815260040160405180910390fd5b6101615460405163cfd4766360e01b81525f916001600160a01b03169063cfd4766390611a269030908a90600401614de6565b602060405180830381865afa158015611a41573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a659190614dff565b905080851115611a73578094505b8581611a9557604051637f7b8b8d60e01b8152600401610ec591815260200190565b50611aa2600287876137a9565b9350846101665f828254611ab69190614d74565b92505081905550846101685f828254611acf9190614cf3565b9091555050610161546040516313e1937d60e21b81526004810188905260248101869052604481018790526001600160a01b0390911690634f864df4906064015f604051808303815f87803b158015611b26575f5ffd5b505af1158015611b38573d5f5f3e3d5ffd5b5050505085847fcaf027f94096d868021d65cb574bfd69f91946a2f8ac9d3dd82eae0fc743d59187604051611b6f91815260200190565b60405180910390a35050600161012c555092909150565b5f611b9081612b33565b61016482905560405182815233907fd30864fe562875819420946502b0d79444034cd8fc7c1f77406a434a3858dc47906020015b60405180910390a25050565b5f611bdb8333610bd5565b905081811015611c395760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b6064820152608401610ec5565b611c488333610edd8585614d74565b61107283836132a0565b5f610d418261386f565b5f516020614fcc5f395f51905f52611c7381612b33565b611c7d60016136ad565b611c876001613898565b611c916001613918565b6110996001612fbd565b5f6060805f5f5f60605f611cad61399a565b8054909150158015611cc157506001810154155b611d055760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610ec5565b611d0d6139be565b611d15613a5c565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b5f5f611d49613a78565b546001600160a01b031692915050565b5f5f611d63612b0f565b5f948552602090815260408086206001600160a01b03959095168652939052505090205460ff1690565b606060368054610d5690614d06565b5f611da681612b33565b612710821115611dc95760405163499fddb160e01b815260040160405180910390fd5b610163829055604051829033907f389f6e01d911ce2a6919bdcf4e57d270003243ca9c54e7911454a70f89aee19e905f90a35050565b335f9081526033602090815260408083206001600160a01b038616845290915281205482811015611e805760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610ec5565b611e8f3385610edd8685614d74565b5060019392505050565b5f610e3033848461294c565b6060600261012c5403611eca5760405162461bcd60e51b8152600401610ec590614d87565b600261012c55826001600160401b03811115611ee857611ee8614945565b604051908082528060200260200182016040528015611f11578160200160208202803683370190505b5090505f5b83811015611f6557611f40858583818110611f3357611f33614dbe565b905060200201358461304c565b828281518110611f5257611f52614dbe565b6020908102919091010152600101611f16565b50600161012c559392505050565b5f5f611f7d610ceb565b90505f611f8960345490565b9050811580611f96575080155b15611fa357509192915050565b81610e128286614d3e565b611fb6614652565b5f82815261015e602052604090819020815160c081019092528054829060ff166002811115611fe757611fe7614a63565b6002811115611ff857611ff8614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a09091015292915050565b5f61204c81612b33565b6110af82613898565b5f600261012c54036120795760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f5261209681612b33565b5f84815261015e602052604081206101645460048201548793916120b991614cf3565b90505f82600401541183906120e45760405163f4670c0560e01b8152600401610ec591815260200190565b5080421015839061210b57604051636f9550f360e11b8152600401610ec591815260200190565b506003820154839060ff161561213757604051634d3258cf60e01b8152600401610ec591815260200190565b505f87815261015e602052604090206002815460ff16600281111561215e5761215e614a63565b1461217c57604051631d62f57560e11b815260040160405180910390fd5b60038101805460ff191660019081179091558101545f9061219e908a8a613a9c565b905081600201546101685f8282546121b69190614d74565b92505081905550806101675f8282546121cf9190614cf3565b9091555050604051818152881515908a907f33e55d5beb676e4238c78d4adacacb11d125de294fe3017556a2962b3a59cfb69060200160405180910390a3600161012c5598975050505050505050565b5f600261012c54036122435760405162461bcd60e51b8152600401610ec590614d87565b600261012c556101655462010000900460ff16156122745760405163c81ab54160e01b815260040160405180910390fd5b64e8d4a5100082101561229a576040516311a660bb60e31b815260040160405180910390fd5b5f6122a483610dd7565b9050610167548111156122ca57604051630f69494160e01b815260040160405180910390fd5b6122d433846132a0565b6122df5f5f836137a9565b9150806101675f8282546122f39190614d74565b909155505060405133907f04fcca04f81983ffc61b309cc6d2935c3e78576bed7045f109b779920d0a1455906123309085905f9086908290614e16565b60405180910390a250600161012c55919050565b5f600261012c54036123685760405162461bcd60e51b8152600401610ec590614d87565b600261012c5534662386f26fc1000081101561239757604051636ba4a1c760e01b815260040160405180910390fd5b6101655460ff16156123bc5760405163035edea360e41b815260040160405180910390fd5b335f6123c783611f73565b9050826101675f8282546123db9190614cf3565b909155506123eb90508282613c89565b60408051848152602081018390526001600160a01b038416917f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca910160405180910390a292505050600161012c5590565b834211156124605760405163313c898160e11b815260048101859052602401610ec5565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861248e8c613d52565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6124e882613d83565b90505f6124f782878787613daf565b9050896001600160a01b0316816001600160a01b03161461253e576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401610ec5565b6125498a8a8a612828565b50505050505050505050565b61255e82610eef565b61256781612b33565b610f298383612dc6565b5f600261012c54036125955760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f526125b281612b33565b610167548311156125c4576101675492505b5f83116125e4576040516323c9a98560e21b815260040160405180910390fd5b826101675f8282546125f69190614d74565b92505081905550826101665f82825461260f9190614cf3565b909155505061016154604051639fa6dd3560e01b8152600481018690526001600160a01b0390911690639fa6dd359085906024015f604051808303818588803b15801561265a575f5ffd5b505af115801561266c573d5f5f3e3d5ffd5b5050505050837fdf2a7c5f7a567419f37f5bba40b572a4500cdf7c85f7b18a67c6dba1b94fba3b846040516126a391815260200190565b60405180910390a25050600161012c55919050565b5f6126c281612b33565b6110af82613918565b5f516020614fcc5f395f51905f526126e281612b33565b3480612701576040516304e224ef60e21b815260040160405180910390fd5b64e8d4a5100081101561272757604051631ab3412960e31b815260040160405180910390fd5b806101675f8282546127399190614cf3565b909155505060405181815233907f2a01595cddf097c90216094025db714da3f4e5bd8877b56ba86a24ecead8e54390602001611bc4565b5f61277a81612b33565b6001600160a01b0382166127a15760405163dfc4d44d60e01b815260040160405180910390fd5b61016280546001600160a01b0319166001600160a01b03841690811790915560405133907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a905f90a35050565b6127f661371d565b6001600160a01b03811661281f575f604051631e4fbdf760e01b8152600401610ec59190614b6b565b6110998161374f565b6001600160a01b03831661288a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610ec5565b6001600160a01b0382166128eb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610ec5565b6001600160a01b038381165f8181526033602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166129b05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610ec5565b6001600160a01b038216612a125760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ec5565b6001600160a01b0383165f9081526032602052604090205481811015612a895760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610ec5565b612a938282614d74565b6001600160a01b038086165f908152603260205260408082209390935590851681529081208054849290612ac8908490614cf3565b92505081905550826001600160a01b0316846001600160a01b03165f5160206150135f395f51905f5284604051612b0191815260200190565b60405180910390a350505050565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680090565b6110998133613dd5565b5f5f612b47612b0f565b9050612b538484611d59565b612bd2575f848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612b883390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610d41565b5f915050610d41565b610165545f90610100900460ff1615612c0757604051636980976360e01b815260040160405180910390fd5b64e8d4a51000821015612c2d576040516311a660bb60e31b815260040160405180910390fd5b5f612c3783610dd7565b6101615460405163cfd4766360e01b81529192505f916001600160a01b039091169063cfd4766390612c6f9030908990600401614de6565b602060405180830381865afa158015612c8a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612cae9190614dff565b90508481831115612cd557604051630963904360e01b8152600401610ec591815260200190565b50612ce033856132a0565b612cec600186846137a9565b9250816101665f828254612d009190614d74565b9091555050610161546040516313e1937d60e21b81526004810187905260248101859052604481018490526001600160a01b0390911690634f864df4906064015f604051808303815f87803b158015612d57575f5ffd5b505af1158015612d69573d5f5f3e3d5ffd5b50505050336001600160a01b03167f04fcca04f81983ffc61b309cc6d2935c3e78576bed7045f109b779920d0a14558487856001604051612dad9493929190614e16565b60405180910390a2505092915050565b5f610d0c613e00565b5f5f612dd0612b0f565b9050612ddc8484611d59565b15612bd2575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610d41565b61109961371d565b5f612e4d613e73565b9050612e5884613ea1565b5f83511180612e645750815b15612e7557612e738484613f46565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16612fb657805460ff19166001178155604051612ef0908690612ec1908590602401614b6b565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052613f46565b50805460ff19168155612f01613e73565b6001600160a01b0316826001600160a01b031614612f795760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610ec5565b612f8285613ea1565b6040516001600160a01b038616907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a25b5050505050565b80151561016560039054906101000a900460ff16151503612ff157604051630b255f6560e31b815260040160405180910390fd5b610165805482151563010000000263ff0000001990911617905560405133907f992a56a5f570253ef03d7f98a2dcee0a0fac86c31e69a225fa7661544b4a3fa39061304190841515815260200190565b60405180910390a250565b5f82815261015e6020526040812061016454600482015485929184916130729190614cf3565b90505f826004015411839061309d5760405163f4670c0560e01b8152600401610ec591815260200190565b508042101583906130c457604051636f9550f360e11b8152600401610ec591815260200190565b506003820154839060ff16156130f057604051634d3258cf60e01b8152600401610ec591815260200190565b50610165546301000000900460ff161561311d576040516318863d4d60e01b815260040160405180910390fd5b5f86815261015e60205260409020600581015487906001600160a01b0316331461315d57604051634b35344d60e11b8152600401610ec591815260200190565b506002815460ff16600281111561317657613176614a63565b0361319457604051631d62f57560e11b815260040160405180910390fd5b60038101805460ff191660011790555f80825460ff1660028111156131bb576131bb614a63565b036131cb575060028101546131dd565b6131da82600101548989613a9c565b90505b60405133905f90829084908381818185875af1925050503d805f811461321e576040519150601f19603f3d011682016040523d82523d5f602084013e613223565b606091505b505090508061324557604051633d2cec6f60e21b815260040160405180910390fd5b83546040516001600160a01b038416917f16ede7d26353101f14a572719bc335a26d49880445bfcd03df637065fc14bf4c9161328a918e91889160ff16908f90614e38565b60405180910390a2509098975050505050505050565b6001600160a01b0382166133005760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610ec5565b6001600160a01b0382165f90815260326020526040902054818110156133735760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610ec5565b61337d8282614d74565b6001600160a01b0384165f90815260326020526040812091909155603480548492906133aa908490614d74565b90915550506040518281525f906001600160a01b038516905f5160206150135f395f51905f529060200161293f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b5f6134066133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561342c5750825b90505f826001600160401b031660011480156134475750303b155b905081158015613455575080155b156134735760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561349c57845460ff60401b1916600160401b1785555b6134a461402d565b6134ae87876140fa565b831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b5f6134e66133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561350c5750825b90505f826001600160401b031660011480156135275750303b155b905081158015613535575080155b156135535760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561357c57845460ff60401b1916600160401b1785555b61358461402d565b61358c61402d565b8315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b60405180910390a15050505050565b6135d26141e2565b61109981604051806040016040528060018152602001603160f81b815250614207565b6135fd6141e2565b61109981614246565b5f61360f6133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156136355750825b90505f826001600160401b031660011480156136505750303b155b90508115801561365e575080155b1561367c5760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156136a557845460ff60401b1916600160401b1785555b61358c61424e565b6101655481151560ff9091161515036136d957604051630b255f6560e31b815260040160405180910390fd5b610165805460ff191682151590811790915560405190815233907fb93c20d2a2cf84896b1c3aeb9dd18a8557c4da5cc8e4e8d48b7b0bd9eb3dcf0e90602001613041565b33613726611d3f565b6001600160a01b03161461198f573360405163118cdaa760e01b8152600401610ec59190614b6b565b5f613758613a78565b80546001600160a01b038481166001600160a01b031983168117845560405193945091169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b5f336137b3614322565b5f81815261015e602052604090208054919350908690829060ff191660018360028111156137e3576137e3614a63565b02179055504260048201556005810180546001600160a01b0319166001600160a01b038416908117909155600282018590556001820186905560038201805460ff191690555f81815261015f602090815260408083206101608084528285208054865291845291842088905593835290528154919061386183614e64565b919050555050509392505050565b5f5f613879614341565b6001600160a01b039093165f9081526020939093525050604090205490565b80151561016560019054906101000a900460ff161515036138cc57604051630b255f6560e31b815260040160405180910390fd5b61016580548215156101000261ff001990911617905560405133907fab1a048bccac5341808ad013515562741b3828e61a8d5a70805f52904a4a14979061304190841515815260200190565b80151561016560029054906101000a900460ff1615150361394c57604051630b255f6560e31b815260040160405180910390fd5b6101658054821515620100000262ff00001990911617905560405133907f741cdca152c0d743efd1031abf7d83c6599b6b08f1720d20063816a408c5a3059061304190841515815260200190565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10090565b60605f6139c961399a565b90508060020180546139da90614d06565b80601f0160208091040260200160405190810160405280929190818152602001828054613a0690614d06565b8015613a515780601f10613a2857610100808354040283529160200191613a51565b820191905f5260205f20905b815481529060010190602001808311613a3457829003601f168201915b505050505091505090565b60605f613a6761399a565b90508060030180546139da90614d06565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930090565b610161546040516361ef2c0760e11b8152600481018590525f91479183916001600160a01b03169063c3de580e90602401602060405180830381865afa158015613ae8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b0c9190614e7c565b90508015613c13576101615460405163c65ee0e160e01b8152600481018890525f916001600160a01b03169063c65ee0e190602401602060405180830381865afa158015613b5c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b809190614dff565b90508085613ba45760405163bc28f24160e01b8152600401610ec591815260200190565b508015613c0d5761016154604051630441a3e760e41b815260048101899052602481018890526001600160a01b039091169063441a3e70906044015f604051808303815f87803b158015613bf6575f5ffd5b505af1158015613c08573d5f5f3e3d5ffd5b505050505b50613c75565b61016154604051630441a3e760e41b815260048101889052602481018790526001600160a01b039091169063441a3e70906044015f604051808303815f87803b158015613c5e575f5ffd5b505af1158015613c70573d5f5f3e3d5ffd5b505050505b613c7f8247614d74565b9695505050505050565b6001600160a01b038216613cdf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ec5565b8060345f828254613cf09190614cf3565b90915550506001600160a01b0382165f9081526032602052604081208054839290613d1c908490614cf3565b90915550506040518181526001600160a01b038316905f905f5160206150135f395f51905f529060200160405180910390a35050565b5f5f613d5c614341565b6001600160a01b039093165f90815260209390935250506040902080546001810190915590565b5f610d41613d8f612dbd565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f613dbe87878787614365565b91509150613dcb81614418565b5095945050505050565b613ddf8282611d59565b6110af57808260405163e2517d3f60e01b8152600401610ec5929190614de6565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613e2a61455c565b613e326145c1565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b803b613f055760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610ec5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b613fa55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610ec5565b5f5f846001600160a01b031684604051613fbf9190614e97565b5f60405180830381855af49150503d805f8114613ff7576040519150601f19603f3d011682016040523d82523d5f602084013e613ffc565b606091505b50915091506140248282604051806060016040528060278152602001614fec60279139614600565b95945050505050565b5f6140366133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561405c5750825b90505f826001600160401b031660011480156140775750303b155b905081158015614085575080155b156140a35760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561358c57845460ff60401b1916600160401b1785558315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b5f6141036133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156141295750825b90505f826001600160401b031660011480156141445750303b155b905081158015614152575080155b156141705760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561419957845460ff60401b1916600160401b1785555b60356141a58882614ef1565b5060366141b28782614ef1565b50831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b6141ea614639565b61198f57604051631afcd79f60e31b815260040160405180910390fd5b61420f6141e2565b5f61421861399a565b9050600281016142288482614ef1565b50600381016142378382614ef1565b505f8082556001909101555050565b6127f66141e2565b5f6142576133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561427d5750825b90505f826001600160401b031660011480156142985750303b155b9050811580156142a6575080155b156142c45760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156142ed57845460ff60401b1916600160401b1785555b600161012c558315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b61016980545f918261433383614e64565b919050555061016954905090565b7f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb0090565b5f806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561439057505f9050600361440f565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156143e1573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614409575f6001925092505061440f565b91505f90505b94509492505050565b5f81600481111561442b5761442b614a63565b036144335750565b600181600481111561444757614447614a63565b0361448f5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610ec5565b60028160048111156144a3576144a3614a63565b036144f05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ec5565b600381600481111561450457614504614a63565b036110995760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ec5565b5f5f61456661399a565b90505f6145716139be565b80519091501561458957805160209091012092915050565b81548015614598579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f6145cb61399a565b90505f6145d6613a5c565b8051909150156145ee57805160209091012092915050565b60018201548015614598579392505050565b6060831561460f575081610ee8565b82511561461f5782518084602001fd5b8160405162461bcd60e51b8152600401610ec591906146e3565b5f6146426133d9565b54600160401b900460ff16919050565b6040805160c08101909152805f81526020015f81526020015f81526020015f151581526020015f81526020015f6001600160a01b031681525090565b5f6020828403121561469e575f5ffd5b81356001600160e01b031981168114610ee8575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610ee860208301846146b5565b5f60208284031215614705575f5ffd5b5035919050565b6001600160a01b0381168114611099575f5ffd5b5f5f60408385031215614731575f5ffd5b823561473c8161470c565b946020939093013593505050565b5f5f5f6060848603121561475c575f5ffd5b83356147678161470c565b925060208401356147778161470c565b929592945050506040919091013590565b5f5f60408385031215614799575f5ffd5b8235915060208301356147ab8161470c565b809150509250929050565b5f5f83601f8401126147c6575f5ffd5b5081356001600160401b038111156147dc575f5ffd5b6020830191508360208260051b85010111156147f6575f5ffd5b9250929050565b5f5f5f5f60408587031215614810575f5ffd5b84356001600160401b03811115614825575f5ffd5b614831878288016147b6565b90955093505060208501356001600160401b0381111561484f575f5ffd5b61485b878288016147b6565b95989497509550505050565b5f8151808452602084019350602083015f5b82811015614897578151865260209586019590910190600101614879565b5093949350505050565b602081525f610ee86020830184614867565b5f602082840312156148c3575f5ffd5b8135610ee88161470c565b8015158114611099575f5ffd5b5f602082840312156148eb575f5ffd5b8135610ee8816148ce565b5f5f60408385031215614907575f5ffd5b8235915060208301356147ab816148ce565b5f5f6040838503121561492a575f5ffd5b82356149358161470c565b915060208301356147ab8161470c565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561496a575f5ffd5b82356149758161470c565b915060208301356001600160401b0381111561498f575f5ffd5b8301601f8101851361499f575f5ffd5b80356001600160401b038111156149b8576149b8614945565b604051601f8201601f19908116603f011681016001600160401b03811182821017156149e6576149e6614945565b6040528181528282016020018710156149fd575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f5f5f60808587031215614a2f575f5ffd5b8435614a3a8161470c565b935060208501359250604085013591506060850135614a58816148ce565b939692955090935050565b634e487b7160e01b5f52602160045260245ffd5b60038110614a9357634e487b7160e01b5f52602160045260245ffd5b9052565b614aa2828251614a77565b60208181015190830152604080820151908301526060808201511515908301526080808201519083015260a0908101516001600160a01b0316910152565b602080825282518282018190525f918401906040840190835b81811015614b2257614b0c838551614a97565b6020939093019260c09290920191600101614af9565b509095945050505050565b5f5f60208385031215614b3e575f5ffd5b82356001600160401b03811115614b53575f5ffd5b614b5f858286016147b6565b90969095509350505050565b6001600160a01b0391909116815260200190565b5f5f60408385031215614b90575f5ffd5b50508035926020909101359150565b60ff60f81b8816815260e060208201525f614bbd60e08301896146b5565b8281036040840152614bcf81896146b5565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050614c008185614867565b9a9950505050505050505050565b5f5f5f60408486031215614c20575f5ffd5b83356001600160401b03811115614c35575f5ffd5b614c41868287016147b6565b9094509250506020840135614c55816148ce565b809150509250925092565b60c08101610d418284614a97565b5f5f5f5f5f5f5f60e0888a031215614c84575f5ffd5b8735614c8f8161470c565b96506020880135614c9f8161470c565b95506040880135945060608801359350608088013560ff81168114614cc2575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d4157610d41614cdf565b600181811c90821680614d1a57607f821691505b602082108103614d3857634e487b7160e01b5f52602260045260245ffd5b50919050565b8082028115828204841417610d4157610d41614cdf565b5f82614d6f57634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610d4157610d41614cdf565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b6001600160401b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614e0f575f5ffd5b5051919050565b8481526020810184905260408101839052608081016140246060830184614a77565b8481526020810184905260808101614e536040830185614a77565b821515606083015295945050505050565b5f60018201614e7557614e75614cdf565b5060010190565b5f60208284031215614e8c575f5ffd5b8151610ee8816148ce565b5f82518060208501845e5f920191825250919050565b601f82111561107257805f5260205f20601f840160051c81016020851015614ed25750805b601f840160051c820191505b81811015612fb6575f8155600101614ede565b81516001600160401b03811115614f0a57614f0a614945565b614f1e81614f188454614d06565b84614ead565b6020601f821160018114614f50575f8315614f395750848201515b5f19600385901b1c1916600184901b178455612fb6565b5f84815260208120601f198516915b82811015614f7f5787850151825560209485019460019092019101614f5f565b5084821015614f9c57868401515f19600387901b60f8161c191681555b50505050600190811b0190555056fec7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d297667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220878bf88711d9a4ab569cea8e9c3f387975be6f23a688c792cababf7a3bfb858c64736f6c634300081b0033
Deployed Bytecode
0x6080604052600436106103c2575f3560e01c806379cc6790116101ef578063cc0fe4a41161010b578063d9a34952116100a4578063d9a3495214610b9c578063dd62ed3e14610bbb578063e1e158a514610bff578063e882e4ef14610c19578063ecfb49a314610c38578063ed88c68e14610c4e578063f0f4426014610c56578063f2fde38b14610c75578063f475a7ee14610c94578063f5b541a614610ccb575f5ffd5b8063cc0fe4a414610a97578063cc90ef5c14610ac3578063ce213bc914610ae2578063ceaeee5414610af8578063cf5c3eb714610b18578063d02e92a614610b37578063d0e30db014610b56578063d505accf14610b5e578063d547741f14610b7d575f5ffd5b806395d89b411161018857806395d89b411461097d57806398176a0114610991578063a217fddf146109b0578063a457c2d7146109c3578063a9059cbb146109e2578063ac697e3f14610a01578063c6e6f59214610a20578063c9da089214610a3f578063ca16e3eb14610a6b578063cbecf45514610a81575f5ffd5b806379cc6790146108685780637ecebe001461088757806380d04de8146108a65780638456cb59146108bc57806384b0196e146108d057806386c1b4eb146108f75780638da5cb5b1461092a5780639094631e1461093e57806391d148541461095e575f5ffd5b80633659cfe6116102de5780635ab492fd116102775780635ab492fd1461072f5780635eac62391461074e5780635f2b4c091461047f57806361d027b31461076d578063634b91e31461079a578063679aefce146107b957806370a08231146107cd578063715018a61461080157806371bbf3e71461081557806372f0cb3014610849575f5ffd5b80633659cfe61461061757806337d151391461063657806338d0743614610655578063395093511461067457806342966c6814610693578063485cc955146106b25780634f1ef286146106d1578063538dd2f5146106e4578063543f66a414610710575f5ffd5b806315b78a171161035b57806315b78a17146104f657806318160ddd1461050b57806323b872dd1461051f578063248a9ca31461053e5780632f2ff15d1461055d5780632f3cd6721461057c5780632f3ffb9f146105a8578063313ce567146105c95780633644e515146105e457806336568abe146105f8575f5ffd5b806301e1d114146103f957806301ffc9a7146104205780630288a39c1461044f57806302befd241461046557806306036f3a1461047f57806306fdde031461049757806307a2d13a146104b8578063095ea7b3146104d757806313d4d9721461047f575f5ffd5b366103f557610161546001600160a01b031633146103f35760405163e44a287360e01b815260040160405180910390fd5b005b5f5ffd5b348015610404575f5ffd5b5061040d610ceb565b6040519081526020015b60405180910390f35b34801561042b575f5ffd5b5061043f61043a36600461468e565b610d11565b6040519015158152602001610417565b34801561045a575f5ffd5b5061040d6101645481565b348015610470575f5ffd5b506101655461043f9060ff1681565b34801561048a575f5ffd5b5061040d64e8d4a5100081565b3480156104a2575f5ffd5b506104ab610d47565b60405161041791906146e3565b3480156104c3575f5ffd5b5061040d6104d23660046146f5565b610dd7565b3480156104e2575f5ffd5b5061043f6104f1366004614720565b610e24565b348015610501575f5ffd5b5061040d61271081565b348015610516575f5ffd5b5060345461040d565b34801561052a575f5ffd5b5061043f61053936600461474a565b610e39565b348015610549575f5ffd5b5061040d6105583660046146f5565b610eef565b348015610568575f5ffd5b506103f3610577366004614788565b610f0d565b348015610587575f5ffd5b5061059b6105963660046147fd565b610f2f565b60405161041791906148a1565b3480156105b3575f5ffd5b506101655461043f906301000000900460ff1681565b3480156105d4575f5ffd5b5060405160128152602001610417565b3480156105ef575f5ffd5b5061040d611036565b348015610603575f5ffd5b506103f3610612366004614788565b61103f565b348015610622575f5ffd5b506103f36106313660046148b3565b611077565b348015610641575f5ffd5b506103f36106503660046148db565b61109c565b348015610660575f5ffd5b5061040d61066f3660046148f6565b6110b3565b34801561067f575f5ffd5b5061043f61068e366004614720565b6110f4565b34801561069e575f5ffd5b506103f36106ad3660046146f5565b61112a565b3480156106bd575f5ffd5b506103f36106cc366004614919565b611134565b6103f36106df366004614959565b611368565b3480156106ef575f5ffd5b506107036106fe366004614a1c565b61137d565b6040516104179190614ae0565b34801561071b575f5ffd5b506103f361072a3660046148db565b611662565b34801561073a575f5ffd5b506101655461043f90610100900460ff1681565b348015610759575f5ffd5b506103f3610768366004614b2d565b611675565b348015610778575f5ffd5b506101625461078d906001600160a01b031681565b6040516104179190614b6b565b3480156107a5575f5ffd5b5061040d6107b4366004614b7f565b611938565b3480156107c4575f5ffd5b5061040d61196c565b3480156107d8575f5ffd5b5061040d6107e73660046148b3565b6001600160a01b03165f9081526032602052604090205490565b34801561080c575f5ffd5b506103f361197e565b348015610820575f5ffd5b5061083461082f366004614b7f565b611991565b60408051928352602083019190915201610417565b348015610854575f5ffd5b506103f36108633660046146f5565b611b86565b348015610873575f5ffd5b506103f3610882366004614720565b611bd0565b348015610892575f5ffd5b5061040d6108a13660046148b3565b611c52565b3480156108b1575f5ffd5b5061040d6101665481565b3480156108c7575f5ffd5b506103f3611c5c565b3480156108db575f5ffd5b506108e4611c9b565b6040516104179796959493929190614b9f565b348015610902575f5ffd5b5061040d7ff7db13299c8a9e501861f04c20f69a2444829a36a363cfad4b58864709c7556081565b348015610935575f5ffd5b5061078d611d3f565b348015610949575f5ffd5b506101615461078d906001600160a01b031681565b348015610969575f5ffd5b5061043f610978366004614788565b611d59565b348015610988575f5ffd5b506104ab611d8d565b34801561099c575f5ffd5b506103f36109ab3660046146f5565b611d9c565b3480156109bb575f5ffd5b5061040d5f81565b3480156109ce575f5ffd5b5061043f6109dd366004614720565b611dff565b3480156109ed575f5ffd5b5061043f6109fc366004614720565b611e99565b348015610a0c575f5ffd5b5061059b610a1b366004614c0e565b611ea5565b348015610a2b575f5ffd5b5061040d610a3a3660046146f5565b611f73565b348015610a4a575f5ffd5b5061040d610a593660046148b3565b6101606020525f908152604090205481565b348015610a76575f5ffd5b5061040d6101695481565b348015610a8c575f5ffd5b5061040d6101635481565b348015610aa2575f5ffd5b50610ab6610ab13660046146f5565b611fae565b6040516104179190614c60565b348015610ace575f5ffd5b506103f3610add3660046148db565b612042565b348015610aed575f5ffd5b5061040d6101685481565b348015610b03575f5ffd5b506101655461043f9062010000900460ff1681565b348015610b23575f5ffd5b5061040d610b323660046148f6565b612055565b348015610b42575f5ffd5b5061040d610b513660046146f5565b61221f565b61040d612344565b348015610b69575f5ffd5b506103f3610b78366004614c6e565b61243c565b348015610b88575f5ffd5b506103f3610b97366004614788565b612555565b348015610ba7575f5ffd5b5061040d610bb6366004614b7f565b612571565b348015610bc6575f5ffd5b5061040d610bd5366004614919565b6001600160a01b039182165f90815260336020908152604080832093909416825291909152205490565b348015610c0a575f5ffd5b5061040d662386f26fc1000081565b348015610c24575f5ffd5b506103f3610c333660046148db565b6126b8565b348015610c43575f5ffd5b5061040d6101675481565b6103f36126cb565b348015610c61575f5ffd5b506103f3610c703660046148b3565b612770565b348015610c80575f5ffd5b506103f3610c8f3660046148b3565b6127ee565b348015610c9f575f5ffd5b5061040d610cae366004614720565b61015f60209081525f928352604080842090915290825290205481565b348015610cd6575f5ffd5b5061040d5f516020614fcc5f395f51905f5281565b5f610168546101665461016754610d029190614cf3565b610d0c9190614cf3565b905090565b5f6001600160e01b03198216637965db0b60e01b1480610d4157506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060358054610d5690614d06565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8290614d06565b8015610dcd5780601f10610da457610100808354040283529160200191610dcd565b820191905f5260205f20905b815481529060010190602001808311610db057829003601f168201915b5050505050905090565b5f5f610de1610ceb565b90505f610ded60345490565b9050811580610dfa575080155b15610e0757509192915050565b80610e128386614d3e565b610e1c9190614d55565b949350505050565b5f610e30338484612828565b50600192915050565b5f610e4584848461294c565b6001600160a01b0384165f90815260336020908152604080832033845290915290205482811015610ece5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610ee28533610edd8685614d74565b612828565b60019150505b9392505050565b5f5f610ef9612b0f565b5f9384526020525050604090206001015490565b610f1682610eef565b610f1f81612b33565b610f298383612b3d565b50505050565b6060600261012c5403610f545760405162461bcd60e51b8152600401610ec590614d87565b600261012c55838214610f7a5760405163512509d360e11b815260040160405180910390fd5b836001600160401b03811115610f9257610f92614945565b604051908082528060200260200182016040528015610fbb578160200160208202803683370190505b5090505f5b8481101561102757611002868683818110610fdd57610fdd614dbe565b90506020020135858584818110610ff657610ff6614dbe565b90506020020135612bdb565b82828151811061101457611014614dbe565b6020908102919091010152600101610fc0565b50600161012c55949350505050565b5f610d0c612dbd565b6001600160a01b03811633146110685760405163334bd91960e11b815260040160405180910390fd5b6110728282612dc6565b505050565b61108081612e3c565b6110998160405180602001604052805f8152505f612e44565b50565b5f6110a681612b33565b6110af82612fbd565b5050565b5f600261012c54036110d75760405162461bcd60e51b8152600401610ec590614d87565b600261012c556110e7838361304c565b600161012c559392505050565b335f8181526033602090815260408083206001600160a01b03871684529091528120549091610e30918590610edd908690614cf3565b61109933826132a0565b5f61113d6133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156111635750825b90505f826001600160401b0316600114801561117e5750303b155b90508115801561118c575080155b156111aa5760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156111d357845460ff60401b1916600160401b1785555b6112236040518060400160405280601481526020017353757072614669205374616b656420536f6e696360601b81525060405180604001604052806002815260200161735360f01b8152506133fd565b61122b6134dd565b6112606040518060400160405280601481526020017353757072614669205374616b656420536f6e696360601b8152506135ca565b611269336135f5565b6112716134dd565b611279613606565b6112835f33612b3d565b506001600160a01b0387166112ab576040516377edc7f960e11b815260040160405180910390fd5b6001600160a01b0386166112d25760405163dfc4d44d60e01b815260040160405180910390fd5b61016180546001600160a01b03808a166001600160a01b0319928316179092556101628054928916929091169190911790556212750061016455610165805463ffffffff191690556103e861016355606461016955831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b60405180910390a15b50505050505050565b61137182612e3c565b6110af82826001612e44565b6001600160a01b0384165f908152610160602052604090205460609084106113b85760405163f9cc1ec960e01b815260040160405180910390fd5b5f83116113d8576040516308f5521560e21b815260040160405180910390fd5b6001600160a01b0385165f90815261016060205260408120546113fc908690614d74565b90505f84821061140c578461140e565b815b90505f816001600160401b0381111561142957611429614945565b60405190808252806020026020018201604052801561146257816020015b61144f614652565b8152602001906001900390816114475790505b5090505f5b82811015611656578561155d576001600160a01b0389165f90815261015f6020526040812061015e91908161149c858d614cf3565b81526020019081526020015f205481526020019081526020015f206040518060c00160405290815f82015f9054906101000a900460ff1660028111156114e4576114e4614a63565b60028111156114f5576114f5614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a090910152825183908390811061154d5761154d614dbe565b602002602001018190525061164e565b6001600160a01b0389165f90815261015f6020526040812061015e9190818461158760018a614d74565b6115919190614d74565b81526020019081526020015f205481526020019081526020015f206040518060c00160405290815f82015f9054906101000a900460ff1660028111156115d9576115d9614a63565b60028111156115ea576115ea614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a090910152825183908390811061164257611642614dbe565b60200260200101819052505b600101611467565b50979650505050505050565b5f61166c81612b33565b6110af826136ad565b600261012c54036116985760405162461bcd60e51b8152600401610ec590614d87565b600261012c557ff7db13299c8a9e501861f04c20f69a2444829a36a363cfad4b58864709c755606116c881612b33565b475f5b838110156117e557610161545f906001600160a01b0316636099ecb2308888868181106116fa576116fa614dbe565b905060200201356040518363ffffffff1660e01b815260040161171e929190614de6565b602060405180830381865afa158015611739573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061175d9190614dff565b905080156117dc57610161546001600160a01b0316630962ef7987878581811061178957611789614dbe565b905060200201356040518263ffffffff1660e01b81526004016117ae91815260200190565b5f604051808303815f87803b1580156117c5575f5ffd5b505af11580156117d7573d5f5f3e3d5ffd5b505050505b506001016116cb565b505f6117f18247614d74565b905064e8d4a510008111611818576040516322a3f28960e01b815260040160405180910390fd5b610163545f90156118d95761271061016354836118359190614d3e565b61183f9190614d55565b905061184b8183614d74565b6101675f82825461185c9190614cf3565b9091555050610162546040515f916001600160a01b03169083908381818185875af1925050503d805f81146118ac576040519150601f19603f3d011682016040523d82523d5f602084013e6118b1565b606091505b50509050806118d357604051630dbefa6760e41b815260040160405180910390fd5b506118f1565b816101675f8282546118eb9190614cf3565b90915550505b60408051838152602081018390527f38be9b012e428704c0fb2b81dfd53444b76ac4cd45c46cfd2d661f73d97cf47b910160405180910390a15050600161012c5550505050565b5f600261012c540361195c5760405162461bcd60e51b8152600401610ec590614d87565b600261012c556110e78383612bdb565b5f610d0c670de0b6b3a7640000610dd7565b61198661371d565b61198f5f61374f565b565b5f5f600261012c54036119b65760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f526119d381612b33565b5f84116119f357604051638f8de2cf60e01b815260040160405180910390fd5b6101615460405163cfd4766360e01b81525f916001600160a01b03169063cfd4766390611a269030908a90600401614de6565b602060405180830381865afa158015611a41573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a659190614dff565b905080851115611a73578094505b8581611a9557604051637f7b8b8d60e01b8152600401610ec591815260200190565b50611aa2600287876137a9565b9350846101665f828254611ab69190614d74565b92505081905550846101685f828254611acf9190614cf3565b9091555050610161546040516313e1937d60e21b81526004810188905260248101869052604481018790526001600160a01b0390911690634f864df4906064015f604051808303815f87803b158015611b26575f5ffd5b505af1158015611b38573d5f5f3e3d5ffd5b5050505085847fcaf027f94096d868021d65cb574bfd69f91946a2f8ac9d3dd82eae0fc743d59187604051611b6f91815260200190565b60405180910390a35050600161012c555092909150565b5f611b9081612b33565b61016482905560405182815233907fd30864fe562875819420946502b0d79444034cd8fc7c1f77406a434a3858dc47906020015b60405180910390a25050565b5f611bdb8333610bd5565b905081811015611c395760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b6064820152608401610ec5565b611c488333610edd8585614d74565b61107283836132a0565b5f610d418261386f565b5f516020614fcc5f395f51905f52611c7381612b33565b611c7d60016136ad565b611c876001613898565b611c916001613918565b6110996001612fbd565b5f6060805f5f5f60605f611cad61399a565b8054909150158015611cc157506001810154155b611d055760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610ec5565b611d0d6139be565b611d15613a5c565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b5f5f611d49613a78565b546001600160a01b031692915050565b5f5f611d63612b0f565b5f948552602090815260408086206001600160a01b03959095168652939052505090205460ff1690565b606060368054610d5690614d06565b5f611da681612b33565b612710821115611dc95760405163499fddb160e01b815260040160405180910390fd5b610163829055604051829033907f389f6e01d911ce2a6919bdcf4e57d270003243ca9c54e7911454a70f89aee19e905f90a35050565b335f9081526033602090815260408083206001600160a01b038616845290915281205482811015611e805760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610ec5565b611e8f3385610edd8685614d74565b5060019392505050565b5f610e3033848461294c565b6060600261012c5403611eca5760405162461bcd60e51b8152600401610ec590614d87565b600261012c55826001600160401b03811115611ee857611ee8614945565b604051908082528060200260200182016040528015611f11578160200160208202803683370190505b5090505f5b83811015611f6557611f40858583818110611f3357611f33614dbe565b905060200201358461304c565b828281518110611f5257611f52614dbe565b6020908102919091010152600101611f16565b50600161012c559392505050565b5f5f611f7d610ceb565b90505f611f8960345490565b9050811580611f96575080155b15611fa357509192915050565b81610e128286614d3e565b611fb6614652565b5f82815261015e602052604090819020815160c081019092528054829060ff166002811115611fe757611fe7614a63565b6002811115611ff857611ff8614a63565b81526001820154602082015260028201546040820152600382015460ff1615156060820152600482015460808201526005909101546001600160a01b031660a09091015292915050565b5f61204c81612b33565b6110af82613898565b5f600261012c54036120795760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f5261209681612b33565b5f84815261015e602052604081206101645460048201548793916120b991614cf3565b90505f82600401541183906120e45760405163f4670c0560e01b8152600401610ec591815260200190565b5080421015839061210b57604051636f9550f360e11b8152600401610ec591815260200190565b506003820154839060ff161561213757604051634d3258cf60e01b8152600401610ec591815260200190565b505f87815261015e602052604090206002815460ff16600281111561215e5761215e614a63565b1461217c57604051631d62f57560e11b815260040160405180910390fd5b60038101805460ff191660019081179091558101545f9061219e908a8a613a9c565b905081600201546101685f8282546121b69190614d74565b92505081905550806101675f8282546121cf9190614cf3565b9091555050604051818152881515908a907f33e55d5beb676e4238c78d4adacacb11d125de294fe3017556a2962b3a59cfb69060200160405180910390a3600161012c5598975050505050505050565b5f600261012c54036122435760405162461bcd60e51b8152600401610ec590614d87565b600261012c556101655462010000900460ff16156122745760405163c81ab54160e01b815260040160405180910390fd5b64e8d4a5100082101561229a576040516311a660bb60e31b815260040160405180910390fd5b5f6122a483610dd7565b9050610167548111156122ca57604051630f69494160e01b815260040160405180910390fd5b6122d433846132a0565b6122df5f5f836137a9565b9150806101675f8282546122f39190614d74565b909155505060405133907f04fcca04f81983ffc61b309cc6d2935c3e78576bed7045f109b779920d0a1455906123309085905f9086908290614e16565b60405180910390a250600161012c55919050565b5f600261012c54036123685760405162461bcd60e51b8152600401610ec590614d87565b600261012c5534662386f26fc1000081101561239757604051636ba4a1c760e01b815260040160405180910390fd5b6101655460ff16156123bc5760405163035edea360e41b815260040160405180910390fd5b335f6123c783611f73565b9050826101675f8282546123db9190614cf3565b909155506123eb90508282613c89565b60408051848152602081018390526001600160a01b038416917f73a19dd210f1a7f902193214c0ee91dd35ee5b4d920cba8d519eca65a7b488ca910160405180910390a292505050600161012c5590565b834211156124605760405163313c898160e11b815260048101859052602401610ec5565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861248e8c613d52565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6124e882613d83565b90505f6124f782878787613daf565b9050896001600160a01b0316816001600160a01b03161461253e576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401610ec5565b6125498a8a8a612828565b50505050505050505050565b61255e82610eef565b61256781612b33565b610f298383612dc6565b5f600261012c54036125955760405162461bcd60e51b8152600401610ec590614d87565b600261012c555f516020614fcc5f395f51905f526125b281612b33565b610167548311156125c4576101675492505b5f83116125e4576040516323c9a98560e21b815260040160405180910390fd5b826101675f8282546125f69190614d74565b92505081905550826101665f82825461260f9190614cf3565b909155505061016154604051639fa6dd3560e01b8152600481018690526001600160a01b0390911690639fa6dd359085906024015f604051808303818588803b15801561265a575f5ffd5b505af115801561266c573d5f5f3e3d5ffd5b5050505050837fdf2a7c5f7a567419f37f5bba40b572a4500cdf7c85f7b18a67c6dba1b94fba3b846040516126a391815260200190565b60405180910390a25050600161012c55919050565b5f6126c281612b33565b6110af82613918565b5f516020614fcc5f395f51905f526126e281612b33565b3480612701576040516304e224ef60e21b815260040160405180910390fd5b64e8d4a5100081101561272757604051631ab3412960e31b815260040160405180910390fd5b806101675f8282546127399190614cf3565b909155505060405181815233907f2a01595cddf097c90216094025db714da3f4e5bd8877b56ba86a24ecead8e54390602001611bc4565b5f61277a81612b33565b6001600160a01b0382166127a15760405163dfc4d44d60e01b815260040160405180910390fd5b61016280546001600160a01b0319166001600160a01b03841690811790915560405133907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a905f90a35050565b6127f661371d565b6001600160a01b03811661281f575f604051631e4fbdf760e01b8152600401610ec59190614b6b565b6110998161374f565b6001600160a01b03831661288a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610ec5565b6001600160a01b0382166128eb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610ec5565b6001600160a01b038381165f8181526033602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166129b05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610ec5565b6001600160a01b038216612a125760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610ec5565b6001600160a01b0383165f9081526032602052604090205481811015612a895760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610ec5565b612a938282614d74565b6001600160a01b038086165f908152603260205260408082209390935590851681529081208054849290612ac8908490614cf3565b92505081905550826001600160a01b0316846001600160a01b03165f5160206150135f395f51905f5284604051612b0191815260200190565b60405180910390a350505050565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680090565b6110998133613dd5565b5f5f612b47612b0f565b9050612b538484611d59565b612bd2575f848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612b883390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610d41565b5f915050610d41565b610165545f90610100900460ff1615612c0757604051636980976360e01b815260040160405180910390fd5b64e8d4a51000821015612c2d576040516311a660bb60e31b815260040160405180910390fd5b5f612c3783610dd7565b6101615460405163cfd4766360e01b81529192505f916001600160a01b039091169063cfd4766390612c6f9030908990600401614de6565b602060405180830381865afa158015612c8a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612cae9190614dff565b90508481831115612cd557604051630963904360e01b8152600401610ec591815260200190565b50612ce033856132a0565b612cec600186846137a9565b9250816101665f828254612d009190614d74565b9091555050610161546040516313e1937d60e21b81526004810187905260248101859052604481018490526001600160a01b0390911690634f864df4906064015f604051808303815f87803b158015612d57575f5ffd5b505af1158015612d69573d5f5f3e3d5ffd5b50505050336001600160a01b03167f04fcca04f81983ffc61b309cc6d2935c3e78576bed7045f109b779920d0a14558487856001604051612dad9493929190614e16565b60405180910390a2505092915050565b5f610d0c613e00565b5f5f612dd0612b0f565b9050612ddc8484611d59565b15612bd2575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610d41565b61109961371d565b5f612e4d613e73565b9050612e5884613ea1565b5f83511180612e645750815b15612e7557612e738484613f46565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16612fb657805460ff19166001178155604051612ef0908690612ec1908590602401614b6b565b60408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052613f46565b50805460ff19168155612f01613e73565b6001600160a01b0316826001600160a01b031614612f795760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610ec5565b612f8285613ea1565b6040516001600160a01b038616907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a25b5050505050565b80151561016560039054906101000a900460ff16151503612ff157604051630b255f6560e31b815260040160405180910390fd5b610165805482151563010000000263ff0000001990911617905560405133907f992a56a5f570253ef03d7f98a2dcee0a0fac86c31e69a225fa7661544b4a3fa39061304190841515815260200190565b60405180910390a250565b5f82815261015e6020526040812061016454600482015485929184916130729190614cf3565b90505f826004015411839061309d5760405163f4670c0560e01b8152600401610ec591815260200190565b508042101583906130c457604051636f9550f360e11b8152600401610ec591815260200190565b506003820154839060ff16156130f057604051634d3258cf60e01b8152600401610ec591815260200190565b50610165546301000000900460ff161561311d576040516318863d4d60e01b815260040160405180910390fd5b5f86815261015e60205260409020600581015487906001600160a01b0316331461315d57604051634b35344d60e11b8152600401610ec591815260200190565b506002815460ff16600281111561317657613176614a63565b0361319457604051631d62f57560e11b815260040160405180910390fd5b60038101805460ff191660011790555f80825460ff1660028111156131bb576131bb614a63565b036131cb575060028101546131dd565b6131da82600101548989613a9c565b90505b60405133905f90829084908381818185875af1925050503d805f811461321e576040519150601f19603f3d011682016040523d82523d5f602084013e613223565b606091505b505090508061324557604051633d2cec6f60e21b815260040160405180910390fd5b83546040516001600160a01b038416917f16ede7d26353101f14a572719bc335a26d49880445bfcd03df637065fc14bf4c9161328a918e91889160ff16908f90614e38565b60405180910390a2509098975050505050505050565b6001600160a01b0382166133005760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610ec5565b6001600160a01b0382165f90815260326020526040902054818110156133735760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610ec5565b61337d8282614d74565b6001600160a01b0384165f90815260326020526040812091909155603480548492906133aa908490614d74565b90915550506040518281525f906001600160a01b038516905f5160206150135f395f51905f529060200161293f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b5f6134066133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561342c5750825b90505f826001600160401b031660011480156134475750303b155b905081158015613455575080155b156134735760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561349c57845460ff60401b1916600160401b1785555b6134a461402d565b6134ae87876140fa565b831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b5f6134e66133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561350c5750825b90505f826001600160401b031660011480156135275750303b155b905081158015613535575080155b156135535760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561357c57845460ff60401b1916600160401b1785555b61358461402d565b61358c61402d565b8315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b60405180910390a15050505050565b6135d26141e2565b61109981604051806040016040528060018152602001603160f81b815250614207565b6135fd6141e2565b61109981614246565b5f61360f6133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156136355750825b90505f826001600160401b031660011480156136505750303b155b90508115801561365e575080155b1561367c5760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156136a557845460ff60401b1916600160401b1785555b61358c61424e565b6101655481151560ff9091161515036136d957604051630b255f6560e31b815260040160405180910390fd5b610165805460ff191682151590811790915560405190815233907fb93c20d2a2cf84896b1c3aeb9dd18a8557c4da5cc8e4e8d48b7b0bd9eb3dcf0e90602001613041565b33613726611d3f565b6001600160a01b03161461198f573360405163118cdaa760e01b8152600401610ec59190614b6b565b5f613758613a78565b80546001600160a01b038481166001600160a01b031983168117845560405193945091169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b5f336137b3614322565b5f81815261015e602052604090208054919350908690829060ff191660018360028111156137e3576137e3614a63565b02179055504260048201556005810180546001600160a01b0319166001600160a01b038416908117909155600282018590556001820186905560038201805460ff191690555f81815261015f602090815260408083206101608084528285208054865291845291842088905593835290528154919061386183614e64565b919050555050509392505050565b5f5f613879614341565b6001600160a01b039093165f9081526020939093525050604090205490565b80151561016560019054906101000a900460ff161515036138cc57604051630b255f6560e31b815260040160405180910390fd5b61016580548215156101000261ff001990911617905560405133907fab1a048bccac5341808ad013515562741b3828e61a8d5a70805f52904a4a14979061304190841515815260200190565b80151561016560029054906101000a900460ff1615150361394c57604051630b255f6560e31b815260040160405180910390fd5b6101658054821515620100000262ff00001990911617905560405133907f741cdca152c0d743efd1031abf7d83c6599b6b08f1720d20063816a408c5a3059061304190841515815260200190565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10090565b60605f6139c961399a565b90508060020180546139da90614d06565b80601f0160208091040260200160405190810160405280929190818152602001828054613a0690614d06565b8015613a515780601f10613a2857610100808354040283529160200191613a51565b820191905f5260205f20905b815481529060010190602001808311613a3457829003601f168201915b505050505091505090565b60605f613a6761399a565b90508060030180546139da90614d06565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930090565b610161546040516361ef2c0760e11b8152600481018590525f91479183916001600160a01b03169063c3de580e90602401602060405180830381865afa158015613ae8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b0c9190614e7c565b90508015613c13576101615460405163c65ee0e160e01b8152600481018890525f916001600160a01b03169063c65ee0e190602401602060405180830381865afa158015613b5c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b809190614dff565b90508085613ba45760405163bc28f24160e01b8152600401610ec591815260200190565b508015613c0d5761016154604051630441a3e760e41b815260048101899052602481018890526001600160a01b039091169063441a3e70906044015f604051808303815f87803b158015613bf6575f5ffd5b505af1158015613c08573d5f5f3e3d5ffd5b505050505b50613c75565b61016154604051630441a3e760e41b815260048101889052602481018790526001600160a01b039091169063441a3e70906044015f604051808303815f87803b158015613c5e575f5ffd5b505af1158015613c70573d5f5f3e3d5ffd5b505050505b613c7f8247614d74565b9695505050505050565b6001600160a01b038216613cdf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610ec5565b8060345f828254613cf09190614cf3565b90915550506001600160a01b0382165f9081526032602052604081208054839290613d1c908490614cf3565b90915550506040518181526001600160a01b038316905f905f5160206150135f395f51905f529060200160405180910390a35050565b5f5f613d5c614341565b6001600160a01b039093165f90815260209390935250506040902080546001810190915590565b5f610d41613d8f612dbd565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f613dbe87878787614365565b91509150613dcb81614418565b5095945050505050565b613ddf8282611d59565b6110af57808260405163e2517d3f60e01b8152600401610ec5929190614de6565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613e2a61455c565b613e326145c1565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b803b613f055760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610ec5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b613fa55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610ec5565b5f5f846001600160a01b031684604051613fbf9190614e97565b5f60405180830381855af49150503d805f8114613ff7576040519150601f19603f3d011682016040523d82523d5f602084013e613ffc565b606091505b50915091506140248282604051806060016040528060278152602001614fec60279139614600565b95945050505050565b5f6140366133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561405c5750825b90505f826001600160401b031660011480156140775750303b155b905081158015614085575080155b156140a35760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561358c57845460ff60401b1916600160401b1785558315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b5f6141036133d9565b805490915060ff600160401b82041615906001600160401b03165f811580156141295750825b90505f826001600160401b031660011480156141445750303b155b905081158015614152575080155b156141705760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561419957845460ff60401b1916600160401b1785555b60356141a58882614ef1565b5060366141b28782614ef1565b50831561135f57845460ff60401b191685556040515f516020614fac5f395f51905f529061135690600190614dd2565b6141ea614639565b61198f57604051631afcd79f60e31b815260040160405180910390fd5b61420f6141e2565b5f61421861399a565b9050600281016142288482614ef1565b50600381016142378382614ef1565b505f8082556001909101555050565b6127f66141e2565b5f6142576133d9565b805490915060ff600160401b82041615906001600160401b03165f8115801561427d5750825b90505f826001600160401b031660011480156142985750303b155b9050811580156142a6575080155b156142c45760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156142ed57845460ff60401b1916600160401b1785555b600161012c558315612fb657845460ff60401b191685556040515f516020614fac5f395f51905f52906135bb90600190614dd2565b61016980545f918261433383614e64565b919050555061016954905090565b7f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb0090565b5f806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561439057505f9050600361440f565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156143e1573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614409575f6001925092505061440f565b91505f90505b94509492505050565b5f81600481111561442b5761442b614a63565b036144335750565b600181600481111561444757614447614a63565b0361448f5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610ec5565b60028160048111156144a3576144a3614a63565b036144f05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ec5565b600381600481111561450457614504614a63565b036110995760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610ec5565b5f5f61456661399a565b90505f6145716139be565b80519091501561458957805160209091012092915050565b81548015614598579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f6145cb61399a565b90505f6145d6613a5c565b8051909150156145ee57805160209091012092915050565b60018201548015614598579392505050565b6060831561460f575081610ee8565b82511561461f5782518084602001fd5b8160405162461bcd60e51b8152600401610ec591906146e3565b5f6146426133d9565b54600160401b900460ff16919050565b6040805160c08101909152805f81526020015f81526020015f81526020015f151581526020015f81526020015f6001600160a01b031681525090565b5f6020828403121561469e575f5ffd5b81356001600160e01b031981168114610ee8575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610ee860208301846146b5565b5f60208284031215614705575f5ffd5b5035919050565b6001600160a01b0381168114611099575f5ffd5b5f5f60408385031215614731575f5ffd5b823561473c8161470c565b946020939093013593505050565b5f5f5f6060848603121561475c575f5ffd5b83356147678161470c565b925060208401356147778161470c565b929592945050506040919091013590565b5f5f60408385031215614799575f5ffd5b8235915060208301356147ab8161470c565b809150509250929050565b5f5f83601f8401126147c6575f5ffd5b5081356001600160401b038111156147dc575f5ffd5b6020830191508360208260051b85010111156147f6575f5ffd5b9250929050565b5f5f5f5f60408587031215614810575f5ffd5b84356001600160401b03811115614825575f5ffd5b614831878288016147b6565b90955093505060208501356001600160401b0381111561484f575f5ffd5b61485b878288016147b6565b95989497509550505050565b5f8151808452602084019350602083015f5b82811015614897578151865260209586019590910190600101614879565b5093949350505050565b602081525f610ee86020830184614867565b5f602082840312156148c3575f5ffd5b8135610ee88161470c565b8015158114611099575f5ffd5b5f602082840312156148eb575f5ffd5b8135610ee8816148ce565b5f5f60408385031215614907575f5ffd5b8235915060208301356147ab816148ce565b5f5f6040838503121561492a575f5ffd5b82356149358161470c565b915060208301356147ab8161470c565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561496a575f5ffd5b82356149758161470c565b915060208301356001600160401b0381111561498f575f5ffd5b8301601f8101851361499f575f5ffd5b80356001600160401b038111156149b8576149b8614945565b604051601f8201601f19908116603f011681016001600160401b03811182821017156149e6576149e6614945565b6040528181528282016020018710156149fd575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f5f5f60808587031215614a2f575f5ffd5b8435614a3a8161470c565b935060208501359250604085013591506060850135614a58816148ce565b939692955090935050565b634e487b7160e01b5f52602160045260245ffd5b60038110614a9357634e487b7160e01b5f52602160045260245ffd5b9052565b614aa2828251614a77565b60208181015190830152604080820151908301526060808201511515908301526080808201519083015260a0908101516001600160a01b0316910152565b602080825282518282018190525f918401906040840190835b81811015614b2257614b0c838551614a97565b6020939093019260c09290920191600101614af9565b509095945050505050565b5f5f60208385031215614b3e575f5ffd5b82356001600160401b03811115614b53575f5ffd5b614b5f858286016147b6565b90969095509350505050565b6001600160a01b0391909116815260200190565b5f5f60408385031215614b90575f5ffd5b50508035926020909101359150565b60ff60f81b8816815260e060208201525f614bbd60e08301896146b5565b8281036040840152614bcf81896146b5565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050614c008185614867565b9a9950505050505050505050565b5f5f5f60408486031215614c20575f5ffd5b83356001600160401b03811115614c35575f5ffd5b614c41868287016147b6565b9094509250506020840135614c55816148ce565b809150509250925092565b60c08101610d418284614a97565b5f5f5f5f5f5f5f60e0888a031215614c84575f5ffd5b8735614c8f8161470c565b96506020880135614c9f8161470c565b95506040880135945060608801359350608088013560ff81168114614cc2575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d4157610d41614cdf565b600181811c90821680614d1a57607f821691505b602082108103614d3857634e487b7160e01b5f52602260045260245ffd5b50919050565b8082028115828204841417610d4157610d41614cdf565b5f82614d6f57634e487b7160e01b5f52601260045260245ffd5b500490565b81810381811115610d4157610d41614cdf565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b6001600160401b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614e0f575f5ffd5b5051919050565b8481526020810184905260408101839052608081016140246060830184614a77565b8481526020810184905260808101614e536040830185614a77565b821515606083015295945050505050565b5f60018201614e7557614e75614cdf565b5060010190565b5f60208284031215614e8c575f5ffd5b8151610ee8816148ce565b5f82518060208501845e5f920191825250919050565b601f82111561107257805f5260205f20601f840160051c81016020851015614ed25750805b601f840160051c820191505b81811015612fb6575f8155600101614ede565b81516001600160401b03811115614f0a57614f0a614945565b614f1e81614f188454614d06565b84614ead565b6020601f821160018114614f50575f8315614f395750848201515b5f19600385901b1c1916600184901b178455612fb6565b5f84815260208120601f198516915b82811015614f7f5787850151825560209485019460019092019101614f5f565b5084821015614f9c57868401515f19600387901b60f8161c191681555b50505050600190811b0190555056fec7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d297667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220878bf88711d9a4ab569cea8e9c3f387975be6f23a688c792cababf7a3bfb858c64736f6c634300081b0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.