Source Code
Overview
HYPE Balance
HYPE Value
$0.00Latest 5 from a total of 5 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Project Budg... | 22104185 | 118 days ago | IN | 0 HYPE | 0.00000307 | ||||
| Create Fuul Proj... | 16999562 | 177 days ago | IN | 0 HYPE | 0.00045235 | ||||
| Add Currency Tok... | 16637769 | 181 days ago | IN | 0 HYPE | 0.00000756 | ||||
| Create Fuul Proj... | 13060011 | 221 days ago | IN | 0 HYPE | 0.00317351 | ||||
| Add Currency Tok... | 12973244 | 222 days ago | IN | 0 HYPE | 0.00000545 |
Latest 3 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 16999562 | 177 days ago | Contract Creation | 0 HYPE | |||
| 13060011 | 221 days ago | Contract Creation | 0 HYPE | |||
| 3154969 | 350 days ago | Contract Creation | 0 HYPE |
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:
FuulFactory
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "./FuulProject.sol";
import "./interfaces/IFuulFactory.sol";
import "./interfaces/IFuulManager.sol";
contract FuulFactory is IFuulFactory, AccessControlEnumerable {
using Counters for Counters.Counter;
// Manager role
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
// Tracker of the number of projects created
Counters.Counter private _projectTracker;
// Implementation contract address
address immutable fuulProjectImplementation;
// Address that will collect protocol fees
address public protocolFeeCollector;
// Currency paid for NFT fixed fees
address public nftFeeCurrency;
// Fixed fee for NFT rewards
uint256 public nftFixedFeeAmount = 1 ether;
// Protocol fee percentage. 1 => 0.01%
uint256 public protocolFee = 0;
// Client fee. 1 => 0.01%
uint256 public clientFee = 0;
// Attributor fee. 1 => 0.01%
uint256 public attributorFee = 0;
// Amount of time that must elapse between a project's application to remove funds from its budget and the actual removal of those funds.
uint256 public projectBudgetCooldown = 30 days;
// Period of time that a project can remove funds after cooldown. If they don't remove in this period, they will have to apply to remove again.
uint256 public projectRemoveBudgetPeriod = 30 days;
// Mapping token addresses with token information
mapping(address => CurrencyToken) public acceptedCurrencies;
/**
* @dev Sets the values for `fuulManager`, `fuulProjectImplementation` and the initial values for `protocolFeeCollector` and `nftFeeCurrency`.
* It grants the DEFAULT_ADMIN_ROLE to the deployer.
*
* `fuulProjectImplementation` value is immutable: it can only be set once during
* construction.
*/
constructor(
address fuulManager,
address initialProtocolFeeCollector,
address initialNftFeeCurrency,
address acceptedERC20CurrencyToken
) {
if (
fuulManager == address(0) ||
initialProtocolFeeCollector == address(0) ||
acceptedERC20CurrencyToken == address(0)
) {
revert ZeroAddress();
}
fuulProjectImplementation = address(new FuulProject());
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MANAGER_ROLE, fuulManager);
protocolFeeCollector = initialProtocolFeeCollector;
nftFeeCurrency = initialNftFeeCurrency;
_addCurrencyToken(address(0), TokenType(0));
_addCurrencyToken(acceptedERC20CurrencyToken, TokenType(1));
}
/*╔═════════════════════════════╗
║ CREATE PROJECT ║
╚═════════════════════════════╝*/
/**
* @dev Creates a new Project. It deploys a new clone of the implementation
* and initializes it.
* The `projectId` follows the number of projects created.
*
* Emits {ProjectCreated}.
*
* Requirements:
*
* - `_projectAdmin` and `_projectEventSigner` must not be the zero address.
* - `_projectInfoURI` must not be an empty string.
*/
function createFuulProject(
address projectAdmin,
address projectEventSigner,
string calldata projectInfoURI,
address clientFeeCollector
) external {
if (
projectAdmin == address(0) ||
projectEventSigner == address(0) ||
clientFeeCollector == address(0)
) {
revert ZeroAddress();
}
address clone = Clones.clone(fuulProjectImplementation);
FuulProject(clone).initialize(
projectAdmin,
projectEventSigner,
projectInfoURI,
clientFeeCollector
);
_projectTracker.increment();
emit ProjectCreated(
totalProjectsCreated(),
address(clone),
projectEventSigner,
projectInfoURI,
clientFeeCollector
);
}
/**
* @dev Returns the number of total projects created.
*/
function totalProjectsCreated() public view returns (uint256) {
return _projectTracker.current();
}
/*╔═════════════════════════════╗
║ MANAGER ROLE ║
╚═════════════════════════════╝*/
/**
* @dev Returns if an address has `MANAGER_ROLE`.
*/
function hasManagerRole(address account) public view returns (bool) {
if (!hasRole(MANAGER_ROLE, account)) {
revert Unauthorized();
}
return true;
}
/*╔═════════════════════════════╗
║ FEES VARIABLES ║
╚═════════════════════════════╝*/
/**
* @dev Returns all fees in one function.
*/
function getAllFees() public view returns (FeesInformation memory) {
return (
FeesInformation({
protocolFee: protocolFee,
attributorFee: attributorFee,
clientFee: clientFee,
protocolFeeCollector: protocolFeeCollector,
nftFixedFeeAmount: nftFixedFeeAmount,
nftFeeCurrency: nftFeeCurrency
})
);
}
/**
* @dev Returns all fees for attribution and checks that the sender has `MANAGER_ROLE`.
*
* Note:
* The function purpose is to check and return all necessary data
* to the {FuulProject} in one call when attributing.
*
* Even though the sender is a parameter, in {FuulProject} is _msgSender() so it cannot be manipulated.
*/
function attributionFeeHelper(
address sender
) external view returns (FeesInformation memory) {
// Checking sender only for {FuulProject} attribution to make only one call
hasManagerRole(sender);
return getAllFees();
}
/**
* @dev Sets the protocol fees for each attribution.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setProtocolFee(
uint256 value
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (value == protocolFee) {
revert IFuulManager.InvalidArgument();
}
protocolFee = value;
emit ProtocolFeeUpdated(value);
}
/**
* @dev Sets the fees for the client that was used to create the project.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setClientFee(uint256 value) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (value == clientFee) {
revert IFuulManager.InvalidArgument();
}
clientFee = value;
emit ClientFeeUpdated(value);
}
/**
* @dev Sets the fees for the attributor.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setAttributorFee(
uint256 value
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (value == attributorFee) {
revert IFuulManager.InvalidArgument();
}
attributorFee = value;
emit AttributorFeeUpdated(value);
}
/**
* @dev Sets the fixed fee amount for NFT rewards.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setNftFixedFeeAmount(
uint256 value
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (value == nftFixedFeeAmount) {
revert IFuulManager.InvalidArgument();
}
nftFixedFeeAmount = value;
emit NftFixedFeeUpdated(value);
}
/**
* @dev Sets the currency that will be used to pay NFT rewards fees.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setNftFeeCurrency(
address newCurrency
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (newCurrency == nftFeeCurrency) {
revert IFuulManager.InvalidArgument();
}
nftFeeCurrency = newCurrency;
emit NftFeeCurrencyUpdated(newCurrency);
}
/**
* @dev Sets the protocol fee collector address.
*
* Requirements:
*
* - `value` must be different from the current one.
* - Only admins can call this function.
*/
function setProtocolFeeCollector(
address newCollector
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (newCollector == protocolFeeCollector) {
revert IFuulManager.InvalidArgument();
}
protocolFeeCollector = newCollector;
emit ProtocolFeeCollectorUpdated(newCollector);
}
/*╔═════════════════════════════╗
║ TOKEN CURRENCIES ║
╚═════════════════════════════╝*/
/**
* @dev Adds a currency token.
* See {_addCurrencyToken}
*
* Requirements:
*
* - Only admins can call this function.
* - Token not accepted
*/
function addCurrencyToken(
address tokenAddress,
TokenType tokenType
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (acceptedCurrencies[tokenAddress].isAccepted) {
revert TokenCurrencyAlreadyAccepted();
}
_addCurrencyToken(tokenAddress, tokenType);
}
/**
* @dev Adds a currency token.
*
*/
function _addCurrencyToken(
address tokenAddress,
TokenType tokenType
) internal {
if (tokenAddress != address(0) && tokenType == TokenType.NATIVE) {
revert InvalidTokenType();
}
acceptedCurrencies[tokenAddress] = CurrencyToken({
tokenType: tokenType,
isAccepted: true
});
emit CurrencyAdded(tokenAddress, tokenType);
}
/**
* @dev Removes a currency token.
*
* Notes:
* - Projects will not be able to deposit with the currency token.
* - We don't remove the `currencyToken` object because users will still be able to claim/remove it
*
* Requirements:
*
* - `tokenAddress` must be accepted.
* - Only admins can call this function.
*/
function removeCurrencyToken(
address tokenAddress
) external onlyRole(DEFAULT_ADMIN_ROLE) {
CurrencyToken storage currency = acceptedCurrencies[tokenAddress];
if (!currency.isAccepted) {
revert TokenCurrencyNotAccepted();
}
currency.isAccepted = false;
emit CurrencyRemoved(tokenAddress, currency.tokenType);
}
/*╔═════════════════════════════╗
║ REMOVE VARIABLES ║
╚═════════════════════════════╝*/
/**
* @dev Sets the period for `projectBudgetCooldown`.
*
* Requirements:
*
* - `period` must be different from the current one.
* - Only admins can call this function.
*/
function setProjectBudgetCooldown(
uint256 period
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (period == projectBudgetCooldown || period == 0) {
revert IFuulManager.InvalidArgument();
}
projectBudgetCooldown = period;
emit ProjectCooldownUpdated(period);
}
/**
* @dev Sets the period for `projectRemoveBudgetPeriod`.
*
* Requirements:
*
* - `period` must be different from the current one.
* - `period` must be greater than 5 days.
* - Only admins can call this function.
*/
function setProjectRemoveBudgetPeriod(
uint256 period
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (period == projectRemoveBudgetPeriod || period < 5 days) {
revert IFuulManager.InvalidArgument();
}
projectRemoveBudgetPeriod = period;
emit ProjectRemovePeriodUpdated(period);
}
/**
* @dev Returns removal info. The function purpose is to call only once from {FuulProject} when needing this info.
*/
function getBudgetRemoveInfo()
external
view
returns (uint256 cooldown, uint256 removeWindow)
{
return (projectBudgetCooldown, projectRemoveBudgetPeriod);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.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 AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).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 ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) 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());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual 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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (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: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.0;
import "./ERC1155Receiver.sol";
/**
* Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*
* @dev _Available since v3.1._
*/
contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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 Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.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 ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/IFuulFactory.sol";
import "./interfaces/IFuulProject.sol";
contract FuulProject is
IFuulProject,
AccessControlEnumerable,
ERC721Holder,
ERC1155Holder,
ReentrancyGuard
{
using SafeERC20 for IERC20;
using Address for address payable;
// Checks if contract is initialized
bool private initialized;
// Factory contract address
address public immutable fuulFactory;
// Address that will receive client fees (client that created the project)
address public clientFeeCollector;
// Roles for allowed addresses to send events through our SDK (not used in the contract)
bytes32 public constant EVENTS_SIGNER_ROLE =
keccak256("EVENTS_SIGNER_ROLE");
// Mapping attribution proofs with already processed
mapping(bytes32 => bool) public attributionProofs;
// URI that points to a file with project information (image, name, description, attribution conditions, etc)
string public projectInfoURI;
// Timestamp for the last application to remove budget
uint256 public lastRemovalApplication;
// Mapping currency with amount
mapping(address => uint256) public budgets;
// Mapping owner address to currency to earnings
mapping(address => mapping(address => uint256)) public availableToClaim;
// Mapping currency with fees when rewarding NFTs. Using mappings to be able to withdraw after fee currency changes
mapping(address => uint256) public nftFeeBudget;
// {FuulFactory} instance
IFuulFactory private immutable fuulFactoryInstance;
/**
* @dev Modifier to check if the project can remove funds. Reverts with an {OutsideRemovalWindow} error.
*/
modifier canRemove() {
canRemoveFunds();
_;
}
/**
* @dev Modifier to check if the uint amount is zero.
*/
modifier nonZeroAmount(uint256 amount) {
_nonZeroAmount(amount);
_;
}
/**
* @dev Internal function for {nonZeroAmount} modifier. Reverts with a {TokenCurrencyNotAccepted} error.
*/
function _nonZeroAmount(uint256 amount) internal pure {
if (amount == 0) {
revert ZeroAmount();
}
}
/*╔═════════════════════════════╗
║ CONSTRUCTOR ║
╚═════════════════════════════╝*/
/**
* @dev Sets the value for `fuulFactory`.
* This value is immutable.
*/
constructor() {
fuulFactory = _msgSender();
fuulFactoryInstance = IFuulFactory(fuulFactory);
}
/**
* @dev Initializes the contract when the Factory deploys a new clone.
*
* Grants roles for project admin, the address allowed to send events
* through the SDK, the URI with the project information and the address
* that will receive the client fees.
*/
function initialize(
address projectAdmin,
address projectEventSignerAddress,
string calldata projectURI,
address clientCreator
) external {
if (fuulFactory != _msgSender() || initialized) {
revert Forbidden();
}
_setupRole(DEFAULT_ADMIN_ROLE, projectAdmin);
_setupRole(EVENTS_SIGNER_ROLE, projectEventSignerAddress);
_setProjectURI(projectURI);
clientFeeCollector = clientCreator;
initialized = true;
}
/*╔═════════════════════════════╗
║ PROJECT INFO ║
╚═════════════════════════════╝*/
/**
* @dev Internal function that sets `projectInfoURI` as the information for the project.
*
* Requirements:
*
* - `projectURI` must not be an empty string.
*/
function _setProjectURI(string memory projectURI) internal {
if (bytes(projectURI).length == 0) {
revert EmptyURI();
}
projectInfoURI = projectURI;
}
/**
* @dev Sets `projectInfoURI` as the information for the project.
*
* Emits {ProjectInfoUpdated}.
*
* Requirements:
*
* - Only admins can call this function.
*/
function setProjectURI(
string calldata projectURI
) external onlyRole(DEFAULT_ADMIN_ROLE) {
_setProjectURI(projectURI);
emit ProjectInfoUpdated(projectURI);
}
/*╔═════════════════════════════╗
║ DEPOSIT BUDGET ║
╚═════════════════════════════╝*/
/**
* @dev Deposits fungible tokens.
* They can be native or ERC20 tokens.
*
* Emits {BudgetDeposited}.
*
* Requirements:
*
* - `amount` must be greater than zero.
* - Only admins can deposit.
* - Token currency must be accepted in {FuulFactory}
* - Currency must be the address zero (native token) or ERC20.
*/
function depositFungibleToken(
address currency,
uint256 amount
)
external
payable
onlyRole(DEFAULT_ADMIN_ROLE)
nonReentrant
nonZeroAmount(amount)
{
IFuulFactory.TokenType currencyType = _getCurrencyToken(currency);
uint256 depositedAmount;
if (currencyType == IFuulFactory.TokenType.NATIVE) {
if (msg.value != amount) {
revert IncorrectMsgValue();
}
depositedAmount = amount;
} else if (currencyType == IFuulFactory.TokenType.ERC_20) {
if (msg.value > 0) {
revert IncorrectMsgValue();
}
uint256 previousBalance = IERC20(currency).balanceOf(address(this));
IERC20(currency).safeTransferFrom(
_msgSender(),
address(this),
amount
);
depositedAmount =
IERC20(currency).balanceOf(address(this)) -
previousBalance;
} else {
revert InvalidCurrency();
}
// Update balance
budgets[currency] += depositedAmount;
emit FungibleBudgetDeposited(depositedAmount, currency);
}
/**
* @dev Deposits NFTs.
*
* Note: `amounts` parameter is only used when dealing with ERC1155 tokens.
*
* Emits {BudgetDeposited}.
*
* Requirements:
*
* - `tokenIds` must not be an empty string.
* - Only admins can deposit.
* - Token currency must be accepted in {FuulFactory}
* - Currency must be an ERC721 or ERC1155.
*/
function depositNFTToken(
address currency,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) external onlyRole(DEFAULT_ADMIN_ROLE) nonReentrant {
IFuulFactory.TokenType currencyType = _getCurrencyToken(currency);
if (currencyType == IFuulFactory.TokenType.ERC_721) {
uint256 depositedAmount = tokenIds.length;
_nonZeroAmount(depositedAmount);
budgets[currency] += depositedAmount;
_transferERC721Tokens(
currency,
_msgSender(),
address(this),
tokenIds
);
emit ERC721BudgetDeposited(depositedAmount, currency, tokenIds);
} else if (currencyType == IFuulFactory.TokenType.ERC_1155) {
uint256 depositedAmount = _getSumFromArray(amounts);
_nonZeroAmount(depositedAmount);
budgets[currency] += depositedAmount;
_transferERC1155Tokens(
currency,
_msgSender(),
address(this),
tokenIds,
amounts
);
emit ERC1155BudgetDeposited(
_msgSender(),
depositedAmount,
currency,
tokenIds,
amounts
);
} else {
revert InvalidCurrency();
}
}
/*╔═════════════════════════════╗
║ REMOVE BUDGET ║
╚═════════════════════════════╝*/
/**
* @dev Sets timestamp for which users request to remove their budgets.
*
* Emits {AppliedToRemove}.
*
* Requirements:
*
* - Only admins can call this function.
*/
function applyToRemoveBudget() external onlyRole(DEFAULT_ADMIN_ROLE) {
lastRemovalApplication = block.timestamp;
emit AppliedToRemove(lastRemovalApplication);
}
/**
* @dev Returns the window when projects can remove funds.
* The cooldown period for removing a project's budget begins upon calling the {applyToRemoveBudget} function
* and ends once the `projectBudgetCooldown` period has elapsed.
*
* The period to remove starts when the cooldown is completed, and ends after {removePeriod}.
*
* It is a public function for the UI to be able to read and display dates.
*/
function getBudgetRemovePeriod()
public
view
returns (uint256 cooldown, uint256 removePeriodEnds)
{
uint256 lastApplication = lastRemovalApplication;
if (lastApplication == 0) {
revert NoRemovalApplication();
}
(uint256 budgetCooldown, uint256 removePeriod) = fuulFactoryInstance
.getBudgetRemoveInfo();
cooldown = lastApplication + budgetCooldown;
removePeriodEnds = cooldown + removePeriod;
return (cooldown, removePeriodEnds);
}
/**
* @dev Returns if the project is inside the removal window.
* It should be after the cooldown is completed and before the removal period ends.
* It is a public function for the UI to be able to check if the project can remove.
*/
function canRemoveFunds() public view returns (bool) {
(
uint256 cooldownPeriodEnds,
uint256 removePeriodEnds
) = getBudgetRemovePeriod();
if (
block.timestamp < cooldownPeriodEnds ||
block.timestamp > removePeriodEnds
) {
revert OutsideRemovalWindow();
}
return true;
}
/**
* @dev Removes fungible tokens.
* They can be native or ERC20 tokens.
*
* Emits {BudgetRemoved}.
*
* Requirements:
*
* - `amount` must be greater than zero.
* - `amount` must be lower than budget for currency
* - Only admins can remove.
* - Must be within the Budget removal window.
* - Currency must be the address zero (native token) or ERC20.
*/
function removeFungibleBudget(
address currency,
uint256 amount
)
external
onlyRole(DEFAULT_ADMIN_ROLE)
nonReentrant
canRemove
nonZeroAmount(amount)
{
// Update budget - By underflow it indirectly checks that amount <= currentBudget
budgets[currency] -= amount;
(IFuulFactory.TokenType currencyType, ) = fuulFactoryInstance
.acceptedCurrencies(currency);
if (currencyType == IFuulFactory.TokenType.NATIVE) {
payable(_msgSender()).sendValue(amount);
} else if (currencyType == IFuulFactory.TokenType.ERC_20) {
IERC20(currency).safeTransfer(_msgSender(), amount);
} else {
revert InvalidCurrency();
}
emit FungibleBudgetRemoved(amount, currency);
}
/**
* @dev Removes NFT tokens.
* They can be ERC1155 or ERC721 tokens.
* `amounts` parameter is only used when dealing with ERC1155 tokens.
*
* Emits {BudgetRemoved}.
*
* Requirements:
*
* - `amount` must be greater than zero.
* - `amount` must be lower than budget for currency
* - Only admins can remove.
* - Must be within the Budget removal window.
* - Currency must be an ERC721 or ERC1155.
*/
function removeNFTBudget(
address currency,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) external onlyRole(DEFAULT_ADMIN_ROLE) nonReentrant canRemove {
(IFuulFactory.TokenType currencyType, ) = fuulFactoryInstance
.acceptedCurrencies(currency);
if (currencyType == IFuulFactory.TokenType.ERC_721) {
uint256 removeAmount = tokenIds.length;
_nonZeroAmount(removeAmount);
// Update budget - By underflow it indirectly checks that amount <= budget
budgets[currency] -= removeAmount;
_transferERC721Tokens(
currency,
address(this),
_msgSender(),
tokenIds
);
emit ERC721BudgetRemoved(removeAmount, currency, tokenIds);
} else if (currencyType == IFuulFactory.TokenType.ERC_1155) {
uint256 removeAmount = _getSumFromArray(amounts);
_nonZeroAmount(removeAmount);
// Update budget - By underflow it indirectly checks that amount <= budget
budgets[currency] -= removeAmount;
_transferERC1155Tokens(
currency,
address(this),
_msgSender(),
tokenIds,
amounts
);
emit ERC1155BudgetRemoved(
_msgSender(),
removeAmount,
currency,
tokenIds,
amounts
);
} else {
revert InvalidCurrency();
}
}
/*╔═════════════════════════════╗
║ NFT FEE BUDGET ║
╚═════════════════════════════╝*/
/**
* @dev Deposits budget to pay for fees when rewarding NFTs.
* The currency is defined in the {FuulFactory} contract.
*
* Emits {FeeBudgetDeposit}.
*
* Requirements:
*
* - `amount` must be greater than zero.
* - Only admins can deposit.
*/
function depositFeeBudget(
uint256 amount
)
external
payable
onlyRole(DEFAULT_ADMIN_ROLE)
nonReentrant
nonZeroAmount(amount)
{
address currency = fuulFactoryInstance.nftFeeCurrency();
uint256 depositedAmount;
if (currency == address(0)) {
if (msg.value != amount) {
revert IncorrectMsgValue();
}
depositedAmount = amount;
} else {
if (msg.value > 0) {
revert IncorrectMsgValue();
}
uint256 previousBalance = IERC20(currency).balanceOf(address(this));
IERC20(currency).safeTransferFrom(
_msgSender(),
address(this),
amount
);
depositedAmount =
IERC20(currency).balanceOf(address(this)) -
previousBalance;
}
// Update balance
nftFeeBudget[currency] += depositedAmount;
emit FeeBudgetDeposited(_msgSender(), depositedAmount, currency);
}
/**
* @dev Removes fee budget for NFT rewards.
*
* Emits {FeeBudgetRemoved}.
*
* Notes: Currency is an argument because if the default is
* changed in {FuulProject}, projects will still be able to remove.
*
* Requirements:
*
* - `amount` must be greater than zero.
* - `amount` must be lower than fee budget.
* - Only admins can remove.
* - Must be within the Budget removal window.
*/
function removeFeeBudget(
address currency,
uint256 amount
)
external
onlyRole(DEFAULT_ADMIN_ROLE)
nonReentrant
canRemove
nonZeroAmount(amount)
{
// Update budget - By underflow it indirectly checks that amount <= nftFeeBudget
nftFeeBudget[currency] -= amount;
if (currency == address(0)) {
payable(_msgSender()).sendValue(amount);
} else {
IERC20(currency).safeTransfer(_msgSender(), amount);
}
emit FeeBudgetRemoved(_msgSender(), amount, currency);
}
/*╔═════════════════════════════╗
║ ATTRIBUTION ║
╚═════════════════════════════╝*/
/**
* @dev Internal function to calculate fees and amounts for fungible token reward.
*/
function _calculateAmountsForFungibleToken(
IFuulFactory.FeesInformation memory feesInfo,
uint256 amountToPartner,
uint256 amountToEndUser
)
internal
pure
returns (
uint256[3] memory fees,
uint256 netAmountToPartner,
uint256 netAmountToEndUser
)
{
uint256 totalAmount = amountToPartner + amountToEndUser;
// Calculate the percentage to partners
uint256 partnerPercentage = (100 * amountToPartner) / totalAmount;
// Get all fees
fees = [
(feesInfo.protocolFee * totalAmount) / 10000,
(feesInfo.clientFee * totalAmount) / 10000,
(feesInfo.attributorFee * totalAmount) / 10000
];
// Get net amounts
uint256 netTotal = (totalAmount - fees[0] - fees[1] - fees[2]);
netAmountToPartner = (netTotal * partnerPercentage) / 100;
netAmountToEndUser = netTotal - netAmountToPartner;
return (fees, netAmountToPartner, netAmountToEndUser);
}
/**
* @dev Internal function to calculate fees for non fungible token reward.
*
*/
function _calculateFeesForNFT(
IFuulFactory.FeesInformation memory feesInfo
) internal pure returns (uint256[3] memory fees) {
uint256 totalAmount = feesInfo.nftFixedFeeAmount;
fees = [
(feesInfo.protocolFee * totalAmount) / 10000,
(feesInfo.clientFee * totalAmount) / 10000,
(feesInfo.attributorFee * totalAmount) / 10000
];
return fees;
}
/**
* @dev Attributes: removes amounts from budget and adds them to corresponding partners, users and fee collectors.
*
* Emits {Attributed}.
*
* Notes:
* - When rewards are fungible tokens, fees will be a percentage of the payment and it will be substracted from the payment.
* - When rewards are NFTs, fees will be a fixed amount and the `nftFeeBudget` will be used.
*
* Requirements:
*
* - Currency budgets have to be greater than amounts attributed.
* - The sum of `amountToPartner` and `amountToEndUser` for each `Attribution` must be greater than zero.
* - Only `MANAGER_ROLE` in {FuulFactory} addresses can call this function. This is checked through the `getFeesInformation` in {FuulFactory}.
* - Proof must not exist (be previously attributed).
* - {FuulManager} must not be paused. This is checked through The `attributeConversions` function in {FuulManager}.
* - Currency token must be accepted in {FuulFactory}
*/
function attributeConversions(
Attribution[] calldata attributions,
address attributorFeeCollector
) external nonReentrant {
// Using this function to get all the necessary info from {FuulFactory} from one call
IFuulFactory.FeesInformation memory feesInfo = fuulFactoryInstance
.attributionFeeHelper(_msgSender());
for (uint256 i = 0; i < attributions.length; ) {
Attribution memory attribution = attributions[i];
if (attributionProofs[attribution.proof]) {
revert AlreadyAttributed();
}
if (
keccak256(
abi.encodePacked(
attribution.proofWithoutProject,
address(this)
)
) != attribution.proof
) {
revert InvalidProof();
}
address currency = attribution.currency;
IFuulFactory.TokenType currencyType = _getCurrencyToken(currency);
attributionProofs[attribution.proof] = true;
uint256 totalAmount = attribution.amountToPartner +
attribution.amountToEndUser;
_nonZeroAmount(totalAmount);
// Calculate fees and amounts
uint256[3] memory fees;
uint256 amountToPartner;
uint256 amountToEndUser;
address feeCurrency;
if (
currencyType == IFuulFactory.TokenType.NATIVE ||
currencyType == IFuulFactory.TokenType.ERC_20
) {
(
fees,
amountToPartner,
amountToEndUser
) = _calculateAmountsForFungibleToken(
feesInfo,
attribution.amountToPartner,
attribution.amountToEndUser
);
feeCurrency = currency;
} else if (
currencyType == IFuulFactory.TokenType.ERC_721 ||
currencyType == IFuulFactory.TokenType.ERC_1155
) {
// It is not necessary to check if it's an NFT address. If it has budget and it is not a fungible, then it's an NFT
fees = _calculateFeesForNFT(feesInfo);
amountToPartner = attribution.amountToPartner;
amountToEndUser = attribution.amountToEndUser;
feeCurrency = feesInfo.nftFeeCurrency;
// Remove from fees budget
nftFeeBudget[feeCurrency] -= (fees[0] + fees[1] + fees[2]);
} else {
revert InvalidCurrency();
}
// Update budget balance
budgets[currency] -= totalAmount;
// Update protocol balance
availableToClaim[feesInfo.protocolFeeCollector][
feeCurrency
] += fees[0];
// Update client balance
availableToClaim[clientFeeCollector][feeCurrency] += fees[1];
// Update attributor balance
availableToClaim[attributorFeeCollector][feeCurrency] += fees[2];
// Update partner balance
availableToClaim[attribution.partner][currency] += amountToPartner;
// Update end user balance
availableToClaim[attribution.endUser][currency] += amountToEndUser;
// Emit Event
emit Attributed(
currency,
totalAmount,
[
feesInfo.protocolFeeCollector,
clientFeeCollector,
attributorFeeCollector,
attribution.partner,
attribution.endUser
],
[fees[0], fees[1], fees[2], amountToPartner, amountToEndUser],
attribution.proof
);
// Using unchecked to the next element in the loop optimize gas
unchecked {
i++;
}
}
}
/**
* @dev Claims: sends funds to `receiver` that has available to claim funds.
*
* `tokenIds` parameter is only used when dealing with ERC1155 and ERC721 tokens.
* `amounts` parameter is only used when dealing with ERC1155 tokens.
*
* Requirements:
*
* - `receiver` must have available funds to claim for {currency}.
* - Only `MANAGER_ROLE` in {FuulFactory} addresses can call this function.
* - {FuulManager} must not be paused. This is checked through The `claim` function in {FuulManager}.
*/
function claimFromProject(
address currency,
address receiver,
uint256 amount,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) external nonReentrant {
fuulFactoryInstance.hasManagerRole(_msgSender());
// It fails with underflow if amount < avaiable to claim
availableToClaim[receiver][currency] -= amount;
(IFuulFactory.TokenType currencyType, ) = fuulFactoryInstance
.acceptedCurrencies(currency);
if (currencyType == IFuulFactory.TokenType.NATIVE) {
payable(receiver).sendValue(amount);
} else if (currencyType == IFuulFactory.TokenType.ERC_20) {
IERC20(currency).safeTransfer(receiver, amount);
} else if (currencyType == IFuulFactory.TokenType.ERC_721) {
uint256 tokenIdsLength = tokenIds.length;
// Check that the amount of tokenIds to claim is equal to the available amount
if (amount != tokenIdsLength) {
revert InvalidArgument();
}
_transferERC721Tokens(currency, address(this), receiver, tokenIds);
} else if (currencyType == IFuulFactory.TokenType.ERC_1155) {
// Check that the sum of the amounts of tokenIds to claim is equal to the available amount
if (amount != _getSumFromArray(amounts)) {
revert InvalidArgument();
}
_transferERC1155Tokens(
currency,
address(this),
receiver,
tokenIds,
amounts
);
} else {
revert InvalidCurrency();
}
emit Claimed(receiver, currency, amount, tokenIds, amounts);
}
/*╔═════════════════════════════╗
║ INTERNAL TRANSFER TOKENS ║
╚═════════════════════════════╝*/
/**
* @dev Helper function to transfer ERC721 tokens.
*/
function _transferERC721Tokens(
address tokenAddress,
address senderAddress,
address receiverAddress,
uint256[] calldata tokenIds
) internal {
for (uint256 i = 0; i < tokenIds.length; ) {
IERC721(tokenAddress).safeTransferFrom(
senderAddress,
receiverAddress,
tokenIds[i]
);
// Using unchecked to the next element in the loop optimize gas
unchecked {
i++;
}
}
}
/**
* @dev Helper function to transfer ERC1155 tokens.
*/
function _transferERC1155Tokens(
address tokenAddress,
address senderAddress,
address receiverAddress,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) internal {
// Transfer from does not allow to send more funds than balance
IERC1155(tokenAddress).safeBatchTransferFrom(
senderAddress,
receiverAddress,
tokenIds,
amounts,
""
);
}
/*╔═════════════════════════════╗
║ OTHER ║
╚═════════════════════════════╝*/
/**
* @dev Gets token info from {FuulFactory}.
*/
function _getCurrencyToken(
address currency
) internal view returns (IFuulFactory.TokenType currencyType) {
bool isAccepted;
(currencyType, isAccepted) = fuulFactoryInstance.acceptedCurrencies(
currency
);
if (!isAccepted) {
revert IFuulFactory.TokenCurrencyNotAccepted();
}
return currencyType;
}
/**
* @dev Helper function to sum all amounts inside the array.
*/
function _getSumFromArray(
uint256[] calldata amounts
) internal pure returns (uint256 result) {
for (uint256 i = 0; i < amounts.length; ) {
result += amounts[i];
// Using unchecked to the next element in the loop optimize gas
unchecked {
i++;
}
}
return result;
}
/*╔═════════════════════════════╗
║ OVERRIDES ║
╚═════════════════════════════╝*/
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
override(AccessControlEnumerable, ERC1155Receiver)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
interface IFuulFactory {
struct FeesInformation {
uint256 protocolFee;
uint256 attributorFee;
uint256 clientFee;
address protocolFeeCollector;
uint256 nftFixedFeeAmount;
address nftFeeCurrency;
}
enum TokenType {
NATIVE,
ERC_20,
ERC_721,
ERC_1155
}
struct CurrencyToken {
TokenType tokenType;
bool isAccepted;
}
/*╔═════════════════════════════╗
║ EVENTS ║
╚═════════════════════════════╝*/
event ProjectCreated(
uint256 projectId,
address indexed deployedAddress,
address indexed eventSigner,
string projectInfoURI,
address clientFeeCollector
);
event ProtocolFeeUpdated(uint256 value);
event ClientFeeUpdated(uint256 value);
event AttributorFeeUpdated(uint256 value);
event NftFixedFeeUpdated(uint256 value);
event NftFeeCurrencyUpdated(address newCurrency);
event ProtocolFeeCollectorUpdated(address indexed newCollector);
event CurrencyAdded(address indexed newCurrency, TokenType tokenType);
event CurrencyRemoved(address indexed newCurrency, TokenType tokenType);
event ProjectCooldownUpdated(uint256 value);
event ProjectRemovePeriodUpdated(uint256 value);
/*╔═════════════════════════════╗
║ ERRORS ║
╚═════════════════════════════╝*/
error ZeroAddress();
error TokenCurrencyAlreadyAccepted();
error TokenCurrencyNotAccepted();
error Unauthorized();
error InvalidTokenType();
/*╔═════════════════════════════╗
║ CREATE PROJECT ║
╚═════════════════════════════╝*/
function createFuulProject(
address projectAdmin,
address projectEventSigner,
string calldata projectInfoURI,
address clientFeeCollector
) external;
function totalProjectsCreated() external view returns (uint256);
/*╔═════════════════════════════╗
║ MANAGER ROLE ║
╚═════════════════════════════╝*/
function hasManagerRole(address account) external view returns (bool);
/*╔═════════════════════════════╗
║ FEES VARIABLES ║
╚═════════════════════════════╝*/
function protocolFee() external view returns (uint256 fees);
function protocolFeeCollector() external view returns (address);
function getAllFees() external returns (FeesInformation memory);
function attributionFeeHelper(
address sender
) external returns (FeesInformation memory);
function clientFee() external view returns (uint256 fees);
function attributorFee() external view returns (uint256 fees);
function nftFeeCurrency() external view returns (address);
function setProtocolFee(uint256 value) external;
function setClientFee(uint256 value) external;
function setAttributorFee(uint256 value) external;
function setNftFixedFeeAmount(uint256 value) external;
function setNftFeeCurrency(address newCurrency) external;
/*╔═════════════════════════════╗
║ TOKEN CURRENCIES ║
╚═════════════════════════════╝*/
function acceptedCurrencies(
address tokenAddress
) external view returns (TokenType tokenType, bool isAccepted);
function addCurrencyToken(
address tokenAddress,
TokenType tokenType
) external;
function removeCurrencyToken(address tokenAddress) external;
/*╔═════════════════════════════╗
║ REMOVE VARIABLES ║
╚═════════════════════════════╝*/
function projectBudgetCooldown() external view returns (uint256 period);
function getBudgetRemoveInfo()
external
view
returns (uint256 cooldown, uint256 removeWindow);
function setProjectBudgetCooldown(uint256 period) external;
function setProjectRemoveBudgetPeriod(uint256 period) external;
}// SPDX-License-Identifier: MIT
import "./IFuulProject.sol";
pragma solidity ^0.8.18;
interface IFuulManager {
struct CurrencyTokenLimit {
uint256 claimLimitPerCooldown;
uint256 cumulativeClaimPerCooldown;
uint256 claimCooldownPeriodStarted;
}
struct ClaimCheck {
address projectAddress;
address currency;
uint256 amount;
uint256[] tokenIds;
uint256[] amounts;
}
struct AttributionEntity {
address projectAddress;
IFuulProject.Attribution[] projectAttributions;
}
/*╔═════════════════════════════╗
║ EVENTS ║
╚═════════════════════════════╝*/
event ClaimCooldownUpdated(uint256 value);
event TokenLimitAdded(address indexed token, uint256 value);
event TokenLimitUpdated(address indexed token, uint256 value);
/*╔═════════════════════════════╗
║ ERRORS ║
╚═════════════════════════════╝*/
error InvalidArgument();
error LimitAlreadySet();
error OverTheLimit();
error ZeroAddress();
error Unauthorized();
/*╔═════════════════════════════╗
║ PUBLIC VARIABLES ║
╚═════════════════════════════╝*/
function claimCooldown() external view returns (uint256 period);
function usersClaims(
address user,
address currency
) external view returns (uint256);
/*╔═════════════════════════════╗
║ CLAIM VARIABLES ║
╚═════════════════════════════╝*/
function setClaimCooldown(uint256 period) external;
/*╔═════════════════════════════╗
║ TOKEN CURRENCIES ║
╚═════════════════════════════╝*/
function currencyLimits(
address currencyToken
) external view returns (uint256, uint256, uint256);
function addCurrencyLimit(
address tokenAddress,
uint256 claimLimitPerCooldown
) external;
function setCurrencyTokenLimit(
address tokenAddress,
uint256 limit
) external;
/*╔═════════════════════════════╗
║ PAUSE ║
╚═════════════════════════════╝*/
function pauseAll() external;
function unpauseAll() external;
function isPaused() external view returns (bool);
/*╔═════════════════════════════╗
║ ATTRIBUTE AND CLAIM ║
╚═════════════════════════════╝*/
function attributeConversions(
AttributionEntity[] memory attributions,
address attributorFeeCollector
) external;
function claim(ClaimCheck[] calldata claimChecks) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
interface IFuulProject is IAccessControlEnumerable {
/*╔═════════════════════════════╗
║ STRUCT ║
╚═════════════════════════════╝*/
// Attribution
struct Attribution {
address currency;
address partner;
address endUser;
uint256 amountToPartner;
uint256 amountToEndUser;
bytes32 proof;
bytes32 proofWithoutProject;
}
/*╔═════════════════════════════╗
║ EVENTS ║
╚═════════════════════════════╝*/
event ProjectInfoUpdated(string projectInfoURI);
event FungibleBudgetDeposited(uint256 amount, address indexed currency);
event ERC721BudgetDeposited(
uint256 amount,
address indexed currency,
uint256[] tokenIds
);
event ERC1155BudgetDeposited(
address indexed account,
uint256 amount,
address indexed currency,
uint256[] tokenIds,
uint256[] amounts
);
event FungibleBudgetRemoved(uint256 amount, address indexed currency);
event ERC721BudgetRemoved(
uint256 amount,
address indexed currency,
uint256[] tokenIds
);
event ERC1155BudgetRemoved(
address indexed account,
uint256 amount,
address indexed currency,
uint256[] tokenIds,
uint256[] amounts
);
event Claimed(
address indexed account,
address indexed currency,
uint256 amount,
uint256[] rewardTokenIds,
uint256[] amounts
);
// Array Order: protocol, client, attributor, partner, end user
event Attributed(
address indexed currency,
uint256 totalAmount,
address[5] receivers,
uint256[5] amounts,
bytes32 proof
);
event FeeBudgetDeposited(
address indexed account,
uint256 amount,
address indexed currency
);
event FeeBudgetRemoved(
address indexed account,
uint256 amount,
address indexed currency
);
event AppliedToRemove(uint256 timestamp);
/*╔═════════════════════════════╗
║ ERRORS ║
╚═════════════════════════════╝*/
error ManagerIsPaused();
error EmptyURI();
error NoRemovalApplication();
error IncorrectMsgValue();
error OutsideRemovalWindow();
error ZeroAmount();
error AlreadyAttributed();
error InvalidProof();
error Forbidden();
error InvalidCurrency();
error InvalidArgument();
/*╔═════════════════════════════╗
║ PUBLIC VARIABLES ║
╚═════════════════════════════╝*/
function fuulFactory() external view returns (address);
function availableToClaim(
address account,
address currency
) external view returns (uint256);
/*╔═════════════════════════════╗
║ PROJECT INFO ║
╚═════════════════════════════╝*/
function projectInfoURI() external view returns (string memory);
function setProjectURI(string memory projectURI) external;
function clientFeeCollector() external view returns (address);
/*╔═════════════════════════════╗
║ DEPOSIT ║
╚═════════════════════════════╝*/
function depositFungibleToken(
address currency,
uint256 amount
) external payable;
function depositNFTToken(
address currency,
uint256[] memory rewardTokenIds,
uint256[] memory amounts
) external;
/*╔═════════════════════════════╗
║ REMOVE ║
╚═════════════════════════════╝*/
function lastRemovalApplication() external view returns (uint256);
function applyToRemoveBudget() external;
function getBudgetRemovePeriod() external view returns (uint256, uint256);
function canRemoveFunds() external view returns (bool insideRemovalWindow);
function removeFungibleBudget(address currency, uint256 amount) external;
function removeNFTBudget(
address currency,
uint256[] memory rewardTokenIds,
uint256[] memory amounts
) external;
/*╔═════════════════════════════╗
║ ATTRIBUTE ║
╚═════════════════════════════╝*/
function attributeConversions(
Attribution[] calldata attributions,
address attributorFeeCollector
) external;
function attributionProofs(bytes32 proof) external view returns (bool);
/*╔═════════════════════════════╗
║ CLAIM ║
╚═════════════════════════════╝*/
function claimFromProject(
address currency,
address receiver,
uint256 amount,
uint256[] memory tokenIds,
uint256[] memory amounts
) external;
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"fuulManager","type":"address"},{"internalType":"address","name":"initialProtocolFeeCollector","type":"address"},{"internalType":"address","name":"initialNftFeeCurrency","type":"address"},{"internalType":"address","name":"acceptedERC20CurrencyToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidArgument","type":"error"},{"inputs":[],"name":"InvalidTokenType","type":"error"},{"inputs":[],"name":"TokenCurrencyAlreadyAccepted","type":"error"},{"inputs":[],"name":"TokenCurrencyNotAccepted","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"AttributorFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ClientFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"},{"indexed":false,"internalType":"enum IFuulFactory.TokenType","name":"tokenType","type":"uint8"}],"name":"CurrencyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"},{"indexed":false,"internalType":"enum IFuulFactory.TokenType","name":"tokenType","type":"uint8"}],"name":"CurrencyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newCurrency","type":"address"}],"name":"NftFeeCurrencyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"NftFixedFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ProjectCooldownUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":true,"internalType":"address","name":"deployedAddress","type":"address"},{"indexed":true,"internalType":"address","name":"eventSigner","type":"address"},{"indexed":false,"internalType":"string","name":"projectInfoURI","type":"string"},{"indexed":false,"internalType":"address","name":"clientFeeCollector","type":"address"}],"name":"ProjectCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ProjectRemovePeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCollector","type":"address"}],"name":"ProtocolFeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ProtocolFeeUpdated","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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"acceptedCurrencies","outputs":[{"internalType":"enum IFuulFactory.TokenType","name":"tokenType","type":"uint8"},{"internalType":"bool","name":"isAccepted","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"enum IFuulFactory.TokenType","name":"tokenType","type":"uint8"}],"name":"addCurrencyToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"attributionFeeHelper","outputs":[{"components":[{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"attributorFee","type":"uint256"},{"internalType":"uint256","name":"clientFee","type":"uint256"},{"internalType":"address","name":"protocolFeeCollector","type":"address"},{"internalType":"uint256","name":"nftFixedFeeAmount","type":"uint256"},{"internalType":"address","name":"nftFeeCurrency","type":"address"}],"internalType":"struct IFuulFactory.FeesInformation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"attributorFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clientFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"projectAdmin","type":"address"},{"internalType":"address","name":"projectEventSigner","type":"address"},{"internalType":"string","name":"projectInfoURI","type":"string"},{"internalType":"address","name":"clientFeeCollector","type":"address"}],"name":"createFuulProject","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllFees","outputs":[{"components":[{"internalType":"uint256","name":"protocolFee","type":"uint256"},{"internalType":"uint256","name":"attributorFee","type":"uint256"},{"internalType":"uint256","name":"clientFee","type":"uint256"},{"internalType":"address","name":"protocolFeeCollector","type":"address"},{"internalType":"uint256","name":"nftFixedFeeAmount","type":"uint256"},{"internalType":"address","name":"nftFeeCurrency","type":"address"}],"internalType":"struct IFuulFactory.FeesInformation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBudgetRemoveInfo","outputs":[{"internalType":"uint256","name":"cooldown","type":"uint256"},{"internalType":"uint256","name":"removeWindow","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"hasManagerRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftFeeCurrency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftFixedFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectBudgetCooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectRemoveBudgetPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"removeCurrencyToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setAttributorFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setClientFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newCurrency","type":"address"}],"name":"setNftFeeCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setNftFixedFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"setProjectBudgetCooldown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"setProjectRemoveBudgetPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newCollector","type":"address"}],"name":"setProtocolFeeCollector","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":"totalProjectsCreated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a0604052670de0b6b3a764000060055560006006556000600755600060085562278d0060095562278d00600a553480156200003a57600080fd5b50604051620094aa380380620094aa83398181016040528101906200006091906200078d565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480620000c85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80620001005750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b1562000138576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051620001469062000715565b604051809103906000f08015801562000163573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1681525050620001bb6000801b620001af620002c960201b60201c565b620002d160201b60201c565b620001ed7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0885620002d160201b60201c565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200029760008060038111156200028b576200028a620007ff565b5b620002e760201b60201c565b620002bf8160016003811115620002b357620002b2620007ff565b5b620002e760201b60201c565b505050506200089c565b600033905090565b620002e382826200049d60201b60201c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156200034f575060006003811115620003375762000336620007ff565b5b8160038111156200034d576200034c620007ff565b5b145b1562000387576040517fa1e9dd9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060400160405280826003811115620003a857620003a7620007ff565b5b815260200160011515815250600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690836003811115620004215762000420620007ff565b5b021790555060208201518160000160016101000a81548160ff0219169083151502179055509050508173ffffffffffffffffffffffffffffffffffffffff167fbe433982945125798dc0fb45d2aedb711f3461ff28984baab1334b3bce20d5e8826040516200049191906200087f565b60405180910390a25050565b620004b48282620004e560201b620014311760201c565b620004e08160016000858152602001908152602001600020620005d660201b620015111790919060201c565b505050565b620004f782826200060e60201b60201c565b620005d257600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555062000577620002c960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000606836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6200067860201b60201c565b905092915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60006200068c8383620006f260201b60201c565b620006e7578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050620006ec565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b61609b806200340f83390190565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620007558262000728565b9050919050565b620007678162000748565b81146200077357600080fd5b50565b60008151905062000787816200075c565b92915050565b60008060008060808587031215620007aa57620007a962000723565b5b6000620007ba8782880162000776565b9450506020620007cd8782880162000776565b9350506040620007e08782880162000776565b9250506060620007f38782880162000776565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60048110620008425762000841620007ff565b5b50565b600081905062000855826200082e565b919050565b6000620008678262000845565b9050919050565b62000879816200085a565b82525050565b60006020820190506200089660008301846200086e565b92915050565b608051612b57620008b86000396000610c0c0152612b576000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80639010d07c11610125578063b20feaaf116100ad578063cfca31471161007c578063cfca314714610603578063d547741f1461061f578063ec87621c1461063b578063f2e2e2aa14610659578063f88139101461068a57610211565b8063b20feaaf14610567578063c36a470814610585578063c4c04534146105a3578063ca15c873146105d357610211565b8063a221c64a116100f4578063a221c64a146104d1578063a5fd8edc146104ef578063aa405af91461050d578063b013ab381461052b578063b0e21e8a1461054957610211565b80639010d07c1461043757806391d148541461046757806399f8cbaf14610497578063a217fddf146104b357610211565b80632f7d5c66116101a85780635e73fd76116101775780635e73fd76146103a957806366fbf11b146103c5578063787dce3d146103e157806380cc90ed146103fd578063850a15011461041957610211565b80632f7d5c661461032357806336568abe1461033f57806339591b001461035b5780635026c8261461037957610211565b80631c91ecb6116101e45780631c91ecb61461029a578063248a9ca3146102b85780632a53ff5f146102e85780632f2ff15d1461030757610211565b806301ffc9a714610216578063059129471461024657806306bdd7d5146102625780631776a8271461027e575b600080fd5b610230600480360381019061022b9190612002565b6106a6565b60405161023d919061204a565b60405180910390f35b610260600480360381019061025b919061209b565b610720565b005b61027c6004803603810190610277919061209b565b6107aa565b005b61029860048036038101906102939190612126565b610840565b005b6102a2610950565b6040516102af9190612162565b60405180910390f35b6102d260048036038101906102cd91906121b3565b610961565b6040516102df91906121ef565b60405180910390f35b6102f0610980565b6040516102fe92919061220a565b60405180910390f35b610321600480360381019061031c9190612233565b610991565b005b61033d6004803603810190610338919061209b565b6109b2565b005b61035960048036038101906103549190612233565b610a3c565b005b610363610abf565b6040516103709190612162565b60405180910390f35b610393600480360381019061038e9190612126565b610ac5565b6040516103a0919061204a565b60405180910390f35b6103c360048036038101906103be91906122d8565b610b30565b005b6103df60048036038101906103da9190612126565b610d29565b005b6103fb60048036038101906103f6919061209b565b610e42565b005b6104176004803603810190610412919061209b565b610ecc565b005b610421610f64565b60405161042e919061236f565b60405180910390f35b610451600480360381019061044c919061238a565b610f8a565b60405161045e919061236f565b60405180910390f35b610481600480360381019061047c9190612233565b610fb9565b60405161048e919061204a565b60405180910390f35b6104b160048036038101906104ac919061209b565b611023565b005b6104bb6110ad565b6040516104c891906121ef565b60405180910390f35b6104d96110b4565b6040516104e69190612162565b60405180910390f35b6104f76110ba565b6040516105049190612162565b60405180910390f35b6105156110c0565b6040516105229190612162565b60405180910390f35b6105336110c6565b604051610540919061236f565b60405180910390f35b6105516110ec565b60405161055e9190612162565b60405180910390f35b61056f6110f2565b60405161057c9190612463565b60405180910390f35b61058d6111a4565b60405161059a9190612162565b60405180910390f35b6105bd60048036038101906105b89190612126565b6111aa565b6040516105ca9190612463565b60405180910390f35b6105ed60048036038101906105e891906121b3565b6111cb565b6040516105fa9190612162565b60405180910390f35b61061d60048036038101906106189190612126565b6111ef565b005b61063960048036038101906106349190612233565b61130b565b005b61064361132c565b60405161065091906121ef565b60405180910390f35b610673600480360381019061066e9190612126565b611350565b6040516106819291906124f5565b60405180910390f35b6106a4600480360381019061069f9190612543565b61138e565b005b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610719575061071882611541565b5b9050919050565b6000801b61072d816115bb565b6005548203610768576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816005819055507f7a25f4d39c7ef2d9ff33e6304584e4c9fb1532bc39972e2cd34b074c1e40e02b8260405161079e9190612162565b60405180910390a15050565b6000801b6107b7816115bb565b6009548214806107c75750600082145b156107fe576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816009819055507f87948cba23b87f534057161b507f18cd7f69576b88a81a74c55d8f29dfb06452826040516108349190612162565b60405180910390a15050565b6000801b61084d816115bb565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108d4576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f372b5e772b71a68b761c4ac03b59a6a2322bd34ac161ba7029a6a418fe89005182604051610944919061236f565b60405180910390a15050565b600061095c60026115cf565b905090565b6000806000838152602001908152602001600020600101549050919050565b600080600954600a54915091509091565b61099a82610961565b6109a3816115bb565b6109ad83836115dd565b505050565b6000801b6109bf816115bb565b60085482036109fa576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816008819055507f3a1dedaf5733100a92da764c2066bdc86b970e224ee473d515375645ce99a9d282604051610a309190612162565b60405180910390a15050565b610a44611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa890612606565b60405180910390fd5b610abb8282611619565b5050565b600a5481565b6000610af17f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0883610fb9565b610b27576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60019050919050565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610b975750600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610bce5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15610c05576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610c307f000000000000000000000000000000000000000000000000000000000000000061164d565b90508073ffffffffffffffffffffffffffffffffffffffff166309c26fb187878787876040518663ffffffff1660e01b8152600401610c73959493929190612673565b600060405180830381600087803b158015610c8d57600080fd5b505af1158015610ca1573d6000803e3d6000fd5b50505050610caf6002611707565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f68828e0b01cfe3740f67270e157a30f161e6531d36cd5db5797ec0e32d1f6911610d06610950565b878787604051610d1994939291906126c1565b60405180910390a3505050505050565b6000801b610d36816115bb565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160019054906101000a900460ff16610dc1576040517f3aca788a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160000160016101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167f523fff9d18fef7247d13e67b28b58c6173cc8868a73b220fcebfd5887c1135b28260000160009054906101000a900460ff16604051610e359190612701565b60405180910390a2505050565b6000801b610e4f816115bb565b6006548203610e8a576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816006819055507fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de4082604051610ec09190612162565b60405180910390a15050565b6000801b610ed9816115bb565b600a54821480610eeb57506206978082105b15610f22576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600a819055507f2c941b29cbb54e4feeb31a83ebf90b2ffdd425f3970b341bf588a6ca88a8b56b82604051610f589190612162565b60405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610fb1826001600086815260200190815260200160002061171d90919063ffffffff16565b905092915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b611030816115bb565b600754820361106b576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816007819055507f6d3d82f4a368310fc477262ac1c98c96cf147c62b219e94a4acf691400922905826040516110a19190612162565b60405180910390a15050565b6000801b81565b60075481565b60085481565b60095481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6110fa611f3e565b6040518060c00160405280600654815260200160085481526020016007548152602001600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016005548152602001600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250905090565b60055481565b6111b2611f3e565b6111bb82610ac5565b506111c46110f2565b9050919050565b60006111e860016000848152602001908152602001600020611737565b9050919050565b6000801b6111fc816115bb565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611283576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f33837f672315b6cffcf11894714abfdec631a913c18d7738fcaf40c444376fb660405160405180910390a25050565b61131482610961565b61131d816115bb565b6113278383611619565b505050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b600b6020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16905082565b6000801b61139b816115bb565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a900460ff1615611422576040517f56b89dcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61142c838361174c565b505050565b61143b8282610fb9565b61150d57600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506114b2611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000611539836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6118f2565b905092915050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806115b457506115b382611962565b5b9050919050565b6115cc816115c7611611565b6119cc565b50565b600081600001549050919050565b6115e78282611431565b61160c816001600085815260200190815260200160002061151190919063ffffffff16565b505050565b600033905090565b6116238282611a51565b6116488160016000858152602001908152602001600020611b3290919063ffffffff16565b505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f990612768565b60405180910390fd5b919050565b6001816000016000828254019250508190555050565b600061172c8360000183611b62565b60001c905092915050565b600061174582600001611b8d565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156117ad5750600060038111156117985761179761247e565b5b8160038111156117ab576117aa61247e565b5b145b156117e4576040517fa1e9dd9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405180604001604052808260038111156118025761180161247e565b5b815260200160011515815250600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360038111156118785761187761247e565b5b021790555060208201518160000160016101000a81548160ff0219169083151502179055509050508173ffffffffffffffffffffffffffffffffffffffff167fbe433982945125798dc0fb45d2aedb711f3461ff28984baab1334b3bce20d5e8826040516118e69190612701565b60405180910390a25050565b60006118fe8383611b9e565b61195757826000018290806001815401808255809150506001900390600052602060002001600090919091909150558260000180549050836001016000848152602001908152602001600020819055506001905061195c565b600090505b92915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6119d68282610fb9565b611a4d576119e381611bc1565b6119f18360001c6020611bee565b604051602001611a02929190612891565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a449190612904565b60405180910390fd5b5050565b611a5b8282610fb9565b15611b2e57600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611ad3611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000611b5a836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e2a565b905092915050565b6000826000018281548110611b7a57611b79612926565b5b9060005260206000200154905092915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b6060611be78273ffffffffffffffffffffffffffffffffffffffff16601460ff16611bee565b9050919050565b606060006002836002611c019190612984565b611c0b91906129c6565b67ffffffffffffffff811115611c2457611c236129fa565b5b6040519080825280601f01601f191660200182016040528015611c565781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611c8e57611c8d612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611cf257611cf1612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002611d329190612984565b611d3c91906129c6565b90505b6001811115611ddc577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110611d7e57611d7d612926565b5b1a60f81b828281518110611d9557611d94612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080611dd590612a29565b9050611d3f565b5060008414611e20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1790612a9e565b60405180910390fd5b8091505092915050565b60008083600101600084815260200190815260200160002054905060008114611f32576000600182611e5c9190612abe565b9050600060018660000180549050611e749190612abe565b9050818114611ee3576000866000018281548110611e9557611e94612926565b5b9060005260206000200154905080876000018481548110611eb957611eb8612926565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611ef757611ef6612af2565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611f38565b60009150505b92915050565b6040518060c00160405280600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611fdf81611faa565b8114611fea57600080fd5b50565b600081359050611ffc81611fd6565b92915050565b60006020828403121561201857612017611fa0565b5b600061202684828501611fed565b91505092915050565b60008115159050919050565b6120448161202f565b82525050565b600060208201905061205f600083018461203b565b92915050565b6000819050919050565b61207881612065565b811461208357600080fd5b50565b6000813590506120958161206f565b92915050565b6000602082840312156120b1576120b0611fa0565b5b60006120bf84828501612086565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006120f3826120c8565b9050919050565b612103816120e8565b811461210e57600080fd5b50565b600081359050612120816120fa565b92915050565b60006020828403121561213c5761213b611fa0565b5b600061214a84828501612111565b91505092915050565b61215c81612065565b82525050565b60006020820190506121776000830184612153565b92915050565b6000819050919050565b6121908161217d565b811461219b57600080fd5b50565b6000813590506121ad81612187565b92915050565b6000602082840312156121c9576121c8611fa0565b5b60006121d78482850161219e565b91505092915050565b6121e98161217d565b82525050565b600060208201905061220460008301846121e0565b92915050565b600060408201905061221f6000830185612153565b61222c6020830184612153565b9392505050565b6000806040838503121561224a57612249611fa0565b5b60006122588582860161219e565b925050602061226985828601612111565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f84011261229857612297612273565b5b8235905067ffffffffffffffff8111156122b5576122b4612278565b5b6020830191508360018202830111156122d1576122d061227d565b5b9250929050565b6000806000806000608086880312156122f4576122f3611fa0565b5b600061230288828901612111565b955050602061231388828901612111565b945050604086013567ffffffffffffffff81111561233457612333611fa5565b5b61234088828901612282565b9350935050606061235388828901612111565b9150509295509295909350565b612369816120e8565b82525050565b60006020820190506123846000830184612360565b92915050565b600080604083850312156123a1576123a0611fa0565b5b60006123af8582860161219e565b92505060206123c085828601612086565b9150509250929050565b6123d381612065565b82525050565b6123e2816120e8565b82525050565b60c0820160008201516123fe60008501826123ca565b50602082015161241160208501826123ca565b50604082015161242460408501826123ca565b50606082015161243760608501826123d9565b50608082015161244a60808501826123ca565b5060a082015161245d60a08501826123d9565b50505050565b600060c08201905061247860008301846123e8565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600481106124be576124bd61247e565b5b50565b60008190506124cf826124ad565b919050565b60006124df826124c1565b9050919050565b6124ef816124d4565b82525050565b600060408201905061250a60008301856124e6565b612517602083018461203b565b9392505050565b6004811061252b57600080fd5b50565b60008135905061253d8161251e565b92915050565b6000806040838503121561255a57612559611fa0565b5b600061256885828601612111565b92505060206125798582860161252e565b9150509250929050565b600082825260208201905092915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b60006125f0602f83612583565b91506125fb82612594565b604082019050919050565b6000602082019050818103600083015261261f816125e3565b9050919050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006126528385612583565b935061265f838584612626565b61266883612635565b840190509392505050565b60006080820190506126886000830188612360565b6126956020830187612360565b81810360408301526126a8818587612646565b90506126b76060830184612360565b9695505050505050565b60006060820190506126d66000830187612153565b81810360208301526126e9818587612646565b90506126f86040830184612360565b95945050505050565b600060208201905061271660008301846124e6565b92915050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b6000612752601683612583565b915061275d8261271c565b602082019050919050565b6000602082019050818103600083015261278181612745565b9050919050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b60006127c9601783612788565b91506127d482612793565b601782019050919050565b600081519050919050565b60005b838110156128085780820151818401526020810190506127ed565b60008484015250505050565b600061281f826127df565b6128298185612788565b93506128398185602086016127ea565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061287b601183612788565b915061288682612845565b601182019050919050565b600061289c826127bc565b91506128a88285612814565b91506128b38261286e565b91506128bf8284612814565b91508190509392505050565b60006128d6826127df565b6128e08185612583565b93506128f08185602086016127ea565b6128f981612635565b840191505092915050565b6000602082019050818103600083015261291e81846128cb565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061298f82612065565b915061299a83612065565b92508282026129a881612065565b915082820484148315176129bf576129be612955565b5b5092915050565b60006129d182612065565b91506129dc83612065565b92508282019050808211156129f4576129f3612955565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000612a3482612065565b915060008203612a4757612a46612955565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000612a88602083612583565b9150612a9382612a52565b602082019050919050565b60006020820190508181036000830152612ab781612a7b565b9050919050565b6000612ac982612065565b9150612ad483612065565b9250828203905081811115612aec57612aeb612955565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212203ce6affe32251169dd3c6370bc016e3b4e4e67ae8958ea21ee9c01a659788dcb64736f6c6343000812003360c06040523480156200001157600080fd5b5060016002819055506200002a6200009960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505060805173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050620000a1565b600033905090565b60805160a051615f9c620000ff60003960008181610c0301528181610ce60152818161195b015281816121c9015281816127260152818161285d01528181612bf90152612f930152600081816108770152610ad50152615f9c6000f3fe6080604052600436106101f95760003560e01c80636d2401c81161010d578063bd464115116100a0578063cb3a6b2c1161006f578063cb3a6b2c14610750578063d547741f1461078d578063dc63f6ae146107b6578063f23a6e61146107df578063f75166fc1461081c576101f9565b8063bd464115146106aa578063c2986b0e146106d3578063c7395be2146106fc578063ca15c87314610713576101f9565b8063a217fddf116100dc578063a217fddf146105da578063af06216f14610605578063bb19b4d314610630578063bc197c811461066d576101f9565b80636d2401c8146104f85780639010d07c1461052357806391d148541461056057806393e6c4361461059d576101f9565b8063248a9ca3116101905780634517863d1161015f5780634517863d14610443578063564cd00b1461046e57806359416e0e1461049757806361f43848146104c057806364cde8d2146104dc576101f9565b8063248a9ca3146103885780632f2ff15d146103c557806336568abe146103ee5780633dd781de14610417576101f9565b8063150b7a02116101cc578063150b7a02146102ca57806316ecfdf0146103075780631b8ec5d714610332578063222e9e821461035d576101f9565b806301ffc9a7146101fe57806309c26fb11461023b5780630be4d2b814610264578063147e7e661461028d575b600080fd5b34801561020a57600080fd5b50610225600480360381019061022091906141a4565b610845565b60405161023291906141ec565b60405180910390f35b34801561024757600080fd5b50610262600480360381019061025d91906142ca565b610857565b005b34801561027057600080fd5b5061028b60048036038101906102869190614352565b6109e3565b005b34801561029957600080fd5b506102b460048036038101906102af919061439f565b610a7b565b6040516102c191906143e5565b60405180910390f35b3480156102d657600080fd5b506102f160048036038101906102ec919061456d565b610a93565b6040516102fe91906145ff565b60405180910390f35b34801561031357600080fd5b5061031c610aa7565b60405161032991906143e5565b60405180910390f35b34801561033e57600080fd5b50610347610aad565b6040516103549190614629565b60405180910390f35b34801561036957600080fd5b50610372610ad3565b60405161037f9190614629565b60405180910390f35b34801561039457600080fd5b506103af60048036038101906103aa919061467a565b610af7565b6040516103bc91906146b6565b60405180910390f35b3480156103d157600080fd5b506103ec60048036038101906103e791906146d1565b610b16565b005b3480156103fa57600080fd5b50610415600480360381019061041091906146d1565b610b37565b005b34801561042357600080fd5b5061042c610bba565b60405161043a929190614711565b60405180910390f35b34801561044f57600080fd5b50610458610cb6565b60405161046591906146b6565b60405180910390f35b34801561047a57600080fd5b5061049560048036038101906104909190614790565b610cda565b005b3480156104a357600080fd5b506104be60048036038101906104b99190614846565b6116ab565b005b6104da60048036038101906104d591906148db565b611938565b005b6104f660048036038101906104f19190614908565b611ca7565b005b34801561050457600080fd5b5061050d611fce565b60405161051a91906149c7565b60405180910390f35b34801561052f57600080fd5b5061054a600480360381019061054591906149e9565b61205c565b6040516105579190614629565b60405180910390f35b34801561056c57600080fd5b50610587600480360381019061058291906146d1565b61208b565b60405161059491906141ec565b60405180910390f35b3480156105a957600080fd5b506105c460048036038101906105bf919061439f565b6120f5565b6040516105d191906143e5565b60405180910390f35b3480156105e657600080fd5b506105ef61210d565b6040516105fc91906146b6565b60405180910390f35b34801561061157600080fd5b5061061a612114565b60405161062791906141ec565b60405180910390f35b34801561063c57600080fd5b506106576004803603810190610652919061467a565b612172565b60405161066491906141ec565b60405180910390f35b34801561067957600080fd5b50610694600480360381019061068f9190614aec565b612192565b6040516106a191906145ff565b60405180910390f35b3480156106b657600080fd5b506106d160048036038101906106cc9190614846565b6121a7565b005b3480156106df57600080fd5b506106fa60048036038101906106f59190614908565b6124ce565b005b34801561070857600080fd5b50610711612662565b005b34801561071f57600080fd5b5061073a6004803603810190610735919061467a565b6126b2565b60405161074791906143e5565b60405180910390f35b34801561075c57600080fd5b5061077760048036038101906107729190614bbb565b6126d6565b60405161078491906143e5565b60405180910390f35b34801561079957600080fd5b506107b460048036038101906107af91906146d1565b6126fb565b005b3480156107c257600080fd5b506107dd60048036038101906107d89190614bfb565b61271c565b005b3480156107eb57600080fd5b5061080660048036038101906108019190614cb7565b612b62565b60405161081391906145ff565b60405180910390f35b34801561082857600080fd5b50610843600480360381019061083e9190614908565b612b77565b005b600061085082612de7565b9050919050565b61085f612e61565b73ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161415806108c55750600360009054906101000a900460ff165b156108fc576040517fee90c46800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109096000801b86612e69565b6109337f184bcf7a4c0de7fb994ea3d6b639bfcbf8e00735a8168c18466903113c39a4b685612e69565b61098083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612e77565b80600360016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600360006101000a81548160ff0219169083151502179055505050505050565b6000801b6109f081612ec5565b610a3d83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612e77565b7f121f741ddf8ba42be07a0e28c2017398f83e3766e2f4bfa9ea925307c0c5d1378383604051610a6e929190614d7b565b60405180910390a1505050565b60076020528060005260406000206000915090505481565b600063150b7a0260e01b9050949350505050565b60065481565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000838152602001908152602001600020600101549050919050565b610b1f82610af7565b610b2881612ec5565b610b328383612ed9565b505050565b610b3f612e61565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba390614e11565b60405180910390fd5b610bb68282612f0d565b5050565b6000806000600654905060008103610bfe576040517fbb6aa2ee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632a53ff5f6040518163ffffffff1660e01b81526004016040805180830381865afa158015610c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8f9190614e46565b915091508183610c9f9190614eb5565b94508085610cad9190614eb5565b93505050509091565b7f184bcf7a4c0de7fb994ea3d6b639bfcbf8e00735a8168c18466903113c39a4b681565b610ce2612f41565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c4c04534610d28612e61565b6040518263ffffffff1660e01b8152600401610d449190614629565b60c0604051808303816000875af1158015610d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d879190614fa3565b905060005b8484905081101561169c576000858583818110610dac57610dab614fd0565b5b905060e00201803603810190610dc291906150b3565b9050600460008260a00151815260200190815260200160002060009054906101000a900460ff1615610e20576040517fc41a375100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060a001518160c0015130604051602001610e3c929190615149565b6040516020818303038152906040528051906020012014610e89576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000816000015190506000610e9d82612f8e565b90506001600460008560a00151815260200190815260200160002060006101000a81548160ff021916908315150217905550600083608001518460600151610ee59190614eb5565b9050610ef08161306f565b610ef8614116565b6000806000806003811115610f1057610f0f615175565b5b866003811115610f2357610f22615175565b5b1480610f53575060016003811115610f3e57610f3d615175565b5b866003811115610f5157610f50615175565b5b145b15610f7f57610f6b8a89606001518a608001516130ac565b8094508195508296505050508690506110e6565b60026003811115610f9357610f92615175565b5b866003811115610fa657610fa5615175565b5b1480610fd55750600380811115610fc057610fbf615175565b5b866003811115610fd357610fd2615175565b5b145b156110b357610fe38a6131f6565b935087606001519250876080015191508960a0015190508360026003811061100e5761100d614fd0565b5b60200201518460016003811061102757611026614fd0565b5b6020020151856000600381106110405761103f614fd0565b5b602002015161104f9190614eb5565b6110599190614eb5565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110a791906151a4565b925050819055506110e5565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b84600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461113591906151a4565b92505081905550836000600381106111505761114f614fd0565b5b6020020151600860008c6060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111e49190614eb5565b92505081905550836001600381106111ff576111fe614fd0565b5b602002015160086000600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b19190614eb5565b92505081905550836002600381106112cc576112cb614fd0565b5b6020020151600860008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461135c9190614eb5565b9250508190555082600860008a6020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546113f39190614eb5565b9250508190555081600860008a6040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461148a9190614eb5565b925050819055508673ffffffffffffffffffffffffffffffffffffffff167f68509a400b7cc402898b7aacefe7cf662539f64e5a79d4234c58734256b5e224866040518060a001604052808e6060015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018c6020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018c6040015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152506040518060a001604052808960006003811061161a57611619614fd0565b5b602002015181526020018960016003811061163857611637614fd0565b5b602002015181526020018960026003811061165657611655614fd0565b5b60200201518152602001888152602001878152508c60a0015160405161167f949392919061532e565b60405180910390a288806001019950505050505050505050610d8c565b50506116a661327e565b505050565b6000801b6116b881612ec5565b6116c0612f41565b60006116cb87612f8e565b9050600260038111156116e1576116e0615175565b5b8160038111156116f4576116f3615175565b5b036117cc57600086869050905061170a8161306f565b80600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117599190614eb5565b925050819055506117748861176c612e61565b308a8a613288565b8773ffffffffffffffffffffffffffffffffffffffff167fd6d003c3b12171676fc9412009c65e678368ee9deedce21d9efe7c9d9d34a1c18289896040516117be939291906153f0565b60405180910390a250611927565b6003808111156117df576117de615175565b5b8160038111156117f2576117f1615175565b5b036118f45760006118038585613333565b905061180e8161306f565b80600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461185d9190614eb5565b9250508190555061187a88611870612e61565b308a8a8a8a613381565b8773ffffffffffffffffffffffffffffffffffffffff16611899612e61565b73ffffffffffffffffffffffffffffffffffffffff167f4f7bc006fa3e8a3fde1c087dfff50e0cda2cc7791fa6343ee9f4c395e3da0d37838a8a8a8a6040516118e6959493929190615422565b60405180910390a350611926565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b5061193061327e565b505050505050565b6000801b61194581612ec5565b61194d612f41565b816119578161306f565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b013ab386040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e8919061546b565b905060008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611a6057843414611a58576040517f26ea953d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b849050611bd6565b6000341115611a9b576040517f26ea953d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611ad69190614629565b602060405180830381865afa158015611af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b179190615498565b9050611b4d611b24612e61565b30888673ffffffffffffffffffffffffffffffffffffffff166133ff909392919063ffffffff16565b808373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611b879190614629565b602060405180830381865afa158015611ba4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc89190615498565b611bd291906151a4565b9150505b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c259190614eb5565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16611c4b612e61565b73ffffffffffffffffffffffffffffffffffffffff167f85dd53a04234402c5e629c4ab3051ff7aa3d103e7d22804a9713094c50e6ca9283604051611c9091906143e5565b60405180910390a3505050611ca361327e565b5050565b6000801b611cb481612ec5565b611cbc612f41565b81611cc68161306f565b6000611cd185612f8e565b90506000806003811115611ce857611ce7615175565b5b826003811115611cfb57611cfa615175565b5b03611d4157843414611d39576040517f26ea953d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b849050611f1a565b60016003811115611d5557611d54615175565b5b826003811115611d6857611d67615175565b5b03611ee7576000341115611da8576040517f26ea953d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611de39190614629565b602060405180830381865afa158015611e00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e249190615498565b9050611e5a611e31612e61565b30888a73ffffffffffffffffffffffffffffffffffffffff166133ff909392919063ffffffff16565b808773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611e949190614629565b602060405180830381865afa158015611eb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed59190615498565b611edf91906151a4565b915050611f19565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b80600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f699190614eb5565b925050819055508573ffffffffffffffffffffffffffffffffffffffff167f78cae0ecd388607ec2d56e9b6f673cd0a042c8407cdfc7b578e9707223ee64b282604051611fb691906143e5565b60405180910390a2505050611fc961327e565b505050565b60058054611fdb906154f4565b80601f0160208091040260200160405190810160405280929190818152602001828054612007906154f4565b80156120545780601f1061202957610100808354040283529160200191612054565b820191906000526020600020905b81548152906001019060200180831161203757829003601f168201915b505050505081565b6000612083826001600086815260200190815260200160002061348890919063ffffffff16565b905092915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60096020528060005260406000206000915090505481565b6000801b81565b6000806000612121610bba565b915091508142108061213257508042115b15612169576040517fbd95a86000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60019250505090565b60046020528060005260406000206000915054906101000a900460ff1681565b600063bc197c8160e01b905095945050505050565b6000801b6121b481612ec5565b6121bc612f41565b6121c4612114565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f2e2e2aa886040518263ffffffff1660e01b81526004016122209190614629565b6040805180830381865afa15801561223c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122609190615576565b5090506002600381111561227757612276615175565b5b81600381111561228a57612289615175565b5b036123625760008686905090506122a08161306f565b80600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546122ef91906151a4565b9250508190555061230a8830612303612e61565b8a8a613288565b8773ffffffffffffffffffffffffffffffffffffffff167f9345f22c71af54e80c416040732be09908da822fef94e166af33535f824c51c7828989604051612354939291906153f0565b60405180910390a2506124bd565b60038081111561237557612374615175565b5b81600381111561238857612387615175565b5b0361248a5760006123998585613333565b90506123a48161306f565b80600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123f391906151a4565b925050819055506124108830612407612e61565b8a8a8a8a613381565b8773ffffffffffffffffffffffffffffffffffffffff1661242f612e61565b73ffffffffffffffffffffffffffffffffffffffff167f0dc54c2a40ababb385f82389a070a55b00cd3fae93fc5b1916924ade1633503b838a8a8a8a60405161247c959493929190615422565b60405180910390a3506124bc565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b506124c661327e565b505050505050565b6000801b6124db81612ec5565b6124e3612f41565b6124eb612114565b50816124f68161306f565b82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461254591906151a4565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036125b5576125b08361258c612e61565b73ffffffffffffffffffffffffffffffffffffffff166134a290919063ffffffff16565b6125e8565b6125e76125c0612e61565b848673ffffffffffffffffffffffffffffffffffffffff166135969092919063ffffffff16565b5b8373ffffffffffffffffffffffffffffffffffffffff16612607612e61565b73ffffffffffffffffffffffffffffffffffffffff167ff57fb8b8dfa150e93ac811898e14550baf3452656f9d4e8058a5c24efa9ecaad8560405161264c91906143e5565b60405180910390a35061265d61327e565b505050565b6000801b61266f81612ec5565b426006819055507f01909d53c76ffada2e8f99e82b9afa64e37cfe2bc2c1fa7ba5959fc62e4baa7f6006546040516126a791906143e5565b60405180910390a150565b60006126cf6001600084815260200190815260200160002061361c565b9050919050565b6008602052816000526040600020602052806000526040600020600091509150505481565b61270482610af7565b61270d81612ec5565b6127178383612f0d565b505050565b612724612f41565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635026c826612768612e61565b6040518263ffffffff1660e01b81526004016127849190614629565b602060405180830381865afa1580156127a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c591906155b6565b5084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461285291906151a4565b9250508190555060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f2e2e2aa896040518263ffffffff1660e01b81526004016128b49190614629565b6040805180830381865afa1580156128d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f49190615576565b5090506000600381111561290b5761290a615175565b5b81600381111561291e5761291d615175565b5b036129515761294c868873ffffffffffffffffffffffffffffffffffffffff166134a290919063ffffffff16565b612ae3565b6001600381111561296557612964615175565b5b81600381111561297857612977615175565b5b036129ad576129a887878a73ffffffffffffffffffffffffffffffffffffffff166135969092919063ffffffff16565b612ae2565b600260038111156129c1576129c0615175565b5b8160038111156129d4576129d3615175565b5b03612a2d576000858590509050808714612a1a576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612a2789308a8989613288565b50612ae1565b600380811115612a4057612a3f615175565b5b816003811115612a5357612a52615175565b5b03612aae57612a628383613333565b8614612a9a576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612aa988308988888888613381565b612ae0565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b5b5b8773ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f0c3f6188054cfad2267b81cfd4ec43dcf3245a8b92e59cc44d6b4e85a58672648888888888604051612b48959493929190615422565b60405180910390a350612b5961327e565b50505050505050565b600063f23a6e6160e01b905095945050505050565b6000801b612b8481612ec5565b612b8c612f41565b612b94612114565b5081612b9f8161306f565b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612bee91906151a4565b9250508190555060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f2e2e2aa866040518263ffffffff1660e01b8152600401612c509190614629565b6040805180830381865afa158015612c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c909190615576565b50905060006003811115612ca757612ca6615175565b5b816003811115612cba57612cb9615175565b5b03612cf457612cef84612ccb612e61565b73ffffffffffffffffffffffffffffffffffffffff166134a290919063ffffffff16565b612d8a565b60016003811115612d0857612d07615175565b5b816003811115612d1b57612d1a615175565b5b03612d5757612d52612d2b612e61565b858773ffffffffffffffffffffffffffffffffffffffff166135969092919063ffffffff16565b612d89565b6040517ff599342800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b8473ffffffffffffffffffffffffffffffffffffffff167f2bde45b775c7b186ca5991ba05250885d44cad19752d5e84f715be315dc60ad085604051612dd091906143e5565b60405180910390a25050612de261327e565b505050565b60007f4e2312e0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612e5a5750612e5982613631565b5b9050919050565b600033905090565b612e738282612ed9565b5050565b6000815103612eb2576040517fd07b00d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060059081612ec1919061578f565b5050565b612ed681612ed1612e61565b6136ab565b50565b612ee38282613730565b612f08816001600085815260200190815260200160002061381090919063ffffffff16565b505050565b612f178282613840565b612f3c816001600085815260200190815260200160002061392190919063ffffffff16565b505050565b6002805403612f85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f7c906158ad565b60405180910390fd5b60028081905550565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f2e2e2aa846040518263ffffffff1660e01b8152600401612fea9190614629565b6040805180830381865afa158015613006573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061302a9190615576565b809250819350505080613069576040517f3aca788a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b600081036130a9576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6130b4614116565b600080600084866130c59190614eb5565b90506000818760646130d791906158cd565b6130e1919061593e565b90506040518060600160405280612710848b6000015161310191906158cd565b61310b919061593e565b8152602001612710848b6040015161312391906158cd565b61312d919061593e565b8152602001612710848b6020015161314591906158cd565b61314f919061593e565b815250945060008560026003811061316a57613169614fd0565b5b60200201518660016003811061318357613182614fd0565b5b60200201518760006003811061319c5761319b614fd0565b5b6020020151856131ac91906151a4565b6131b691906151a4565b6131c091906151a4565b9050606482826131d091906158cd565b6131da919061593e565b945084816131e891906151a4565b935050505093509350939050565b6131fe614116565b600082608001519050604051806060016040528061271083866000015161322591906158cd565b61322f919061593e565b815260200161271083866040015161324791906158cd565b613251919061593e565b815260200161271083866020015161326991906158cd565b613273919061593e565b815250915050919050565b6001600281905550565b60005b8282905081101561332b578573ffffffffffffffffffffffffffffffffffffffff166342842e0e86868686868181106132c7576132c6614fd0565b5b905060200201356040518463ffffffff1660e01b81526004016132ec9392919061596f565b600060405180830381600087803b15801561330657600080fd5b505af115801561331a573d6000803e3d6000fd5b50505050808060010191505061328b565b505050505050565b600080600090505b8383905081101561337a5783838281811061335957613358614fd0565b5b905060200201358261336b9190614eb5565b9150808060010191505061333b565b5092915050565b8673ffffffffffffffffffffffffffffffffffffffff16632eb2c2d68787878787876040518763ffffffff1660e01b81526004016133c4969594939291906159dd565b600060405180830381600087803b1580156133de57600080fd5b505af11580156133f2573d6000803e3d6000fd5b5050505050505050505050565b613482846323b872dd60e01b8585856040516024016134209392919061596f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613951565b50505050565b60006134978360000183613a19565b60001c905092915050565b804710156134e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134dc90615a93565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405161350b90615ae1565b60006040518083038185875af1925050503d8060008114613548576040519150601f19603f3d011682016040523d82523d6000602084013e61354d565b606091505b5050905080613591576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161358890615b68565b60405180910390fd5b505050565b6136178363a9059cbb60e01b84846040516024016135b5929190615b88565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613951565b505050565b600061362a82600001613a44565b9050919050565b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806136a457506136a382613a55565b5b9050919050565b6136b5828261208b565b61372c576136c281613acf565b6136d08360001c6020613afc565b6040516020016136e1929190615c85565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161372391906149c7565b60405180910390fd5b5050565b61373a828261208b565b61380c57600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506137b1612e61565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000613838836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613d38565b905092915050565b61384a828261208b565b1561391d57600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506138c2612e61565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000613949836000018373ffffffffffffffffffffffffffffffffffffffff1660001b613da8565b905092915050565b60006139b3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613ebc9092919063ffffffff16565b90506000815114806139d55750808060200190518101906139d491906155b6565b5b613a14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a0b90615d31565b60405180910390fd5b505050565b6000826000018281548110613a3157613a30614fd0565b5b9060005260206000200154905092915050565b600081600001805490509050919050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480613ac85750613ac782613ed4565b5b9050919050565b6060613af58273ffffffffffffffffffffffffffffffffffffffff16601460ff16613afc565b9050919050565b606060006002836002613b0f91906158cd565b613b199190614eb5565b67ffffffffffffffff811115613b3257613b31614442565b5b6040519080825280601f01601f191660200182016040528015613b645781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613b9c57613b9b614fd0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613c0057613bff614fd0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002613c4091906158cd565b613c4a9190614eb5565b90505b6001811115613cea577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110613c8c57613c8b614fd0565b5b1a60f81b828281518110613ca357613ca2614fd0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080613ce390615d51565b9050613c4d565b5060008414613d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d2590615dc6565b60405180910390fd5b8091505092915050565b6000613d448383613f3e565b613d9d578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613da2565b600090505b92915050565b60008083600101600084815260200190815260200160002054905060008114613eb0576000600182613dda91906151a4565b9050600060018660000180549050613df291906151a4565b9050818114613e61576000866000018281548110613e1357613e12614fd0565b5b9060005260206000200154905080876000018481548110613e3757613e36614fd0565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480613e7557613e74615de6565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050613eb6565b60009150505b92915050565b6060613ecb8484600085613f61565b90509392505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600080836001016000848152602001908152602001600020541415905092915050565b606082471015613fa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f9d90615e87565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613fcf9190615ee3565b60006040518083038185875af1925050503d806000811461400c576040519150601f19603f3d011682016040523d82523d6000602084013e614011565b606091505b50915091506140228783838761402e565b92505050949350505050565b6060831561409057600083510361408857614048856140a3565b614087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161407e90615f46565b60405180910390fd5b5b82905061409b565b61409a83836140c6565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156140d95781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161410d91906149c7565b60405180910390fd5b6040518060600160405280600390602082028036833780820191505090505090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6141818161414c565b811461418c57600080fd5b50565b60008135905061419e81614178565b92915050565b6000602082840312156141ba576141b9614142565b5b60006141c88482850161418f565b91505092915050565b60008115159050919050565b6141e6816141d1565b82525050565b600060208201905061420160008301846141dd565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061423282614207565b9050919050565b61424281614227565b811461424d57600080fd5b50565b60008135905061425f81614239565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261428a57614289614265565b5b8235905067ffffffffffffffff8111156142a7576142a661426a565b5b6020830191508360018202830111156142c3576142c261426f565b5b9250929050565b6000806000806000608086880312156142e6576142e5614142565b5b60006142f488828901614250565b955050602061430588828901614250565b945050604086013567ffffffffffffffff81111561432657614325614147565b5b61433288828901614274565b9350935050606061434588828901614250565b9150509295509295909350565b6000806020838503121561436957614368614142565b5b600083013567ffffffffffffffff81111561438757614386614147565b5b61439385828601614274565b92509250509250929050565b6000602082840312156143b5576143b4614142565b5b60006143c384828501614250565b91505092915050565b6000819050919050565b6143df816143cc565b82525050565b60006020820190506143fa60008301846143d6565b92915050565b614409816143cc565b811461441457600080fd5b50565b60008135905061442681614400565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61447a82614431565b810181811067ffffffffffffffff8211171561449957614498614442565b5b80604052505050565b60006144ac614138565b90506144b88282614471565b919050565b600067ffffffffffffffff8211156144d8576144d7614442565b5b6144e182614431565b9050602081019050919050565b82818337600083830152505050565b600061451061450b846144bd565b6144a2565b90508281526020810184848401111561452c5761452b61442c565b5b6145378482856144ee565b509392505050565b600082601f83011261455457614553614265565b5b81356145648482602086016144fd565b91505092915050565b6000806000806080858703121561458757614586614142565b5b600061459587828801614250565b94505060206145a687828801614250565b93505060406145b787828801614417565b925050606085013567ffffffffffffffff8111156145d8576145d7614147565b5b6145e48782880161453f565b91505092959194509250565b6145f98161414c565b82525050565b600060208201905061461460008301846145f0565b92915050565b61462381614227565b82525050565b600060208201905061463e600083018461461a565b92915050565b6000819050919050565b61465781614644565b811461466257600080fd5b50565b6000813590506146748161464e565b92915050565b6000602082840312156146905761468f614142565b5b600061469e84828501614665565b91505092915050565b6146b081614644565b82525050565b60006020820190506146cb60008301846146a7565b92915050565b600080604083850312156146e8576146e7614142565b5b60006146f685828601614665565b925050602061470785828601614250565b9150509250929050565b600060408201905061472660008301856143d6565b61473360208301846143d6565b9392505050565b60008083601f8401126147505761474f614265565b5b8235905067ffffffffffffffff81111561476d5761476c61426a565b5b6020830191508360e08202830111156147895761478861426f565b5b9250929050565b6000806000604084860312156147a9576147a8614142565b5b600084013567ffffffffffffffff8111156147c7576147c6614147565b5b6147d38682870161473a565b935093505060206147e686828701614250565b9150509250925092565b60008083601f84011261480657614805614265565b5b8235905067ffffffffffffffff8111156148235761482261426a565b5b60208301915083602082028301111561483f5761483e61426f565b5b9250929050565b60008060008060006060868803121561486257614861614142565b5b600061487088828901614250565b955050602086013567ffffffffffffffff81111561489157614890614147565b5b61489d888289016147f0565b9450945050604086013567ffffffffffffffff8111156148c0576148bf614147565b5b6148cc888289016147f0565b92509250509295509295909350565b6000602082840312156148f1576148f0614142565b5b60006148ff84828501614417565b91505092915050565b6000806040838503121561491f5761491e614142565b5b600061492d85828601614250565b925050602061493e85828601614417565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b83811015614982578082015181840152602081019050614967565b60008484015250505050565b600061499982614948565b6149a38185614953565b93506149b3818560208601614964565b6149bc81614431565b840191505092915050565b600060208201905081810360008301526149e1818461498e565b905092915050565b60008060408385031215614a00576149ff614142565b5b6000614a0e85828601614665565b9250506020614a1f85828601614417565b9150509250929050565b600067ffffffffffffffff821115614a4457614a43614442565b5b602082029050602081019050919050565b6000614a68614a6384614a29565b6144a2565b90508083825260208201905060208402830185811115614a8b57614a8a61426f565b5b835b81811015614ab45780614aa08882614417565b845260208401935050602081019050614a8d565b5050509392505050565b600082601f830112614ad357614ad2614265565b5b8135614ae3848260208601614a55565b91505092915050565b600080600080600060a08688031215614b0857614b07614142565b5b6000614b1688828901614250565b9550506020614b2788828901614250565b945050604086013567ffffffffffffffff811115614b4857614b47614147565b5b614b5488828901614abe565b935050606086013567ffffffffffffffff811115614b7557614b74614147565b5b614b8188828901614abe565b925050608086013567ffffffffffffffff811115614ba257614ba1614147565b5b614bae8882890161453f565b9150509295509295909350565b60008060408385031215614bd257614bd1614142565b5b6000614be085828601614250565b9250506020614bf185828601614250565b9150509250929050565b600080600080600080600060a0888a031215614c1a57614c19614142565b5b6000614c288a828b01614250565b9750506020614c398a828b01614250565b9650506040614c4a8a828b01614417565b955050606088013567ffffffffffffffff811115614c6b57614c6a614147565b5b614c778a828b016147f0565b9450945050608088013567ffffffffffffffff811115614c9a57614c99614147565b5b614ca68a828b016147f0565b925092505092959891949750929550565b600080600080600060a08688031215614cd357614cd2614142565b5b6000614ce188828901614250565b9550506020614cf288828901614250565b9450506040614d0388828901614417565b9350506060614d1488828901614417565b925050608086013567ffffffffffffffff811115614d3557614d34614147565b5b614d418882890161453f565b9150509295509295909350565b6000614d5a8385614953565b9350614d678385846144ee565b614d7083614431565b840190509392505050565b60006020820190508181036000830152614d96818486614d4e565b90509392505050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b6000614dfb602f83614953565b9150614e0682614d9f565b604082019050919050565b60006020820190508181036000830152614e2a81614dee565b9050919050565b600081519050614e4081614400565b92915050565b60008060408385031215614e5d57614e5c614142565b5b6000614e6b85828601614e31565b9250506020614e7c85828601614e31565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614ec0826143cc565b9150614ecb836143cc565b9250828201905080821115614ee357614ee2614e86565b5b92915050565b600080fd5b600081519050614efd81614239565b92915050565b600060c08284031215614f1957614f18614ee9565b5b614f2360c06144a2565b90506000614f3384828501614e31565b6000830152506020614f4784828501614e31565b6020830152506040614f5b84828501614e31565b6040830152506060614f6f84828501614eee565b6060830152506080614f8384828501614e31565b60808301525060a0614f9784828501614eee565b60a08301525092915050565b600060c08284031215614fb957614fb8614142565b5b6000614fc784828501614f03565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060e0828403121561501557615014614ee9565b5b61501f60e06144a2565b9050600061502f84828501614250565b600083015250602061504384828501614250565b602083015250604061505784828501614250565b604083015250606061506b84828501614417565b606083015250608061507f84828501614417565b60808301525060a061509384828501614665565b60a08301525060c06150a784828501614665565b60c08301525092915050565b600060e082840312156150c9576150c8614142565b5b60006150d784828501614fff565b91505092915050565b6000819050919050565b6150fb6150f682614644565b6150e0565b82525050565b60008160601b9050919050565b600061511982615101565b9050919050565b600061512b8261510e565b9050919050565b61514361513e82614227565b615120565b82525050565b600061515582856150ea565b6020820191506151658284615132565b6014820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006151af826143cc565b91506151ba836143cc565b92508282039050818111156151d2576151d1614e86565b5b92915050565b600060059050919050565b600081905092915050565b6000819050919050565b61520181614227565b82525050565b600061521383836151f8565b60208301905092915050565b6000602082019050919050565b615235816151d8565b61523f81846151e3565b925061524a826151ee565b8060005b8381101561527b5781516152628782615207565b965061526d8361521f565b92505060018101905061524e565b505050505050565b600060059050919050565b600081905092915050565b6000819050919050565b6152ac816143cc565b82525050565b60006152be83836152a3565b60208301905092915050565b6000602082019050919050565b6152e081615283565b6152ea818461528e565b92506152f582615299565b8060005b8381101561532657815161530d87826152b2565b9650615318836152ca565b9250506001810190506152f9565b505050505050565b60006101808201905061534460008301876143d6565b615351602083018661522c565b61535e60c08301856152d7565b61536c6101608301846146a7565b95945050505050565b600082825260208201905092915050565b600080fd5b82818337505050565b60006153a08385615375565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156153d3576153d2615386565b5b6020830292506153e483858461538b565b82840190509392505050565b600060408201905061540560008301866143d6565b8181036020830152615418818486615394565b9050949350505050565b600060608201905061543760008301886143d6565b818103602083015261544a818688615394565b9050818103604083015261545f818486615394565b90509695505050505050565b60006020828403121561548157615480614142565b5b600061548f84828501614eee565b91505092915050565b6000602082840312156154ae576154ad614142565b5b60006154bc84828501614e31565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061550c57607f821691505b60208210810361551f5761551e6154c5565b5b50919050565b6004811061553257600080fd5b50565b60008151905061554481615525565b92915050565b615553816141d1565b811461555e57600080fd5b50565b6000815190506155708161554a565b92915050565b6000806040838503121561558d5761558c614142565b5b600061559b85828601615535565b92505060206155ac85828601615561565b9150509250929050565b6000602082840312156155cc576155cb614142565b5b60006155da84828501615561565b91505092915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026156457fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82615608565b61564f8683615608565b95508019841693508086168417925050509392505050565b6000819050919050565b600061568c615687615682846143cc565b615667565b6143cc565b9050919050565b6000819050919050565b6156a683615671565b6156ba6156b282615693565b848454615615565b825550505050565b600090565b6156cf6156c2565b6156da81848461569d565b505050565b5b818110156156fe576156f36000826156c7565b6001810190506156e0565b5050565b601f82111561574357615714816155e3565b61571d846155f8565b8101602085101561572c578190505b615740615738856155f8565b8301826156df565b50505b505050565b600082821c905092915050565b600061576660001984600802615748565b1980831691505092915050565b600061577f8383615755565b9150826002028217905092915050565b61579882614948565b67ffffffffffffffff8111156157b1576157b0614442565b5b6157bb82546154f4565b6157c6828285615702565b600060209050601f8311600181146157f957600084156157e7578287015190505b6157f18582615773565b865550615859565b601f198416615807866155e3565b60005b8281101561582f5784890151825560018201915060208501945060208101905061580a565b8683101561584c5784890151615848601f891682615755565b8355505b6001600288020188555050505b505050505050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000615897601f83614953565b91506158a282615861565b602082019050919050565b600060208201905081810360008301526158c68161588a565b9050919050565b60006158d8826143cc565b91506158e3836143cc565b92508282026158f1816143cc565b9150828204841483151761590857615907614e86565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615949826143cc565b9150615954836143cc565b9250826159645761596361590f565b5b828204905092915050565b6000606082019050615984600083018661461a565b615991602083018561461a565b61599e60408301846143d6565b949350505050565b600082825260208201905092915050565b50565b60006159c76000836159a6565b91506159d2826159b7565b600082019050919050565b600060a0820190506159f2600083018961461a565b6159ff602083018861461a565b8181036040830152615a12818688615394565b90508181036060830152615a27818486615394565b90508181036080830152615a3a816159ba565b9050979650505050505050565b7f416464726573733a20696e73756666696369656e742062616c616e6365000000600082015250565b6000615a7d601d83614953565b9150615a8882615a47565b602082019050919050565b60006020820190508181036000830152615aac81615a70565b9050919050565b600081905092915050565b6000615acb600083615ab3565b9150615ad6826159b7565b600082019050919050565b6000615aec82615abe565b9150819050919050565b7f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008201527f6563697069656e74206d61792068617665207265766572746564000000000000602082015250565b6000615b52603a83614953565b9150615b5d82615af6565b604082019050919050565b60006020820190508181036000830152615b8181615b45565b9050919050565b6000604082019050615b9d600083018561461a565b615baa60208301846143d6565b9392505050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b6000615bf2601783615bb1565b9150615bfd82615bbc565b601782019050919050565b6000615c1382614948565b615c1d8185615bb1565b9350615c2d818560208601614964565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b6000615c6f601183615bb1565b9150615c7a82615c39565b601182019050919050565b6000615c9082615be5565b9150615c9c8285615c08565b9150615ca782615c62565b9150615cb38284615c08565b91508190509392505050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615d1b602a83614953565b9150615d2682615cbf565b604082019050919050565b60006020820190508181036000830152615d4a81615d0e565b9050919050565b6000615d5c826143cc565b915060008203615d6f57615d6e614e86565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000615db0602083614953565b9150615dbb82615d7a565b602082019050919050565b60006020820190508181036000830152615ddf81615da3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615e71602683614953565b9150615e7c82615e15565b604082019050919050565b60006020820190508181036000830152615ea081615e64565b9050919050565b600081519050919050565b6000615ebd82615ea7565b615ec78185615ab3565b9350615ed7818560208601614964565b80840191505092915050565b6000615eef8284615eb2565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615f30601d83614953565b9150615f3b82615efa565b602082019050919050565b60006020820190508181036000830152615f5f81615f23565b905091905056fea264697066735822122099088fdc08c8f6153f4590456c186dd9a600e2479c80bc099989d43d1eb66dbf64736f6c63430008120033000000000000000000000000c38e3a10b5818601b29c83f195e8b5854aae45af0000000000000000000000009d8d9ee5e0fbf96491d7b3cf96bbe0630c959deb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000005555555555555555555555555555555555555555
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80639010d07c11610125578063b20feaaf116100ad578063cfca31471161007c578063cfca314714610603578063d547741f1461061f578063ec87621c1461063b578063f2e2e2aa14610659578063f88139101461068a57610211565b8063b20feaaf14610567578063c36a470814610585578063c4c04534146105a3578063ca15c873146105d357610211565b8063a221c64a116100f4578063a221c64a146104d1578063a5fd8edc146104ef578063aa405af91461050d578063b013ab381461052b578063b0e21e8a1461054957610211565b80639010d07c1461043757806391d148541461046757806399f8cbaf14610497578063a217fddf146104b357610211565b80632f7d5c66116101a85780635e73fd76116101775780635e73fd76146103a957806366fbf11b146103c5578063787dce3d146103e157806380cc90ed146103fd578063850a15011461041957610211565b80632f7d5c661461032357806336568abe1461033f57806339591b001461035b5780635026c8261461037957610211565b80631c91ecb6116101e45780631c91ecb61461029a578063248a9ca3146102b85780632a53ff5f146102e85780632f2ff15d1461030757610211565b806301ffc9a714610216578063059129471461024657806306bdd7d5146102625780631776a8271461027e575b600080fd5b610230600480360381019061022b9190612002565b6106a6565b60405161023d919061204a565b60405180910390f35b610260600480360381019061025b919061209b565b610720565b005b61027c6004803603810190610277919061209b565b6107aa565b005b61029860048036038101906102939190612126565b610840565b005b6102a2610950565b6040516102af9190612162565b60405180910390f35b6102d260048036038101906102cd91906121b3565b610961565b6040516102df91906121ef565b60405180910390f35b6102f0610980565b6040516102fe92919061220a565b60405180910390f35b610321600480360381019061031c9190612233565b610991565b005b61033d6004803603810190610338919061209b565b6109b2565b005b61035960048036038101906103549190612233565b610a3c565b005b610363610abf565b6040516103709190612162565b60405180910390f35b610393600480360381019061038e9190612126565b610ac5565b6040516103a0919061204a565b60405180910390f35b6103c360048036038101906103be91906122d8565b610b30565b005b6103df60048036038101906103da9190612126565b610d29565b005b6103fb60048036038101906103f6919061209b565b610e42565b005b6104176004803603810190610412919061209b565b610ecc565b005b610421610f64565b60405161042e919061236f565b60405180910390f35b610451600480360381019061044c919061238a565b610f8a565b60405161045e919061236f565b60405180910390f35b610481600480360381019061047c9190612233565b610fb9565b60405161048e919061204a565b60405180910390f35b6104b160048036038101906104ac919061209b565b611023565b005b6104bb6110ad565b6040516104c891906121ef565b60405180910390f35b6104d96110b4565b6040516104e69190612162565b60405180910390f35b6104f76110ba565b6040516105049190612162565b60405180910390f35b6105156110c0565b6040516105229190612162565b60405180910390f35b6105336110c6565b604051610540919061236f565b60405180910390f35b6105516110ec565b60405161055e9190612162565b60405180910390f35b61056f6110f2565b60405161057c9190612463565b60405180910390f35b61058d6111a4565b60405161059a9190612162565b60405180910390f35b6105bd60048036038101906105b89190612126565b6111aa565b6040516105ca9190612463565b60405180910390f35b6105ed60048036038101906105e891906121b3565b6111cb565b6040516105fa9190612162565b60405180910390f35b61061d60048036038101906106189190612126565b6111ef565b005b61063960048036038101906106349190612233565b61130b565b005b61064361132c565b60405161065091906121ef565b60405180910390f35b610673600480360381019061066e9190612126565b611350565b6040516106819291906124f5565b60405180910390f35b6106a4600480360381019061069f9190612543565b61138e565b005b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610719575061071882611541565b5b9050919050565b6000801b61072d816115bb565b6005548203610768576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816005819055507f7a25f4d39c7ef2d9ff33e6304584e4c9fb1532bc39972e2cd34b074c1e40e02b8260405161079e9190612162565b60405180910390a15050565b6000801b6107b7816115bb565b6009548214806107c75750600082145b156107fe576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816009819055507f87948cba23b87f534057161b507f18cd7f69576b88a81a74c55d8f29dfb06452826040516108349190612162565b60405180910390a15050565b6000801b61084d816115bb565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108d4576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f372b5e772b71a68b761c4ac03b59a6a2322bd34ac161ba7029a6a418fe89005182604051610944919061236f565b60405180910390a15050565b600061095c60026115cf565b905090565b6000806000838152602001908152602001600020600101549050919050565b600080600954600a54915091509091565b61099a82610961565b6109a3816115bb565b6109ad83836115dd565b505050565b6000801b6109bf816115bb565b60085482036109fa576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816008819055507f3a1dedaf5733100a92da764c2066bdc86b970e224ee473d515375645ce99a9d282604051610a309190612162565b60405180910390a15050565b610a44611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa890612606565b60405180910390fd5b610abb8282611619565b5050565b600a5481565b6000610af17f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0883610fb9565b610b27576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60019050919050565b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610b975750600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610bce5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15610c05576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610c307f000000000000000000000000cbf5a27a6c5e2794e0fdd0752984c955d9f81a1361164d565b90508073ffffffffffffffffffffffffffffffffffffffff166309c26fb187878787876040518663ffffffff1660e01b8152600401610c73959493929190612673565b600060405180830381600087803b158015610c8d57600080fd5b505af1158015610ca1573d6000803e3d6000fd5b50505050610caf6002611707565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f68828e0b01cfe3740f67270e157a30f161e6531d36cd5db5797ec0e32d1f6911610d06610950565b878787604051610d1994939291906126c1565b60405180910390a3505050505050565b6000801b610d36816115bb565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160019054906101000a900460ff16610dc1576040517f3aca788a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008160000160016101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167f523fff9d18fef7247d13e67b28b58c6173cc8868a73b220fcebfd5887c1135b28260000160009054906101000a900460ff16604051610e359190612701565b60405180910390a2505050565b6000801b610e4f816115bb565b6006548203610e8a576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816006819055507fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de4082604051610ec09190612162565b60405180910390a15050565b6000801b610ed9816115bb565b600a54821480610eeb57506206978082105b15610f22576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600a819055507f2c941b29cbb54e4feeb31a83ebf90b2ffdd425f3970b341bf588a6ca88a8b56b82604051610f589190612162565b60405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610fb1826001600086815260200190815260200160002061171d90919063ffffffff16565b905092915050565b600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b611030816115bb565b600754820361106b576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816007819055507f6d3d82f4a368310fc477262ac1c98c96cf147c62b219e94a4acf691400922905826040516110a19190612162565b60405180910390a15050565b6000801b81565b60075481565b60085481565b60095481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6110fa611f3e565b6040518060c00160405280600654815260200160085481526020016007548152602001600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016005548152602001600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250905090565b60055481565b6111b2611f3e565b6111bb82610ac5565b506111c46110f2565b9050919050565b60006111e860016000848152602001908152602001600020611737565b9050919050565b6000801b6111fc816115bb565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611283576040517fa9cb9e0d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f33837f672315b6cffcf11894714abfdec631a913c18d7738fcaf40c444376fb660405160405180910390a25050565b61131482610961565b61131d816115bb565b6113278383611619565b505050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b600b6020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16905082565b6000801b61139b816115bb565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a900460ff1615611422576040517f56b89dcc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61142c838361174c565b505050565b61143b8282610fb9565b61150d57600160008084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506114b2611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000611539836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6118f2565b905092915050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806115b457506115b382611962565b5b9050919050565b6115cc816115c7611611565b6119cc565b50565b600081600001549050919050565b6115e78282611431565b61160c816001600085815260200190815260200160002061151190919063ffffffff16565b505050565b600033905090565b6116238282611a51565b6116488160016000858152602001908152602001600020611b3290919063ffffffff16565b505050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f09050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f990612768565b60405180910390fd5b919050565b6001816000016000828254019250508190555050565b600061172c8360000183611b62565b60001c905092915050565b600061174582600001611b8d565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156117ad5750600060038111156117985761179761247e565b5b8160038111156117ab576117aa61247e565b5b145b156117e4576040517fa1e9dd9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405180604001604052808260038111156118025761180161247e565b5b815260200160011515815250600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360038111156118785761187761247e565b5b021790555060208201518160000160016101000a81548160ff0219169083151502179055509050508173ffffffffffffffffffffffffffffffffffffffff167fbe433982945125798dc0fb45d2aedb711f3461ff28984baab1334b3bce20d5e8826040516118e69190612701565b60405180910390a25050565b60006118fe8383611b9e565b61195757826000018290806001815401808255809150506001900390600052602060002001600090919091909150558260000180549050836001016000848152602001908152602001600020819055506001905061195c565b600090505b92915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6119d68282610fb9565b611a4d576119e381611bc1565b6119f18360001c6020611bee565b604051602001611a02929190612891565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a449190612904565b60405180910390fd5b5050565b611a5b8282610fb9565b15611b2e57600080600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611ad3611611565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000611b5a836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e2a565b905092915050565b6000826000018281548110611b7a57611b79612926565b5b9060005260206000200154905092915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b6060611be78273ffffffffffffffffffffffffffffffffffffffff16601460ff16611bee565b9050919050565b606060006002836002611c019190612984565b611c0b91906129c6565b67ffffffffffffffff811115611c2457611c236129fa565b5b6040519080825280601f01601f191660200182016040528015611c565781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611c8e57611c8d612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611cf257611cf1612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002611d329190612984565b611d3c91906129c6565b90505b6001811115611ddc577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110611d7e57611d7d612926565b5b1a60f81b828281518110611d9557611d94612926565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080611dd590612a29565b9050611d3f565b5060008414611e20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1790612a9e565b60405180910390fd5b8091505092915050565b60008083600101600084815260200190815260200160002054905060008114611f32576000600182611e5c9190612abe565b9050600060018660000180549050611e749190612abe565b9050818114611ee3576000866000018281548110611e9557611e94612926565b5b9060005260206000200154905080876000018481548110611eb957611eb8612926565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611ef757611ef6612af2565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611f38565b60009150505b92915050565b6040518060c00160405280600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611fdf81611faa565b8114611fea57600080fd5b50565b600081359050611ffc81611fd6565b92915050565b60006020828403121561201857612017611fa0565b5b600061202684828501611fed565b91505092915050565b60008115159050919050565b6120448161202f565b82525050565b600060208201905061205f600083018461203b565b92915050565b6000819050919050565b61207881612065565b811461208357600080fd5b50565b6000813590506120958161206f565b92915050565b6000602082840312156120b1576120b0611fa0565b5b60006120bf84828501612086565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006120f3826120c8565b9050919050565b612103816120e8565b811461210e57600080fd5b50565b600081359050612120816120fa565b92915050565b60006020828403121561213c5761213b611fa0565b5b600061214a84828501612111565b91505092915050565b61215c81612065565b82525050565b60006020820190506121776000830184612153565b92915050565b6000819050919050565b6121908161217d565b811461219b57600080fd5b50565b6000813590506121ad81612187565b92915050565b6000602082840312156121c9576121c8611fa0565b5b60006121d78482850161219e565b91505092915050565b6121e98161217d565b82525050565b600060208201905061220460008301846121e0565b92915050565b600060408201905061221f6000830185612153565b61222c6020830184612153565b9392505050565b6000806040838503121561224a57612249611fa0565b5b60006122588582860161219e565b925050602061226985828601612111565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f84011261229857612297612273565b5b8235905067ffffffffffffffff8111156122b5576122b4612278565b5b6020830191508360018202830111156122d1576122d061227d565b5b9250929050565b6000806000806000608086880312156122f4576122f3611fa0565b5b600061230288828901612111565b955050602061231388828901612111565b945050604086013567ffffffffffffffff81111561233457612333611fa5565b5b61234088828901612282565b9350935050606061235388828901612111565b9150509295509295909350565b612369816120e8565b82525050565b60006020820190506123846000830184612360565b92915050565b600080604083850312156123a1576123a0611fa0565b5b60006123af8582860161219e565b92505060206123c085828601612086565b9150509250929050565b6123d381612065565b82525050565b6123e2816120e8565b82525050565b60c0820160008201516123fe60008501826123ca565b50602082015161241160208501826123ca565b50604082015161242460408501826123ca565b50606082015161243760608501826123d9565b50608082015161244a60808501826123ca565b5060a082015161245d60a08501826123d9565b50505050565b600060c08201905061247860008301846123e8565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600481106124be576124bd61247e565b5b50565b60008190506124cf826124ad565b919050565b60006124df826124c1565b9050919050565b6124ef816124d4565b82525050565b600060408201905061250a60008301856124e6565b612517602083018461203b565b9392505050565b6004811061252b57600080fd5b50565b60008135905061253d8161251e565b92915050565b6000806040838503121561255a57612559611fa0565b5b600061256885828601612111565b92505060206125798582860161252e565b9150509250929050565b600082825260208201905092915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b60006125f0602f83612583565b91506125fb82612594565b604082019050919050565b6000602082019050818103600083015261261f816125e3565b9050919050565b82818337600083830152505050565b6000601f19601f8301169050919050565b60006126528385612583565b935061265f838584612626565b61266883612635565b840190509392505050565b60006080820190506126886000830188612360565b6126956020830187612360565b81810360408301526126a8818587612646565b90506126b76060830184612360565b9695505050505050565b60006060820190506126d66000830187612153565b81810360208301526126e9818587612646565b90506126f86040830184612360565b95945050505050565b600060208201905061271660008301846124e6565b92915050565b7f455243313136373a20637265617465206661696c656400000000000000000000600082015250565b6000612752601683612583565b915061275d8261271c565b602082019050919050565b6000602082019050818103600083015261278181612745565b9050919050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b60006127c9601783612788565b91506127d482612793565b601782019050919050565b600081519050919050565b60005b838110156128085780820151818401526020810190506127ed565b60008484015250505050565b600061281f826127df565b6128298185612788565b93506128398185602086016127ea565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b600061287b601183612788565b915061288682612845565b601182019050919050565b600061289c826127bc565b91506128a88285612814565b91506128b38261286e565b91506128bf8284612814565b91508190509392505050565b60006128d6826127df565b6128e08185612583565b93506128f08185602086016127ea565b6128f981612635565b840191505092915050565b6000602082019050818103600083015261291e81846128cb565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061298f82612065565b915061299a83612065565b92508282026129a881612065565b915082820484148315176129bf576129be612955565b5b5092915050565b60006129d182612065565b91506129dc83612065565b92508282019050808211156129f4576129f3612955565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000612a3482612065565b915060008203612a4757612a46612955565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000612a88602083612583565b9150612a9382612a52565b602082019050919050565b60006020820190508181036000830152612ab781612a7b565b9050919050565b6000612ac982612065565b9150612ad483612065565b9250828203905081811115612aec57612aeb612955565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea26469706673582212203ce6affe32251169dd3c6370bc016e3b4e4e67ae8958ea21ee9c01a659788dcb64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c38e3a10b5818601b29c83f195e8b5854aae45af0000000000000000000000009d8d9ee5e0fbf96491d7b3cf96bbe0630c959deb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000005555555555555555555555555555555555555555
-----Decoded View---------------
Arg [0] : fuulManager (address): 0xC38E3A10B5818601b29c83F195E8b5854AAE45aF
Arg [1] : initialProtocolFeeCollector (address): 0x9D8D9ee5E0fBF96491D7b3CF96Bbe0630c959deb
Arg [2] : initialNftFeeCurrency (address): 0x0000000000000000000000000000000000000000
Arg [3] : acceptedERC20CurrencyToken (address): 0x5555555555555555555555555555555555555555
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000c38e3a10b5818601b29c83f195e8b5854aae45af
Arg [1] : 0000000000000000000000009d8d9ee5e0fbf96491d7b3cf96bbe0630c959deb
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000005555555555555555555555555555555555555555
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in HYPE
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.