Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MigrationWrapper
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
// //////////////////////////////////////////////solarlabs.gg////////////////////////////////////////////
// _____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
// //////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.17;
import {ERC4626Wrapper} from "./ERC4626Wrapper.sol";
import {LibOptions, IERC20, SafeERC20, IOptions} from "./LibOptions.sol";
import {Initializer, LibInitializer} from "./solar/contracts/modules/utils/initializer/Initializer.sol";
import {ReentrancyGuard} from "./solar/contracts/modules/security/reentrancy-guard/ReentrancyGuard.sol";
import {ERC20Facet, LibERC20, LibPausable, LibSimpleBlacklist, IERC20Metadata} from "./solar/contracts/modules/token/ERC20/facets/ERC20Facet.sol";
import {AccessControlFacet, LibAccessControl} from "./solar/contracts/modules/access/AccessControlFacet.sol";
import {LibRoles} from "./solar/contracts/modules/access/LibRoles.sol";
import {SimpleBlacklistFacet} from "./solar/contracts/modules/blacklist/SimpleBlacklistFacet.sol";
contract MigrationWrapper is ERC4626Wrapper {
using SafeERC20 for IERC20;
//token to be migrated
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
IERC20 public immutable oldStakingToken;
//Flag that indicates whether tokens can be migrated at the moment, true - no, migration is paused, false - yes, migration is active
bool public migrationPausedFlag;
event Migrated(IERC20 oldStakingToken, address account, uint256 amount);
event PauseMigration(bool flag);
error MigrationPaused();
///@notice Contract initialization.
///@param _oldStakingToken Token to be migrated.
constructor(IERC20 _oldStakingToken) {
oldStakingToken = _oldStakingToken;
}
///@notice Migrate old staking token to new one with 1:1 rate.
///@param amount Amount to be migrated.
///@dev New staking token will be minted to the user.
///@dev Recalculation works only in case when oldStakingToken decimals <= to current stakingToken decimals.
function migrate(uint256 amount) external {
if (migrationPausedFlag) revert MigrationPaused();
if (amount == 0) {
revert ZeroAmount();
}
IOptions.Storage memory s = LibOptions.getStorage();
oldStakingToken.safeTransferFrom(msg.sender, s.treasury, amount);
uint256 recalculatedAmount = amount;
//recalculate amount to match decimals
if (IERC20Metadata(address(oldStakingToken)).decimals() != LibERC20.getDecimals()) {
recalculatedAmount =
recalculatedAmount *
10 **
(LibERC20.getDecimals() -
IERC20Metadata(address(oldStakingToken)).decimals());
}
LibERC20.mint(msg.sender, recalculatedAmount);
emit Migrated(oldStakingToken, msg.sender, recalculatedAmount);
}
///@notice Pauses token migration.
///@param newFlag indicates whether tokens can be migrated at the moment (true - migration stopped, false - migration active)
///@dev Made independently from the staking system, so the Pausable library is not used here.
function pauseMigration(bool newFlag) external {
LibAccessControl.enforceRole(LibRoles.DEFAULT_ADMIN_ROLE);
migrationPausedFlag = newFlag;
emit PauseMigration(newFlag);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (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: UNLICENSED
// //////////////////////////////////////////////solarlabs.gg////////////////////////////////////////////
// _____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
// //////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.17;
import {IERC4626Wrapper} from "./interfaces/IERC4626Wrapper.sol";
import {IStakingRewards} from "./interfaces/IStakingRewards.sol";
import {IThirdParty} from "./interfaces/IThirdParty.sol";
import {LibOptions, IERC20, SafeERC20, IOptions} from "./LibOptions.sol";
import {Initializer, LibInitializer} from "./solar/contracts/modules/utils/initializer/Initializer.sol";
import {ReentrancyGuard} from "./solar/contracts/modules/security/reentrancy-guard/ReentrancyGuard.sol";
import {ERC20Facet, LibERC20, LibPausable, LibSimpleBlacklist, IERC20Metadata} from "./solar/contracts/modules/token/ERC20/facets/ERC20Facet.sol";
import {AccessControlFacet, LibAccessControl} from "./solar/contracts/modules/access/AccessControlFacet.sol";
import {LibRoles} from "./solar/contracts/modules/access/LibRoles.sol";
import {SimpleBlacklistFacet} from "./solar/contracts/modules/blacklist/SimpleBlacklistFacet.sol";
contract ERC4626Wrapper is
IERC4626Wrapper,
Initializer,
ReentrancyGuard,
AccessControlFacet,
SimpleBlacklistFacet,
ERC20Facet
{
using SafeERC20 for IERC20;
//token that will be locked in 3rd party
IERC20 public coreToken;
//wrapped token (aMaia/aHermes)
address public wrappedToken;
//staking contract with reward system
IStakingRewards public stakingRewards;
//used for rate calculation
uint256 public constant DENOMINATOR = 1e10;
constructor() {
LibInitializer.disable();
}
///@notice Contract initialization.
///@param _coreToken Token that will be locked in 3rd party (Maia/Hermes).
///@param _wrappedToken Wrapped token (aMaia/aHermes).
///@param owner Owner of the contract.
///@param treasury Treasury address where wrapped tokens will be sent.
///@param rate Rate for wrapped token deposit.
///@param tokenName Name of the token (this contract).
///@param tokenSymbol Symbol of the token (this contract).
function initialize(
IERC20 _coreToken,
address _wrappedToken,
address owner,
address treasury,
uint256 rate,
uint256 coreRate,
string memory tokenName,
string memory tokenSymbol,
uint8 tokenDecimals
) external initializer {
if (
address(_coreToken) == address(0) ||
_wrappedToken == address(0) ||
owner == address(0) ||
treasury == address(0)
) {
revert ZeroAddress();
}
if (rate == 0 || coreRate == 0) {
revert ZeroAmount();
}
LibAccessControl.grantRole(LibRoles.DEFAULT_ADMIN_ROLE, owner);
LibAccessControl.grantRole(LibRoles.STAKING_REWARDS_MANAGER, owner);
LibERC20.setName(tokenName);
LibERC20.setSymbol(tokenSymbol);
coreToken = _coreToken;
wrappedToken = _wrappedToken;
LibOptions.setTreasury(treasury);
LibOptions.setRate(rate);
LibOptions.setRateForCoreTokenDeposit(coreRate);
LibERC20.setDecimals(tokenDecimals);
}
//FOR USER//
///@notice Function flow:
///1. Transfer core tokens (Maia/Hermes) from user to this contract.
///2. Process core tokens deposit to 3rd party.
///3. Process received from 3rd party wrapped tokens (vMaia/bHermes) and send them to treasury.
///4. Mint our tokens (aMaia/aHermes) to this contract with rate 1:1 to wrapped tokens from 3rd party.
///5. Stake minted amount of aMaia/aHermes in staking rewards contract.
///@param amount Amount of core tokens to deposit.
function coreTokenDeposit(uint256 amount) external nonReentrant {
LibPausable.enforceNotPaused();
LibSimpleBlacklist.enforceNotBlacklisted(msg.sender);
IOptions.Storage memory s = LibOptions.getStorage();
if (amount == 0) {
revert ZeroAmount();
}
coreToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 shares = _processTokens(amount);
//mint our wrapped token (aMaia - with 1:1 rate; aHermes - with coreRate) to this address
uint256 calculatedAmount = _mint(address(this), shares, s.coreRate);
_stakeTokens(msg.sender, calculatedAmount);
emit DepositCoreTokens(msg.sender, amount, address(coreToken));
}
///@notice Function flow:
///1. Transfer wrapped tokens (vMaia/bHermes) from user to treasury.
///2. Mint our tokens (aMaia/aHermes) to user with specified by owner rate.
///3. Stake minted amount of aMaia/aHermes in staking rewards contract.
///@param amount Amount of wrapped tokens to deposit.
function wrappedTokenDeposit(uint256 amount) external nonReentrant {
LibPausable.enforceNotPaused();
LibSimpleBlacklist.enforceNotBlacklisted(msg.sender);
if (amount == 0) {
revert ZeroAmount();
}
IOptions.Storage memory s = LibOptions.getStorage();
IERC20(wrappedToken).safeTransferFrom(msg.sender, s.treasury, amount);
//mint our wrapped token (aMaia/aHermes) to this address with rate
uint256 calculatedAmount = _mint(address(this), amount, s.rate);
_stakeTokens(msg.sender, calculatedAmount);
emit DepositWrappedTokens(msg.sender, amount, address(wrappedToken));
}
//SETTERS//
///@notice Set treasury address where wrapped tokens (vMaia/bHermes) will be sent.
///@param treasury Address of the treasury.
///@dev Only default admin can call this function.
function setTreasury(address treasury) external {
LibAccessControl.enforceRole(LibRoles.DEFAULT_ADMIN_ROLE);
if (treasury == address(0)) {
revert ZeroAddress();
}
LibOptions.setTreasury(treasury);
emit TreasurySet(treasury);
}
///@notice Set rate for wrapped token deposit.
///@param rate Rate for wrapped token deposit.
///@dev Only default admin can call this function.
///@dev Rate is calculated as follows: rate = (amount * rate) / DENOMINATOR.
///@dev Examples of rate setup: 1e10 - 1:1, 2e10 - 2:1, 95e8 - 0.95:1.
function setRateForWrappedTokenDeposit(uint256 rate) public {
LibAccessControl.enforceRole(LibRoles.DEFAULT_ADMIN_ROLE);
if (rate == 0) {
revert ZeroAmount();
}
LibOptions.setRate(rate);
emit RateForWrappedTokenDepositSet(rate);
}
///@notice Set rate for core token deposit.
///@param coreRate Rate for wrapped token deposit via coreTokenDeposit function.
///@dev Only default admin can call this function.
///@dev Rate is calculated as follows: rate = (amount * rate) / DENOMINATOR.
///@dev Examples of rate setup: 1e10 - 1:1, 2e10 - 2:1, 95e8 - 0.95:1.
function setRateForCoreTokenDeposit(uint256 coreRate) public {
LibAccessControl.enforceRole(LibRoles.DEFAULT_ADMIN_ROLE);
if (coreRate == 0) {
revert ZeroAmount();
}
LibOptions.setRateForCoreTokenDeposit(coreRate);
emit RateForCoreTokenDepositSet(coreRate);
}
///@notice Set staking rewards contract.
///@param _stakingRewards Address of the staking rewards contract.
///@dev Only default admin can call this function.
///@dev Staking token in staking rewards contract should be compatible with this contract.
function setStakingRewards(IStakingRewards _stakingRewards) external {
LibAccessControl.enforceRole(LibRoles.DEFAULT_ADMIN_ROLE);
if (_stakingRewards.stakingToken() != address(this)) {
revert StakingTokenNotCompatible();
}
stakingRewards = _stakingRewards;
emit StakingRewardsSet(address(_stakingRewards));
}
//GETTERS//
function getOptions()
external
pure
returns (IOptions.Storage memory options)
{
return LibOptions.getStorage();
}
//INTERNAL//
///@notice Mint our tokens (aMaia/aHermes) to account with specified rate.
///@dev Recalculation works only in case when wrapped token decimals >= to current staking token decimals.
function _mint(
address account,
uint256 amount,
uint256 rate
) internal virtual returns (uint256) {
uint256 calculatedAmount = (amount * rate) / DENOMINATOR;
//recalculate amount to match decimals
if (IERC20Metadata(wrappedToken).decimals() != LibERC20.getDecimals()) {
calculatedAmount =
calculatedAmount /
10 **
(IERC20Metadata(wrappedToken).decimals() -
LibERC20.getDecimals());
}
LibERC20.mint(account, calculatedAmount);
return calculatedAmount;
}
///@notice Process core tokens deposit to 3rd party.
///@param amount Amount of core tokens to deposit.
///@return shares Amount of received wrapped tokens (vMaia/bHermes).
///@dev No need for zero check - it's already on 3rd party side.
function _processTokens(uint256 amount) internal returns (uint256) {
//approve 3rd party to spend core token
coreToken.approve(address(wrappedToken), amount);
//deposit Maia/Hermes on vMaia/bHermes and get vMaia/bHermes
uint256 shares = IThirdParty(wrappedToken).deposit(
amount,
LibOptions.getTreasury()
);
return shares;
}
///@notice Stake aMaia/aHermes in staking rewards.
///@param account Account for whom to stake tokens.
///@param amount Amount of tokens to stake.
function _stakeTokens(address account, uint256 amount) internal {
//approve staking rewards to spend our token
LibERC20.approve(address(this), address(stakingRewards), amount);
stakingRewards.stakeOnBehalf(account, amount);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IERC4626Wrapper {
event DepositCoreTokens(address account, uint256 amount, address token);
event DepositWrappedTokens(address account, uint256 amount, address token);
event RateForWrappedTokenDepositSet(uint256 rate);
event RateForCoreTokenDepositSet(uint256 coreRate);
event TreasurySet(address treasury);
event StakingRewardsSet(address stakingRewards);
error StakingTokenNotCompatible();
error ZeroAmount();
error ZeroAddress();
}// SPDX-License-Identifier: UNLICENSED
////////////////////////////////////////////////solarlabs.gg////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.17;
import {IVotingEscrow} from "./IVotingEscrow.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface IOptions {
struct Storage {
address treasury;
uint256 fee;
uint256 rate;
uint256 coreRate;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IStakingRewards {
function stakingToken() external view returns (address);
function stake(uint256 amount) external;
function stakeOnBehalf(address account, uint256 amount) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IThirdParty {
function deposit(uint256 assets, address receiver) external returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
// solhint-disable func-name-mixedcase,var-name-mixedcase
// slither-disable-start naming-convention
interface IVotingEscrow is IERC721Metadata {
struct LockedBalance {
int128 amount;
uint end;
}
function locked(
uint256 tokenId
) external view returns (LockedBalance memory);
/// @notice Get the most recently recorded rate of voting power decrease for `_tokenId`
/// @param _tokenId token of the NFT
/// @return Value of the slope
function get_last_user_slope(uint _tokenId) external view returns (int128);
/// @notice Get the timestamp for checkpoint `_idx` for `_tokenId`
/// @param _tokenId token of the NFT
/// @param _idx User epoch number
/// @return Epoch time of the checkpoint
function user_point_history__ts(
uint _tokenId,
uint _idx
) external view returns (uint);
/// @notice Get timestamp when `_tokenId`'s lock finishes
/// @param _tokenId User NFT
/// @return Epoch time of the lock end
function locked__end(uint _tokenId) external view returns (uint);
/// @dev Returns remaining vote lock for an NFT.
/// @param _tokenId The identifier for an NFT.
function voteExpiry(uint _tokenId) external view returns (uint);
/// @notice Locks tokenID vote for 1 week.
/// @param _tokenId The identifier for an NFT.
function lockVote(uint _tokenId) external;
function attach(uint _tokenId) external;
function detach(uint _tokenId) external;
function merge(uint _from, uint _to) external;
/// @notice Deposit `_value` tokens for `_tokenId` and add to the lock
/// @dev Anyone (even a smart contract) can deposit for someone else, but
/// cannot extend their locktime and deposit for a brand new user
/// @param _tokenId lock NFT
/// @param _value Amount to add to user's lock
function deposit_for(uint _tokenId, uint _value) external;
/// @notice Deposit `_value` tokens for `_to` and lock for `_lock_duration` by minter
/// @param _value Amount to deposit
/// @param _lock_duration Number of seconds to lock tokens for (rounded down to last week)
/// @param _to Address to deposit
function create_lock_for_minter(
uint _value,
uint _lock_duration,
address _to
) external returns (uint);
/// @notice Deposit `_value` tokens for `_to` and lock for `_lock_duration`
/// @param _value Amount to deposit
/// @param _lock_duration Number of seconds to lock tokens for (rounded down to nearest week)
/// @param _to Address to deposit
function create_lock_for(
uint _value,
uint _lock_duration,
address _to
) external returns (uint);
/// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lock_duration`
/// @param _value Amount to deposit
/// @param _lock_duration Number of seconds to lock tokens for (rounded down to nearest week)
function create_lock(
uint _value,
uint _lock_duration
) external returns (uint);
/// @notice Deposit `_value` additional tokens for `_tokenId` without modifying the unlock time
/// @param _value Amount of tokens to deposit and add to the lock
function increase_amount(uint _tokenId, uint _value) external;
/// @notice Extend the unlock time for `_tokenId`
/// @param _lock_duration New number of seconds until tokens unlock
function increase_unlock_time(uint _tokenId, uint _lock_duration) external;
/// @notice Withdraw all tokens for `_tokenId`
/// @dev Only possible if the lock has expired
function withdraw(uint _tokenId) external;
function balanceOfNFT(uint _tokenId) external view returns (uint);
function balanceOfNFTAt(
uint _tokenId,
uint _t
) external view returns (uint);
function balanceOfAtNFT(
uint _tokenId,
uint _block
) external view returns (uint);
/// @notice Calculate total voting power
/// @dev Adheres to the ERC20 `totalSupply` interface for Aragon compatibility
/// @return Total voting power
function totalSupplyAtT(uint t) external view returns (uint);
/// @notice Calculate total voting power at some point in the past
/// @param _block Block to calculate the total voting power at
/// @return Total voting power at `_block`
function totalSupplyAt(uint _block) external view returns (uint);
function tokensOfOwner(
address _owner
) external view returns (uint256[] memory);
function tokenOfOwnerByIndex(
address _owner,
uint _tokenIndex
) external view returns (uint);
}
// slither-disable-end naming-convention// SPDX-License-Identifier: UNLICENSED
////////////////////////////////////////////////solarlabs.gg////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.17;
import {IOptions, IVotingEscrow, IERC20, SafeERC20} from "./interfaces/IOptions.sol";
library LibOptions {
bytes32 private constant STORAGE_SLOT = keccak256("aerarium.LibOptions");
/**
* @dev Returns the storage.
*/
function getStorage() internal pure returns (IOptions.Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
function getTreasury() internal view returns (address treasury) {
treasury = getStorage().treasury;
}
function setTreasury(address treasury) internal {
getStorage().treasury = treasury;
}
function setFee(uint256 fee) internal {
getStorage().fee = fee;
}
function setRate(uint256 rate) internal {
getStorage().rate = rate;
}
function setRateForCoreTokenDeposit(uint256 coreRate) internal {
getStorage().coreRate = coreRate;
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {LibAccessControl} from "./LibAccessControl.sol";
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
contract AccessControlFacet is IAccessControlEnumerable {
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account)
external
view
virtual
override
returns (bool)
{
return LibAccessControl.hasRole(role, account);
}
/**
* @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
virtual
override
returns (bytes32)
{
return LibAccessControl.getRoleAdmin(role);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function setRoleAdmin(bytes32 role, bytes32 adminRole) external {
LibAccessControl.enforceRole(LibAccessControl.getRoleAdmin(role));
LibAccessControl.setRoleAdmin(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.
*/
function grantRole(bytes32 role, address account)
external
virtual
override
{
LibAccessControl.enforceRole(LibAccessControl.getRoleAdmin(role));
LibAccessControl.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.
*/
function revokeRole(bytes32 role, address account)
external
virtual
override
{
LibAccessControl.enforceRole(LibAccessControl.getRoleAdmin(role));
LibAccessControl.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 granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account)
external
virtual
override
{
// solhint-disable-next-line reason-string
require(
account == msg.sender,
"AccessControl: can only renounce roles for self"
);
LibAccessControl.revokeRole(role, account);
}
/**
* @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)
{
return LibAccessControl.getRoleMember(role, 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) external view returns (uint256) {
return LibAccessControl.getRoleMemberCount(role);
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/**
* @dev Library version of the OpenZeppelin AccessControlEnumerable contract with Diamond storage.
* See: https://docs.openzeppelin.com/contracts/4.x/api/access#AccessControl
* See: https://docs.openzeppelin.com/contracts/4.x/api/access#AccessControlEnumerable
* See: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControl.sol
* See: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/AccessControlEnumerable.sol
*/
library LibAccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
struct Storage {
mapping(bytes32 => RoleData) roles;
mapping(bytes32 => EnumerableSet.AddressSet) roleMembers;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
bytes32 private constant STORAGE_SLOT =
keccak256("solarprotocol.contracts.access.LibAccessControl");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(
bytes32 indexed role,
bytes32 indexed previousAdminRole,
bytes32 indexed newAdminRole
);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call.
*/
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)
internal
view
returns (bool)
{
return
_storage().roles[role].members[account] ||
_storage().roles[getRoleAdmin(role)].members[account];
}
/**
* @dev Revert with a standard message if `msg.sender` is missing `role`.
* @notice This function is identical to {checkRole} but is following the naming convention.
*/
function enforceRole(bytes32 role) internal view {
checkRole(role, msg.sender);
}
/**
* @dev Revert with a standard message if `msg.sender` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {checkRole}.
*
* _Available since v4.6._
*/
function checkRole(bytes32 role) internal view {
checkRole(role, msg.sender);
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) internal view returns (bytes32) {
return _storage().roles[role].adminRole;
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function setRoleAdmin(bytes32 role, bytes32 adminRole) internal {
bytes32 previousAdminRole = getRoleAdmin(role);
_storage().roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function grantRole(bytes32 role, address account) internal {
if (!hasRole(role, account)) {
_storage().roles[role].members[account] = true;
// slither-disable-next-line unused-return
_storage().roleMembers[role].add(account);
emit RoleGranted(role, account, msg.sender);
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function revokeRole(bytes32 role, address account) internal {
if (hasRole(role, account)) {
_storage().roles[role].members[account] = false;
// slither-disable-next-line unused-return
_storage().roleMembers[role].remove(account);
emit RoleRevoked(role, account, msg.sender);
}
}
/**
* @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)
internal
view
returns (address)
{
return _storage().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) internal view returns (uint256) {
return _storage().roleMembers[role].length();
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
/**
* @dev Library with a set of default roles to use across different other contracts.
*/
library LibRoles {
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
bytes32 public constant BLACKLIST_MANAGER_ROLE =
keccak256("BLACKLIST_MANAGER_ROLE");
bytes32 public constant PAUSE_MANAGER_ROLE =
keccak256("PAUSE_MANAGER_ROLE");
bytes32 public constant STABLE_PRICE_MANAGER_ROLE =
keccak256("STABLE_PRICE_MANAGER_ROLE");
bytes32 public constant TESTER_ROLE = keccak256("TESTER_ROLE");
bytes32 public constant STAKING_REWARDS_MANAGER =
keccak256("STAKING_REWARDS_MANAGER");
bytes32 public constant ERC20_MINTER_ROLE = keccak256("ERC20_MINTER_ROLE");
bytes32 public constant TOKEN_TAXES_MANAGER =
keccak256("TOKEN_TAXES_MANAGER");
bytes32 public constant TOKEN_REFLECTION_MANAGER =
keccak256("TOKEN_REFLECTION_MANAGER");
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
/*
* @dev External interface of a simple blacklist.
*/
interface ISimpleBlacklist {
/*
* @dev Emitted when an address was added to the blacklist
* @param account The address of the account added to the blacklist
* @param reason The reason string
*/
event Blacklisted(address indexed account, string indexed reason);
/*
* @dev Emitted when an address was removed from the blacklist
* @param account The address of the account removed from the blacklist
* @param reason The reason string
*/
event UnBlacklisted(address indexed account, string indexed reason);
/*
* @dev Check if `account` is on the blacklist.
*/
function isBlacklisted(address account) external view returns (bool);
/*
* @dev Check if any address in `accounts` is on the blacklist.
*/
function isBlacklisted(address[] memory accounts)
external
view
returns (bool);
/*
* @dev Adds `account` to the blacklist with `reason`.
*
* The `reason` is optional and can be an empty string.
*
* Emits {Blacklisted} event, if `account` was added to the blacklist.
*/
function blacklist(address account, string calldata reason) external;
/*
* @dev Adds `accounts` to the blacklist with `reasons`.
*
* The `reasons` is optional and can be an array of empty strings.
* Length of the `accounts`and `reasons` arrays must be equal.
*
* Emits {Blacklisted} events, for each account that was added to the blacklist
*/
function blacklist(address[] calldata accounts, string[] calldata reasons)
external;
/*
* @dev Removes `account` from the blacklist with `reason`.
*
* The `reason` is optional and can be an empty string.
*
* Emits {UnBlacklisted} event, if `account` was removed from the blacklist
*/
function unblacklist(address account, string calldata reason) external;
/*
* @dev Removes multiple `accounts` from the blacklist with `reasons`.
*
* The `reasons` is optional and can be an array of empty strings.
* Length of the `accounts`and `reasons` arrays must be equal.
*
* Emits {UnBlacklisted} events, for each account that was removed from the blacklist
*/
function unblacklist(address[] calldata accounts, string[] calldata reasons)
external;
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {ISimpleBlacklist} from "./ISimpleBlacklist.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
library LibSimpleBlacklist {
struct Storage {
mapping(address => bool) accounts;
}
bytes32 internal constant STORAGE_SLOT =
keccak256("solarprotocol.contracts.blacklist.LibSimpleBlacklist");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
/*
* @dev Emitted when an address was added to the blacklist
* @param account The address of the account added to the blacklist
* @param reason The reason string
*/
event Blacklisted(address indexed account, string indexed reason);
/*
* @dev Emitted when an address was removed from the blacklist
* @param account The address of the account removed from the blacklist
* @param reason The reason string
*/
event UnBlacklisted(address indexed account, string indexed reason);
/**
* @dev Revert with a standard message if `msg.sender` is blacklisted.
*/
function enforceNotBlacklisted() internal view {
checkBlacklisted(msg.sender);
}
/**
* @dev Revert with a standard message if `account` is blacklisted.
*/
function enforceNotBlacklisted(address account) internal view {
checkBlacklisted(account);
}
/**
* @dev Returns `true` if `account` is blacklisted.
*/
function isBlacklisted(address account) internal view returns (bool) {
return _storage().accounts[account];
}
/**
* @dev Returns `true` if any address in `accounts` is on the blacklist.
*/
function isBlacklisted(address[] memory accounts)
internal
view
returns (bool)
{
for (uint256 index = 0; index < accounts.length; index++) {
if (isBlacklisted(accounts[index])) {
return true;
}
}
return false;
}
/**
* @dev Revert with a standard message if `account` is blacklisted.
*
* The format of the revert reason is given by the following regular expression:
*
* /^SimpleBlacklist: account (0x[0-9a-f]{40}) is blacklisted$/
*/
function checkBlacklisted(address account) internal view {
if (isBlacklisted(account)) {
revert(
string(
abi.encodePacked(
"SimpleBlacklist: account ",
Strings.toHexString(uint160(account), 20),
" is blacklisted"
)
)
);
}
}
/**
* @dev Adds `account` to the blacklist.
*
* Internal function without access restriction.
*/
function blacklist(address account, string memory reason) internal {
if (!isBlacklisted(account)) {
_storage().accounts[account] = true;
emit Blacklisted(account, reason);
}
}
/**
* @dev Removes `account` from the blacklist.
*
* Internal function without access restriction.
*/
function unblacklist(address account, string memory reason) internal {
if (isBlacklisted(account)) {
_storage().accounts[account] = false;
emit UnBlacklisted(account, reason);
}
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {LibSimpleBlacklist} from "./LibSimpleBlacklist.sol";
import {ISimpleBlacklist} from "./ISimpleBlacklist.sol";
import {LibAccessControl} from "../access/LibAccessControl.sol";
import {LibRoles} from "../access/LibRoles.sol";
/**
* @dev Contract module that exposes athe interface for a simple blacklist.
*/
contract SimpleBlacklistFacet is ISimpleBlacklist {
/**
* @dev External function to add `account` to the blacklist.
*
* WARNING: This function is abstract, to enforce it's implementation
* in the final contract. This is important to make sure
* the final contraqct's access control mechanism will be used!
*
* See {ISimpleBlacklist-blacklist}
*
*/
function blacklist(address account, string calldata reason)
external
virtual
override
{
LibAccessControl.enforceRole(LibRoles.BLACKLIST_MANAGER_ROLE);
LibSimpleBlacklist.blacklist(account, reason);
}
/**
* @dev External function to add `account` to the blacklist.
*
* WARNING: This function is abstract, to enforce it's implementation
* in the final contract. This is important to make sure
* the final contraqct's access control mechanism will be used!
*
* See {ISimpleBlacklist-blacklist}
*
*/
function blacklist(address[] calldata accounts, string[] calldata reasons)
external
virtual
override
{
LibAccessControl.enforceRole(LibRoles.BLACKLIST_MANAGER_ROLE);
if (reasons.length > 0) {
// solhint-disable-next-line reason-string
require(
accounts.length == reasons.length,
"SimpleBlacklist: Not enough reasons"
);
for (uint256 index = 0; index < accounts.length; index++) {
LibSimpleBlacklist.blacklist(accounts[index], reasons[index]);
}
return;
}
for (uint256 index = 0; index < accounts.length; index++) {
LibSimpleBlacklist.blacklist(accounts[index], "");
}
}
/**
* @dev External function to remove `account` from the blacklist.
*
* WARNING: This function is abstract, to enforce it's implementation
* in the final contract. This is important to make sure
* the final contraqct's access control mechanism will be used!
*
* See {ISimpleBlacklist-unblacklist}
*
*/
function unblacklist(address account, string calldata reason)
external
virtual
override
{
LibAccessControl.enforceRole(LibRoles.BLACKLIST_MANAGER_ROLE);
LibSimpleBlacklist.unblacklist(account, reason);
}
/**
* @dev External function to add `account` to the blacklist.
*
* WARNING: This function is abstract, to enforce it's implementation
* in the final contract. This is important to make sure
* the final contraqct's access control mechanism will be used!
*
* See {ISimpleBlacklist-blacklist}
*
*/
function unblacklist(address[] calldata accounts, string[] calldata reasons)
external
virtual
override
{
LibAccessControl.enforceRole(LibRoles.BLACKLIST_MANAGER_ROLE);
if (reasons.length > 0) {
// solhint-disable-next-line reason-string
require(
accounts.length == reasons.length,
"SimpleBlacklist: Not enough reasons"
);
for (uint256 index = 0; index < accounts.length; index++) {
LibSimpleBlacklist.unblacklist(accounts[index], reasons[index]);
}
return;
}
for (uint256 index = 0; index < accounts.length; index++) {
LibSimpleBlacklist.unblacklist(accounts[index], "");
}
}
/**
* @dev Returns `true` if `account` is blacklisted.
*/
function isBlacklisted(address account)
external
view
virtual
override
returns (bool)
{
return LibSimpleBlacklist.isBlacklisted(account);
}
/**
* @dev Returns `true` if any address in `accounts` is on the blacklist.
*/
function isBlacklisted(address[] memory accounts)
external
view
virtual
override
returns (bool)
{
return LibSimpleBlacklist.isBlacklisted(accounts);
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {LibAccessControl} from "../access/LibAccessControl.sol";
import {LibRoles} from "../access/LibRoles.sol";
/**
* @dev Library version of the OpenZeppelin Pausable contract with Diamond storage.
* See: https://docs.openzeppelin.com/contracts/4.x/api/security#Pausable
* See: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/Pausable.sol
*/
library LibPausable {
struct Storage {
bool paused;
}
bytes32 private constant STORAGE_SLOT =
keccak256("solarprotocol.contracts.pausable.LibPausable");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev Reverts when paused.
*/
function enforceNotPaused() internal view {
require(
!paused() ||
LibAccessControl.hasRole(LibRoles.TESTER_ROLE, msg.sender),
"Pausable: paused"
);
}
/**
* @dev Reverts when paused.
*/
function enforceNotPaused(address address1, address address2)
internal
view
{
require(
!paused() ||
LibAccessControl.hasRole(LibRoles.TESTER_ROLE, msg.sender) ||
LibAccessControl.hasRole(LibRoles.TESTER_ROLE, address1) ||
LibAccessControl.hasRole(LibRoles.TESTER_ROLE, address2),
"Pausable: paused"
);
}
/**
* @dev Reverts when not paused.
*/
function enforcePaused() internal view {
require(
paused() ||
LibAccessControl.hasRole(LibRoles.TESTER_ROLE, msg.sender),
"Pausable: not paused"
);
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() internal view returns (bool) {
return _storage().paused;
}
/**
* @dev Triggers stopped state.
*/
function pause() internal {
_storage().paused = true;
emit Paused(msg.sender);
}
/**
* @dev Returns to normal state.
*/
function unpause() internal {
_storage().paused = false;
emit Unpaused(msg.sender);
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
interface IReentrancyGuard {
error ReentrancyGuardReentrantCall();
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
library LibReentrancyGuard {
uint256 internal constant NOT_ENTERED = 1;
uint256 internal constant ENTERED = 2;
struct Storage {
uint256 status;
}
bytes32 private constant STORAGE_SLOT =
keccak256("solarlabs.modules.reentrancy-guard.LibReentrancyGuard");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
function isEntered() internal view returns (bool) {
return _storage().status == ENTERED;
}
function enter() internal {
_storage().status = ENTERED;
}
function exit() internal {
_storage().status = NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {IReentrancyGuard} from "./IReentrancyGuard.sol";
import {LibReentrancyGuard} from "./LibReentrancyGuard.sol";
abstract contract ReentrancyGuard is IReentrancyGuard {
/**
* @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() {
// On the first call to nonReentrant, isEntered will be false
if (LibReentrancyGuard.isEntered()) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
LibReentrancyGuard.enter();
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
LibReentrancyGuard.exit();
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
interface IERC20Errors {
error ERC20TransferFromZeroAddress();
error ERC20TransferToZeroAddress();
error ERC20TransferAmountExceedsBalance(uint256 amount, uint256 balance);
error ERC20MintToZeroAddress();
error ERC20BurnFromZeroAddress();
error ERC20BurnAmountExceedsBalance(uint256 amount, uint256 balance);
error ERC20ApproveFromZeroAddress();
error ERC20ApproveToZeroAddress();
error ERC20InsufficientAllowance(uint256 amount, uint256 allowance);
error ERC20DecreasedAllowanceBelowZero(uint256 value, uint256 allowance);
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {LibERC20} from "../LibERC20.sol";
import {IERC20Errors} from "../errors/IERC20Errors.sol";
import {LibSimpleBlacklist} from "../../../blacklist/LibSimpleBlacklist.sol";
import {LibPausable} from "../../../pausable/LibPausable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
contract ERC20Facet is IERC20, IERC20Metadata, IERC20Errors {
/**
* @inheritdoc IERC20
*/
function transfer(address to, uint256 amount)
external
virtual
override
returns (bool)
{
LibPausable.enforceNotPaused(to, address(0));
LibSimpleBlacklist.enforceNotBlacklisted();
LibSimpleBlacklist.enforceNotBlacklisted(to);
LibERC20.transfer(msg.sender, to, amount);
return true;
}
/**
* @inheritdoc IERC20
*/
function transferFrom(
address from,
address to,
uint256 amount
) external virtual override returns (bool) {
LibPausable.enforceNotPaused(from, to);
LibSimpleBlacklist.enforceNotBlacklisted();
LibSimpleBlacklist.enforceNotBlacklisted(from);
LibSimpleBlacklist.enforceNotBlacklisted(to);
LibERC20.spendAllowance(from, msg.sender, amount);
LibERC20.transfer(from, to, amount);
return true;
}
/**
* @inheritdoc IERC20
*/
function balanceOf(address account)
external
view
virtual
override
returns (uint256)
{
return LibERC20.balanceOf(account);
}
/**
* @inheritdoc IERC20
*/
function allowance(address owner, address spender)
external
view
virtual
override
returns (uint256)
{
return LibERC20.allowance(owner, spender);
}
/**
* @inheritdoc IERC20
*/
function approve(address spender, uint256 amount)
external
virtual
override
returns (bool)
{
LibERC20.approve(msg.sender, spender, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
LibERC20.approve(
msg.sender,
spender,
LibERC20.allowance(msg.sender, spender) + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = LibERC20.allowance(msg.sender, spender);
if (subtractedValue > currentAllowance) {
revert IERC20Errors.ERC20DecreasedAllowanceBelowZero(
subtractedValue,
currentAllowance
);
}
unchecked {
LibERC20.approve(
msg.sender,
spender,
currentAllowance - subtractedValue
);
}
return true;
}
/**
* @inheritdoc IERC20
*/
function totalSupply() external view virtual override returns (uint256) {
return LibERC20.totalSupply();
}
/**
* @inheritdoc IERC20Metadata
*/
function name() external view virtual override returns (string memory) {
return LibERC20.getName();
}
/**
* @inheritdoc IERC20Metadata
*/
function symbol() external view virtual override returns (string memory) {
return LibERC20.getSymbol();
}
/**
* @inheritdoc IERC20Metadata
*/
function decimals()
external
view
virtual
override
returns (uint8 decimals_)
{
decimals_ = LibERC20.getDecimals();
if (decimals_ == 0) {
decimals_ = 18;
}
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {IERC20Errors} from "./errors/IERC20Errors.sol";
library LibERC20 {
struct Storage {
uint256 totalSupply;
string name;
string symbol;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowances;
uint8 decimals;
}
bytes32 private constant STORAGE_SLOT =
keccak256("solarlabs.modules.ERC20.LibERC20");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
/**
* @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 Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function transfer(
address from,
address to,
uint256 amount
) internal {
if (from == address(0)) {
revert IERC20Errors.ERC20TransferFromZeroAddress();
}
if (to == address(0)) revert IERC20Errors.ERC20TransferToZeroAddress();
Storage storage s = _storage();
uint256 fromBalance = _storage().balances[from];
if (amount > fromBalance) {
revert IERC20Errors.ERC20TransferAmountExceedsBalance(
amount,
fromBalance
);
}
unchecked {
s.balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
s.balances[to] += amount;
}
emit Transfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function mint(address account, uint256 amount) internal {
if (account == address(0)) revert IERC20Errors.ERC20MintToZeroAddress();
Storage storage s = _storage();
s.totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
s.balances[account] += amount;
}
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function burn(address account, uint256 amount) internal {
if (account == address(0))
revert IERC20Errors.ERC20BurnFromZeroAddress();
Storage storage s = _storage();
uint256 accountBalance = s.balances[account];
if (amount > accountBalance)
revert IERC20Errors.ERC20BurnAmountExceedsBalance(
amount,
accountBalance
);
unchecked {
s.balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
s.totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) internal view returns (uint256) {
return _storage().balances[account];
}
/**
* @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.
*
* Returns max allowance if spender is owner.
*/
function allowance(address owner, address spender)
internal
view
returns (uint256)
{
if (owner == spender) {
return type(uint256).max;
}
return _storage().allowances[owner][spender];
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function approve(
address owner,
address spender,
uint256 amount
) internal {
if (owner == address(0))
revert IERC20Errors.ERC20ApproveFromZeroAddress();
if (spender == address(0))
revert IERC20Errors.ERC20ApproveToZeroAddress();
_storage().allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function spendAllowance(
address owner,
address spender,
uint256 amount
) internal {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (amount > currentAllowance)
revert IERC20Errors.ERC20InsufficientAllowance(
amount,
currentAllowance
);
unchecked {
approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Returns the name of the token.
*/
function getName() internal view returns (string memory) {
return _storage().name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function getSymbol() internal view returns (string memory) {
return _storage().symbol;
}
/**
* @dev Returns the total supply of the token.
*/
function totalSupply() internal view returns (uint256) {
return _storage().totalSupply;
}
function setName(string memory name) internal {
_storage().name = name;
}
function setSymbol(string memory symbol) internal {
_storage().symbol = symbol;
}
function getDecimals() internal view returns (uint8 decimals) {
return _storage().decimals;
}
function setDecimals(uint8 decimals) internal {
_storage().decimals = decimals;
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
interface IInitializer {
error InitializerContractIsInitializing();
error InitializerContractIsNotInitializing();
error InitializerContractAlreadyInitialized();
error InitializerVersionAlreadyInitialized(uint8 version);
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {IInitializer} from "./IInitializer.sol";
import {LibInitializer} from "./LibInitializer.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
abstract contract Initializer is IInitializer {
/**
* @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. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !LibInitializer.isInitializing();
if (
(isTopLevelCall && !LibInitializer.isInitialized(1)) ||
(!Address.isContract(address(this)) &&
LibInitializer.getInitializedVersion() == 1)
) {
LibInitializer.setInitialized(1);
if (isTopLevelCall) {
LibInitializer.setInitializing(true);
}
_;
if (isTopLevelCall) {
LibInitializer.setInitializing(false);
emit Initialized(1);
}
} else {
revert InitializerContractAlreadyInitialized();
}
}
/**
* @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.
*
* `initializer` is equivalent to `reinitializer(1)`, so 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.
*
* 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.
*/
modifier reinitializer(uint8 version) {
if (
LibInitializer.isInitializing() ||
LibInitializer.isInitialized(version)
) {
revert InitializerVersionAlreadyInitialized(version);
}
LibInitializer.setInitialized(version);
LibInitializer.setInitializing(true);
_;
LibInitializer.setInitializing(false);
emit Initialized(version);
}
}// SPDX-License-Identifier: MIT
////////////////////////////////////////////////solarde.fi//////////////////////////////////////////////
//_____/\\\\\\\\\\\_________/\\\\\_______/\\\_________________/\\\\\\\\\_______/\\\\\\\\\_____ //
// ___/\\\/////////\\\_____/\\\///\\\____\/\\\_______________/\\\\\\\\\\\\\___/\\\///////\\\___ //
// __\//\\\______\///____/\\\/__\///\\\__\/\\\______________/\\\/////////\\\_\/\\\_____\/\\\___ //
// ___\////\\\__________/\\\______\//\\\_\/\\\_____________\/\\\_______\/\\\_\/\\\\\\\\\\\/____ //
// ______\////\\\______\/\\\_______\/\\\_\/\\\_____________\/\\\\\\\\\\\\\\\_\/\\\//////\\\____ //
// _________\////\\\___\//\\\______/\\\__\/\\\_____________\/\\\/////////\\\_\/\\\____\//\\\___ //
// __/\\\______\//\\\___\///\\\__/\\\____\/\\\_____________\/\\\_______\/\\\_\/\\\_____\//\\\__ //
// _\///\\\\\\\\\\\/______\///\\\\\/_____\/\\\\\\\\\\\\\\\_\/\\\_______\/\\\_\/\\\______\//\\\_ //
// ___\///////////__________\/////_______\///////////////__\///________\///__\///________\///__//
////////////////////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.9;
import {IInitializer} from "./IInitializer.sol";
library LibInitializer {
struct Storage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint8 initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool initializing;
}
bytes32 private constant STORAGE_SLOT =
keccak256("solarprotocol.contracts.utils.initializer.LibInitializer");
/**
* @dev Returns the storage.
*/
function _storage() private pure returns (Storage storage s) {
bytes32 slot = STORAGE_SLOT;
// solhint-disable no-inline-assembly
// slither-disable-next-line assembly
assembly {
s.slot := slot
}
// solhint-enable
}
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
function enforceIsInitializing() internal view {
if (!isInitializing()) {
revert IInitializer.InitializerContractIsNotInitializing();
}
}
function isInitializing() internal view returns (bool) {
return _storage().initializing;
}
function setInitializing(bool value) internal {
_storage().initializing = value;
}
function isInitialized() internal view returns (bool) {
return isInitialized(1);
}
function isInitialized(uint8 version) internal view returns (bool) {
return _storage().initialized >= version;
}
function getInitializedVersion() internal view returns (uint8) {
return _storage().initialized;
}
function setInitialized(uint8 version) internal {
if (isInitialized(version)) {
revert IInitializer.InitializerVersionAlreadyInitialized(version);
}
_storage().initialized = version;
}
/**
* @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.
*/
function disable() internal {
if (isInitializing()) {
revert IInitializer.InitializerContractIsInitializing();
}
if (!isInitialized(type(uint8).max)) {
setInitialized(type(uint8).max);
emit Initialized(type(uint8).max);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 999999
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IERC20","name":"_oldStakingToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC20ApproveFromZeroAddress","type":"error"},{"inputs":[],"name":"ERC20ApproveToZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"ERC20BurnAmountExceedsBalance","type":"error"},{"inputs":[],"name":"ERC20BurnFromZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"}],"name":"ERC20DecreasedAllowanceBelowZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[],"name":"ERC20MintToZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"ERC20TransferAmountExceedsBalance","type":"error"},{"inputs":[],"name":"ERC20TransferFromZeroAddress","type":"error"},{"inputs":[],"name":"ERC20TransferToZeroAddress","type":"error"},{"inputs":[],"name":"InitializerContractAlreadyInitialized","type":"error"},{"inputs":[],"name":"InitializerContractIsInitializing","type":"error"},{"inputs":[],"name":"InitializerContractIsNotInitializing","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"InitializerVersionAlreadyInitialized","type":"error"},{"inputs":[],"name":"MigrationPaused","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"StakingTokenNotCompatible","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"string","name":"reason","type":"string"}],"name":"Blacklisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"DepositCoreTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"DepositWrappedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"oldStakingToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Migrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"flag","type":"bool"}],"name":"PauseMigration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"coreRate","type":"uint256"}],"name":"RateForCoreTokenDepositSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"RateForWrappedTokenDepositSet","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":false,"internalType":"address","name":"stakingRewards","type":"address"}],"name":"StakingRewardsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"string","name":"reason","type":"string"}],"name":"UnBlacklisted","type":"event"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"string[]","name":"reasons","type":"string[]"}],"name":"blacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"string","name":"reason","type":"string"}],"name":"blacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"coreToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"coreTokenDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"decimals_","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getOptions","outputs":[{"components":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"coreRate","type":"uint256"}],"internalType":"struct IOptions.Storage","name":"options","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_coreToken","type":"address"},{"internalType":"address","name":"_wrappedToken","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"coreRate","type":"uint256"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"string","name":"tokenSymbol","type":"string"},{"internalType":"uint8","name":"tokenDecimals","type":"uint8"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"migrationPausedFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oldStakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"newFlag","type":"bool"}],"name":"pauseMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"coreRate","type":"uint256"}],"name":"setRateForCoreTokenDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"setRateForWrappedTokenDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"bytes32","name":"adminRole","type":"bytes32"}],"name":"setRoleAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IStakingRewards","name":"_stakingRewards","type":"address"}],"name":"setStakingRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingRewards","outputs":[{"internalType":"contract IStakingRewards","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"string[]","name":"reasons","type":"string[]"}],"name":"unblacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"string","name":"reason","type":"string"}],"name":"unblacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"wrappedTokenDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b5060405162004bfe38038062004bfe833981016040819052620000349162000157565b620000496200005b60201b620020671760201c565b6001600160a01b031660805262000189565b60008051602062004bde83398151915254610100900460ff161562000093576040516338733d7760e01b815260040160405180910390fd5b60008051602062004bde8339815191525460ff9081161015620000f157620000bc60ff620000f3565b60405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60008051602062004bde8339815191525460ff808316911610620001335760405163bfdd178560e01b815260ff8216600482015260240160405180910390fd5b60008051602062004bde833981519152805460ff191660ff92909216919091179055565b6000602082840312156200016a57600080fd5b81516001600160a01b03811681146200018257600080fd5b9392505050565b608051614a1d620001c16000396000818161046501528181610cc601528181610d2001528181610db70152610eb00152614a1d6000f3fe608060405234801561001057600080fd5b50600436106102d35760003560e01c806370a0823111610186578063ca15c873116100e3578063dd62ed3e11610097578063eedf9c7211610071578063eedf9c721461066f578063f0f4426014610682578063fe575a871461069557600080fd5b8063dd62ed3e14610636578063ddf579ff14610649578063e62600331461065c57600080fd5b8063ce5da407116100c8578063ce5da407146105fd578063d1e6c30c14610610578063d547741f1461062357600080fd5b8063ca15c87314610599578063cc2ee196146105ac57600080fd5b806395d89b411161013a578063a457c2d71161011f578063a457c2d714610560578063a58d747614610573578063a9059cbb1461058657600080fd5b806395d89b4114610538578063996c6cc31461054057600080fd5b80639010d07c1161016b5780639010d07c14610506578063918f86741461051957806391d148541461052557600080fd5b806370a08231146104e05780638088cbdf146104f357600080fd5b8063313ce5671161023457806347451770116101e85780636c14da15116101cd5780636c14da15146104a75780636ebb16d3146104ba5780636fb83a57146104cd57600080fd5b8063474517701461046057806364b87a701461048757600080fd5b806336568abe1161021957806336568abe14610427578063395093511461043a578063454b06081461044d57600080fd5b8063313ce567146103fa57806334fa505d1461041457600080fd5b8063186d38301161028b57806323b872dd1161027057806323b872dd146103c1578063248a9ca3146103d45780632f2ff15d146103e757600080fd5b8063186d3830146103995780631e4e0091146103ae57600080fd5b80630c2b72e9116102bc5780630c2b72e9146103195780630f4af7e21461035e57806318160ddd1461038357600080fd5b806306fdde03146102d8578063095ea7b3146102f6575b600080fd5b6102e06106a8565b6040516102ed9190613de7565b60405180910390f35b610309610304366004613e6a565b6106b7565b60405190151581526020016102ed565b6000546103399073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ed565b6002546103099074010000000000000000000000000000000000000000900460ff1681565b61038b6106ce565b6040519081526020016102ed565b6103ac6103a7366004613ee2565b6106f8565b005b6103ac6103bc366004613f4e565b6108ca565b6103096103cf366004613f70565b610912565b61038b6103e2366004613fb1565b610958565b6103ac6103f5366004613fca565b61098e565b6104026109d2565b60405160ff90911681526020016102ed565b6103ac610422366004614008565b610a13565b6103ac610435366004613fca565b610aa1565b610309610448366004613e6a565b610b50565b6103ac61045b366004613fb1565b610b71565b6103397f000000000000000000000000000000000000000000000000000000000000000081565b6002546103399073ffffffffffffffffffffffffffffffffffffffff1681565b6103ac6104b5366004613fb1565b610f10565b6103096104c83660046140a3565b610fac565b6103ac6104db366004614155565b610fb7565b61038b6104ee366004614155565b611107565b6103ac610501366004613fb1565b611151565b610339610514366004613f4e565b6111ed565b61038b6402540be40081565b610309610533366004613fca565b611200565b6102e061120c565b6001546103399073ffffffffffffffffffffffffffffffffffffffff1681565b61030961056e366004613e6a565b611216565b6103ac610581366004613fb1565b611276565b610309610594366004613e6a565b6114bb565b61038b6105a7366004613fb1565b6114e4565b6105b46114ef565b6040516102ed9190815173ffffffffffffffffffffffffffffffffffffffff16815260208083015190820152604080830151908201526060918201519181019190915260800190565b6103ac61060b366004613ee2565b6115ef565b6103ac61061e366004614172565b6117ae565b6103ac610631366004613fca565b61181c565b61038b6106443660046141f7565b611856565b6103ac610657366004614172565b611862565b6103ac61066a366004613fb1565b6118cb565b6103ac61067d3660046142cd565b611b29565b6103ac610690366004614155565b611f1e565b6103096106a3366004614155565b61201a565b60606106b2612136565b905090565b60006106c43384846121ea565b5060015b92915050565b60006106b27f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c5490565b6107217ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b8015610866578281146107bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f53696d706c65426c61636b6c6973743a204e6f7420656e6f756768207265617360448201527f6f6e73000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60005b838110156108605761084e8585838181106107db576107db61439c565b90506020020160208101906107f09190614155565b8484848181106108025761080261439c565b905060200281019061081491906143cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061231c92505050565b806108588161445f565b9150506107be565b506108c4565b60005b838110156108c2576108b08585838181106108865761088661439c565b905060200201602081019061089b9190614155565b6040518060200160405280600081525061231c565b806108ba8161445f565b915050610869565b505b50505050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d2602052604090206001015461090490612312565b61090e828261242d565b5050565b600061091e8484612497565b610926612596565b61092f8461259f565b6109388361259f565b6109438433846125a8565b61094e84848461262e565b5060019392505050565b60008181527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260205260408120600101546106c8565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260205260409020600101546109c890612312565b61090e82826127f1565b60006109ff7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b90508060ff16600003610a10575060125b90565b610a1d6000612312565b6002805482151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9091161790556040517fca5d20db5ed02871e691a7c4a23917adcad339d591183550e3f7906bd9a29c4590610a9690831515815260200190565b60405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff81163314610b46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016107b2565b61090e82826128f3565b60006106c4338484610b6233886129f3565b610b6c9190614497565b6121ea565b60025474010000000000000000000000000000000000000000900460ff1615610bc6576040517f3312a45000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610c00576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff9081168083527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208401527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54938301939093527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e5460608301529091610cef917f00000000000000000000000000000000000000000000000000000000000000001690339085612aa7565b81610d1b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b60ff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906144aa565b60ff1614610e8b577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4491906144aa565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff16610e7391906144c7565b610e7e90600a614600565b610e88908261460f565b90505b610e953382612b3c565b6040805173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001681523360208201529081018290527f928fd5531324ee87d76cc5307dc37580174da76b85cd546da631b2670bc266b59060600160405180910390a1505050565b610f1a6000612312565b80600003610f54576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f7c817f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e55565b6040518181527fbd1048098ac937668fc3d9ba4ca1637fe40039164499a7b5058fe39c69e1c35890602001610a96565b60006106c882612c1f565b610fc16000612312565b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611023573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110479190614626565b73ffffffffffffffffffffffffffffffffffffffff1614611094576040517ffdc6a4ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb63c81227c62f4cb3e2b1120e3afbf3a2ed5dd8b9d99b8bef7275b084e6a98cb90602001610a96565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9f60205260408120546106c8565b61115b6000612312565b80600003611195576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111bd817f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d55565b6040518181527f57f9576c7cc9e4bee1691972c52cccc86f416830332dac3b0c3bf04a697d3a2590602001610a96565b60006111f98383612cbc565b9392505050565b60006111f98383612cf3565b60606106b2612de6565b60008061122333856129f3565b905080831115611269576040517fc7d2f36c00000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044016107b2565b61094e33858584036121ea565b7fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee59546002036112d1576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112fa60027fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b611302612e17565b61130b3361259f565b80600003611345576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff9081168083527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208401527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54938301939093527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e54606083015260015491926114189290911690339085612aa7565b600061142930848460400151612eb6565b90506114353382613086565b600154604080513381526020810186905273ffffffffffffffffffffffffffffffffffffffff90921682820152517f4d2f03b0bc1d35d66ed7218ea246994516d72824491f11dd83d73368c7205f179181900360600190a150506114b860017fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b50565b60006114c8836000612497565b6114d0612596565b6114d98361259f565b6106c433848461262e565b60006106c88261313b565b6115306040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081525090565b50604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1681527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208201527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54918101919091527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e54606082015290565b6116187ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b8015611752578281146116ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f53696d706c65426c61636b6c6973743a204e6f7420656e6f756768207265617360448201527f6f6e73000000000000000000000000000000000000000000000000000000000060648201526084016107b2565b60005b83811015610860576117408585838181106116cd576116cd61439c565b90506020020160208101906116e29190614155565b8484848181106116f4576116f461439c565b905060200281019061170691906143cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061317192505050565b8061174a8161445f565b9150506116b0565b60005b838110156108c25761179c8585838181106117725761177261439c565b90506020020160208101906117879190614155565b60405180602001604052806000815250613171565b806117a68161445f565b915050611755565b6117d77ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b6118178383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061231c92505050565b505050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020526040902060010154610b4690612312565b60006111f983836129f3565b61188b7ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b6118178383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061317192505050565b7fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5954600203611926576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61194f60027fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b611957612e17565b6119603361259f565b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1681527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208201527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54918101919091527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e5460608201526000829003611a56576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600054611a7b9073ffffffffffffffffffffffffffffffffffffffff16333085612aa7565b6000611a8683613284565b90506000611a9930838560600151612eb6565b9050611aa53382613086565b600054604080513381526020810187905273ffffffffffffffffffffffffffffffffffffffff90921682820152517f69b0f3b4178d264250856190b700a0c75ddc0ec702ccfa68548d0b3d2ebcf8489181900360600190a15050506114b860017fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354610100900460ff1615808015611b8757507f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354600160ff909116105b80611ba65750303b158015611ba65750611b9f61341a565b60ff166001145b15611ee057611bb56001613447565b8015611c07577f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff8a161580611c3e575073ffffffffffffffffffffffffffffffffffffffff8916155b80611c5d575073ffffffffffffffffffffffffffffffffffffffff8816155b80611c7c575073ffffffffffffffffffffffffffffffffffffffff8716155b15611cb3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b851580611cbe575084155b15611cf5576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d006000896127f1565b611d2a7f93e2d8b2e93c88f3c19b401174361b9247b08aa8aeed66c2e49da11183f7efa7896127f1565b611d33846134ff565b611d3c8361352a565b6000805473ffffffffffffffffffffffffffffffffffffffff8c81167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255600180548c84169083161790557f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b8054928a1692909116919091179055611de5867f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d55565b611e0d857f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e55565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff84161790558015611edb577f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b611f12565b6040517f5d99ebd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505050505050565b611f286000612312565b73ffffffffffffffffffffffffffffffffffffffff8116611f75576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560405173ffffffffffffffffffffffffffffffffffffffff821681527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f90602001610a96565b73ffffffffffffffffffffffffffffffffffffffff811660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604081205460ff166106c8565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354610100900460ff16156120c8576040517f38733d7700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35460ff9081161015612134576120ff60ff613447565b60405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60607f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c600101805461216790614643565b80601f016020809104026020016040519081016040528092919081815260200182805461219390614643565b80156121e05780601f106121b5576101008083540402835291602001916121e0565b820191906000526020600020905b8154815290600101906020018083116121c357829003601f168201915b5050505050905090565b73ffffffffffffffffffffffffffffffffffffffff8316612237576040517fbec36d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216612284576040517fd8aedff600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83811660008181527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea0602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6114b88133613555565b73ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff161561090e5773ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d60205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055516123e1908290614696565b6040519081900381209073ffffffffffffffffffffffffffffffffffffffff8416907fe4e3c0e67592981f9042a3df81ea0ee0dfb06be469efdbd2bfc674ab37ab62fe90600090a35050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61249f6135fe565b15806124d057506124d07fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e33612cf3565b8061250057506125007fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e83612cf3565b8061253057506125307fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e82612cf3565b61090e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107b2565b61213433613626565b6114b881613626565b60006125b484846129f3565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108c45780821115612621576040517f9667a91e00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526044016107b2565b6108c484848484036121ea565b73ffffffffffffffffffffffffffffffffffffffff831661267b576040517f27903dcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166126c8576040517f0359c55e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9f60205260409020547f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c9080831115612773576040517f089b804c00000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044016107b2565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260038501602052604080822087860390559287168082529083902080548701905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906127e29087815260200190565b60405180910390a35050505050565b6127fb8282612cf3565b61090e5760008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558483527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d390915290206128a990826136a4565b50604051339073ffffffffffffffffffffffffffffffffffffffff83169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b6128fd8282612cf3565b1561090e5760008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558483527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d390915290206129a990826136c6565b50604051339073ffffffffffffffffffffffffffffffffffffffff83169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612a4f57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6106c8565b5073ffffffffffffffffffffffffffffffffffffffff91821660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea06020908152604080832093909416825291909152205490565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526108c49085906136e8565b73ffffffffffffffffffffffffffffffffffffffff8216612b89576040517fd1bb5a3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c805482908290600090612bbe908490614497565b909155505073ffffffffffffffffffffffffffffffffffffffff831660008181526003830160209081526040808320805487019055518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101612305565b6000805b8251811015612cb357612c93838281518110612c4157612c4161439c565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff1690565b15612ca15750600192915050565b80612cab8161445f565b915050612c23565b50600092915050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d3602052604081206111f990836137f7565b60007fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260008481526020918252604080822073ffffffffffffffffffffffffffffffffffffffff86168352909252205460ff16806111f957507fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26000612da78560009081527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d2602052604090206001015490565b81526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff8616825290925290205460ff16905092915050565b60607f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c600201805461216790614643565b612e1f6135fe565b1580612e505750612e507fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e33612cf3565b612134576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107b2565b6000806402540be400612ec9848661460f565b612ed391906146b2565b9050612f007f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b60ff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f9491906144aa565b60ff1614613074577f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561302e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061305291906144aa565b61305c91906144c7565b61306790600a614600565b61307190826146b2565b90505b61307e8582612b3c565b949350505050565b6002546130ab90309073ffffffffffffffffffffffffffffffffffffffff16836121ea565b6002546040517f460b5ee200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018490529091169063460b5ee290604401600060405180830381600087803b15801561311f57600080fd5b505af1158015613133573d6000803e3d6000fd5b505050505050565b60008181527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d3602052604081206106c890613803565b73ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff1661090e5773ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d60205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551613238908290614696565b6040519081900381209073ffffffffffffffffffffffffffffffffffffffff8416907f71ffd5b2f7b305f2f756c161455e2951077ed1951f9ecbee6252949bc1e13c5a90600090a35050565b600080546001546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810185905291169063095ea7b3906044016020604051808303816000875af1158015613300573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061332491906146ed565b5060015460009073ffffffffffffffffffffffffffffffffffffffff16636e553f65846133857f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016020604051808303816000875af11580156133f6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f9919061470a565b60007f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35b5460ff16919050565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35460ff8083169116106134ac576040517fbfdd178500000000000000000000000000000000000000000000000000000000815260ff821660048201526024016107b2565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff92909216919091179055565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9d61090e8282614769565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9e61090e8282614769565b61355f8282612cf3565b61090e576135848173ffffffffffffffffffffffffffffffffffffffff16601461380d565b61358f83602061380d565b6040516020016135a0929190614883565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526107b291600401613de7565b60007fb65939979d77055fe20d21bcb90b95461947bffa39f3588194f5015117626ea761343e565b73ffffffffffffffffffffffffffffffffffffffff811660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff16156114b8576136948173ffffffffffffffffffffffffffffffffffffffff16601461380d565b6040516020016135a09190614904565b60006111f98373ffffffffffffffffffffffffffffffffffffffff8416613a50565b60006111f98373ffffffffffffffffffffffffffffffffffffffff8416613a9f565b600061374a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b929092919063ffffffff16565b905080516000148061376b57508080602001905181019061376b91906146ed565b611817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107b2565b60006111f98383613ba1565b60006106c8825490565b6060600061381c83600261460f565b613827906002614497565b67ffffffffffffffff81111561383f5761383f614025565b6040519080825280601f01601f191660200182016040528015613869576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106138a0576138a061439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106139035761390361439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061393f84600261460f565b61394a906001614497565b90505b60018111156139e7577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061398b5761398b61439c565b1a60f81b8282815181106139a1576139a161439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936139e081614970565b905061394d565b5083156111f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107b2565b6000818152600183016020526040812054613a97575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106c8565b5060006106c8565b60008181526001830160205260408120548015613b88576000613ac36001836149a5565b8554909150600090613ad7906001906149a5565b9050818114613b3c576000866000018281548110613af757613af761439c565b9060005260206000200154905080876000018481548110613b1a57613b1a61439c565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b4d57613b4d6149b8565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106c8565b60009150506106c8565b606061307e8484600085613bcb565b6000826000018281548110613bb857613bb861439c565b9060005260206000200154905092915050565b606082471015613c5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107b2565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613c869190614696565b60006040518083038185875af1925050503d8060008114613cc3576040519150601f19603f3d011682016040523d82523d6000602084013e613cc8565b606091505b5091509150613cd987838387613ce4565b979650505050505050565b60608315613d7a578251600003613d735773ffffffffffffffffffffffffffffffffffffffff85163b613d73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107b2565b508161307e565b61307e8383815115613d8f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b29190613de7565b60005b83811015613dde578181015183820152602001613dc6565b50506000910152565b6020815260008251806020840152613e06816040850160208701613dc3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff811681146114b857600080fd5b8035613e6581613e38565b919050565b60008060408385031215613e7d57600080fd5b8235613e8881613e38565b946020939093013593505050565b60008083601f840112613ea857600080fd5b50813567ffffffffffffffff811115613ec057600080fd5b6020830191508360208260051b8501011115613edb57600080fd5b9250929050565b60008060008060408587031215613ef857600080fd5b843567ffffffffffffffff80821115613f1057600080fd5b613f1c88838901613e96565b90965094506020870135915080821115613f3557600080fd5b50613f4287828801613e96565b95989497509550505050565b60008060408385031215613f6157600080fd5b50508035926020909101359150565b600080600060608486031215613f8557600080fd5b8335613f9081613e38565b92506020840135613fa081613e38565b929592945050506040919091013590565b600060208284031215613fc357600080fd5b5035919050565b60008060408385031215613fdd57600080fd5b823591506020830135613fef81613e38565b809150509250929050565b80151581146114b857600080fd5b60006020828403121561401a57600080fd5b81356111f981613ffa565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561409b5761409b614025565b604052919050565b600060208083850312156140b657600080fd5b823567ffffffffffffffff808211156140ce57600080fd5b818501915085601f8301126140e257600080fd5b8135818111156140f4576140f4614025565b8060051b9150614105848301614054565b818152918301840191848101908884111561411f57600080fd5b938501935b83851015614149578435925061413983613e38565b8282529385019390850190614124565b98975050505050505050565b60006020828403121561416757600080fd5b81356111f981613e38565b60008060006040848603121561418757600080fd5b833561419281613e38565b9250602084013567ffffffffffffffff808211156141af57600080fd5b818601915086601f8301126141c357600080fd5b8135818111156141d257600080fd5b8760208285010111156141e457600080fd5b6020830194508093505050509250925092565b6000806040838503121561420a57600080fd5b823561421581613e38565b91506020830135613fef81613e38565b600082601f83011261423657600080fd5b813567ffffffffffffffff81111561425057614250614025565b61428160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614054565b81815284602083860101111561429657600080fd5b816020850160208301376000918101602001919091529392505050565b60ff811681146114b857600080fd5b8035613e65816142b3565b60008060008060008060008060006101208a8c0312156142ec57600080fd5b89356142f781613e38565b985060208a013561430781613e38565b975061431560408b01613e5a565b965061432360608b01613e5a565b955060808a0135945060a08a0135935060c08a013567ffffffffffffffff8082111561434e57600080fd5b61435a8d838e01614225565b945060e08c013591508082111561437057600080fd5b5061437d8c828d01614225565b92505061438d6101008b016142c2565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261440057600080fd5b83018035915067ffffffffffffffff82111561441b57600080fd5b602001915036819003821315613edb57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361449057614490614430565b5060010190565b808201808211156106c8576106c8614430565b6000602082840312156144bc57600080fd5b81516111f9816142b3565b60ff82811682821603908111156106c8576106c8614430565b600181815b8085111561453957817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561451f5761451f614430565b8085161561452c57918102915b93841c93908002906144e5565b509250929050565b600082614550575060016106c8565b8161455d575060006106c8565b8160018114614573576002811461457d57614599565b60019150506106c8565b60ff84111561458e5761458e614430565b50506001821b6106c8565b5060208310610133831016604e8410600b84101617156145bc575081810a6106c8565b6145c683836144e0565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156145f8576145f8614430565b029392505050565b60006111f960ff841683614541565b80820281158282048414176106c8576106c8614430565b60006020828403121561463857600080fd5b81516111f981613e38565b600181811c9082168061465757607f821691505b602082108103614690577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600082516146a8818460208701613dc3565b9190910192915050565b6000826146e8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156146ff57600080fd5b81516111f981613ffa565b60006020828403121561471c57600080fd5b5051919050565b601f82111561181757600081815260208120601f850160051c8101602086101561474a5750805b601f850160051c820191505b8181101561313357828155600101614756565b815167ffffffffffffffff81111561478357614783614025565b614797816147918454614643565b84614723565b602080601f8311600181146147ea57600084156147b45750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613133565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561483757888601518255948401946001909101908401614818565b508582101561487357878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516148bb816017850160208801613dc3565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516148f8816028840160208801613dc3565b01602801949350505050565b7f53696d706c65426c61636b6c6973743a206163636f756e74200000000000000081526000825161493c816019850160208701613dc3565b7f20697320626c61636b6c697374656400000000000000000000000000000000006019939091019283015250602801919050565b60008161497f5761497f614430565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b818103818111156106c8576106c8614430565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220143946ef535b425cd66defaf2a3e6972d9ef8163cba91e75779d115996995c9b64736f6c634300081100330de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb3000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102d35760003560e01c806370a0823111610186578063ca15c873116100e3578063dd62ed3e11610097578063eedf9c7211610071578063eedf9c721461066f578063f0f4426014610682578063fe575a871461069557600080fd5b8063dd62ed3e14610636578063ddf579ff14610649578063e62600331461065c57600080fd5b8063ce5da407116100c8578063ce5da407146105fd578063d1e6c30c14610610578063d547741f1461062357600080fd5b8063ca15c87314610599578063cc2ee196146105ac57600080fd5b806395d89b411161013a578063a457c2d71161011f578063a457c2d714610560578063a58d747614610573578063a9059cbb1461058657600080fd5b806395d89b4114610538578063996c6cc31461054057600080fd5b80639010d07c1161016b5780639010d07c14610506578063918f86741461051957806391d148541461052557600080fd5b806370a08231146104e05780638088cbdf146104f357600080fd5b8063313ce5671161023457806347451770116101e85780636c14da15116101cd5780636c14da15146104a75780636ebb16d3146104ba5780636fb83a57146104cd57600080fd5b8063474517701461046057806364b87a701461048757600080fd5b806336568abe1161021957806336568abe14610427578063395093511461043a578063454b06081461044d57600080fd5b8063313ce567146103fa57806334fa505d1461041457600080fd5b8063186d38301161028b57806323b872dd1161027057806323b872dd146103c1578063248a9ca3146103d45780632f2ff15d146103e757600080fd5b8063186d3830146103995780631e4e0091146103ae57600080fd5b80630c2b72e9116102bc5780630c2b72e9146103195780630f4af7e21461035e57806318160ddd1461038357600080fd5b806306fdde03146102d8578063095ea7b3146102f6575b600080fd5b6102e06106a8565b6040516102ed9190613de7565b60405180910390f35b610309610304366004613e6a565b6106b7565b60405190151581526020016102ed565b6000546103399073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ed565b6002546103099074010000000000000000000000000000000000000000900460ff1681565b61038b6106ce565b6040519081526020016102ed565b6103ac6103a7366004613ee2565b6106f8565b005b6103ac6103bc366004613f4e565b6108ca565b6103096103cf366004613f70565b610912565b61038b6103e2366004613fb1565b610958565b6103ac6103f5366004613fca565b61098e565b6104026109d2565b60405160ff90911681526020016102ed565b6103ac610422366004614008565b610a13565b6103ac610435366004613fca565b610aa1565b610309610448366004613e6a565b610b50565b6103ac61045b366004613fb1565b610b71565b6103397f000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a81565b6002546103399073ffffffffffffffffffffffffffffffffffffffff1681565b6103ac6104b5366004613fb1565b610f10565b6103096104c83660046140a3565b610fac565b6103ac6104db366004614155565b610fb7565b61038b6104ee366004614155565b611107565b6103ac610501366004613fb1565b611151565b610339610514366004613f4e565b6111ed565b61038b6402540be40081565b610309610533366004613fca565b611200565b6102e061120c565b6001546103399073ffffffffffffffffffffffffffffffffffffffff1681565b61030961056e366004613e6a565b611216565b6103ac610581366004613fb1565b611276565b610309610594366004613e6a565b6114bb565b61038b6105a7366004613fb1565b6114e4565b6105b46114ef565b6040516102ed9190815173ffffffffffffffffffffffffffffffffffffffff16815260208083015190820152604080830151908201526060918201519181019190915260800190565b6103ac61060b366004613ee2565b6115ef565b6103ac61061e366004614172565b6117ae565b6103ac610631366004613fca565b61181c565b61038b6106443660046141f7565b611856565b6103ac610657366004614172565b611862565b6103ac61066a366004613fb1565b6118cb565b6103ac61067d3660046142cd565b611b29565b6103ac610690366004614155565b611f1e565b6103096106a3366004614155565b61201a565b60606106b2612136565b905090565b60006106c43384846121ea565b5060015b92915050565b60006106b27f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c5490565b6107217ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b8015610866578281146107bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f53696d706c65426c61636b6c6973743a204e6f7420656e6f756768207265617360448201527f6f6e73000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60005b838110156108605761084e8585838181106107db576107db61439c565b90506020020160208101906107f09190614155565b8484848181106108025761080261439c565b905060200281019061081491906143cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061231c92505050565b806108588161445f565b9150506107be565b506108c4565b60005b838110156108c2576108b08585838181106108865761088661439c565b905060200201602081019061089b9190614155565b6040518060200160405280600081525061231c565b806108ba8161445f565b915050610869565b505b50505050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d2602052604090206001015461090490612312565b61090e828261242d565b5050565b600061091e8484612497565b610926612596565b61092f8461259f565b6109388361259f565b6109438433846125a8565b61094e84848461262e565b5060019392505050565b60008181527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260205260408120600101546106c8565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260205260409020600101546109c890612312565b61090e82826127f1565b60006109ff7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b90508060ff16600003610a10575060125b90565b610a1d6000612312565b6002805482151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9091161790556040517fca5d20db5ed02871e691a7c4a23917adcad339d591183550e3f7906bd9a29c4590610a9690831515815260200190565b60405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff81163314610b46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016107b2565b61090e82826128f3565b60006106c4338484610b6233886129f3565b610b6c9190614497565b6121ea565b60025474010000000000000000000000000000000000000000900460ff1615610bc6576040517f3312a45000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610c00576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff9081168083527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208401527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54938301939093527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e5460608301529091610cef917f000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a1690339085612aa7565b81610d1b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b60ff167f000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a73ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad91906144aa565b60ff1614610e8b577f000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a73ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4491906144aa565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff16610e7391906144c7565b610e7e90600a614600565b610e88908261460f565b90505b610e953382612b3c565b6040805173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a1681523360208201529081018290527f928fd5531324ee87d76cc5307dc37580174da76b85cd546da631b2670bc266b59060600160405180910390a1505050565b610f1a6000612312565b80600003610f54576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f7c817f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e55565b6040518181527fbd1048098ac937668fc3d9ba4ca1637fe40039164499a7b5058fe39c69e1c35890602001610a96565b60006106c882612c1f565b610fc16000612312565b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611023573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110479190614626565b73ffffffffffffffffffffffffffffffffffffffff1614611094576040517ffdc6a4ef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fb63c81227c62f4cb3e2b1120e3afbf3a2ed5dd8b9d99b8bef7275b084e6a98cb90602001610a96565b73ffffffffffffffffffffffffffffffffffffffff811660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9f60205260408120546106c8565b61115b6000612312565b80600003611195576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111bd817f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d55565b6040518181527f57f9576c7cc9e4bee1691972c52cccc86f416830332dac3b0c3bf04a697d3a2590602001610a96565b60006111f98383612cbc565b9392505050565b60006111f98383612cf3565b60606106b2612de6565b60008061122333856129f3565b905080831115611269576040517fc7d2f36c00000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044016107b2565b61094e33858584036121ea565b7fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee59546002036112d1576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112fa60027fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b611302612e17565b61130b3361259f565b80600003611345576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff9081168083527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208401527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54938301939093527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e54606083015260015491926114189290911690339085612aa7565b600061142930848460400151612eb6565b90506114353382613086565b600154604080513381526020810186905273ffffffffffffffffffffffffffffffffffffffff90921682820152517f4d2f03b0bc1d35d66ed7218ea246994516d72824491f11dd83d73368c7205f179181900360600190a150506114b860017fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b50565b60006114c8836000612497565b6114d0612596565b6114d98361259f565b6106c433848461262e565b60006106c88261313b565b6115306040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081525090565b50604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1681527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208201527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54918101919091527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e54606082015290565b6116187ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b8015611752578281146116ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f53696d706c65426c61636b6c6973743a204e6f7420656e6f756768207265617360448201527f6f6e73000000000000000000000000000000000000000000000000000000000060648201526084016107b2565b60005b83811015610860576117408585838181106116cd576116cd61439c565b90506020020160208101906116e29190614155565b8484848181106116f4576116f461439c565b905060200281019061170691906143cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061317192505050565b8061174a8161445f565b9150506116b0565b60005b838110156108c25761179c8585838181106117725761177261439c565b90506020020160208101906117879190614155565b60405180602001604052806000815250613171565b806117a68161445f565b915050611755565b6117d77ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b6118178383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061231c92505050565b505050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020526040902060010154610b4690612312565b60006111f983836129f3565b61188b7ff988e4fb62b8e14f4820fed03192306ddf4d7dbfa215595ba1c6ba4b76b369ee612312565b6118178383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061317192505050565b7fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5954600203611926576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61194f60027fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b611957612e17565b6119603361259f565b604080516080810182527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1681527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3c5460208201527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d54918101919091527f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e5460608201526000829003611a56576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600054611a7b9073ffffffffffffffffffffffffffffffffffffffff16333085612aa7565b6000611a8683613284565b90506000611a9930838560600151612eb6565b9050611aa53382613086565b600054604080513381526020810187905273ffffffffffffffffffffffffffffffffffffffff90921682820152517f69b0f3b4178d264250856190b700a0c75ddc0ec702ccfa68548d0b3d2ebcf8489181900360600190a15050506114b860017fd370c446e45a741b5961ac03f05d57d1a5768014420ffedc28dbab09fedaee5955565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354610100900460ff1615808015611b8757507f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354600160ff909116105b80611ba65750303b158015611ba65750611b9f61341a565b60ff166001145b15611ee057611bb56001613447565b8015611c07577f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff8a161580611c3e575073ffffffffffffffffffffffffffffffffffffffff8916155b80611c5d575073ffffffffffffffffffffffffffffffffffffffff8816155b80611c7c575073ffffffffffffffffffffffffffffffffffffffff8716155b15611cb3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b851580611cbe575084155b15611cf5576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d006000896127f1565b611d2a7f93e2d8b2e93c88f3c19b401174361b9247b08aa8aeed66c2e49da11183f7efa7896127f1565b611d33846134ff565b611d3c8361352a565b6000805473ffffffffffffffffffffffffffffffffffffffff8c81167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255600180548c84169083161790557f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b8054928a1692909116919091179055611de5867f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3d55565b611e0d857f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3e55565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff84161790558015611edb577f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b611f12565b6040517f5d99ebd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505050505050565b611f286000612312565b73ffffffffffffffffffffffffffffffffffffffff8116611f75576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560405173ffffffffffffffffffffffffffffffffffffffff821681527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f90602001610a96565b73ffffffffffffffffffffffffffffffffffffffff811660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604081205460ff166106c8565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb354610100900460ff16156120c8576040517f38733d7700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35460ff9081161015612134576120ff60ff613447565b60405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60607f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c600101805461216790614643565b80601f016020809104026020016040519081016040528092919081815260200182805461219390614643565b80156121e05780601f106121b5576101008083540402835291602001916121e0565b820191906000526020600020905b8154815290600101906020018083116121c357829003601f168201915b5050505050905090565b73ffffffffffffffffffffffffffffffffffffffff8316612237576040517fbec36d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216612284576040517fd8aedff600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83811660008181527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea0602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6114b88133613555565b73ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff161561090e5773ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d60205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055516123e1908290614696565b6040519081900381209073ffffffffffffffffffffffffffffffffffffffff8416907fe4e3c0e67592981f9042a3df81ea0ee0dfb06be469efdbd2bfc674ab37ab62fe90600090a35050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b61249f6135fe565b15806124d057506124d07fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e33612cf3565b8061250057506125007fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e83612cf3565b8061253057506125307fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e82612cf3565b61090e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107b2565b61213433613626565b6114b881613626565b60006125b484846129f3565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146108c45780821115612621576040517f9667a91e00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526044016107b2565b6108c484848484036121ea565b73ffffffffffffffffffffffffffffffffffffffff831661267b576040517f27903dcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166126c8576040517f0359c55e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9f60205260409020547f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c9080831115612773576040517f089b804c00000000000000000000000000000000000000000000000000000000815260048101849052602481018290526044016107b2565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260038501602052604080822087860390559287168082529083902080548701905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906127e29087815260200190565b60405180910390a35050505050565b6127fb8282612cf3565b61090e5760008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558483527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d390915290206128a990826136a4565b50604051339073ffffffffffffffffffffffffffffffffffffffff83169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b6128fd8282612cf3565b1561090e5760008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558483527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d390915290206129a990826136c6565b50604051339073ffffffffffffffffffffffffffffffffffffffff83169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612a4f57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6106c8565b5073ffffffffffffffffffffffffffffffffffffffff91821660009081527f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea06020908152604080832093909416825291909152205490565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526108c49085906136e8565b73ffffffffffffffffffffffffffffffffffffffff8216612b89576040517fd1bb5a3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c805482908290600090612bbe908490614497565b909155505073ffffffffffffffffffffffffffffffffffffffff831660008181526003830160209081526040808320805487019055518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101612305565b6000805b8251811015612cb357612c93838281518110612c4157612c4161439c565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff1690565b15612ca15750600192915050565b80612cab8161445f565b915050612c23565b50600092915050565b60008281527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d3602052604081206111f990836137f7565b60007fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d260008481526020918252604080822073ffffffffffffffffffffffffffffffffffffffff86168352909252205460ff16806111f957507fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d26000612da78560009081527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d2602052604090206001015490565b81526020808201929092526040908101600090812073ffffffffffffffffffffffffffffffffffffffff8616825290925290205460ff16905092915050565b60607f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9c600201805461216790614643565b612e1f6135fe565b1580612e505750612e507fda6fac9f81a22bb02ed26455dcee2a5f2434c8a3377a2cc986478052c1594f9e33612cf3565b612134576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107b2565b6000806402540be400612ec9848661460f565b612ed391906146b2565b9050612f007f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff1690565b60ff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f9491906144aa565b60ff1614613074577f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12ea15460ff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561302e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061305291906144aa565b61305c91906144c7565b61306790600a614600565b61307190826146b2565b90505b61307e8582612b3c565b949350505050565b6002546130ab90309073ffffffffffffffffffffffffffffffffffffffff16836121ea565b6002546040517f460b5ee200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018490529091169063460b5ee290604401600060405180830381600087803b15801561311f57600080fd5b505af1158015613133573d6000803e3d6000fd5b505050505050565b60008181527fffaa26784aca465bf23123375047d80ccb2b41102e02e5c4ef5b5aa00624b2d3602052604081206106c890613803565b73ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff1661090e5773ffffffffffffffffffffffffffffffffffffffff821660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d60205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905551613238908290614696565b6040519081900381209073ffffffffffffffffffffffffffffffffffffffff8416907f71ffd5b2f7b305f2f756c161455e2951077ed1951f9ecbee6252949bc1e13c5a90600090a35050565b600080546001546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810185905291169063095ea7b3906044016020604051808303816000875af1158015613300573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061332491906146ed565b5060015460009073ffffffffffffffffffffffffffffffffffffffff16636e553f65846133857f57b8fb8f652f415faa1bb4a7c251054bcda2b537623e667263e27a859c9f4e3b5473ffffffffffffffffffffffffffffffffffffffff1690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016020604051808303816000875af11580156133f6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f9919061470a565b60007f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35b5460ff16919050565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb35460ff8083169116106134ac576040517fbfdd178500000000000000000000000000000000000000000000000000000000815260ff821660048201526024016107b2565b7f0de7f2b0af5ab1aa4eca2b133cdee828bdcfefa98e4927fa304b2ad002ca6eb380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff92909216919091179055565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9d61090e8282614769565b7f1bdb0091f995c1d3419374bcead175ae14251e0f0aba8df7ace36571bda12e9e61090e8282614769565b61355f8282612cf3565b61090e576135848173ffffffffffffffffffffffffffffffffffffffff16601461380d565b61358f83602061380d565b6040516020016135a0929190614883565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526107b291600401613de7565b60007fb65939979d77055fe20d21bcb90b95461947bffa39f3588194f5015117626ea761343e565b73ffffffffffffffffffffffffffffffffffffffff811660009081527fdd021e813d5056b401d30ba505d211a2ca2652076f58ad407a75764b92ed7d9d602052604090205460ff16156114b8576136948173ffffffffffffffffffffffffffffffffffffffff16601461380d565b6040516020016135a09190614904565b60006111f98373ffffffffffffffffffffffffffffffffffffffff8416613a50565b60006111f98373ffffffffffffffffffffffffffffffffffffffff8416613a9f565b600061374a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b929092919063ffffffff16565b905080516000148061376b57508080602001905181019061376b91906146ed565b611817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107b2565b60006111f98383613ba1565b60006106c8825490565b6060600061381c83600261460f565b613827906002614497565b67ffffffffffffffff81111561383f5761383f614025565b6040519080825280601f01601f191660200182016040528015613869576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106138a0576138a061439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106139035761390361439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061393f84600261460f565b61394a906001614497565b90505b60018111156139e7577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061398b5761398b61439c565b1a60f81b8282815181106139a1576139a161439c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936139e081614970565b905061394d565b5083156111f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107b2565b6000818152600183016020526040812054613a97575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106c8565b5060006106c8565b60008181526001830160205260408120548015613b88576000613ac36001836149a5565b8554909150600090613ad7906001906149a5565b9050818114613b3c576000866000018281548110613af757613af761439c565b9060005260206000200154905080876000018481548110613b1a57613b1a61439c565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613b4d57613b4d6149b8565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106c8565b60009150506106c8565b606061307e8484600085613bcb565b6000826000018281548110613bb857613bb861439c565b9060005260206000200154905092915050565b606082471015613c5d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107b2565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613c869190614696565b60006040518083038185875af1925050503d8060008114613cc3576040519150601f19603f3d011682016040523d82523d6000602084013e613cc8565b606091505b5091509150613cd987838387613ce4565b979650505050505050565b60608315613d7a578251600003613d735773ffffffffffffffffffffffffffffffffffffffff85163b613d73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107b2565b508161307e565b61307e8383815115613d8f5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b29190613de7565b60005b83811015613dde578181015183820152602001613dc6565b50506000910152565b6020815260008251806020840152613e06816040850160208701613dc3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff811681146114b857600080fd5b8035613e6581613e38565b919050565b60008060408385031215613e7d57600080fd5b8235613e8881613e38565b946020939093013593505050565b60008083601f840112613ea857600080fd5b50813567ffffffffffffffff811115613ec057600080fd5b6020830191508360208260051b8501011115613edb57600080fd5b9250929050565b60008060008060408587031215613ef857600080fd5b843567ffffffffffffffff80821115613f1057600080fd5b613f1c88838901613e96565b90965094506020870135915080821115613f3557600080fd5b50613f4287828801613e96565b95989497509550505050565b60008060408385031215613f6157600080fd5b50508035926020909101359150565b600080600060608486031215613f8557600080fd5b8335613f9081613e38565b92506020840135613fa081613e38565b929592945050506040919091013590565b600060208284031215613fc357600080fd5b5035919050565b60008060408385031215613fdd57600080fd5b823591506020830135613fef81613e38565b809150509250929050565b80151581146114b857600080fd5b60006020828403121561401a57600080fd5b81356111f981613ffa565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561409b5761409b614025565b604052919050565b600060208083850312156140b657600080fd5b823567ffffffffffffffff808211156140ce57600080fd5b818501915085601f8301126140e257600080fd5b8135818111156140f4576140f4614025565b8060051b9150614105848301614054565b818152918301840191848101908884111561411f57600080fd5b938501935b83851015614149578435925061413983613e38565b8282529385019390850190614124565b98975050505050505050565b60006020828403121561416757600080fd5b81356111f981613e38565b60008060006040848603121561418757600080fd5b833561419281613e38565b9250602084013567ffffffffffffffff808211156141af57600080fd5b818601915086601f8301126141c357600080fd5b8135818111156141d257600080fd5b8760208285010111156141e457600080fd5b6020830194508093505050509250925092565b6000806040838503121561420a57600080fd5b823561421581613e38565b91506020830135613fef81613e38565b600082601f83011261423657600080fd5b813567ffffffffffffffff81111561425057614250614025565b61428160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614054565b81815284602083860101111561429657600080fd5b816020850160208301376000918101602001919091529392505050565b60ff811681146114b857600080fd5b8035613e65816142b3565b60008060008060008060008060006101208a8c0312156142ec57600080fd5b89356142f781613e38565b985060208a013561430781613e38565b975061431560408b01613e5a565b965061432360608b01613e5a565b955060808a0135945060a08a0135935060c08a013567ffffffffffffffff8082111561434e57600080fd5b61435a8d838e01614225565b945060e08c013591508082111561437057600080fd5b5061437d8c828d01614225565b92505061438d6101008b016142c2565b90509295985092959850929598565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261440057600080fd5b83018035915067ffffffffffffffff82111561441b57600080fd5b602001915036819003821315613edb57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361449057614490614430565b5060010190565b808201808211156106c8576106c8614430565b6000602082840312156144bc57600080fd5b81516111f9816142b3565b60ff82811682821603908111156106c8576106c8614430565b600181815b8085111561453957817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561451f5761451f614430565b8085161561452c57918102915b93841c93908002906144e5565b509250929050565b600082614550575060016106c8565b8161455d575060006106c8565b8160018114614573576002811461457d57614599565b60019150506106c8565b60ff84111561458e5761458e614430565b50506001821b6106c8565b5060208310610133831016604e8410600b84101617156145bc575081810a6106c8565b6145c683836144e0565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156145f8576145f8614430565b029392505050565b60006111f960ff841683614541565b80820281158282048414176106c8576106c8614430565b60006020828403121561463857600080fd5b81516111f981613e38565b600181811c9082168061465757607f821691505b602082108103614690577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600082516146a8818460208701613dc3565b9190910192915050565b6000826146e8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156146ff57600080fd5b81516111f981613ffa565b60006020828403121561471c57600080fd5b5051919050565b601f82111561181757600081815260208120601f850160051c8101602086101561474a5750805b601f850160051c820191505b8181101561313357828155600101614756565b815167ffffffffffffffff81111561478357614783614025565b614797816147918454614643565b84614723565b602080601f8311600181146147ea57600084156147b45750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613133565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561483757888601518255948401946001909101908401614818565b508582101561487357878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516148bb816017850160208801613dc3565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516148f8816028840160208801613dc3565b01602801949350505050565b7f53696d706c65426c61636b6c6973743a206163636f756e74200000000000000081526000825161493c816019850160208701613dc3565b7f20697320626c61636b6c697374656400000000000000000000000000000000006019939091019283015250602801919050565b60008161497f5761497f614430565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b818103818111156106c8576106c8614430565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220143946ef535b425cd66defaf2a3e6972d9ef8163cba91e75779d115996995c9b64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a
-----Decoded View---------------
Arg [0] : _oldStakingToken (address): 0xe84b64Bc2B5a69FA7909C9Ae4cf58296AA5f8B3a
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e84b64bc2b5a69fa7909c9ae4cf58296aa5f8b3a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.