Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ApeBondFactory
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
/*
______ _______ __
/ \ | \ | \
| ¦¦¦¦¦¦\ ______ ______ | ¦¦¦¦¦¦¦\ ______ _______ ____| ¦¦
| ¦¦__| ¦¦ / \ / \ | ¦¦__/ ¦¦ / \ | \ / ¦¦
| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦\| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦¦\| ¦¦¦¦¦¦¦
| ¦¦¦¦¦¦¦¦| ¦¦ | ¦¦| ¦¦ ¦¦| ¦¦¦¦¦¦¦\| ¦¦ | ¦¦| ¦¦ | ¦¦| ¦¦ | ¦¦
| ¦¦ | ¦¦| ¦¦__/ ¦¦| ¦¦¦¦¦¦¦¦| ¦¦__/ ¦¦| ¦¦__/ ¦¦| ¦¦ | ¦¦| ¦¦__| ¦¦
| ¦¦ | ¦¦| ¦¦ ¦¦ \¦¦ \| ¦¦ ¦¦ \¦¦ ¦¦| ¦¦ | ¦¦ \¦¦ ¦¦
\¦¦ \¦¦| ¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦ \¦¦ \¦¦ \¦¦¦¦¦¦¦
| ¦¦
| ¦¦
\¦¦
* App: https://Ape.Bond
* Medium: https://ApeBond.medium.com
* Twitter: https://twitter.com/ApeBond
* Telegram: https://t.me/ape_bond
* Announcements: https://t.me/ApeBond_news
* Discord: https://ApeBond.click/discord
* Reddit: https://ApeBond.click/reddit
* Instagram: https://instagram.com/ape.bond
* GitHub: https://github.com/ApeSwapFinance
*/
import "./ApeBondFactoryBase.sol";
import "../Errors.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract ApeBondFactory is Initializable, ApeBondFactoryBase {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {}
function initialize(
address _bondImplementationAddress,
address _treasuryImplementationAddress,
address[] memory _bondCreators
) external initializer {
__ApeBondFactoryBase_init(_bondImplementationAddress, _treasuryImplementationAddress, _bondCreators);
}
/* ======== FACTORY FUNCTIONS ======== */
/**
@notice deploys IBondTreasury and IApeBond contracts
@param _bondCreationDetails IApeBond.BondCreationDetails
@param _bondTerms IApeBond.BondTerms
@param _payoutAddress account which receives deposited tokens
@param _bondOperators accounts allowed to adjust the bond
*/
function createBondAndTreasury(
IApeBond.BondCreationDetails calldata _bondCreationDetails,
IApeBond.BondTerms calldata _bondTerms,
IApeBond.BondAccounts calldata _bondAccounts,
address _payoutAddress,
address[] calldata _bondOperators
) external onlyRole(BOND_CREATOR_ROLE) returns (IBondTreasury _customTreasury, IApeBond _bond) {
_customTreasury = _createTreasury(
_bondCreationDetails.payoutToken,
_bondCreationDetails.initialOwner,
_payoutAddress,
_bondOperators
);
return _createBond(_bondCreationDetails, _bondTerms, _bondAccounts, _customTreasury, _bondOperators);
}
/**
@notice deploys IApeBond contract
@param _bondCreationDetails IApeBond.BondCreationDetails
@param _bondTerms IApeBond.BondTerms
@param _customTreasury address of IBondTreasury linked to this bond
@param _bondOperators accounts allowed to adjust the bond
*/
function createBond(
IApeBond.BondCreationDetails calldata _bondCreationDetails,
IApeBond.BondTerms calldata _bondTerms,
IApeBond.BondAccounts calldata _bondAccounts,
IBondTreasury _customTreasury,
address[] calldata _bondOperators
) external onlyRole(BOND_CREATOR_ROLE) returns (IBondTreasury _treasury, IApeBond _bond) {
return _createBond(_bondCreationDetails, _bondTerms, _bondAccounts, _customTreasury, _bondOperators);
}
/**
@notice deploys IBondTreasury contract
*/
function createTreasury(
address _payoutToken,
address _initialOwner,
address _payoutAddress,
address[] calldata _bondOperators
) external onlyRole(BOND_CREATOR_ROLE) returns (IBondTreasury _customTreasury) {
return _createTreasury(_payoutToken, _initialOwner, _payoutAddress, _bondOperators);
}
/* ======== HELPER FUNCTIONS ======== */
/**
* @notice helper function to create an IApeBond.BondCreationDetails tuple for BondTreasury and ApeBond deployments
*/
function getBondCreationDetails(
address _payoutToken,
address _principalToken,
address _initialOwner,
IVestingCurve _vestingCurve,
uint256 _feeInPrincipal,
uint256 _feeInPayout
) public pure returns (IApeBond.BondCreationDetails memory) {
return
IApeBond.BondCreationDetails({
payoutToken: _payoutToken,
principalToken: _principalToken,
initialOwner: _initialOwner,
vestingCurve: _vestingCurve,
feeInPrincipal: _feeInPrincipal,
feeInPayout: _feeInPayout
});
}
/**
* @notice helper function to create an IApeBond.BondTerms tuple for BondTreasury and ApeBond deployments
*/
function getBondTerms(
uint256 _controlVariable,
uint256 _vestingTerm,
uint256 _minimumPrice,
uint256 _maxPayout,
uint256 _maxDebt,
uint256 _maxTotalPayout,
uint256 _initialDebt
) public pure returns (IApeBond.BondTerms memory) {
return
IApeBond.BondTerms({
controlVariable: _controlVariable,
vestingTerm: _vestingTerm,
minimumPrice: _minimumPrice,
maxPayout: _maxPayout,
maxDebt: _maxDebt,
maxTotalPayout: _maxTotalPayout,
initialDebt: _initialDebt
});
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @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.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// ? `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// ? `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSetUpgradeable {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
* > a minimal bytecode implementation that delegates all calls to a known, fixed address.
*
* The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
* (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
* deterministic method.
*
* _Available since v3.4._
*/
library Clones {
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create opcode, which should never revert.
*/
function clone(address implementation) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create(0, 0x09, 0x37)
}
require(instance != address(0), "ERC1167: create failed");
}
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy
* the clone. Using the same `implementation` and `salt` multiple time will revert, since
* the clones cannot be deployed twice at the same address.
*/
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create2(0, 0x09, 0x37, salt)
}
require(instance != address(0), "ERC1167: create2 failed");
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt,
address deployer
) internal pure returns (address predicted) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(add(ptr, 0x38), deployer)
mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
mstore(add(ptr, 0x14), implementation)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
mstore(add(ptr, 0x58), salt)
mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
predicted := keccak256(add(ptr, 0x43), 0x55)
}
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt
) internal view returns (address predicted) {
return predictDeterministicAddress(implementation, salt, address(this));
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
/*
______ _______ __
/ \ | \ | \
| ¦¦¦¦¦¦\ ______ ______ | ¦¦¦¦¦¦¦\ ______ _______ ____| ¦¦
| ¦¦__| ¦¦ / \ / \ | ¦¦__/ ¦¦ / \ | \ / ¦¦
| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦\| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦¦\| ¦¦¦¦¦¦¦
| ¦¦¦¦¦¦¦¦| ¦¦ | ¦¦| ¦¦ ¦¦| ¦¦¦¦¦¦¦\| ¦¦ | ¦¦| ¦¦ | ¦¦| ¦¦ | ¦¦
| ¦¦ | ¦¦| ¦¦__/ ¦¦| ¦¦¦¦¦¦¦¦| ¦¦__/ ¦¦| ¦¦__/ ¦¦| ¦¦ | ¦¦| ¦¦__| ¦¦
| ¦¦ | ¦¦| ¦¦ ¦¦ \¦¦ \| ¦¦ ¦¦ \¦¦ ¦¦| ¦¦ | ¦¦ \¦¦ ¦¦
\¦¦ \¦¦| ¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦ \¦¦ \¦¦ \¦¦¦¦¦¦¦
| ¦¦
| ¦¦
\¦¦
* App: https://Ape.Bond
* Medium: https://ApeBond.medium.com
* Twitter: https://twitter.com/ApeBond
* Telegram: https://t.me/ape_bond
* Announcements: https://t.me/ApeBond_news
* Discord: https://ApeBond.click/discord
* Reddit: https://ApeBond.click/reddit
* Instagram: https://instagram.com/ape.bond
* GitHub: https://github.com/ApeSwapFinance
*/
import "@openzeppelin/contracts/proxy/Clones.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../ApeBondAccessControlUpgradeable.sol";
import "../interfaces/IVersionable.sol";
import "./IApeBond.sol";
import "../IBondTreasury.sol";
import "../IBondNft.sol";
import "../Errors.sol";
contract ApeBondFactoryBase is IVersionable, Initializable, OwnableUpgradeable, ApeBondAccessControlUpgradeable {
/* ======== STATE VARIABLES ======== */
IApeBond public bondImplementationAddress;
IBondTreasury public treasuryImplementationAddress;
IApeBond[] public deployedBonds;
IBondTreasury[] public deployedTreasuries;
bytes32 public constant BOND_CREATOR_ROLE = keccak256("BOND_CREATOR_ROLE");
event CreatedTreasury(IBondTreasury customTreasury, address payoutToken, address owner, address payoutAddress);
event CreatedBond(
IApeBond.BondCreationDetails bondCreationDetails,
IBondTreasury customTreasury,
IApeBond bond,
address bondNft
);
event SetBondImplementation(IApeBond newBondImplementation);
event SetTreasuryImplementation(IBondTreasury newTreasuryImplementation);
/* ======== INITIALIZATION ======== */
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
// _disableInitializers();
}
function __ApeBondFactoryBase_init(
address _bondImplementationAddress,
address _treasuryImplementationAddress,
address[] memory _bondCreators
) internal onlyInitializing {
__Ownable_init();
__AccessControlEnumerable_init();
if (_bondImplementationAddress == address(0)) revert ZeroAddress();
bondImplementationAddress = IApeBond(_bondImplementationAddress);
if (_treasuryImplementationAddress == address(0)) revert ZeroAddress();
treasuryImplementationAddress = IBondTreasury(_treasuryImplementationAddress);
for (uint i = 0; i < _bondCreators.length; i++) {
_grantRole(BOND_CREATOR_ROLE, _bondCreators[i]);
}
}
function VERSION() public view returns (string memory) {
return bondImplementationAddress.VERSION();
}
function totalDeployed() external view returns (uint256 _bondsDeployed, uint256 _treasuriesDeployed) {
return (deployedBonds.length, deployedTreasuries.length);
}
/* ======== OWNER CONFIGURATIONS ======== */
/**
* @notice Set the ApeBond implementation address
* @param _bondImplementation Implementation of ApeBond
*/
function setBondImplementation(IApeBond _bondImplementation) external onlyOwnerOrRole(OPERATIONS_ROLE) {
bondImplementationAddress = _bondImplementation;
emit SetBondImplementation(bondImplementationAddress);
}
/**
* @notice Set the BondTreasury implementation address
* @param _treasuryImplementation Implementation of BondTreasury
*/
function setTreasuryImplementation(
IBondTreasury _treasuryImplementation
) external onlyOwnerOrRole(OPERATIONS_ROLE) {
treasuryImplementationAddress = _treasuryImplementation;
emit SetTreasuryImplementation(treasuryImplementationAddress);
}
/**
* @notice Grant the ability to create Treasury Bonds
* @param _bondCreators Array of addresses to whitelist as bond creators
*/
function grantBondCreatorRole(address[] calldata _bondCreators) external onlyOwnerOrRole(OPERATIONS_ROLE) {
for (uint i = 0; i < _bondCreators.length; i++) {
_grantRole(BOND_CREATOR_ROLE, _bondCreators[i]);
}
}
/**
* @notice Revoke the ability to create Treasury Bonds
* @param _bondCreators Array of addresses to revoke as bond creators
*/
function revokeBondCreatorRole(address[] calldata _bondCreators) external onlyOwnerOrRole(OPERATIONS_ROLE) {
for (uint i = 0; i < _bondCreators.length; i++) {
_revokeRole(BOND_CREATOR_ROLE, _bondCreators[i]);
}
}
/* ======== INTERNAL FUNCTIONS ======== */
function _createTreasury(
address _payoutToken,
address _owner,
address _payoutAddress,
address[] calldata _bondOperators
) internal returns (IBondTreasury _customTreasury) {
_customTreasury = IBondTreasury(Clones.clone(address(treasuryImplementationAddress)));
_customTreasury.initialize(_payoutToken, _owner, _payoutAddress, _bondOperators);
deployedTreasuries.push(_customTreasury);
emit CreatedTreasury(_customTreasury, _payoutToken, _owner, _payoutAddress);
}
/**
@notice deploys custom bond contract and returns address of the bond and its treasury
@param _bondCreationDetails BondCreationDetails
@param _customTreasury address
*/
function _createBond(
IApeBond.BondCreationDetails memory _bondCreationDetails,
IApeBond.BondTerms memory _bondTerms,
IApeBond.BondAccounts memory _bondAccounts,
IBondTreasury _customTreasury,
address[] memory _bondOperators
) internal returns (IBondTreasury _treasury, IApeBond _bond) {
if (_customTreasury.payoutToken() != _bondCreationDetails.payoutToken) revert PayoutTokenAddressMismatch();
IApeBond bond = IApeBond(Clones.clone(address(bondImplementationAddress)));
bond.initialize(_customTreasury, _bondCreationDetails, _bondTerms, _bondAccounts, _bondOperators);
IBondNft(_bondAccounts.billNft).addMinter(address(bond));
deployedBonds.push(bond);
emit CreatedBond(_bondCreationDetails, _customTreasury, bond, _bondAccounts.billNft);
return (_customTreasury, IApeBond(bond));
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import {IBondTreasury} from "../IBondTreasury.sol";
import {IVestingCurve} from "../curves/IVestingCurve.sol";
import {IVersionable} from "../interfaces/IVersionable.sol";
interface IApeBond is IVersionable {
/// @notice Info for bill holder
/// @param payout Total payout value
/// @param payoutClaimed Amount of payout claimed
/// @param vesting Seconds left until vesting is complete
/// @param vestingTerm Length of vesting in seconds
/// @param vestingStartTimestamp Timestamp at start of vesting
/// @param lastClaimTimestamp Last timestamp interaction
/// @param truePricePaid Price paid (principal tokens per payout token) in ten-millionths - 4000000 = 0.4
struct Bill {
uint256 payout;
uint256 payoutClaimed;
uint256 vesting;
uint256 vestingTerm;
uint256 vestingStartTimestamp;
uint256 lastClaimTimestamp;
uint256 truePricePaid;
}
struct BondTerms {
uint256 controlVariable;
uint256 vestingTerm;
uint256 minimumPrice;
uint256 maxPayout;
uint256 maxDebt;
uint256 maxTotalPayout;
uint256 initialDebt;
}
/// @notice Details required to create a new bill
/// @param payoutToken The token in which the payout will be made
/// @param principalToken The token used to purchase the bill
/// @param initialOwner The initial owner of the bill
/// @param vestingCurve The vesting curve contract used for the bill
/// @param tierCeilings The ceilings of each tier for the bill
/// @param fees The fees associated with each tier
/// @param feeInPayout Boolean indicating if the fee is taken from the payout
struct BondCreationDetails {
address payoutToken;
address principalToken;
address initialOwner;
IVestingCurve vestingCurve;
uint256 feeInPrincipal;
uint256 feeInPayout;
}
/// @notice Important accounts related to a ApeBond
/// @param feeInPrincipalRecipient Account which receives the principal token fees
/// @param feeInPayoutRecipient Account which receives the payout token fees
/// @param automationAddress Automation address
/// @param billNft BillNFT contract which mints the NFTs
struct BondAccounts {
address feeInPrincipalRecipient;
address feeInPayoutRecipient;
address automationAddress;
address billNft;
}
function initialize(
IBondTreasury _customTreasury,
BondCreationDetails memory _billCreationDetails,
BondTerms memory _billTerms,
BondAccounts memory _billAccounts,
address[] memory _billOperators
) external;
function getBillInfo(uint256 billId) external view returns (Bill memory);
function customTreasury() external returns (IBondTreasury);
function claim(uint256 billId) external returns (uint256);
function pendingVesting(uint256 billId) external view returns (uint256);
function pendingPayout(uint256 billId) external view returns (uint256);
function vestingPeriod(uint256 billId) external view returns (uint256 vestingStart_, uint256 vestingEnd_);
function vestingPayout(uint256 billId) external view returns (uint256 vestingPayout_);
function vestedPayoutAtTime(uint256 billId, uint256 timestamp) external view returns (uint256 vestedPayout_);
function claimablePayout(uint256 billId) external view returns (uint256 claimablePayout_);
function payoutToken() external view returns (IERC20MetadataUpgradeable);
function principalToken() external view returns (IERC20MetadataUpgradeable);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
/*
______ _______ __
/ \ | \ | \
| ¦¦¦¦¦¦\ ______ ______ | ¦¦¦¦¦¦¦\ ______ _______ ____| ¦¦
| ¦¦__| ¦¦ / \ / \ | ¦¦__/ ¦¦ / \ | \ / ¦¦
| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦\| ¦¦ ¦¦| ¦¦¦¦¦¦\| ¦¦¦¦¦¦¦\| ¦¦¦¦¦¦¦
| ¦¦¦¦¦¦¦¦| ¦¦ | ¦¦| ¦¦ ¦¦| ¦¦¦¦¦¦¦\| ¦¦ | ¦¦| ¦¦ | ¦¦| ¦¦ | ¦¦
| ¦¦ | ¦¦| ¦¦__/ ¦¦| ¦¦¦¦¦¦¦¦| ¦¦__/ ¦¦| ¦¦__/ ¦¦| ¦¦ | ¦¦| ¦¦__| ¦¦
| ¦¦ | ¦¦| ¦¦ ¦¦ \¦¦ \| ¦¦ ¦¦ \¦¦ ¦¦| ¦¦ | ¦¦ \¦¦ ¦¦
\¦¦ \¦¦| ¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦¦ \¦¦¦¦¦¦ \¦¦ \¦¦ \¦¦¦¦¦¦¦
| ¦¦
| ¦¦
\¦¦
* App: https://Ape.Bond
* Medium: https://ApeBond.medium.com
* Twitter: https://twitter.com/ApeBond
* Telegram: https://t.me/ape_bond
* Announcements: https://t.me/ApeBond_news
* Discord: https://ApeBond.click/discord
* Reddit: https://ApeBond.click/reddit
* Instagram: https://instagram.com/ape.bond
* GitHub: https://github.com/ApeSwapFinance
*/
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
/**
* @title ApeBondAccessControlUpgradeable
* @notice This contract manages the ownership and role based access for ApeBond contracts
*/
contract ApeBondAccessControlUpgradeable is OwnableUpgradeable, AccessControlEnumerableUpgradeable {
/* ======== STATE ======== */
/// @notice Operations role, used to adjust specific settings on the bond
bytes32 public constant OPERATIONS_ROLE = keccak256("OPERATIONS_ROLE");
/// @notice Automation role, used to manage automation
bytes32 public constant AUTOMATION_ROLE = keccak256("AUTOMATION_ROLE");
/* ======== INITIALIZATION ======== */
function __ApeBondAccessControlUpgradeable__init(
address _initialOwner,
address _automationAddress,
address[] calldata _bondOperators
) internal onlyInitializing {
__Ownable_init();
_transferOwnership(_initialOwner);
_grantRole(AUTOMATION_ROLE, _automationAddress);
for (uint256 i = 0; i < _bondOperators.length; i++) {
_grantRole(OPERATIONS_ROLE, _bondOperators[i]);
}
}
/* ======== MODIFIERS ======== */
modifier onlyOwnerOrRole(bytes32 role1) {
require(msg.sender == owner() || hasRole(role1, msg.sender), "Caller is not owner or has required role");
_;
}
modifier onlyOwnerOrRoles(bytes32 role1, bytes32 role2) {
require(
msg.sender == owner() || hasRole(role1, msg.sender) || hasRole(role2, msg.sender),
"Caller is not owner or has required role"
);
_;
}
/* ======== onlyOwner FUNCTIONS ======== */
/**
* @notice Grant a role
* @param role The role to grant
* @param account The address to grant the role to
*/
function grantRole(
bytes32 role,
address account
) public override(AccessControlUpgradeable, IAccessControlUpgradeable) onlyOwner {
_grantRole(role, account);
}
}// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.17; /// @notice General errors error ZeroAddress(); error Unauthorized(); error LengthMismatch(); error InvalidAmount(); error InvalidTimestamp(); error InvalidParameter(); error InvalidState(); error InvalidAddress(); error InvalidContract(); error InvalidRole(); error InvalidOperation(); /// @notice ApeBond specific errors error SlippageExceeded(); error BondTooSmall(); error BondTooLarge(); error MaxCapacityReached(); error MaxTotalPayoutExceeded(); error NothingToClaim(); error InvalidBondId(); error NotApproved(); error VestingTooShort(); error ControlVariableTooLow(); error TargetMustBeAboveZero(); error TooSoonForBCVUpdate(); error IncrementTooLarge(); error DecrementTooLarge(); error DebtMustBeZero(); error InvalidPointsLens(); error NoTierAccess(); error InvalidBCV(); error UpdateIntervalNotElapsed(); error InvalidUpdateInterval(); /// @notice Factory specific errors error NotBondCreator(); error BondStateNotChanged(); error TreasuryAddressMismatch(); error PayoutTokenAddressMismatch(); error TierLengthMismatch(); error InvalidFee(); error InvalidTierOrder(); /// @notice Treasury specific errors error NotBondContract(); error FeeCannotBeSentToZeroAddress();
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
import {IERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
import {IERC5725Upgradeable} from "./interfaces/IERC5725.sol";
interface IBondNft is IERC5725Upgradeable, IERC721EnumerableUpgradeable {
struct TokenData {
uint256 tokenId;
address billAddress;
}
function addMinter(address minter) external;
function mint(address to, address billAddress) external returns (uint256);
function mintMany(uint256 amount, address to, address billAddress) external;
function lockURI() external;
function setTokenURI(uint256 tokenId, string memory _tokenURI) external;
function claimMany(uint256[] calldata _tokenIds) external;
function pendingPayout(uint256 tokenId) external view returns (uint256 pendingPayoutAmount);
function pendingVesting(uint256 tokenId) external view returns (uint256 pendingSeconds);
function allTokensDataOfOwner(address owner) external view returns (TokenData[] memory);
function getTokensOfOwnerByIndexes(
address owner,
uint256 start,
uint256 end
) external view returns (TokenData[] memory);
function tokenDataOfOwnerByIndex(address owner, uint256 index) external view returns (TokenData memory tokenData);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
interface IBondTreasury {
function deposit(
address _principalTokenAddress,
uint256 _amountPrincipalToken,
uint256 _amountPayoutToken
) external;
function deposit_FeeInPayout(
address _principalTokenAddress,
uint256 _amountPrincipalToken,
uint256 _amountPayoutToken,
uint256 _feePayoutToken,
address _feeReceiver
) external;
function initialize(
address _payoutToken,
address _initialOwner,
address _payoutAddress,
address[] calldata _bondOperators
) external;
function valueOfToken(address _principalTokenAddress, uint256 _amount) external view returns (uint256 value_);
function payoutToken() external view returns (address token);
function bondContract(address _bondContract) external returns (bool);
function transferPayoutToken(uint256 _amount) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.17;
/// @notice VestingCurve interface to allow for simple updates of vesting release schedules.
interface IVestingCurve {
/**
* @notice Returns the vested token amount given the inputs below.
* @param totalPayout Total payout vested once the vestingTerm is up
* @param vestingTerm Length of time in seconds that tokens are vesting for
* @param startTimestamp The timestamp of when vesting starts
* @param checkTimestamp The timestamp to calculate vested tokens
* @return vestedPayout Total payoutTokens vested at checkTimestamp
*
* Requirements
* - MUST return 0 if checkTimestamp is less than startTimestamp
* - MUST return totalPayout if checkTimestamp is greater than startTimestamp + vestingTerm,
* - MUST return a value including or between 0 and totalPayout
*/
function getVestedPayoutAtTime(
uint256 totalPayout,
uint256 vestingTerm,
uint256 startTimestamp,
uint256 checkTimestamp
) external view returns (uint256 vestedPayout);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
/**
* @title Non-Fungible Vesting Token Standard.
* @notice A non-fungible token standard used to vest ERC-20 tokens over a vesting release curve
* scheduled using timestamps.
* @dev Because this standard relies on timestamps for the vesting schedule, it's important to keep track of the
* tokens claimed per Vesting NFT so that a user cannot withdraw more tokens than allotted for a specific Vesting NFT.
* @custom:interface-id 0xbd3a202b
*/
interface IERC5725Upgradeable is IERC721Upgradeable {
/**
* This event is emitted when the payout is claimed through the claim function.
* @param tokenId the NFT tokenId of the assets being claimed.
* @param recipient The address which is receiving the payout.
* @param claimAmount The amount of tokens being claimed.
*/
event PayoutClaimed(uint256 indexed tokenId, address indexed recipient, uint256 claimAmount);
/**
* This event is emitted when an `owner` sets an address to manage token claims for all tokens.
* @param owner The address setting a manager to manage all tokens.
* @param spender The address being permitted to manage all tokens.
* @param approved A boolean indicating whether the spender is approved to claim for all tokens.
*/
event ClaimApprovalForAll(address indexed owner, address indexed spender, bool approved);
/**
* This event is emitted when an `owner` sets an address to manage token claims for a `tokenId`.
* @param owner The `owner` of `tokenId`.
* @param spender The address being permitted to manage a tokenId.
* @param tokenId The unique identifier of the token being managed.
* @param approved A boolean indicating whether the spender is approved to claim for `tokenId`.
*/
event ClaimApproval(address indexed owner, address indexed spender, uint256 indexed tokenId, bool approved);
/**
* @notice Claim the pending payout for the NFT.
* @dev MUST grant the claimablePayout value at the time of claim being called to `msg.sender`.
* MUST revert if not called by the token owner or approved users.
* MUST emit PayoutClaimed.
* SHOULD revert if there is nothing to claim.
* @param tokenId The NFT token id.
*/
function claim(uint256 tokenId) external;
/**
* @notice Number of tokens for the NFT which have been claimed at the current timestamp.
* @param tokenId The NFT token id.
* @return payout The total amount of payout tokens claimed for this NFT.
*/
function claimedPayout(uint256 tokenId) external view returns (uint256 payout);
/**
* @notice Number of tokens for the NFT which can be claimed at the current timestamp.
* @dev It is RECOMMENDED that this is calculated as the `vestedPayout()` subtracted from `payoutClaimed()`.
* @param tokenId The NFT token id.
* @return payout The amount of unlocked payout tokens for the NFT which have not yet been claimed.
*/
function claimablePayout(uint256 tokenId) external view returns (uint256 payout);
/**
* @notice Total amount of tokens which have been vested at the current timestamp.
* This number also includes vested tokens which have been claimed.
* @dev It is RECOMMENDED that this function calls `vestedPayoutAtTime`
* with `block.timestamp` as the `timestamp` parameter.
* @param tokenId The NFT token id.
* @return payout Total amount of tokens which have been vested at the current timestamp.
*/
function vestedPayout(uint256 tokenId) external view returns (uint256 payout);
/**
* @notice Total amount of vested tokens at the provided timestamp.
* This number also includes vested tokens which have been claimed.
* @dev `timestamp` MAY be both in the future and in the past.
* Zero MUST be returned if the timestamp is before the token was minted.
* @param tokenId The NFT token id.
* @param timestamp The timestamp to check on, can be both in the past and the future.
* @return payout Total amount of tokens which have been vested at the provided timestamp.
*/
function vestedPayoutAtTime(uint256 tokenId, uint256 timestamp) external view returns (uint256 payout);
/**
* @notice Number of tokens for an NFT which are currently vesting.
* @dev The sum of vestedPayout and vestingPayout SHOULD always be the total payout.
* @param tokenId The NFT token id.
* @return payout The number of tokens for the NFT which are vesting until a future date.
*/
function vestingPayout(uint256 tokenId) external view returns (uint256 payout);
/**
* @notice The start and end timestamps for the vesting of the provided NFT.
* MUST return the timestamp where no further increase in vestedPayout occurs for `vestingEnd`.
* @param tokenId The NFT token id.
* @return vestingStart The beginning of the vesting as a unix timestamp.
* @return vestingEnd The ending of the vesting as a unix timestamp.
*/
function vestingPeriod(uint256 tokenId) external view returns (uint256 vestingStart, uint256 vestingEnd);
/**
* @notice Token which is used to pay out the vesting claims.
* @param tokenId The NFT token id.
* @return token The token which is used to pay out the vesting claims.
*/
function payoutToken(uint256 tokenId) external view returns (address token);
/**
* @notice Sets a global `operator` with permission to manage all tokens owned by the current `msg.sender`.
* @param operator The address to let manage all tokens.
* @param approved A boolean indicating whether the spender is approved to claim for all tokens.
*/
function setClaimApprovalForAll(address operator, bool approved) external;
/**
* @notice Sets a tokenId `operator` with permission to manage a single `tokenId` owned by the `msg.sender`.
* @param operator The address to let manage a single `tokenId`.
* @param tokenId the `tokenId` to be managed.
* @param approved A boolean indicating whether the spender is approved to claim for all tokens.
*/
function setClaimApproval(address operator, bool approved, uint256 tokenId) external;
/**
* @notice Returns true if `owner` has set `operator` to manage all `tokenId`s.
* @param owner The owner allowing `operator` to manage all `tokenId`s.
* @param operator The address who is given permission to spend tokens on behalf of the `owner`.
*/
function isClaimApprovedForAll(address owner, address operator) external view returns (bool isClaimApproved);
/**
* @notice Returns the operating address for a `tokenId`.
* If `tokenId` is not managed, then returns the zero address.
* @param tokenId The NFT `tokenId` to query for a `tokenId` manager.
*/
function getClaimApproved(uint256 tokenId) external view returns (address operator);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IVersionable {
function VERSION() external view returns (string memory);
}{
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 100
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"PayoutTokenAddressMismatch","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"payoutToken","type":"address"},{"internalType":"address","name":"principalToken","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"contract IVestingCurve","name":"vestingCurve","type":"address"},{"internalType":"uint256","name":"feeInPrincipal","type":"uint256"},{"internalType":"uint256","name":"feeInPayout","type":"uint256"}],"indexed":false,"internalType":"struct IApeBond.BondCreationDetails","name":"bondCreationDetails","type":"tuple"},{"indexed":false,"internalType":"contract IBondTreasury","name":"customTreasury","type":"address"},{"indexed":false,"internalType":"contract IApeBond","name":"bond","type":"address"},{"indexed":false,"internalType":"address","name":"bondNft","type":"address"}],"name":"CreatedBond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IBondTreasury","name":"customTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"payoutToken","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"payoutAddress","type":"address"}],"name":"CreatedTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"contract IApeBond","name":"newBondImplementation","type":"address"}],"name":"SetBondImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IBondTreasury","name":"newTreasuryImplementation","type":"address"}],"name":"SetTreasuryImplementation","type":"event"},{"inputs":[],"name":"AUTOMATION_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOND_CREATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATIONS_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bondImplementationAddress","outputs":[{"internalType":"contract IApeBond","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"payoutToken","type":"address"},{"internalType":"address","name":"principalToken","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"contract IVestingCurve","name":"vestingCurve","type":"address"},{"internalType":"uint256","name":"feeInPrincipal","type":"uint256"},{"internalType":"uint256","name":"feeInPayout","type":"uint256"}],"internalType":"struct IApeBond.BondCreationDetails","name":"_bondCreationDetails","type":"tuple"},{"components":[{"internalType":"uint256","name":"controlVariable","type":"uint256"},{"internalType":"uint256","name":"vestingTerm","type":"uint256"},{"internalType":"uint256","name":"minimumPrice","type":"uint256"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"maxDebt","type":"uint256"},{"internalType":"uint256","name":"maxTotalPayout","type":"uint256"},{"internalType":"uint256","name":"initialDebt","type":"uint256"}],"internalType":"struct IApeBond.BondTerms","name":"_bondTerms","type":"tuple"},{"components":[{"internalType":"address","name":"feeInPrincipalRecipient","type":"address"},{"internalType":"address","name":"feeInPayoutRecipient","type":"address"},{"internalType":"address","name":"automationAddress","type":"address"},{"internalType":"address","name":"billNft","type":"address"}],"internalType":"struct IApeBond.BondAccounts","name":"_bondAccounts","type":"tuple"},{"internalType":"contract IBondTreasury","name":"_customTreasury","type":"address"},{"internalType":"address[]","name":"_bondOperators","type":"address[]"}],"name":"createBond","outputs":[{"internalType":"contract IBondTreasury","name":"_treasury","type":"address"},{"internalType":"contract IApeBond","name":"_bond","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"payoutToken","type":"address"},{"internalType":"address","name":"principalToken","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"contract IVestingCurve","name":"vestingCurve","type":"address"},{"internalType":"uint256","name":"feeInPrincipal","type":"uint256"},{"internalType":"uint256","name":"feeInPayout","type":"uint256"}],"internalType":"struct IApeBond.BondCreationDetails","name":"_bondCreationDetails","type":"tuple"},{"components":[{"internalType":"uint256","name":"controlVariable","type":"uint256"},{"internalType":"uint256","name":"vestingTerm","type":"uint256"},{"internalType":"uint256","name":"minimumPrice","type":"uint256"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"maxDebt","type":"uint256"},{"internalType":"uint256","name":"maxTotalPayout","type":"uint256"},{"internalType":"uint256","name":"initialDebt","type":"uint256"}],"internalType":"struct IApeBond.BondTerms","name":"_bondTerms","type":"tuple"},{"components":[{"internalType":"address","name":"feeInPrincipalRecipient","type":"address"},{"internalType":"address","name":"feeInPayoutRecipient","type":"address"},{"internalType":"address","name":"automationAddress","type":"address"},{"internalType":"address","name":"billNft","type":"address"}],"internalType":"struct IApeBond.BondAccounts","name":"_bondAccounts","type":"tuple"},{"internalType":"address","name":"_payoutAddress","type":"address"},{"internalType":"address[]","name":"_bondOperators","type":"address[]"}],"name":"createBondAndTreasury","outputs":[{"internalType":"contract IBondTreasury","name":"_customTreasury","type":"address"},{"internalType":"contract IApeBond","name":"_bond","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_payoutToken","type":"address"},{"internalType":"address","name":"_initialOwner","type":"address"},{"internalType":"address","name":"_payoutAddress","type":"address"},{"internalType":"address[]","name":"_bondOperators","type":"address[]"}],"name":"createTreasury","outputs":[{"internalType":"contract IBondTreasury","name":"_customTreasury","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"deployedBonds","outputs":[{"internalType":"contract IApeBond","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"deployedTreasuries","outputs":[{"internalType":"contract IBondTreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_payoutToken","type":"address"},{"internalType":"address","name":"_principalToken","type":"address"},{"internalType":"address","name":"_initialOwner","type":"address"},{"internalType":"contract IVestingCurve","name":"_vestingCurve","type":"address"},{"internalType":"uint256","name":"_feeInPrincipal","type":"uint256"},{"internalType":"uint256","name":"_feeInPayout","type":"uint256"}],"name":"getBondCreationDetails","outputs":[{"components":[{"internalType":"address","name":"payoutToken","type":"address"},{"internalType":"address","name":"principalToken","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"contract IVestingCurve","name":"vestingCurve","type":"address"},{"internalType":"uint256","name":"feeInPrincipal","type":"uint256"},{"internalType":"uint256","name":"feeInPayout","type":"uint256"}],"internalType":"struct IApeBond.BondCreationDetails","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_controlVariable","type":"uint256"},{"internalType":"uint256","name":"_vestingTerm","type":"uint256"},{"internalType":"uint256","name":"_minimumPrice","type":"uint256"},{"internalType":"uint256","name":"_maxPayout","type":"uint256"},{"internalType":"uint256","name":"_maxDebt","type":"uint256"},{"internalType":"uint256","name":"_maxTotalPayout","type":"uint256"},{"internalType":"uint256","name":"_initialDebt","type":"uint256"}],"name":"getBondTerms","outputs":[{"components":[{"internalType":"uint256","name":"controlVariable","type":"uint256"},{"internalType":"uint256","name":"vestingTerm","type":"uint256"},{"internalType":"uint256","name":"minimumPrice","type":"uint256"},{"internalType":"uint256","name":"maxPayout","type":"uint256"},{"internalType":"uint256","name":"maxDebt","type":"uint256"},{"internalType":"uint256","name":"maxTotalPayout","type":"uint256"},{"internalType":"uint256","name":"initialDebt","type":"uint256"}],"internalType":"struct IApeBond.BondTerms","name":"","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":"address[]","name":"_bondCreators","type":"address[]"}],"name":"grantBondCreatorRole","outputs":[],"stateMutability":"nonpayable","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":"_bondImplementationAddress","type":"address"},{"internalType":"address","name":"_treasuryImplementationAddress","type":"address"},{"internalType":"address[]","name":"_bondCreators","type":"address[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","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":"address[]","name":"_bondCreators","type":"address[]"}],"name":"revokeBondCreatorRole","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":"contract IApeBond","name":"_bondImplementation","type":"address"}],"name":"setBondImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBondTreasury","name":"_treasuryImplementation","type":"address"}],"name":"setTreasuryImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeployed","outputs":[{"internalType":"uint256","name":"_bondsDeployed","type":"uint256"},{"internalType":"uint256","name":"_treasuriesDeployed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryImplementationAddress","outputs":[{"internalType":"contract IBondTreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60808060405234610016576122bc908161001c8239f35b600080fdfe608060408181526004908136101561001657600080fd5b600092833560e01c90816301ffc9a7146111fe575080630b546b34146111705780630cfb14b01461114b578063248a9ca31461112057806324c20eec146110e55780632e96d6f9146110895780632f2ff15d14610fd957806336568abe14610f475780636d5be30314610e165780636f77825d14610d6f578063715018a614610d1257806373aa999614610c98578063746c096214610bab57806377a24f361461098357806378a6cc091461095a578063886ab1ff146109315780638b50063e146108795780638da5cb5b146108505780639010d07c1461080f57806391d14854146107c85780639878aadc1461079f5780639d19d217146106e7578063a1a0b68814610642578063a217fddf14610627578063ae2f05b1146105cb578063ca15c873146105a3578063d547741f146103b6578063ef140ccc1461038d578063f2fde38b146102fb578063fa5d7c50146102845763ffa1ad741461017957600080fd5b3461027457826003193601126102745760fb5481516001621794a360e21b03198152939081908590859082906001600160a01b03165afa9283156102785781936101cf575b8251806101cb86826114dd565b0390f35b909192503d8083863e6101e281866113f7565b84019160208584031261025a5784516001600160401b039586821161027457019183601f8401121561027057825195861161025d575083519261022f601f8701601f1916602001856113f7565b8584526020868401011161025a57506101cb9361025291602080850191016114ba565b9038806101be565b80fd5b634e487b7160e01b825260419052602490fd5b5080fd5b8280fd5b509051903d90823e3d90fd5b50823461025a57608036600319011261025a5761029f61130d565b906102a86112db565b936102b1611323565b91606435906001600160401b03821161025a5750916102da6102ea94926020979436910161134d565b9390926102e5611592565b611d95565b90516001600160a01b039091168152f35b5090346102745760203660031901126102745761031661130d565b9161031f611757565b6001600160a01b0383161561033b5783610338846117af565b80f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b838234610270578160031936011261027057602090516000805160206122478339815191528152f35b5091903461027057826003193601126102705780356103d36112db565b918184526020609781526001808787200154808752878720338852835260ff88882054161561040757866103388787611509565b87945090869161041633611809565b90865192610423846113dc565b60428452858401946060368737845115610590576030865384518210156105905790607860218601536041915b818311610525575050506104f5576104f19386936104dd936104ce6048946104a59a519a8576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d9788015282519283916037890191016114ba565b8401917001034b99036b4b9b9b4b733903937b6329607d1b6037840152518093868401906114ba565b010360288101875201856113f7565b5162461bcd60e51b815292839283016114dd565b0390fd5b50505080606493519262461bcd60e51b845283015260248201526000805160206122278339815191526044820152fd5b909192600f8116601081101561057d576f181899199a1a9b1b9c1cb0b131b232b360811b901a61055585886117f8565b53881c92801561056a57600019019190610450565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b50903461027457602036600319011261027457602092829135815260c9845220549051908152f35b509034610274576020366003190112610274573560fe548110156102745760fe9092527f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a9091015490516001600160a01b039091168152602090f35b83823461027057816003193601126102705751908152602090f35b8382346102705760203660031901126102705760207f8c264331caf0a7dd7a5ddc4f9f6f00f8a7b9ae22c8724810ddcd8ca0d96ced3f9161068161130d565b6033546001600160a01b0391908216331480156106bd575b6106a290611d28565b16908160018060a01b031960fc54161760fc5551908152a180f35b5060008051602061226783398151915286526097845282862033875284528286205460ff16610699565b5090346102745760203660031901126102745780356001600160401b03811161079b576107389161071a9136910161134d565b91909260018060a01b0360335416331490811561076e575b50611d28565b825b818110610745578380f35b8061076461075f61075a610769948688611d85565b611a0e565b611c0b565b611be6565b61073a565b60ff9150600080516020612267833981519152865260976020528086203387526020528520541638610732565b8380fd5b83823461027057816003193601126102705760fc5490516001600160a01b039091168152602090f35b5090346102745781600319360112610274578160209360ff926107e96112db565b90358252609786528282206001600160a01b039091168252855220549151911615158152f35b50903461027457816003193601126102745760209261083a9135815260c984528260243591206112ad565b905491519160018060a01b039160031b1c168152f35b83823461027057816003193601126102705760335490516001600160a01b039091168152602090f35b8382346102705760c03660031901126102705761089461130d565b9061089d6112db565b6108a5611323565b6064356001600160a01b038181169390929184900361092d5790828594939260c09860a061092b98516108d7816113ae565b82815282602082015282898201528260608201528260808201520152818651986109008a6113ae565b16885216602087015216828501526060840152608435608084015260a43560a0840152518092611476565bf35b8680fd5b83823461027057816003193601126102705760fb5490516001600160a01b039091168152602090f35b838234610270578160031936011261027057602090516000805160206122678339815191528152f35b50346102745760603660031901126102745761099d61130d565b6109a56112db565b906044356001600160401b038111610ba75736602382011215610ba7576109d59036906024818801359101611418565b85549460ff8660081c161593848095610b9a575b8015610b83575b15610b2957600196858860ff198316178a55610b18575b50610a2a60ff895460081c16610a1c81611b86565b610a2581611b86565b611b86565b610a33336117af565b610a4360ff895460081c16611b86565b6001600160a01b03938416908115610b085760fb80546001600160a01b031990811690931790558416918215610afa57509086929160fc54161760fc558187905b610ace575b50505050610a95578280f35b825461ff0019168355519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a138808280f35b8151811015610af55780610764856020610aef9460051b8601015116611c0b565b82610a84565b610a89565b865163d92e233d60e01b8152fd5b865163d92e233d60e01b81528390fd5b61ffff191661010117885538610a07565b855162461bcd60e51b8152602081840152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156109f05750600160ff8816146109f0565b50600160ff8816106109e9565b8580fd5b50823461025a57366003190161026081126102705760c01361025a5760e03660c319011261025a576080366101a319011261025a57610be86112f6565b610244356001600160401b03811161027457610c07903690860161134d565b929094610c12611592565b6001600160a01b0391903590828216820361025a57604435928316830361025a575083866101cb9794610c789694610c4994611d95565b90610c5336611a22565b92610c72610c6036611aa7565b91610c6a36611b0d565b933691611418565b93611f8d565b91516001600160a01b039182168152911660208201529081906040820190565b509034610274573660031901610260811261079b5760c0136102745760e03660c3190112610274576080366101a319011261027457610cd56112f6565b9261024435906001600160401b03821161025a575092610cfe610c78926101cb9536910161134d565b610d09929192611592565b610c5336611a22565b833461025a578060031936011261025a57610d2b611757565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b509034610274576020366003190112610274576001600160a01b0390358181169081900361079b577f36f64842218ca073f57c8301395391dbd548b79c34bdac7d2a5070c2289f7e61926020926033541633148015610dec575b610dd290611d28565b60fb80546001600160a01b0319168317905551908152a180f35b5060008051602061226783398151915285526097835280852033865283528085205460ff16610dc9565b5034610274576020918260031936011261079b578035906001600160401b038211610f4357610e479136910161134d565b91909260018060a01b0392836033541633148015610f19575b610e6990611d28565b855b818110610e76578680f35b80610ec9610e8b61075a610ecf94868b611d85565b600080516020612247833981519152808b52609780885289898d20931692838d52885260ff898d205416610ed4575b508a5260c98652868a20611905565b50611be6565b610e6b565b818c528752878b20828c528752878b20805460ff191690553382827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8e80a438610eba565b5060008051602061226783398151915286526097825282862033875282528286205460ff16610e60565b8480fd5b50919034610270578260031936011261027057610f626112db565b90336001600160a01b03831603610f7e57906103389135611509565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b503461027457806003193601126102745761103a913590610ff86112db565b91611001611757565b808552609760209081528286206001600160a01b039094168087529390528185205460ff161561103e575b845260c96020528320611cba565b5080f35b8085526097602052818520838652602052818520600160ff198254161790553383827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8880a461102c565b509034610274576020366003190112610274573560fd548110156102745760fd9092527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2809091015490516001600160a01b039091168152602090f35b838234610270578160031936011261027057602090517f85d36e3b488c35c2a15344b305cb84e2000f26d4f3a7c1e8a516f0e82aee752a8152f35b5090346102745760203660031901126102745781602093600192358152609785522001549051908152f35b50823461025a578060031936011261025a575060fd5460fe5482519182526020820152f35b50346102745760e0366003190112610274578060e09360c061092b93516111968161137d565b82815282602082015282848201528260608201528260808201528260a082015201528051926111c48461137d565b3583526024356020840152604435818401526064356060840152608435608084015260a43560a084015260c43560c084015251809261126c565b84908434610274576020366003190112610274573563ffffffff60e01b81168091036102745760209250635a05180f60e01b8114908115611241575b5015158152f35b637965db0b60e01b81149150811561125b575b508361123a565b6301ffc9a760e01b14905083611254565b60c08091805184526020810151602085015260408101516040850152606081015160608501526080810151608085015260a081015160a08501520151910152565b80548210156112c55760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b602435906001600160a01b03821682036112f157565b600080fd5b61022435906001600160a01b03821682036112f157565b600435906001600160a01b03821682036112f157565b604435906001600160a01b03821682036112f157565b35906001600160a01b03821682036112f157565b9181601f840112156112f1578235916001600160401b0383116112f1576020808501948460051b0101116112f157565b60e081019081106001600160401b0382111761139857604052565b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b0382111761139857604052565b6001600160401b03811161139857604052565b608081019081106001600160401b0382111761139857604052565b90601f801991011681019081106001600160401b0382111761139857604052565b9092916001600160401b038411611398578360051b6040519260208094611441828501826113f7565b80978152019181019283116112f157905b82821061145f5750505050565b83809161146b84611339565b815201910190611452565b60a08091600180831b038082511685528060208301511660208601528060408301511660408601526060820151166060850152608081015160808501520151910152565b60005b8381106114cd5750506000910152565b81810151838201526020016114bd565b604091602082526114fd81518092816020860152602086860191016114ba565b601f01601f1916010190565b9060406115479260009080825260976020528282209360018060a01b03169384835260205260ff838320541661154a575b815260c960205220611905565b50565b808252609760205282822084835260205282822060ff1981541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a461153a565b3360009081527f6e903081c9f116a92fe510a216e4674e0c5523ef4bcae247c7a1c6721346509460209081526040808320549092906000805160206122478339815191529060ff16156115e55750505050565b6115ee33611809565b8451916115fa836113dc565b6042835284830193606036863783511561174357603085538351906001918210156117435790607860218601536041915b8183116116d5575050506116a5576104a593859361168f936116806048946104f19951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b9788015282519283916037890191016114ba565b010360288101855201836113f7565b5162461bcd60e51b8152918291600483016114dd565b60648486519062461bcd60e51b825280600483015260248201526000805160206122278339815191526044820152fd5b909192600f8116601081101561172f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61170585886117f8565b5360041c92801561171b5760001901919061162b565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b6033546001600160a01b0316330361176b57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b9081518110156112c5570160200190565b60405190606082018281106001600160401b0382111761139857604052602a82526020820160403682378251156112c5576030905381516001908110156112c557607860218401536029905b8082116118975750506118655790565b606460405162461bcd60e51b815260206004820152602060248201526000805160206122278339815191526044820152fd5b9091600f811660108110156118f0576f181899199a1a9b1b9c1cb0b131b232b360811b901a6118c684866117f8565b5360041c9180156118db576000190190611855565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b90600182019060009281845282602052604084205490811515600014611a0757600019918083018181116119f3578254908482019182116119df57808203611991575b5050508054801561197d5782019161196083836112ad565b909182549160031b1b191690555582526020526040812055600190565b634e487b7160e01b86526031600452602486fd5b6119ca6119a16119b193866112ad565b90549060031b1c928392866112ad565b819391549060031b600019811b9283911b169119161790565b90558652846020526040862055388080611948565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b87526011600452602487fd5b5050505090565b356001600160a01b03811681036112f15790565b60c09060031901126112f1576040519060c082018281106001600160401b0382111761139857604052816001600160a01b0360043581811681036112f157825260243581811681036112f157602083015260443581811681036112f157604083015260643590811681036112f1576060820152608435608082015260a060a435910152565b60e09060c31901126112f1576040519060e082018281106001600160401b03821117611398576040528160c435815260e43560208201526101043560408201526101243560608201526101443560808201526101643560a082015260c061018435910152565b6080906101a31901126112f15760405190608082018281106001600160401b03821117611398576040526001600160a01b03826101a43582811681036112f15781526101c43582811681036112f15760208201526101e43582811681036112f15760408201526102043591821682036112f15760600152565b15611b8d57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6000198114611bf55760010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b031660008181527f6e903081c9f116a92fe510a216e4674e0c5523ef4bcae247c7a1c672134650946020526040808220546115479392906000805160206122478339815191529060ff1615611c6f575b815260c960205220611cba565b8082526097602052828220848352602052828220600160ff198254161790553384827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8580a4611c62565b91906001830160009082825280602052604082205415600014611d2257845494600160401b861015611d0e5783611cfe6119b1886001604098999a018555846112ad565b9055549382526020522055600190565b634e487b7160e01b83526041600452602483fd5b50925050565b15611d2f57565b60405162461bcd60e51b815260206004820152602860248201527f43616c6c6572206973206e6f74206f776e6572206f722068617320726571756960448201526772656420726f6c6560c01b6064820152608490fd5b91908110156112c55760051b0190565b60fc5494959492936000936001600160a01b0391908290611db7908216611ef9565b1697883b15610ba7578591604051938492631cd7f7fb60e31b845280828080608488019a169a8b6004890152169b8c60248801521697886044870152608060648701525260a48401929185905b828210611ecd575050505081900381838b5af18015611ec257611eaf575b5060fe5492600160401b841015611e9b5750600183018060fe558310156112c5577fc2e4361e1c4df34325e130fc802df07757639590137fd9e13d8258cfc46864c49360809360fe6000526020600020018760018060a01b031982541617905560405192878452602084015260408301526060820152a1565b634e487b7160e01b81526041600452602490fd5b611ebb909391936113c9565b9138611e22565b6040513d86823e3d90fd5b9295509093509160019082611ee187611339565b16815260208091019501920192859389959392611e04565b6e5af43d82803e903d91602b57fd5bf390763d602d80600a3d3981f3363d3d373d3d3d363d7300000062ffffff8260881c161760005260781b17602052603760096000f0906001600160a01b03821615611f4f57565b60405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606490fd5b6040805163277d415b60e11b8152939695919390926001600160a01b03868116939092600092602092600492848185818b5afa90811561221c5786916121e6575b5086808b51169116036121d65785611fe98160fb5416611ef9565b169b8c3b15610ba7579094809493928d8b978b519485936380beb19960e01b855261026485019a8d898701526024860161202291611476565b60e4850161202f9161126c565b8a8151166101c48501528a88820151166101e48501528a8d82015116610204850152606001988a8a5116610224850152610244840161026090528151809152876102848501920190855b898282106121b457505050508383809203925af18015612197576121a1575b5084845116803b1561079b5783809160248e8b519485938492634c1d96ab60e11b8452888401525af1801561219757908491612183575b505060fd5492600160401b8410156121715750600183018060fd5583101561215c575060fd6000908152200180546001600160a01b031916891790555192517fe42b3bfdda5c3ebec2f72cd7e805728e029ff151c4ae3ee967edda88c25e6a65946101209491939190921691612146908490611476565b60c08301528660e0830152610100820152a19190565b603290634e487b7160e01b6000525260246000fd5b6041602492634e487b7160e01b835252fd5b61218c906113c9565b6102745782386120cf565b88513d86823e3d90fd5b6121ad909391936113c9565b9138612098565b92965093509350806001928c87511681520194019101928f9185938995612079565b87516312bb684960e31b81528390fd5b90508481813d8311612215575b6121fd81836113f7565b81010312610ba757518681168103610ba75738611fce565b503d6121f3565b89513d88823e3d90fdfe537472696e67733a20686578206c656e67746820696e73756666696369656e74b8221483b13a7a4067aee25681b6f32f76bb7c6b22e0e797174ab602f41ebd67e3723f41c074e25ac45636a7cd631386f2e15f8583ade05d0b710b41251f5c7ba264697066735822122016435e88e6a58c8f9b67237982e3d7c41ca6317f4dee71073302c4c6eb209a1264736f6c63430008110033
Deployed Bytecode
0x608060408181526004908136101561001657600080fd5b600092833560e01c90816301ffc9a7146111fe575080630b546b34146111705780630cfb14b01461114b578063248a9ca31461112057806324c20eec146110e55780632e96d6f9146110895780632f2ff15d14610fd957806336568abe14610f475780636d5be30314610e165780636f77825d14610d6f578063715018a614610d1257806373aa999614610c98578063746c096214610bab57806377a24f361461098357806378a6cc091461095a578063886ab1ff146109315780638b50063e146108795780638da5cb5b146108505780639010d07c1461080f57806391d14854146107c85780639878aadc1461079f5780639d19d217146106e7578063a1a0b68814610642578063a217fddf14610627578063ae2f05b1146105cb578063ca15c873146105a3578063d547741f146103b6578063ef140ccc1461038d578063f2fde38b146102fb578063fa5d7c50146102845763ffa1ad741461017957600080fd5b3461027457826003193601126102745760fb5481516001621794a360e21b03198152939081908590859082906001600160a01b03165afa9283156102785781936101cf575b8251806101cb86826114dd565b0390f35b909192503d8083863e6101e281866113f7565b84019160208584031261025a5784516001600160401b039586821161027457019183601f8401121561027057825195861161025d575083519261022f601f8701601f1916602001856113f7565b8584526020868401011161025a57506101cb9361025291602080850191016114ba565b9038806101be565b80fd5b634e487b7160e01b825260419052602490fd5b5080fd5b8280fd5b509051903d90823e3d90fd5b50823461025a57608036600319011261025a5761029f61130d565b906102a86112db565b936102b1611323565b91606435906001600160401b03821161025a5750916102da6102ea94926020979436910161134d565b9390926102e5611592565b611d95565b90516001600160a01b039091168152f35b5090346102745760203660031901126102745761031661130d565b9161031f611757565b6001600160a01b0383161561033b5783610338846117af565b80f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b838234610270578160031936011261027057602090516000805160206122478339815191528152f35b5091903461027057826003193601126102705780356103d36112db565b918184526020609781526001808787200154808752878720338852835260ff88882054161561040757866103388787611509565b87945090869161041633611809565b90865192610423846113dc565b60428452858401946060368737845115610590576030865384518210156105905790607860218601536041915b818311610525575050506104f5576104f19386936104dd936104ce6048946104a59a519a8576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8d9788015282519283916037890191016114ba565b8401917001034b99036b4b9b9b4b733903937b6329607d1b6037840152518093868401906114ba565b010360288101875201856113f7565b5162461bcd60e51b815292839283016114dd565b0390fd5b50505080606493519262461bcd60e51b845283015260248201526000805160206122278339815191526044820152fd5b909192600f8116601081101561057d576f181899199a1a9b1b9c1cb0b131b232b360811b901a61055585886117f8565b53881c92801561056a57600019019190610450565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b50903461027457602036600319011261027457602092829135815260c9845220549051908152f35b509034610274576020366003190112610274573560fe548110156102745760fe9092527f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a9091015490516001600160a01b039091168152602090f35b83823461027057816003193601126102705751908152602090f35b8382346102705760203660031901126102705760207f8c264331caf0a7dd7a5ddc4f9f6f00f8a7b9ae22c8724810ddcd8ca0d96ced3f9161068161130d565b6033546001600160a01b0391908216331480156106bd575b6106a290611d28565b16908160018060a01b031960fc54161760fc5551908152a180f35b5060008051602061226783398151915286526097845282862033875284528286205460ff16610699565b5090346102745760203660031901126102745780356001600160401b03811161079b576107389161071a9136910161134d565b91909260018060a01b0360335416331490811561076e575b50611d28565b825b818110610745578380f35b8061076461075f61075a610769948688611d85565b611a0e565b611c0b565b611be6565b61073a565b60ff9150600080516020612267833981519152865260976020528086203387526020528520541638610732565b8380fd5b83823461027057816003193601126102705760fc5490516001600160a01b039091168152602090f35b5090346102745781600319360112610274578160209360ff926107e96112db565b90358252609786528282206001600160a01b039091168252855220549151911615158152f35b50903461027457816003193601126102745760209261083a9135815260c984528260243591206112ad565b905491519160018060a01b039160031b1c168152f35b83823461027057816003193601126102705760335490516001600160a01b039091168152602090f35b8382346102705760c03660031901126102705761089461130d565b9061089d6112db565b6108a5611323565b6064356001600160a01b038181169390929184900361092d5790828594939260c09860a061092b98516108d7816113ae565b82815282602082015282898201528260608201528260808201520152818651986109008a6113ae565b16885216602087015216828501526060840152608435608084015260a43560a0840152518092611476565bf35b8680fd5b83823461027057816003193601126102705760fb5490516001600160a01b039091168152602090f35b838234610270578160031936011261027057602090516000805160206122678339815191528152f35b50346102745760603660031901126102745761099d61130d565b6109a56112db565b906044356001600160401b038111610ba75736602382011215610ba7576109d59036906024818801359101611418565b85549460ff8660081c161593848095610b9a575b8015610b83575b15610b2957600196858860ff198316178a55610b18575b50610a2a60ff895460081c16610a1c81611b86565b610a2581611b86565b611b86565b610a33336117af565b610a4360ff895460081c16611b86565b6001600160a01b03938416908115610b085760fb80546001600160a01b031990811690931790558416918215610afa57509086929160fc54161760fc558187905b610ace575b50505050610a95578280f35b825461ff0019168355519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a138808280f35b8151811015610af55780610764856020610aef9460051b8601015116611c0b565b82610a84565b610a89565b865163d92e233d60e01b8152fd5b865163d92e233d60e01b81528390fd5b61ffff191661010117885538610a07565b855162461bcd60e51b8152602081840152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156109f05750600160ff8816146109f0565b50600160ff8816106109e9565b8580fd5b50823461025a57366003190161026081126102705760c01361025a5760e03660c319011261025a576080366101a319011261025a57610be86112f6565b610244356001600160401b03811161027457610c07903690860161134d565b929094610c12611592565b6001600160a01b0391903590828216820361025a57604435928316830361025a575083866101cb9794610c789694610c4994611d95565b90610c5336611a22565b92610c72610c6036611aa7565b91610c6a36611b0d565b933691611418565b93611f8d565b91516001600160a01b039182168152911660208201529081906040820190565b509034610274573660031901610260811261079b5760c0136102745760e03660c3190112610274576080366101a319011261027457610cd56112f6565b9261024435906001600160401b03821161025a575092610cfe610c78926101cb9536910161134d565b610d09929192611592565b610c5336611a22565b833461025a578060031936011261025a57610d2b611757565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b509034610274576020366003190112610274576001600160a01b0390358181169081900361079b577f36f64842218ca073f57c8301395391dbd548b79c34bdac7d2a5070c2289f7e61926020926033541633148015610dec575b610dd290611d28565b60fb80546001600160a01b0319168317905551908152a180f35b5060008051602061226783398151915285526097835280852033865283528085205460ff16610dc9565b5034610274576020918260031936011261079b578035906001600160401b038211610f4357610e479136910161134d565b91909260018060a01b0392836033541633148015610f19575b610e6990611d28565b855b818110610e76578680f35b80610ec9610e8b61075a610ecf94868b611d85565b600080516020612247833981519152808b52609780885289898d20931692838d52885260ff898d205416610ed4575b508a5260c98652868a20611905565b50611be6565b610e6b565b818c528752878b20828c528752878b20805460ff191690553382827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8e80a438610eba565b5060008051602061226783398151915286526097825282862033875282528286205460ff16610e60565b8480fd5b50919034610270578260031936011261027057610f626112db565b90336001600160a01b03831603610f7e57906103389135611509565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b503461027457806003193601126102745761103a913590610ff86112db565b91611001611757565b808552609760209081528286206001600160a01b039094168087529390528185205460ff161561103e575b845260c96020528320611cba565b5080f35b8085526097602052818520838652602052818520600160ff198254161790553383827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8880a461102c565b509034610274576020366003190112610274573560fd548110156102745760fd9092527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2809091015490516001600160a01b039091168152602090f35b838234610270578160031936011261027057602090517f85d36e3b488c35c2a15344b305cb84e2000f26d4f3a7c1e8a516f0e82aee752a8152f35b5090346102745760203660031901126102745781602093600192358152609785522001549051908152f35b50823461025a578060031936011261025a575060fd5460fe5482519182526020820152f35b50346102745760e0366003190112610274578060e09360c061092b93516111968161137d565b82815282602082015282848201528260608201528260808201528260a082015201528051926111c48461137d565b3583526024356020840152604435818401526064356060840152608435608084015260a43560a084015260c43560c084015251809261126c565b84908434610274576020366003190112610274573563ffffffff60e01b81168091036102745760209250635a05180f60e01b8114908115611241575b5015158152f35b637965db0b60e01b81149150811561125b575b508361123a565b6301ffc9a760e01b14905083611254565b60c08091805184526020810151602085015260408101516040850152606081015160608501526080810151608085015260a081015160a08501520151910152565b80548210156112c55760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b602435906001600160a01b03821682036112f157565b600080fd5b61022435906001600160a01b03821682036112f157565b600435906001600160a01b03821682036112f157565b604435906001600160a01b03821682036112f157565b35906001600160a01b03821682036112f157565b9181601f840112156112f1578235916001600160401b0383116112f1576020808501948460051b0101116112f157565b60e081019081106001600160401b0382111761139857604052565b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b0382111761139857604052565b6001600160401b03811161139857604052565b608081019081106001600160401b0382111761139857604052565b90601f801991011681019081106001600160401b0382111761139857604052565b9092916001600160401b038411611398578360051b6040519260208094611441828501826113f7565b80978152019181019283116112f157905b82821061145f5750505050565b83809161146b84611339565b815201910190611452565b60a08091600180831b038082511685528060208301511660208601528060408301511660408601526060820151166060850152608081015160808501520151910152565b60005b8381106114cd5750506000910152565b81810151838201526020016114bd565b604091602082526114fd81518092816020860152602086860191016114ba565b601f01601f1916010190565b9060406115479260009080825260976020528282209360018060a01b03169384835260205260ff838320541661154a575b815260c960205220611905565b50565b808252609760205282822084835260205282822060ff1981541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a461153a565b3360009081527f6e903081c9f116a92fe510a216e4674e0c5523ef4bcae247c7a1c6721346509460209081526040808320549092906000805160206122478339815191529060ff16156115e55750505050565b6115ee33611809565b8451916115fa836113dc565b6042835284830193606036863783511561174357603085538351906001918210156117435790607860218601536041915b8183116116d5575050506116a5576104a593859361168f936116806048946104f19951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b9788015282519283916037890191016114ba565b010360288101855201836113f7565b5162461bcd60e51b8152918291600483016114dd565b60648486519062461bcd60e51b825280600483015260248201526000805160206122278339815191526044820152fd5b909192600f8116601081101561172f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61170585886117f8565b5360041c92801561171b5760001901919061162b565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b6033546001600160a01b0316330361176b57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b9081518110156112c5570160200190565b60405190606082018281106001600160401b0382111761139857604052602a82526020820160403682378251156112c5576030905381516001908110156112c557607860218401536029905b8082116118975750506118655790565b606460405162461bcd60e51b815260206004820152602060248201526000805160206122278339815191526044820152fd5b9091600f811660108110156118f0576f181899199a1a9b1b9c1cb0b131b232b360811b901a6118c684866117f8565b5360041c9180156118db576000190190611855565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b90600182019060009281845282602052604084205490811515600014611a0757600019918083018181116119f3578254908482019182116119df57808203611991575b5050508054801561197d5782019161196083836112ad565b909182549160031b1b191690555582526020526040812055600190565b634e487b7160e01b86526031600452602486fd5b6119ca6119a16119b193866112ad565b90549060031b1c928392866112ad565b819391549060031b600019811b9283911b169119161790565b90558652846020526040862055388080611948565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b87526011600452602487fd5b5050505090565b356001600160a01b03811681036112f15790565b60c09060031901126112f1576040519060c082018281106001600160401b0382111761139857604052816001600160a01b0360043581811681036112f157825260243581811681036112f157602083015260443581811681036112f157604083015260643590811681036112f1576060820152608435608082015260a060a435910152565b60e09060c31901126112f1576040519060e082018281106001600160401b03821117611398576040528160c435815260e43560208201526101043560408201526101243560608201526101443560808201526101643560a082015260c061018435910152565b6080906101a31901126112f15760405190608082018281106001600160401b03821117611398576040526001600160a01b03826101a43582811681036112f15781526101c43582811681036112f15760208201526101e43582811681036112f15760408201526102043591821682036112f15760600152565b15611b8d57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6000198114611bf55760010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b031660008181527f6e903081c9f116a92fe510a216e4674e0c5523ef4bcae247c7a1c672134650946020526040808220546115479392906000805160206122478339815191529060ff1615611c6f575b815260c960205220611cba565b8082526097602052828220848352602052828220600160ff198254161790553384827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8580a4611c62565b91906001830160009082825280602052604082205415600014611d2257845494600160401b861015611d0e5783611cfe6119b1886001604098999a018555846112ad565b9055549382526020522055600190565b634e487b7160e01b83526041600452602483fd5b50925050565b15611d2f57565b60405162461bcd60e51b815260206004820152602860248201527f43616c6c6572206973206e6f74206f776e6572206f722068617320726571756960448201526772656420726f6c6560c01b6064820152608490fd5b91908110156112c55760051b0190565b60fc5494959492936000936001600160a01b0391908290611db7908216611ef9565b1697883b15610ba7578591604051938492631cd7f7fb60e31b845280828080608488019a169a8b6004890152169b8c60248801521697886044870152608060648701525260a48401929185905b828210611ecd575050505081900381838b5af18015611ec257611eaf575b5060fe5492600160401b841015611e9b5750600183018060fe558310156112c5577fc2e4361e1c4df34325e130fc802df07757639590137fd9e13d8258cfc46864c49360809360fe6000526020600020018760018060a01b031982541617905560405192878452602084015260408301526060820152a1565b634e487b7160e01b81526041600452602490fd5b611ebb909391936113c9565b9138611e22565b6040513d86823e3d90fd5b9295509093509160019082611ee187611339565b16815260208091019501920192859389959392611e04565b6e5af43d82803e903d91602b57fd5bf390763d602d80600a3d3981f3363d3d373d3d3d363d7300000062ffffff8260881c161760005260781b17602052603760096000f0906001600160a01b03821615611f4f57565b60405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606490fd5b6040805163277d415b60e11b8152939695919390926001600160a01b03868116939092600092602092600492848185818b5afa90811561221c5786916121e6575b5086808b51169116036121d65785611fe98160fb5416611ef9565b169b8c3b15610ba7579094809493928d8b978b519485936380beb19960e01b855261026485019a8d898701526024860161202291611476565b60e4850161202f9161126c565b8a8151166101c48501528a88820151166101e48501528a8d82015116610204850152606001988a8a5116610224850152610244840161026090528151809152876102848501920190855b898282106121b457505050508383809203925af18015612197576121a1575b5084845116803b1561079b5783809160248e8b519485938492634c1d96ab60e11b8452888401525af1801561219757908491612183575b505060fd5492600160401b8410156121715750600183018060fd5583101561215c575060fd6000908152200180546001600160a01b031916891790555192517fe42b3bfdda5c3ebec2f72cd7e805728e029ff151c4ae3ee967edda88c25e6a65946101209491939190921691612146908490611476565b60c08301528660e0830152610100820152a19190565b603290634e487b7160e01b6000525260246000fd5b6041602492634e487b7160e01b835252fd5b61218c906113c9565b6102745782386120cf565b88513d86823e3d90fd5b6121ad909391936113c9565b9138612098565b92965093509350806001928c87511681520194019101928f9185938995612079565b87516312bb684960e31b81528390fd5b90508481813d8311612215575b6121fd81836113f7565b81010312610ba757518681168103610ba75738611fce565b503d6121f3565b89513d88823e3d90fdfe537472696e67733a20686578206c656e67746820696e73756666696369656e74b8221483b13a7a4067aee25681b6f32f76bb7c6b22e0e797174ab602f41ebd67e3723f41c074e25ac45636a7cd631386f2e15f8583ade05d0b710b41251f5c7ba264697066735822122016435e88e6a58c8f9b67237982e3d7c41ca6317f4dee71073302c4c6eb209a1264736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.