Overview
MNT Balance
MNT Value
$0.00Latest 14 from a total of 14 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Deposited | 80833280 | 226 days ago | IN | 0 MNT | 0.00220705 | ||||
| Deposited | 80833216 | 226 days ago | IN | 0 MNT | 0.00219583 | ||||
| Withdraw | 79191761 | 264 days ago | IN | 0 MNT | 0.00267803 | ||||
| Withdraw | 79177823 | 265 days ago | IN | 0 MNT | 0.00268334 | ||||
| Unlock Lockups | 79177403 | 265 days ago | IN | 0 MNT | 0.00135731 | ||||
| Withdraw | 79177177 | 265 days ago | IN | 0 MNT | 0.00267823 | ||||
| Withdraw | 79177156 | 265 days ago | IN | 0 MNT | 0.00268288 | ||||
| Withdraw | 79177058 | 265 days ago | IN | 0 MNT | 0.0026896 | ||||
| Withdraw | 79176932 | 265 days ago | IN | 0 MNT | 0.00268413 | ||||
| Withdraw | 79176901 | 265 days ago | IN | 0 MNT | 0.00268974 | ||||
| Withdraw | 79176869 | 265 days ago | IN | 0 MNT | 0.00269157 | ||||
| Withdraw | 79176750 | 265 days ago | IN | 0 MNT | 0.00269071 | ||||
| Withdraw | 79176688 | 265 days ago | IN | 0 MNT | 0.00268887 | ||||
| Deposit | 68265340 | 517 days ago | IN | 0.0174767 MNT | 0.00492034 |
View more zero value Internal Transactions in Advanced View mode
Cross-Chain Transactions
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {ReentrancyGuardUpgradeable} from "openzeppelin-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import {EnumerableMap} from "openzeppelin/utils/structs/EnumerableMap.sol";
import {EnumerableSet} from "openzeppelin/utils/structs/EnumerableSet.sol";
import {Address} from "openzeppelin/utils/Address.sol";
import {ProtocolEvents} from "./interfaces/ProtocolEvents.sol";
import {BareVaultUpgradable} from "./BareVaultUpgradable.sol";
import {LockupUpgradable} from "./LockupUpgradable.sol";
import {IPauser} from "./interfaces/IPauser.sol";
contract StakingMNT is ProtocolEvents, BareVaultUpgradable, LockupUpgradable, ReentrancyGuardUpgradeable {
// errors
error AddressZeroNotExpected();
error UnexpectedInitialize();
error UnexpectedAmount();
error InsufficientWithdrawableBalance();
error DepositOverBond();
error Cooldown();
error Paused();
error DepositAmountTooSmall(address receiver, uint256 amount, uint256 minStake);
// event
event DepositWithDuration(address indexed owner, uint256 lockStart, uint256 amount, uint256 duration);
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.AddressToUintMap;
// ------- LOGICS ------- //
/// cooldown, minStake, maxStake
bytes32 public constant STAKING_OPERATOR_ROLE = keccak256("STAKING_OPERATOR_ROLE");
mapping(address => uint256) internal _userStakeCooldown;
// The contract for indicating if staking is paused.
IPauser public pauser;
// the address of allocator register
address public allocator;
/// @notice Stake cooldown, not allowed to unstake when still in cool down duration
/// This is to prevent high frequency reward sniping; or other borrow / flashloan to stake exploits.
uint256 public cooldown;
/// @notice stake min limit, limit on every staking
uint256 public minStake;
/// @notice stake max limit, limit on total supply
uint256 public maxStakeSupply;
receive() external payable override { deposit(msg.value); }
fallback() external payable { revert("Not Allowed"); }
// --------- Initialize ---------- //
/// @notice Init params
struct Init {
address admin;
address operator;
address pauser;
address asset;
uint256 cooldown;
uint256 minStake;
uint256 maxStakeSupply;
address allocator;
}
constructor() {
_disableInitializers();
}
function initialize(Init calldata init) external initializer {
if (init.asset != address(0)) {
revert UnexpectedInitialize();
}
__BareVault_init(init.asset);
__ReentrancyGuard_init();
// set admin roles
_setRoleAdmin(STAKING_OPERATOR_ROLE, DEFAULT_ADMIN_ROLE);
// grant admin roles
_grantRole(DEFAULT_ADMIN_ROLE, init.admin);
// grant sub roles
_grantRole(STAKING_OPERATOR_ROLE, init.operator);
// set slot
cooldown = init.cooldown;
minStake = init.minStake;
maxStakeSupply = init.maxStakeSupply;
allocator = init.allocator;
pauser = IPauser(init.pauser);
// initial durations
acceptedDurations.add(50 days);
acceptedDurations.add(100 days);
acceptedDurations.add(200 days);
acceptedDurations.add(300 days);
}
function deposit(uint256 assets) public payable override nonReentrant returns (uint256) {
// only for param checking
if (assets != msg.value) {
revert UnexpectedAmount();
}
if (pauser.isStakingPaused()) {
revert Paused();
}
uint256 maxAssets = maxDeposit(_msgSender());
if (msg.value > maxAssets) {
revert ExceededMaxDeposit(_msgSender(), msg.value, maxAssets);
}
if (msg.value < minStake) {
revert DepositAmountTooSmall(_msgSender(), msg.value, minStake);
}
if (maxStakeSupply != 0 && msg.value + totalDeposit() > maxStakeSupply) {
revert DepositOverBond();
}
_userStakeCooldown[_msgSender()] = block.timestamp;
_deposit(_msgSender(), msg.value);
emit DepositWithDuration(_msgSender(), block.timestamp, msg.value, 0);
return msg.value;
}
function depositWithLockup(uint256 assets, uint256 duration) public payable nonReentrant returns (uint256) {
// only for param checking
if (assets != msg.value) {
revert UnexpectedAmount();
}
if (pauser.isStakingPaused()) {
revert Paused();
}
uint256 maxAssets = maxDeposit(_msgSender());
if (msg.value > maxAssets) {
revert ExceededMaxDeposit(_msgSender(), msg.value, maxAssets);
}
if (msg.value < minStake) {
revert DepositAmountTooSmall(_msgSender(), msg.value, minStake);
}
if (maxStakeSupply != 0 && msg.value + totalDeposit() > maxStakeSupply) {
revert DepositOverBond();
}
_insertLockUp(_msgSender(), assets, duration * 24 * 3600);
_updateLockUp(_msgSender());
_userStakeCooldown[_msgSender()] = block.timestamp;
_deposit(_msgSender(), msg.value);
emit DepositWithDuration(_msgSender(), block.timestamp, msg.value, duration * 24 * 3600);
return msg.value;
}
function withdraw(uint256 assets, address receiver) public override nonReentrant returns (uint256) {
(bool inCooldown,) = this.userStakeCooldown(_msgSender());
if (inCooldown) {
revert Cooldown();
}
if (pauser.isStakingPaused()) {
revert Paused();
}
_updateLockUp(_msgSender());
UserLockStorage storage $ = _getUserLockStorage();
(,uint256 userLocked) = $._userLocked.tryGet(_msgSender());
uint256 deposited_ = deposited(_msgSender());
if (deposited_ - userLocked < assets) {
revert InsufficientWithdrawableBalance();
}
return super.withdraw(assets, receiver);
}
function userStakeCooldown(address depositor) public view returns (bool, uint256) {
if (depositor == address(0)) {
revert AddressZeroNotExpected();
}
if (_userStakeCooldown[depositor] == 0) {
return (false, 0);
}
if (block.timestamp < _userStakeCooldown[depositor]) {
// unexpected time, won't happen
return (true, 0);
}
if (block.timestamp >= _userStakeCooldown[depositor] + cooldown) {
return (false, 0);
}
uint256 cooldown_ = cooldown - (block.timestamp - _userStakeCooldown[depositor]);
return (true, cooldown_);
}
function setCooldown(uint256 newCooldown) external onlyRole(STAKING_OPERATOR_ROLE) {
cooldown = newCooldown;
emit ProtocolConfigChanged(this.setCooldown.selector, "setCooldown(uint256)", abi.encode(newCooldown));
}
function setMinStake(uint256 newMinStake) external onlyRole(STAKING_OPERATOR_ROLE) {
minStake = newMinStake;
emit ProtocolConfigChanged(this.setMinStake.selector, "setMinStake(uint256)", abi.encode(newMinStake));
}
function setMaxStakeSupply(uint256 newMaxStakeSupply) external onlyRole(STAKING_OPERATOR_ROLE) {
maxStakeSupply = newMaxStakeSupply;
emit ProtocolConfigChanged(this.setMaxStakeSupply.selector, "setMaxStakeSupply(uint256)", abi.encode(newMaxStakeSupply));
}
// emergency unlock in advance
function unlockLockups(address[] memory users, uint256[] memory amounts) external onlyRole(STAKING_OPERATOR_ROLE) {
require(users.length == amounts.length, "length must be equal");
uint256 unlockAmount;
for (uint256 i; i < users.length; i++) {
_updateLockUp(users[i]);
uint256 lockAmount = getUserLockUps(users[i]);
if (lockAmount >= amounts[i]) {
unlockAmount = _unlock(users[i], amounts[i]);
}
}
}
function addLockDuration(uint256 duration) external onlyRole(STAKING_OPERATOR_ROLE) returns (bool) {
emit ProtocolConfigChanged(this.addLockDuration.selector, "addLockDuration(uint256)", abi.encode(duration));
return _addLockDuration(duration);
}
function removeLockDuration(uint256 duration) external onlyRole(STAKING_OPERATOR_ROLE) returns (bool) {
emit ProtocolConfigChanged(this.removeLockDuration.selector, "removeLockDuration(uint256)", abi.encode(duration));
return _removeLockDuration(duration);
}
/**
* @dev Deposit/mint common workflow.
*/
function _deposit(address caller, uint256 assets) internal override {
BareVaultStorage storage $ = super._getBareVaultStorage();
(,uint256 _amount) = $._deposit.tryGet(caller);
$._deposit.set(caller, _amount + assets);
$._totalDeposit += assets;
}
/**
* @dev Withdraw/redeem common workflow.
*/
function _withdraw(
address caller,
address receiver,
uint256 assets
) internal override {
BareVaultStorage storage $ = super._getBareVaultStorage();
$._deposit.set(caller, $._deposit.get(caller) - assets);
$._totalDeposit -= assets;
Address.sendValue(payable(receiver), assets);
emit Withdraw(caller, receiver, assets);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../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;
/// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
struct ReentrancyGuardStorage {
uint256 _status;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
assembly {
$.slot := ReentrancyGuardStorageLocation
}
}
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
$._status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// On the first call to nonReentrant, _status will be NOT_ENTERED
if ($._status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
$._status = ENTERED;
}
function _nonReentrantAfter() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
$._status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
return $._status == ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.
pragma solidity ^0.8.0;
import "./EnumerableSet.sol";
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* The following map types are supported:
*
* - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
* - `address -> uint256` (`AddressToUintMap`) since v4.6.0
* - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
* - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
* - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableMap.
* ====
*/
library EnumerableMap {
using EnumerableSet for EnumerableSet.Bytes32Set;
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct Bytes32ToBytes32Map {
// Storage of keys
EnumerableSet.Bytes32Set _keys;
mapping(bytes32 => bytes32) _values;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
map._values[key] = value;
return map._keys.add(key);
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
delete map._values[key];
return map._keys.remove(key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
return map._keys.contains(key);
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
return map._keys.length();
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
bytes32 key = map._keys.at(index);
return (key, map._values[key]);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
bytes32 value = map._values[key];
if (value == bytes32(0)) {
return (contains(map, key), bytes32(0));
} else {
return (true, value);
}
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToBytes32Map storage map,
bytes32 key,
string memory errorMessage
) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), errorMessage);
return value;
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
return map._keys.values();
}
// UintToUintMap
struct UintToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key)));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintToAddressMap
struct UintToAddressMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToAddressMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), address(uint160(uint256(value))));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
UintToAddressMap storage map,
uint256 key,
string memory errorMessage
) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressToUintMap
struct AddressToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(AddressToUintMap storage map, address key) internal returns (bool) {
return remove(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
return contains(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(AddressToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (address(uint160(uint256(key))), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
AddressToUintMap storage map,
address key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(AddressToUintMap storage map) internal view returns (address[] memory) {
bytes32[] memory store = keys(map._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// Bytes32ToUintMap
struct Bytes32ToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
return set(map._inner, key, bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
return remove(map._inner, key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {
return contains(map._inner, key);
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (key, uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, key);
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
return uint256(get(map._inner, key));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToUintMap storage map,
bytes32 key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, key, errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
bytes32[] memory store = keys(map._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface ProtocolEvents {
/// @notice Emitted when a protocol configuration has been updated.
/// @param setterSelector The selector of the function that updated the configuration.
/// @param setterSignature The signature of the function that updated the configuration.
/// @param value The abi-encoded data passed to the function that updated the configuration. Since this event will
/// only be emitted by setters, this data corresponds to the updated values in the protocol configuration.
event ProtocolConfigChanged(bytes4 indexed setterSelector, string setterSignature, bytes value);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
import {EnumerableMap} from "openzeppelin/utils/structs/EnumerableMap.sol";
import {ContextUpgradeable} from "openzeppelin-upgradeable/utils/ContextUpgradeable.sol";
import {AccessControlEnumerableUpgradeable} from "openzeppelin-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";
// inspired by
// openzeppelin-contracts/contracts/finance/VestingWallet.sol
// openzeppelin-contracts/contracts/finance/PaymentSplitter.sol
// openzeppelin-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol
abstract contract BareVaultUpgradable is ContextUpgradeable, AccessControlEnumerableUpgradeable {
// errors
/**
* @dev Attempted to deposit more assets than the max amount for `receiver`.
*/
error ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);
/**
* @dev Attempted to withdraw more assets than the max amount for `receiver`.
*/
error ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);
error ExceededWithdrawal(address owner, uint256 assets, uint256 max);
event Deposit(address indexed sender, uint256 assets);
event Withdraw(address indexed sender, address indexed receiver, uint256 assets);
using EnumerableMap for EnumerableMap.AddressToUintMap;
/// @custom:storage-location erc7201:storage.BareVault
struct BareVaultStorage {
uint256 _totalDeposit;
EnumerableMap.AddressToUintMap _deposit;
address _asset; // ERC20 or NativeToken
}
// keccak256(abi.encode(uint256(keccak256("storage.BareVault")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant BareVaultStorageLocation = 0x1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400;
function _getBareVaultStorage() internal pure returns (BareVaultStorage storage $) {
assembly {
$.slot := BareVaultStorageLocation
}
}
/**
* @dev Sets the sender as the initial owner, the beneficiary as the pending owner, the start timestamp and the
* vesting duration of the vesting wallet.
*/
function __BareVault_init(address _asset) internal onlyInitializing {
__AccessControlEnumerable_init();
__Context_init();
__BareVault_init_unchained(_asset);
}
function __BareVault_init_unchained(address _asset) internal onlyInitializing {
BareVaultStorage storage $ = _getBareVaultStorage();
$._asset = _asset;
}
/**
* @dev The contract should be able to receive Native Token.
*/
receive() external payable virtual {}
/**
* @dev Getter for the beneficiary address.
*/
function asset() public view virtual returns (address) {
BareVaultStorage storage $ = _getBareVaultStorage();
return $._asset;
}
/**
* @dev Total amount of token already deposited
*/
function totalDeposit() public view virtual returns (uint256) {
BareVaultStorage storage $ = _getBareVaultStorage();
return $._totalDeposit;
}
/**
* @dev Total amount of token already deposited
*/
function totalParticipants() public view virtual returns (uint256) {
BareVaultStorage storage $ = _getBareVaultStorage();
return $._deposit.length();
}
/**
* @dev Amount of token already deposited
*/
function deposited(address account) public view virtual returns (uint256) {
BareVaultStorage storage $ = _getBareVaultStorage();
(,uint256 amount) = $._deposit.tryGet(account);
return amount;
}
/** @dev See {IERC4626-deposit}. */
function deposit(uint256 assets) public payable virtual returns (uint256) {
uint256 maxAssets = maxDeposit(_msgSender());
if (assets > maxAssets) {
revert ExceededMaxDeposit(_msgSender(), assets, maxAssets);
}
_deposit(_msgSender(), assets);
return assets;
}
/** @dev See {IERC4626-withdraw}. */
function withdraw(uint256 assets, address receiver) public virtual returns (uint256) {
BareVaultStorage storage $ = _getBareVaultStorage();
uint256 maxAssets = maxWithdraw(_msgSender());
if (assets > maxAssets) {
revert ExceededMaxWithdraw(_msgSender(), assets, maxAssets);
}
(,uint256 _asset) = $._deposit.tryGet(_msgSender());
if (assets > _asset) {
revert ExceededWithdrawal(_msgSender(), assets, _asset);
}
_withdraw(_msgSender(), receiver, assets);
return assets;
}
/** @dev See {IERC4626-maxDeposit}. */
function maxDeposit(address) public view virtual returns (uint256) {
return type(uint256).max;
}
/** @dev See {IERC4626-maxWithdraw}. */
function maxWithdraw(address owner) public view virtual returns (uint256) {
BareVaultStorage storage $ = _getBareVaultStorage();
(,uint256 amount) = $._deposit.tryGet(owner);
return amount;
}
/**
* @dev Deposit/mint common workflow.
*/
function _deposit(address caller, uint256 assets) internal virtual {
BareVaultStorage storage $ = _getBareVaultStorage();
// If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
// `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
// calls the vault, which is assumed not malicious.
//
// Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
// assets are transferred and before the shares are minted, which is a valid state.
// slither-disable-next-line reentrancy-no-eth
SafeERC20.safeTransferFrom(IERC20($._asset), caller, address(this), assets);
(,uint256 _asset) = $._deposit.tryGet(caller);
$._deposit.set(caller, _asset + assets);
$._totalDeposit += assets;
emit Deposit(caller, assets);
}
/**
* @dev Withdraw/redeem common workflow.
*/
function _withdraw(
address caller,
address receiver,
uint256 assets
) internal virtual {
BareVaultStorage storage $ = _getBareVaultStorage();
// safe to use get on _withdraw
$._deposit.set(caller, $._deposit.get(caller) - assets);
$._totalDeposit -= assets;
if ( $._deposit.get(caller) == 0) {
$._deposit.remove(caller);
}
SafeERC20.safeTransfer(IERC20($._asset), receiver, assets);
emit Withdraw(caller, receiver, assets);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {EnumerableMap} from "openzeppelin/utils/structs/EnumerableMap.sol";
import {EnumerableSet} from "openzeppelin/utils/structs/EnumerableSet.sol";
abstract contract LockupUpgradable {
// errors
/**
* @dev Attempted to deposit more assets than the max amount for `receiver`.
*/
error DurationNotExpected();
/**
* @dev Attempted to withdraw more assets than the max amount for `receiver`.
*/
event UserLockUpdated(address indexed owner, uint256 lockedAmount);
event UserUnlocked(address indexed owner, uint256 requestUnlock, uint256 unlockAmount);
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.AddressToUintMap;
modifier checkDuration(uint256 duration) {
if (!acceptedDurations.contains(duration)) {
revert DurationNotExpected();
}
_;
}
// user lockups
struct LockInfos {
uint256[] lockStarts;
uint256[] amounts;
uint256[] durations;
}
struct UserLockStorage {
EnumerableMap.AddressToUintMap _userLocked;
mapping(address => LockInfos) _lockUps;
}
EnumerableSet.UintSet internal acceptedDurations;
// keccak256(abi.encode(uint256(keccak256("storage.UserLockStorage")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant UserLockStorageLocation = 0x0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a876676600;
function _getUserLockStorage() internal pure returns (UserLockStorage storage $) {
assembly {
$.slot := UserLockStorageLocation
}
}
function _insertLockUp(address owner, uint256 amount, uint256 duration) checkDuration(duration) internal {
UserLockStorage storage $ = _getUserLockStorage();
$._lockUps[owner].lockStarts.push(block.timestamp);
$._lockUps[owner].amounts.push(amount);
$._lockUps[owner].durations.push(duration);
(,uint256 locked) = $._userLocked.tryGet(owner);
$._userLocked.set(owner, locked + amount);
}
function _updateLockUp(address owner) internal {
UserLockStorage storage $ = _getUserLockStorage();
(,uint256 amount) = $._userLocked.tryGet(owner);
if ($._lockUps[owner].amounts.length == 0) {
return;
}
// [1-,2,3,4-] => [1-,2,3] => [3,2];
uint256 currentLen;
uint256 currentAmount;
for (uint256 i = $._lockUps[owner].amounts.length; i > 0; i--) {
if ($._lockUps[owner].lockStarts[i-1] + $._lockUps[owner].durations[i-1] <= block.timestamp) {
currentLen = $._lockUps[owner].lockStarts.length;
currentAmount = $._lockUps[owner].amounts[i-1];
if (i == currentLen) {
// if element is the last on; skip swap
} else {
$._lockUps[owner].lockStarts[i-1] = $._lockUps[owner].lockStarts[currentLen-1];
$._lockUps[owner].amounts[i-1] = $._lockUps[owner].amounts[currentLen-1];
$._lockUps[owner].durations[i-1] = $._lockUps[owner].durations[currentLen-1];
}
amount -= currentAmount;
$._lockUps[owner].lockStarts.pop();
$._lockUps[owner].amounts.pop();
$._lockUps[owner].durations.pop();
}
}
$._userLocked.set(owner, amount);
emit UserLockUpdated(owner, amount);
}
// @return unlocked amount
function _unlock(address owner, uint256 amount) internal returns (uint256) {
UserLockStorage storage $ = _getUserLockStorage();
(,uint256 lockedAmount) = $._userLocked.tryGet(owner);
if ($._lockUps[owner].amounts.length == 0) {
return 0;
}
uint256 currentLen;
uint256 unlockAmount;
for (uint256 i = $._lockUps[owner].amounts.length; i > 0; i--) {
if ($._lockUps[owner].lockStarts[i-1] + $._lockUps[owner].durations[i-1] > block.timestamp) {
currentLen = $._lockUps[owner].lockStarts.length;
unlockAmount += $._lockUps[owner].amounts[i-1];
$._lockUps[owner].lockStarts.pop();
$._lockUps[owner].amounts.pop();
$._lockUps[owner].durations.pop();
if (unlockAmount >= amount) {
break;
}
}
}
$._userLocked.set(owner, lockedAmount - unlockAmount);
emit UserUnlocked(owner, amount, unlockAmount);
return unlockAmount;
}
function getUserLockUps(address owner) public virtual view returns (uint256) {
UserLockStorage storage $ = _getUserLockStorage();
(,uint256 amount) = $._userLocked.tryGet(owner);
if ($._lockUps[owner].amounts.length == 0) {
return 0;
}
for (uint256 i = $._lockUps[owner].amounts.length; i > 0; i--) {
if ($._lockUps[owner].lockStarts[i-1] + $._lockUps[owner].durations[i-1] <= block.timestamp) {
amount -= $._lockUps[owner].amounts[i-1];
}
}
return amount;
}
function getUserLockUpArrays(address owner) public virtual view returns (uint256[] memory, uint256[] memory, uint256[] memory) {
UserLockStorage storage $ = _getUserLockStorage();
return ($._lockUps[owner].lockStarts, $._lockUps[owner].amounts, $._lockUps[owner].durations);
}
// for testing purpose
function updateLockUps(address owner) external {
require(msg.sender == address(this), "sender forbidden");
return _updateLockUp(owner);
}
function durations() external virtual view returns (uint256[] memory) {
return acceptedDurations.values();
}
function _addLockDuration(uint256 duration) internal virtual returns (bool) {
return acceptedDurations.add(duration);
}
function _removeLockDuration(uint256 duration) internal virtual returns (bool) {
return acceptedDurations.remove(duration);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface IPauserRead {
/// @notice Flag indicating if staking is paused.
function isStakingPaused() external view returns (bool);
/// @notice Flag indicating if allocation is paused.
function isAllocationPaused() external view returns (bool);
/// @notice Flag indicating if claim is paused.
function isClaimPaused() external view returns (bool);
}
interface IPauserWrite {
/// @notice Pauses all actions.
function pauseAll() external;
/// @notice unPauses all actions.
function unpauseAll() external;
}
interface IPauser is IPauserRead, IPauserWrite {}// 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
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)
pragma solidity ^0.8.20;
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";
import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerable, AccessControlUpgradeable {
using EnumerableSet for EnumerableSet.AddressSet;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControlEnumerable
struct AccessControlEnumerableStorage {
mapping(bytes32 role => EnumerableSet.AddressSet) _roleMembers;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlEnumerable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlEnumerableStorageLocation = 0xc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000;
function _getAccessControlEnumerableStorage() private pure returns (AccessControlEnumerableStorage storage $) {
assembly {
$.slot := AccessControlEnumerableStorageLocation
}
}
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
return $._roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
return $._roleMembers[role].length();
}
/**
* @dev Overload {AccessControl-_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
bool granted = super._grantRole(role, account);
if (granted) {
$._roleMembers[role].add(account);
}
return granted;
}
/**
* @dev Overload {AccessControl-_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {
AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
bool revoked = super._revokeRole(role, account);
if (revoked) {
$._roleMembers[role].remove(account);
}
return revoked;
}
}// 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 v5.0.0) (access/extensions/IAccessControlEnumerable.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "../IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated 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) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 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, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../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);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin/=lib/openzeppelin-contracts/contracts/",
"openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"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":"AddressZeroNotExpected","type":"error"},{"inputs":[],"name":"Cooldown","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minStake","type":"uint256"}],"name":"DepositAmountTooSmall","type":"error"},{"inputs":[],"name":"DepositOverBond","type":"error"},{"inputs":[],"name":"DurationNotExpected","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ExceededMaxWithdraw","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ExceededWithdrawal","type":"error"},{"inputs":[],"name":"InsufficientWithdrawableBalance","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UnexpectedAmount","type":"error"},{"inputs":[],"name":"UnexpectedInitialize","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"DepositWithDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"setterSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"setterSignature","type":"string"},{"indexed":false,"internalType":"bytes","name":"value","type":"bytes"}],"name":"ProtocolConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedAmount","type":"uint256"}],"name":"UserLockUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestUnlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockAmount","type":"uint256"}],"name":"UserUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"Withdraw","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"addLockDuration","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allocator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"depositWithLockup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"deposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"durations","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getUserLockUpArrays","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getUserLockUps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"pauser","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"cooldown","type":"uint256"},{"internalType":"uint256","name":"minStake","type":"uint256"},{"internalType":"uint256","name":"maxStakeSupply","type":"uint256"},{"internalType":"address","name":"allocator","type":"address"}],"internalType":"struct StakingMNT.Init","name":"init","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStakeSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauser","outputs":[{"internalType":"contract IPauser","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"removeLockDuration","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"uint256","name":"newCooldown","type":"uint256"}],"name":"setCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxStakeSupply","type":"uint256"}],"name":"setMaxStakeSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMinStake","type":"uint256"}],"name":"setMinStake","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":"totalDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalParticipants","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"unlockLockups","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"updateLockUps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"userStakeCooldown","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000d6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000735760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d35780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b613f2880620000e66000396000f3fe6080604052600436106102525760003560e01c806391d1485411610138578063c64db12e116100b0578063d547741f1161007f578063eca1973611610064578063eca19736146107e0578063ef9beeee14610800578063f6153ccd1461082057610262565b8063d547741f146107ad578063e5853f56146107cd57610262565b8063c64db12e1461074d578063ca15c8731461076d578063cb13cddb1461078d578063ce96cb771461078d57610262565b8063a217fddf11610107578063aa5dcecc116100ec578063aa5dcecc146106ed578063b6b55f251461071a578063ba61ecae1461072d57610262565b8063a217fddf146106c3578063a26dbf26146106d857610262565b806391d14854146105b957806397e3b7f41461062b5780639fd0506d1461065f578063a0edb2df1461068c57610262565b8063402d267d116101cb57806374e71acb1161019a5780638c80fd901161017f5780638c80fd90146105595780639010d07c146105795780639163b7eb1461059957610262565b806374e71acb1461052d578063787a08a61461054357610262565b8063402d267d1461047c5780634a41d89d146104bc5780634fc3f41a146104de5780635f019d51146104fe57610262565b8063248a9ca31161022257806336568abe1161020757806336568abe146103db578063375b3c0a146103fb57806338d52e0f1461041157610262565b8063248a9ca31461036c5780632f2ff15d146103bb57610262565b8062f714ce146102c957806301ffc9a7146102fc5780630689ef281461032c578063242210161461034c57610262565b366102625761026034610854565b005b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f7420416c6c6f77656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3480156102d557600080fd5b506102e96102e4366004613862565b610b36565b6040519081526020015b60405180910390f35b34801561030857600080fd5b5061031c61031736600461388e565b610d8a565b60405190151581526020016102f3565b34801561033857600080fd5b506102e96103473660046138d0565b610de0565b34801561035857600080fd5b506102606103673660046138eb565b610fa8565b34801561037857600080fd5b506102e96103873660046138eb565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b3480156103c757600080fd5b506102606103d6366004613862565b61106b565b3480156103e757600080fd5b506102606103f6366004613862565b6110b5565b34801561040757600080fd5b506102e960065481565b34801561041d57600080fd5b507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c4045473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f3565b34801561048857600080fd5b506102e96104973660046138d0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b3480156104c857600080fd5b506104d1611113565b6040516102f3919061393f565b3480156104ea57600080fd5b506102606104f93660046138eb565b611124565b34801561050a57600080fd5b5061051e6105193660046138d0565b6111db565b6040516102f393929190613952565b34801561053957600080fd5b506102e960075481565b34801561054f57600080fd5b506102e960055481565b34801561056557600080fd5b506102606105743660046138eb565b611353565b34801561058557600080fd5b50610457610594366004613995565b61140a565b3480156105a557600080fd5b5061031c6105b43660046138eb565b61144b565b3480156105c557600080fd5b5061031c6105d4366004613862565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561063757600080fd5b506102e97f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb81565b34801561066b57600080fd5b506003546104579073ffffffffffffffffffffffffffffffffffffffff1681565b34801561069857600080fd5b506106ac6106a73660046138d0565b611517565b6040805192151583526020830191909152016102f3565b3480156106cf57600080fd5b506102e9600081565b3480156106e457600080fd5b506102e9611664565b3480156106f957600080fd5b506004546104579073ffffffffffffffffffffffffffffffffffffffff1681565b6102e96107283660046138eb565b610854565b34801561073957600080fd5b50610260610748366004613ac4565b6116b6565b34801561075957600080fd5b506102606107683660046138d0565b611819565b34801561077957600080fd5b506102e96107883660046138eb565b61188e565b34801561079957600080fd5b506102e96107a83660046138d0565b6118c6565b3480156107b957600080fd5b506102606107c8366004613862565b61191d565b6102e96107db366004613995565b611961565b3480156107ec57600080fd5b506102606107fb366004613b84565b611bd5565b34801561080c57600080fd5b5061031c61081b3660046138eb565b611f44565b34801561082c57600080fd5b507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400546102e9565b600061085e612009565b348214610897576040517f312f6ffa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610904573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109289190613bad565b1561095f576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061096a33610497565b9050803411156109ce57335b6040517f88db76aa00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152346024820152604481018290526064016102c0565b600654341015610a3357335b6006546040517f75eb5dd100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216600483015234602483015260448201526064016102c0565b60075415801590610a7057506007547f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40054610a6e9034613bf7565b115b15610aa7576040517f950b856e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000818152600260205260409020429055610ac4905b3461208a565b60408051428152346020820152600081830152905133917f71a810dd86885cd9fea6e9b97fe8287ec71dd6475db601e9b925679c9f3ec3d1919081900360600190a2505060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055503490565b919050565b6000610b40612009565b604080517fa0edb2df0000000000000000000000000000000000000000000000000000000081523360048201528151600092309263a0edb2df92602480830193928290030181865afa158015610b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbe9190613c0a565b5090508015610bf9576040517fb0782df700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8a9190613bad565b15610cc1576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610cca3361213a565b7f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a8766766006000610cf78233612693565b9150506000610d066107a83390565b905086610d138383613c36565b1015610d4b576040517f0b1bd51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d5587876126c7565b945050505050610d8460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610d845750610d84826127b1565b60007f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660081610e0e8285612693565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600385016020526040812060010154919350039050610e4d575060009392505050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003830160205260409020600101545b8015610fa05773ffffffffffffffffffffffffffffffffffffffff8516600090815260038401602052604090204290600201610eb6600184613c36565b81548110610ec657610ec6613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff89168352600387019091526040909120610f04600185613c36565b81548110610f1457610f14613c49565b9060005260206000200154610f299190613bf7565b11610f8e5773ffffffffffffffffffffffffffffffffffffffff851660009081526003840160205260409020600190810190610f659083613c36565b81548110610f7557610f75613c49565b906000526020600020015482610f8b9190613c36565b91505b80610f9881613c78565b915050610e79565b509392505050565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb610fd281612848565b600782905560408051602081018490527f2422101600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d11565b60405180910390a25050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260409020600101546110a581612848565b6110af8383612852565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314611104576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61110e82826128a9565b505050565b606061111f60006128f7565b905090565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61114e81612848565b600582905560408051602081018490527f4fc3f41a00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d58565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660360209081526040918290208054835181840281018401909452808452606093849384937f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660093909260018401926002850192859183018282801561129a57602002820191906000526020600020905b815481526020019060010190808311611286575b50505050509250818054806020026020016040519081016040528092919081815260200182805480156112ec57602002820191906000526020600020905b8154815260200190600101908083116112d8575b505050505091508080548060200260200160405190810160405280929190818152602001828054801561133e57602002820191906000526020600020905b81548152602001906001019080831161132a575b50505050509050935093509350509193909250565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61137d81612848565b600682905560408051602081018490527f8c80fd9000000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d9f565b60008281527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020819052604082206114439084612904565b949350505050565b60007f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61147781612848565b60408051602081018590527f9163b7eb00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526114ff91613de6565b60405180910390a261151083612910565b9392505050565b60008073ffffffffffffffffffffffffffffffffffffffff8316611567576040517fa4377c6200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812054900361159e57506000928392509050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260409020544210156115d75750600192600092509050565b60055473ffffffffffffffffffffffffffffffffffffffff841660009081526002602052604090205461160a9190613bf7565b421061161b57506000928392509050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602052604081205461164b9042613c36565b6005546116589190613c36565b60019590945092505050565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c4006116b07f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40161291c565b91505090565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb6116e081612848565b815183511461174b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6c656e677468206d75737420626520657175616c00000000000000000000000060448201526064016102c0565b6000805b84518110156118125761177a85828151811061176d5761176d613c49565b602002602001015161213a565b600061179e86838151811061179157611791613c49565b6020026020010151610de0565b90508482815181106117b2576117b2613c49565b602002602001015181106117ff576117fc8683815181106117d5576117d5613c49565b60200260200101518684815181106117ef576117ef613c49565b6020026020010151612927565b92505b508061180a81613e2d565b91505061174f565b5050505050565b333014611882576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f73656e64657220666f7262696464656e0000000000000000000000000000000060448201526064016102c0565b61188b8161213a565b50565b60008181527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060208190526040822061151090612c94565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400816119147f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40185612693565b95945050505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461195781612848565b6110af83836128a9565b600061196b612009565b3483146119a4576040517f312f6ffa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a359190613bad565b15611a6c576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611a7733610497565b905080341115611a875733610976565b600654341015611a9757336109da565b60075415801590611ad457506007547f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40054611ad29034613bf7565b115b15611b0b576040517f950b856e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b2c3385611b1b866018613e65565b611b2790610e10613e65565b612c9e565b611b353361213a565b336000818152600260205260409020429055611b5090610abe565b337f71a810dd86885cd9fea6e9b97fe8287ec71dd6475db601e9b925679c9f3ec3d14234611b7f876018613e65565b611b8b90610e10613e65565b6040805193845260208401929092529082015260600160405180910390a2505060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005534610d84565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015611c205750825b905060008267ffffffffffffffff166001148015611c3d5750303b155b905081158015611c4b575080155b15611c82576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315611ce35784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b6000611cf560808801606089016138d0565b73ffffffffffffffffffffffffffffffffffffffff1614611d42576040517fb048b75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d5a611d5560808801606089016138d0565b612db4565b611d62612dd5565b611d8d7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb6000612de7565b611da46000611d9f60208901896138d0565b612852565b50611dd97f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb611d9f6040890160208a016138d0565b50608086013560055560a086013560065560c0860135600755611e03610100870160e088016138d0565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055611e5860608701604088016138d0565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055611eab60006241eb00612e8b565b50611eba60006283d600612e8b565b50611eca6000630107ac00612e8b565b50611eda600063018b8200612e8b565b508315611f3c5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b60007f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb611f7081612848565b60408051602081018590527fef9beeee00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052611ff891613e7c565b60405180910390a261151083612e97565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01612084576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40060006120d77f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40185612693565b91506120f49050846120e98584613bf7565b600185019190612ea3565b50828260000160008282546121099190613bf7565b909155505050505050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b7f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660060006121678284612693565b73ffffffffffffffffffffffffffffffffffffffff851660009081526003850160205260408120600101549193500390506121a157505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260038301602052604081206001015481905b801561262f5773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020429060020161220c600184613c36565b8154811061221c5761221c613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8a16835260038901909152604090912061225a600185613c36565b8154811061226a5761226a613c49565b906000526020600020015461227f9190613bf7565b1161261d5773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020805493506001908101906122bf9083613c36565b815481106122cf576122cf613c49565b90600052602060002001549150828103156124e65773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020612316600185613c36565b8154811061232657612326613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff89168352600388019091526040909120612364600184613c36565b8154811061237457612374613c49565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff8816815260038701909152604090206001908101906123b99085613c36565b815481106123c9576123c9613c49565b90600052602060002001548560030160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016001836124259190613c36565b8154811061243557612435613c49565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff881681526003870190915260409020600201612478600185613c36565b8154811061248857612488613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff891683526003880190915260409091206002016124c9600184613c36565b815481106124d9576124d9613c49565b6000918252602090912001555b6124f08285613c36565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260038701602052604090208054919550908061252a5761252a613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff881682526003870190526040902060010180548061259857612598613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff881682526003870190526040902060020180548061260657612606613ec3565b600190038181906000526020600020016000905590555b8061262781613c78565b9150506121cf565b5061263b848685612ea3565b508473ffffffffffffffffffffffffffffffffffffffff167f9e819531b9f4f6660e839d7b1ddb93441f1a62e8248416d7807881afecfa24988460405161268491815260200190565b60405180910390a25050505050565b60008080806126b88673ffffffffffffffffffffffffffffffffffffffff8716612ec6565b909450925050505b9250929050565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400816126f4336118c6565b905080851115612740576040517fd929e44300000000000000000000000000000000000000000000000000000000815233600482015260248101869052604481018290526064016102c0565b600061274f6001840133612693565b9150508086111561279c576040517f4b68b1b900000000000000000000000000000000000000000000000000000000815233600482015260248101879052604481018290526064016102c0565b6127a7338688612f00565b5093949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610d8457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610d84565b61188b8133612ff7565b60007fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320008161288085856130a2565b905080156114435760008581526020839052604090206128a090856131c3565b50949350505050565b60007fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000816128d785856131e5565b905080156114435760008581526020839052604090206128a090856132c3565b60606000611510836132e5565b60006115108383613341565b6000610d84818361336b565b6000610d8482613377565b60007f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a876676600816129558286612693565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260038501602052604081206001015491935003905061299557600092505050610d84565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260038301602052604081206001015481905b8015612c215773ffffffffffffffffffffffffffffffffffffffff8816600090815260038601602052604090204290600201612a00600184613c36565b81548110612a1057612a10613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8c168352600389019091526040909120612a4e600185613c36565b81548110612a5e57612a5e613c49565b9060005260206000200154612a739190613bf7565b1115612c0f5773ffffffffffffffffffffffffffffffffffffffff88166000908152600386016020526040902080549350600190810190612ab49083613c36565b81548110612ac457612ac4613c49565b906000526020600020015482612ada9190613bf7565b73ffffffffffffffffffffffffffffffffffffffff89166000908152600387016020526040902080549193509080612b1457612b14613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff8a16825260038701905260409020600101805480612b8257612b82613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff8a16825260038701905260409020600201805480612bf057612bf0613ec3565b6001900381819060005260206000200160009055905586821015612c21575b80612c1981613c78565b9150506129c3565b50612c3887612c308386613c36565b869190612ea3565b50604080518781526020810183905273ffffffffffffffffffffffffffffffffffffffff8916917f8334525b087bd40a461fad9f34d3dd47831c2639f0ff68c8013c0e88c08f3117910160405180910390a29695505050505050565b6000610d84825490565b80612caa600082613382565b612ce0576040517fbd066f3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081527f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a8766766036020908152604082208054600180820183558285528385204292019190915580820180548083018255908552838520018790556002909101805491820181558352908220018390557f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660090612d918287612693565b9150612dab905086612da38784613bf7565b849190612ea3565b50505050505050565b612dbc61339a565b612dc4613401565b612dcc613401565b61188b81613409565b612ddd61339a565b612de5613477565b565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006000612e428460009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b600085815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b6000611510838361347f565b6000610d848183612e8b565b60006114438473ffffffffffffffffffffffffffffffffffffffff8516846134ce565b6000818152600283016020526040812054819080612ef557612ee885856134eb565b9250600091506126c09050565b6001925090506126c0565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400612f658483612f507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c401836134f7565b612f5a9190613c36565b600184019190612ea3565b5081816000016000828254612f7a9190613c36565b90915550612f8a90508383613519565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb84604051612fe991815260200190565b60405180910390a350505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661309e576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044016102c0565b5050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff166131b95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556131553390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610d84565b6000915050610d84565b60006115108373ffffffffffffffffffffffffffffffffffffffff841661347f565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16156131b95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610d84565b60006115108373ffffffffffffffffffffffffffffffffffffffff8416613673565b60608160000180548060200260200160405190810160405280929190818152602001828054801561333557602002820191906000526020600020905b815481526020019060010190808311613321575b50505050509050919050565b600082600001828154811061335857613358613c49565b9060005260206000200154905092915050565b6000611510838361375c565b6000610d8482612c94565b60008181526001830160205260408120541515611510565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16612de5576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612de561339a565b61341161339a565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61211461339a565b60008181526001830160205260408120546134c657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d84565b506000610d84565b600082815260028401602052604081208290556114438484612e8b565b60006115108383613382565b60006115108373ffffffffffffffffffffffffffffffffffffffff84166137b4565b80471015613583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102c0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146135dd576040519150601f19603f3d011682016040523d82523d6000602084013e6135e2565b606091505b505090508061110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102c0565b600081815260018301602052604081205480156131b9576000613697600183613c36565b85549091506000906136ab90600190613c36565b90508082146137105760008660000182815481106136cb576136cb613c49565b90600052602060002001549050808760000184815481106136ee576136ee613c49565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061372157613721613ec3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d84565b600081815260018301602052604081205480156131b9576000613780600183613c36565b855490915060009061379490600190613c36565b90508181146137105760008660000182815481106136cb576136cb613c49565b6000818152600283016020526040812054801515806137d857506137d884846134eb565b611510576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016102c0565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b3157600080fd5b6000806040838503121561387557600080fd5b823591506138856020840161383e565b90509250929050565b6000602082840312156138a057600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461151057600080fd5b6000602082840312156138e257600080fd5b6115108261383e565b6000602082840312156138fd57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561393457815187529582019590820190600101613918565b509495945050505050565b6020815260006115106020830184613904565b6060815260006139656060830186613904565b82810360208401526139778186613904565b9050828103604084015261398b8185613904565b9695505050505050565b600080604083850312156139a857600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a2d57613a2d6139b7565b604052919050565b600067ffffffffffffffff821115613a4f57613a4f6139b7565b5060051b60200190565b600082601f830112613a6a57600080fd5b81356020613a7f613a7a83613a35565b6139e6565b82815260059290921b84018101918181019086841115613a9e57600080fd5b8286015b84811015613ab95780358352918301918301613aa2565b509695505050505050565b60008060408385031215613ad757600080fd5b823567ffffffffffffffff80821115613aef57600080fd5b818501915085601f830112613b0357600080fd5b81356020613b13613a7a83613a35565b82815260059290921b84018101918181019089841115613b3257600080fd5b948201945b83861015613b5757613b488661383e565b82529482019490820190613b37565b96505086013592505080821115613b6d57600080fd5b50613b7a85828601613a59565b9150509250929050565b60006101008284031215613b9757600080fd5b50919050565b80518015158114610b3157600080fd5b600060208284031215613bbf57600080fd5b61151082613b9d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610d8457610d84613bc8565b60008060408385031215613c1d57600080fd5b613c2683613b9d565b9150602083015190509250929050565b81810381811115610d8457610d84613bc8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081613c8757613c87613bc8565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000815180845260005b81811015613cd357602081850181015186830182015201613cb7565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60408152601a60408201527f7365744d61785374616b65537570706c792875696e743235362900000000000060608201526080602082015260006115106080830184613cad565b60408152601460408201527f736574436f6f6c646f776e2875696e743235362900000000000000000000000060608201526080602082015260006115106080830184613cad565b60408152601460408201527f7365744d696e5374616b652875696e743235362900000000000000000000000060608201526080602082015260006115106080830184613cad565b60408152601b60408201527f72656d6f76654c6f636b4475726174696f6e2875696e7432353629000000000060608201526080602082015260006115106080830184613cad565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613e5e57613e5e613bc8565b5060010190565b8082028115828204841417610d8457610d84613bc8565b60408152601860408201527f6164644c6f636b4475726174696f6e2875696e7432353629000000000000000060608201526080602082015260006115106080830184613cad565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122088246d74ac3980f19a9df9404780aeb2ddc54b7f32bbecea56ae4bb111eeae9a64736f6c63430008140033
Deployed Bytecode
0x6080604052600436106102525760003560e01c806391d1485411610138578063c64db12e116100b0578063d547741f1161007f578063eca1973611610064578063eca19736146107e0578063ef9beeee14610800578063f6153ccd1461082057610262565b8063d547741f146107ad578063e5853f56146107cd57610262565b8063c64db12e1461074d578063ca15c8731461076d578063cb13cddb1461078d578063ce96cb771461078d57610262565b8063a217fddf11610107578063aa5dcecc116100ec578063aa5dcecc146106ed578063b6b55f251461071a578063ba61ecae1461072d57610262565b8063a217fddf146106c3578063a26dbf26146106d857610262565b806391d14854146105b957806397e3b7f41461062b5780639fd0506d1461065f578063a0edb2df1461068c57610262565b8063402d267d116101cb57806374e71acb1161019a5780638c80fd901161017f5780638c80fd90146105595780639010d07c146105795780639163b7eb1461059957610262565b806374e71acb1461052d578063787a08a61461054357610262565b8063402d267d1461047c5780634a41d89d146104bc5780634fc3f41a146104de5780635f019d51146104fe57610262565b8063248a9ca31161022257806336568abe1161020757806336568abe146103db578063375b3c0a146103fb57806338d52e0f1461041157610262565b8063248a9ca31461036c5780632f2ff15d146103bb57610262565b8062f714ce146102c957806301ffc9a7146102fc5780630689ef281461032c578063242210161461034c57610262565b366102625761026034610854565b005b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f7420416c6c6f77656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b3480156102d557600080fd5b506102e96102e4366004613862565b610b36565b6040519081526020015b60405180910390f35b34801561030857600080fd5b5061031c61031736600461388e565b610d8a565b60405190151581526020016102f3565b34801561033857600080fd5b506102e96103473660046138d0565b610de0565b34801561035857600080fd5b506102606103673660046138eb565b610fa8565b34801561037857600080fd5b506102e96103873660046138eb565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b3480156103c757600080fd5b506102606103d6366004613862565b61106b565b3480156103e757600080fd5b506102606103f6366004613862565b6110b5565b34801561040757600080fd5b506102e960065481565b34801561041d57600080fd5b507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c4045473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f3565b34801561048857600080fd5b506102e96104973660046138d0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b3480156104c857600080fd5b506104d1611113565b6040516102f3919061393f565b3480156104ea57600080fd5b506102606104f93660046138eb565b611124565b34801561050a57600080fd5b5061051e6105193660046138d0565b6111db565b6040516102f393929190613952565b34801561053957600080fd5b506102e960075481565b34801561054f57600080fd5b506102e960055481565b34801561056557600080fd5b506102606105743660046138eb565b611353565b34801561058557600080fd5b50610457610594366004613995565b61140a565b3480156105a557600080fd5b5061031c6105b43660046138eb565b61144b565b3480156105c557600080fd5b5061031c6105d4366004613862565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561063757600080fd5b506102e97f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb81565b34801561066b57600080fd5b506003546104579073ffffffffffffffffffffffffffffffffffffffff1681565b34801561069857600080fd5b506106ac6106a73660046138d0565b611517565b6040805192151583526020830191909152016102f3565b3480156106cf57600080fd5b506102e9600081565b3480156106e457600080fd5b506102e9611664565b3480156106f957600080fd5b506004546104579073ffffffffffffffffffffffffffffffffffffffff1681565b6102e96107283660046138eb565b610854565b34801561073957600080fd5b50610260610748366004613ac4565b6116b6565b34801561075957600080fd5b506102606107683660046138d0565b611819565b34801561077957600080fd5b506102e96107883660046138eb565b61188e565b34801561079957600080fd5b506102e96107a83660046138d0565b6118c6565b3480156107b957600080fd5b506102606107c8366004613862565b61191d565b6102e96107db366004613995565b611961565b3480156107ec57600080fd5b506102606107fb366004613b84565b611bd5565b34801561080c57600080fd5b5061031c61081b3660046138eb565b611f44565b34801561082c57600080fd5b507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400546102e9565b600061085e612009565b348214610897576040517f312f6ffa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610904573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109289190613bad565b1561095f576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061096a33610497565b9050803411156109ce57335b6040517f88db76aa00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152346024820152604481018290526064016102c0565b600654341015610a3357335b6006546040517f75eb5dd100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216600483015234602483015260448201526064016102c0565b60075415801590610a7057506007547f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40054610a6e9034613bf7565b115b15610aa7576040517f950b856e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000818152600260205260409020429055610ac4905b3461208a565b60408051428152346020820152600081830152905133917f71a810dd86885cd9fea6e9b97fe8287ec71dd6475db601e9b925679c9f3ec3d1919081900360600190a2505060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055503490565b919050565b6000610b40612009565b604080517fa0edb2df0000000000000000000000000000000000000000000000000000000081523360048201528151600092309263a0edb2df92602480830193928290030181865afa158015610b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbe9190613c0a565b5090508015610bf9576040517fb0782df700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8a9190613bad565b15610cc1576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610cca3361213a565b7f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a8766766006000610cf78233612693565b9150506000610d066107a83390565b905086610d138383613c36565b1015610d4b576040517f0b1bd51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d5587876126c7565b945050505050610d8460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610d845750610d84826127b1565b60007f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660081610e0e8285612693565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600385016020526040812060010154919350039050610e4d575060009392505050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003830160205260409020600101545b8015610fa05773ffffffffffffffffffffffffffffffffffffffff8516600090815260038401602052604090204290600201610eb6600184613c36565b81548110610ec657610ec6613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff89168352600387019091526040909120610f04600185613c36565b81548110610f1457610f14613c49565b9060005260206000200154610f299190613bf7565b11610f8e5773ffffffffffffffffffffffffffffffffffffffff851660009081526003840160205260409020600190810190610f659083613c36565b81548110610f7557610f75613c49565b906000526020600020015482610f8b9190613c36565b91505b80610f9881613c78565b915050610e79565b509392505050565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb610fd281612848565b600782905560408051602081018490527f2422101600000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d11565b60405180910390a25050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680060205260409020600101546110a581612848565b6110af8383612852565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314611104576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61110e82826128a9565b505050565b606061111f60006128f7565b905090565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61114e81612848565b600582905560408051602081018490527f4fc3f41a00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d58565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660360209081526040918290208054835181840281018401909452808452606093849384937f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660093909260018401926002850192859183018282801561129a57602002820191906000526020600020905b815481526020019060010190808311611286575b50505050509250818054806020026020016040519081016040528092919081815260200182805480156112ec57602002820191906000526020600020905b8154815260200190600101908083116112d8575b505050505091508080548060200260200160405190810160405280929190818152602001828054801561133e57602002820191906000526020600020905b81548152602001906001019080831161132a575b50505050509050935093509350509193909250565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61137d81612848565b600682905560408051602081018490527f8c80fd9000000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261105f91613d9f565b60008281527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320006020819052604082206114439084612904565b949350505050565b60007f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb61147781612848565b60408051602081018590527f9163b7eb00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526114ff91613de6565b60405180910390a261151083612910565b9392505050565b60008073ffffffffffffffffffffffffffffffffffffffff8316611567576040517fa4377c6200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812054900361159e57506000928392509050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260409020544210156115d75750600192600092509050565b60055473ffffffffffffffffffffffffffffffffffffffff841660009081526002602052604090205461160a9190613bf7565b421061161b57506000928392509050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602052604081205461164b9042613c36565b6005546116589190613c36565b60019590945092505050565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c4006116b07f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40161291c565b91505090565b7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb6116e081612848565b815183511461174b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6c656e677468206d75737420626520657175616c00000000000000000000000060448201526064016102c0565b6000805b84518110156118125761177a85828151811061176d5761176d613c49565b602002602001015161213a565b600061179e86838151811061179157611791613c49565b6020026020010151610de0565b90508482815181106117b2576117b2613c49565b602002602001015181106117ff576117fc8683815181106117d5576117d5613c49565b60200260200101518684815181106117ef576117ef613c49565b6020026020010151612927565b92505b508061180a81613e2d565b91505061174f565b5050505050565b333014611882576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f73656e64657220666f7262696464656e0000000000000000000000000000000060448201526064016102c0565b61188b8161213a565b50565b60008181527fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200060208190526040822061151090612c94565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400816119147f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40185612693565b95945050505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461195781612848565b6110af83836128a9565b600061196b612009565b3483146119a4576040517f312f6ffa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ea7ca896040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a359190613bad565b15611a6c576040517f9e87fac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611a7733610497565b905080341115611a875733610976565b600654341015611a9757336109da565b60075415801590611ad457506007547f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40054611ad29034613bf7565b115b15611b0b576040517f950b856e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b2c3385611b1b866018613e65565b611b2790610e10613e65565b612c9e565b611b353361213a565b336000818152600260205260409020429055611b5090610abe565b337f71a810dd86885cd9fea6e9b97fe8287ec71dd6475db601e9b925679c9f3ec3d14234611b7f876018613e65565b611b8b90610e10613e65565b6040805193845260208401929092529082015260600160405180910390a2505060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005534610d84565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015611c205750825b905060008267ffffffffffffffff166001148015611c3d5750303b155b905081158015611c4b575080155b15611c82576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315611ce35784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b6000611cf560808801606089016138d0565b73ffffffffffffffffffffffffffffffffffffffff1614611d42576040517fb048b75a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d5a611d5560808801606089016138d0565b612db4565b611d62612dd5565b611d8d7f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb6000612de7565b611da46000611d9f60208901896138d0565b612852565b50611dd97f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb611d9f6040890160208a016138d0565b50608086013560055560a086013560065560c0860135600755611e03610100870160e088016138d0565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055611e5860608701604088016138d0565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055611eab60006241eb00612e8b565b50611eba60006283d600612e8b565b50611eca6000630107ac00612e8b565b50611eda600063018b8200612e8b565b508315611f3c5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b60007f695baaec64dcea9b360cf4afad33a0f77fe653c0db7609569fc416ae7343b5fb611f7081612848565b60408051602081018590527fef9beeee00000000000000000000000000000000000000000000000000000000917f01d854e8dde9402801a4c6f2840193465752abfad61e0bb7c4258d526ae42e749101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052611ff891613e7c565b60405180910390a261151083612e97565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0080547ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01612084576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60029055565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40060006120d77f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40185612693565b91506120f49050846120e98584613bf7565b600185019190612ea3565b50828260000160008282546121099190613bf7565b909155505050505050565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b7f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660060006121678284612693565b73ffffffffffffffffffffffffffffffffffffffff851660009081526003850160205260408120600101549193500390506121a157505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260038301602052604081206001015481905b801561262f5773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020429060020161220c600184613c36565b8154811061221c5761221c613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8a16835260038901909152604090912061225a600185613c36565b8154811061226a5761226a613c49565b906000526020600020015461227f9190613bf7565b1161261d5773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020805493506001908101906122bf9083613c36565b815481106122cf576122cf613c49565b90600052602060002001549150828103156124e65773ffffffffffffffffffffffffffffffffffffffff861660009081526003860160205260409020612316600185613c36565b8154811061232657612326613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff89168352600388019091526040909120612364600184613c36565b8154811061237457612374613c49565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff8816815260038701909152604090206001908101906123b99085613c36565b815481106123c9576123c9613c49565b90600052602060002001548560030160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016001836124259190613c36565b8154811061243557612435613c49565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff881681526003870190915260409020600201612478600185613c36565b8154811061248857612488613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff891683526003880190915260409091206002016124c9600184613c36565b815481106124d9576124d9613c49565b6000918252602090912001555b6124f08285613c36565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260038701602052604090208054919550908061252a5761252a613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff881682526003870190526040902060010180548061259857612598613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff881682526003870190526040902060020180548061260657612606613ec3565b600190038181906000526020600020016000905590555b8061262781613c78565b9150506121cf565b5061263b848685612ea3565b508473ffffffffffffffffffffffffffffffffffffffff167f9e819531b9f4f6660e839d7b1ddb93441f1a62e8248416d7807881afecfa24988460405161268491815260200190565b60405180910390a25050505050565b60008080806126b88673ffffffffffffffffffffffffffffffffffffffff8716612ec6565b909450925050505b9250929050565b60007f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400816126f4336118c6565b905080851115612740576040517fd929e44300000000000000000000000000000000000000000000000000000000815233600482015260248101869052604481018290526064016102c0565b600061274f6001840133612693565b9150508086111561279c576040517f4b68b1b900000000000000000000000000000000000000000000000000000000815233600482015260248101879052604481018290526064016102c0565b6127a7338688612f00565b5093949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610d8457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610d84565b61188b8133612ff7565b60007fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320008161288085856130a2565b905080156114435760008581526020839052604090206128a090856131c3565b50949350505050565b60007fc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000816128d785856131e5565b905080156114435760008581526020839052604090206128a090856132c3565b60606000611510836132e5565b60006115108383613341565b6000610d84818361336b565b6000610d8482613377565b60007f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a876676600816129558286612693565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260038501602052604081206001015491935003905061299557600092505050610d84565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260038301602052604081206001015481905b8015612c215773ffffffffffffffffffffffffffffffffffffffff8816600090815260038601602052604090204290600201612a00600184613c36565b81548110612a1057612a10613c49565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8c168352600389019091526040909120612a4e600185613c36565b81548110612a5e57612a5e613c49565b9060005260206000200154612a739190613bf7565b1115612c0f5773ffffffffffffffffffffffffffffffffffffffff88166000908152600386016020526040902080549350600190810190612ab49083613c36565b81548110612ac457612ac4613c49565b906000526020600020015482612ada9190613bf7565b73ffffffffffffffffffffffffffffffffffffffff89166000908152600387016020526040902080549193509080612b1457612b14613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff8a16825260038701905260409020600101805480612b8257612b82613ec3565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810183905590920190925573ffffffffffffffffffffffffffffffffffffffff8a16825260038701905260409020600201805480612bf057612bf0613ec3565b6001900381819060005260206000200160009055905586821015612c21575b80612c1981613c78565b9150506129c3565b50612c3887612c308386613c36565b869190612ea3565b50604080518781526020810183905273ffffffffffffffffffffffffffffffffffffffff8916917f8334525b087bd40a461fad9f34d3dd47831c2639f0ff68c8013c0e88c08f3117910160405180910390a29695505050505050565b6000610d84825490565b80612caa600082613382565b612ce0576040517fbd066f3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081527f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a8766766036020908152604082208054600180820183558285528385204292019190915580820180548083018255908552838520018790556002909101805491820181558352908220018390557f0ce81d75b936ea44989fc6dc3b015771ad68444f0aa2b557b82bc8a87667660090612d918287612693565b9150612dab905086612da38784613bf7565b849190612ea3565b50505050505050565b612dbc61339a565b612dc4613401565b612dcc613401565b61188b81613409565b612ddd61339a565b612de5613477565b565b7f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006000612e428460009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b600085815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b6000611510838361347f565b6000610d848183612e8b565b60006114438473ffffffffffffffffffffffffffffffffffffffff8516846134ce565b6000818152600283016020526040812054819080612ef557612ee885856134eb565b9250600091506126c09050565b6001925090506126c0565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c400612f658483612f507f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c401836134f7565b612f5a9190613c36565b600184019190612ea3565b5081816000016000828254612f7a9190613c36565b90915550612f8a90508383613519565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb84604051612fe991815260200190565b60405180910390a350505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661309e576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602481018390526044016102c0565b5050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff166131b95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556131553390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610d84565b6000915050610d84565b60006115108373ffffffffffffffffffffffffffffffffffffffff841661347f565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16156131b95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610d84565b60006115108373ffffffffffffffffffffffffffffffffffffffff8416613673565b60608160000180548060200260200160405190810160405280929190818152602001828054801561333557602002820191906000526020600020905b815481526020019060010190808311613321575b50505050509050919050565b600082600001828154811061335857613358613c49565b9060005260206000200154905092915050565b6000611510838361375c565b6000610d8482612c94565b60008181526001830160205260408120541515611510565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16612de5576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612de561339a565b61341161339a565b7f1777a80db1c6a9865545ecb5d27383880a1e667f2012bc238aba256783d9c40480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61211461339a565b60008181526001830160205260408120546134c657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d84565b506000610d84565b600082815260028401602052604081208290556114438484612e8b565b60006115108383613382565b60006115108373ffffffffffffffffffffffffffffffffffffffff84166137b4565b80471015613583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102c0565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146135dd576040519150601f19603f3d011682016040523d82523d6000602084013e6135e2565b606091505b505090508061110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102c0565b600081815260018301602052604081205480156131b9576000613697600183613c36565b85549091506000906136ab90600190613c36565b90508082146137105760008660000182815481106136cb576136cb613c49565b90600052602060002001549050808760000184815481106136ee576136ee613c49565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061372157613721613ec3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d84565b600081815260018301602052604081205480156131b9576000613780600183613c36565b855490915060009061379490600190613c36565b90508181146137105760008660000182815481106136cb576136cb613c49565b6000818152600283016020526040812054801515806137d857506137d884846134eb565b611510576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016102c0565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b3157600080fd5b6000806040838503121561387557600080fd5b823591506138856020840161383e565b90509250929050565b6000602082840312156138a057600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461151057600080fd5b6000602082840312156138e257600080fd5b6115108261383e565b6000602082840312156138fd57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561393457815187529582019590820190600101613918565b509495945050505050565b6020815260006115106020830184613904565b6060815260006139656060830186613904565b82810360208401526139778186613904565b9050828103604084015261398b8185613904565b9695505050505050565b600080604083850312156139a857600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613a2d57613a2d6139b7565b604052919050565b600067ffffffffffffffff821115613a4f57613a4f6139b7565b5060051b60200190565b600082601f830112613a6a57600080fd5b81356020613a7f613a7a83613a35565b6139e6565b82815260059290921b84018101918181019086841115613a9e57600080fd5b8286015b84811015613ab95780358352918301918301613aa2565b509695505050505050565b60008060408385031215613ad757600080fd5b823567ffffffffffffffff80821115613aef57600080fd5b818501915085601f830112613b0357600080fd5b81356020613b13613a7a83613a35565b82815260059290921b84018101918181019089841115613b3257600080fd5b948201945b83861015613b5757613b488661383e565b82529482019490820190613b37565b96505086013592505080821115613b6d57600080fd5b50613b7a85828601613a59565b9150509250929050565b60006101008284031215613b9757600080fd5b50919050565b80518015158114610b3157600080fd5b600060208284031215613bbf57600080fd5b61151082613b9d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610d8457610d84613bc8565b60008060408385031215613c1d57600080fd5b613c2683613b9d565b9150602083015190509250929050565b81810381811115610d8457610d84613bc8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081613c8757613c87613bc8565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000815180845260005b81811015613cd357602081850181015186830182015201613cb7565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60408152601a60408201527f7365744d61785374616b65537570706c792875696e743235362900000000000060608201526080602082015260006115106080830184613cad565b60408152601460408201527f736574436f6f6c646f776e2875696e743235362900000000000000000000000060608201526080602082015260006115106080830184613cad565b60408152601460408201527f7365744d696e5374616b652875696e743235362900000000000000000000000060608201526080602082015260006115106080830184613cad565b60408152601b60408201527f72656d6f76654c6f636b4475726174696f6e2875696e7432353629000000000060608201526080602082015260006115106080830184613cad565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613e5e57613e5e613bc8565b5060010190565b8082028115828204841417610d8457610d84613bc8565b60408152601860408201527f6164644c6f636b4475726174696f6e2875696e7432353629000000000000000060608201526080602082015260006115106080830184613cad565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea264697066735822122088246d74ac3980f19a9df9404780aeb2ddc54b7f32bbecea56ae4bb111eeae9a64736f6c63430008140033
Net Worth in USD
Net Worth in MNT
Token Allocations
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BASE | 100.00% | $2,866.28 | 0.00005 | $0.143314 |
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.