Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 1 from a total of 1 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Deploy Entrypoin... | 23697634 | 131 days ago | IN | 0 ETH | 0.00007285 |
Latest 5 internal transactions
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x60a06040 | 23697634 | 131 days ago | Contract Creation | 0 ETH | |||
| 0x60806040 | 23690426 | 132 days ago | Contract Creation | 0 ETH | |||
| 0x60806040 | 23690426 | 132 days ago | Contract Creation | 0 ETH | |||
| 0x60806040 | 23690426 | 132 days ago | Contract Creation | 0 ETH | |||
| 0x60806040 | 23690426 | 132 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
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:
Manager
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import { Create2 } from "./libraries/Create2Tron.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { EntrypointMerchant } from "./EntrypointMerchant.sol";
import { SmartWallet } from "./SmartWallet.sol";
import { Withdrawal } from "./libraries/DataStruct.sol";
import { ZeroAddress, TransferNativeFailed } from "./libraries/Errors.sol";
import { IEntrypointMerchant } from "./interfaces/IEntrypointMerchant.sol";
import { IManager } from "./interfaces/IManager.sol";
import { IAccessControl } from "@openzeppelin/contracts/access/IAccessControl.sol";
import { ISmartWallet } from "./interfaces/ISmartWallet.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Manager is AccessControl, IManager {
using SafeERC20 for IERC20;
bytes32 public constant DEPLOYER_ROLE = keccak256("DEPLOYER_ROLE");
bytes32 public constant FEE_COLLECTOR_ROLE = keccak256("FEE_COLLECTOR_ROLE");
UpgradeableBeacon public immutable entrypointMerchantBeacon;
UpgradeableBeacon public immutable smartWalletBeacon;
address public feeVault;
mapping(address => bool) public isEntrypointDeployed;
constructor(address _defaultAdmin, address[] memory _deployers, address[] memory _feeCollectors, address _feeVault) {
require(_feeVault != address(0) && _defaultAdmin != address(0), ZeroAddress());
_grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
_setRoleAdmin(DEPLOYER_ROLE, DEFAULT_ADMIN_ROLE);
_setRoleAdmin(FEE_COLLECTOR_ROLE, DEFAULT_ADMIN_ROLE);
for (uint256 i = 0; i < _deployers.length; i++) {
require(_deployers[i] != address(0), ZeroAddress());
_grantRole(DEPLOYER_ROLE, _deployers[i]);
}
for (uint256 i = 0; i < _feeCollectors.length; i++) {
require(_feeCollectors[i] != address(0), ZeroAddress());
_grantRole(FEE_COLLECTOR_ROLE, _feeCollectors[i]);
}
address entrypointMerchantImplementation = address(new EntrypointMerchant());
address smartWalletImplementation = address(new SmartWallet());
entrypointMerchantBeacon = new UpgradeableBeacon(entrypointMerchantImplementation, address(this));
smartWalletBeacon = new UpgradeableBeacon(smartWalletImplementation, address(this));
feeVault = _feeVault;
}
//
// Deployer functions
//
function deployEntrypointMerchant(
address _executor,
bytes32 _salt
) external onlyRole(DEPLOYER_ROLE) returns (address payable entrypoint) {
require(_executor != address(0), ZeroAddress());
bytes memory initData = abi.encodeWithSelector(
EntrypointMerchant.initialize.selector,
_executor,
address(this)
);
entrypoint = payable(address(new BeaconProxy{salt: _salt}(address(entrypointMerchantBeacon), initData)));
isEntrypointDeployed[entrypoint] = true;
emit EntrypointMerchantDeployed(entrypoint, msg.sender, _executor);
return entrypoint;
}
function predictEntrypointMerchantAddress(address _executor, bytes32 _salt) external view returns (address) {
bytes memory initData = abi.encodeWithSelector(EntrypointMerchant.initialize.selector, _executor, address(this));
bytes memory bytecode = abi.encodePacked(
type(BeaconProxy).creationCode,
abi.encode(address(entrypointMerchantBeacon), initData)
);
return Create2.computeAddress(_salt, keccak256(bytecode), address(this));
}
//
// Fee Collector functions
//
function withdraw(address entrypoint, Withdrawal[] calldata withdrawals) external onlyRole(FEE_COLLECTOR_ROLE) {
require(isEntrypointDeployed[entrypoint], EntrypointNotDeployed());
IEntrypointMerchant(entrypoint).withdraw(withdrawals);
}
function withdrawFromEntrypointMerchant(Withdrawal[] calldata withdrawals) external onlyRole(FEE_COLLECTOR_ROLE) {
for (uint256 i = 0; i < withdrawals.length; ) {
require(isEntrypointDeployed[withdrawals[i].wallet], EntrypointNotDeployed());
IEntrypointMerchant(withdrawals[i].wallet).sweep(withdrawals[i].withdrawData);
unchecked {
++i;
}
}
}
//
// Admins functions
//
function upgradeEntrypointMerchantImplementation(
address _newImplementation
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_newImplementation != address(0), ZeroAddress());
address oldImplementation = entrypointMerchantBeacon.implementation();
require(oldImplementation != _newImplementation, SameImplementation());
require(_newImplementation.code.length != 0, InvalidImplementation());
entrypointMerchantBeacon.upgradeTo(_newImplementation);
emit EntrypointMerchantImplementationUpgraded(oldImplementation, _newImplementation);
}
function upgradeSmartWalletImplementation(
address _newImplementation
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_newImplementation != address(0), ZeroAddress());
address oldImplementation = smartWalletBeacon.implementation();
require(oldImplementation != _newImplementation, SameImplementation());
require(_newImplementation.code.length != 0, InvalidImplementation());
smartWalletBeacon.upgradeTo(_newImplementation);
emit SmartWalletImplementationUpgraded(oldImplementation, _newImplementation);
}
function changeFeeVault(address _newFeeVault) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_newFeeVault != address(0), ZeroAddress());
feeVault = _newFeeVault;
emit FeeVaultChanged(_newFeeVault);
}
function grantRoleOnEntrypointMerchant(address entrypoint, bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(isEntrypointDeployed[entrypoint], EntrypointNotDeployed());
IAccessControl(entrypoint).grantRole(role, account);
}
function revokeRoleOnEntrypointMerchant(address entrypoint, bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(isEntrypointDeployed[entrypoint], EntrypointNotDeployed());
IAccessControl(entrypoint).revokeRole(role, account);
}
function changeEntrypointFromSmartWallet(address smartwallet, address newEntrypoint) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(smartwallet.code.length != 0, InvalidImplementation());
require(newEntrypoint != address(0), ZeroAddress());
ISmartWallet(smartwallet).changeEntrypoint(newEntrypoint);
}
function sweep (bytes calldata withdrawData, address collector) external onlyRole(DEFAULT_ADMIN_ROLE) {
(address token, uint256 amount) = abi.decode(withdrawData, (address, uint256));
if (amount == 0) return;
if (token == address(0)) {
(bool success, ) = collector.call{ value: amount }("");
require(success, TransferNativeFailed());
} else {
IERC20(token).safeTransfer(collector, amount);
}
emit Withdraw(token, amount);
}
//
// View functions
//
function getEntrypointMerchantImplementation() external view returns (address) {
return entrypointMerchantBeacon.implementation();
}
function getSmartWalletImplementation() external view returns (address) {
return smartWalletBeacon.implementation();
}
function getEntrypointMerchantBeacon() external view returns (address) {
return address(entrypointMerchantBeacon);
}
function getSmartWalletBeacon() external view returns (address) {
return address(smartWalletBeacon);
}
function getFeeVault() external view returns (address) {
return feeVault;
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../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 account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC-165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
* Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.20;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/beacon/BeaconProxy.sol)
pragma solidity ^0.8.20;
import {IBeacon} from "./IBeacon.sol";
import {Proxy} from "../Proxy.sol";
import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
/**
* @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
*
* The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an
* immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
* https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] so that it can be accessed externally.
*
* CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
* the beacon to not upgrade the implementation maliciously.
*
* IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
* an inconsistent state where the beacon storage slot does not match the beacon address.
*/
contract BeaconProxy is Proxy {
// An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.
address private immutable _beacon;
/**
* @dev Initializes the proxy with `beacon`.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
* will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
* constructor.
*
* Requirements:
*
* - `beacon` must be a contract with the interface {IBeacon}.
* - If `data` is empty, `msg.value` must be zero.
*/
constructor(address beacon, bytes memory data) payable {
ERC1967Utils.upgradeBeaconToAndCall(beacon, data);
_beacon = beacon;
}
/**
* @dev Returns the current implementation address of the associated beacon.
*/
function _implementation() internal view virtual override returns (address) {
return IBeacon(_getBeacon()).implementation();
}
/**
* @dev Returns the beacon.
*/
function _getBeacon() internal view virtual returns (address) {
return _beacon;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.20;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {UpgradeableBeacon} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol)
pragma solidity ^0.8.20;
import {IBeacon} from "./IBeacon.sol";
import {Ownable} from "../../access/Ownable.sol";
/**
* @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their
* implementation contract, which is where they will delegate all function calls.
*
* An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.
*/
contract UpgradeableBeacon is IBeacon, Ownable {
address private _implementation;
/**
* @dev The `implementation` of the beacon is invalid.
*/
error BeaconInvalidImplementation(address implementation);
/**
* @dev Emitted when the implementation returned by the beacon is changed.
*/
event Upgraded(address indexed implementation);
/**
* @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon.
*/
constructor(address implementation_, address initialOwner) Ownable(initialOwner) {
_setImplementation(implementation_);
}
/**
* @dev Returns the current implementation address.
*/
function implementation() public view virtual returns (address) {
return _implementation;
}
/**
* @dev Upgrades the beacon to a new implementation.
*
* Emits an {Upgraded} event.
*
* Requirements:
*
* - msg.sender must be the owner of the contract.
* - `newImplementation` must be a contract.
*/
function upgradeTo(address newImplementation) public virtual onlyOwner {
_setImplementation(newImplementation);
}
/**
* @dev Sets the implementation contract address for this beacon
*
* Requirements:
*
* - `newImplementation` must be a contract.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert BeaconInvalidImplementation(newImplementation);
}
_implementation = newImplementation;
emit Upgraded(newImplementation);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (proxy/ERC1967/ERC1967Utils.sol)
pragma solidity ^0.8.21;
import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";
/**
* @dev This library provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
*/
library ERC1967Utils {
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev The `implementation` of the proxy is invalid.
*/
error ERC1967InvalidImplementation(address implementation);
/**
* @dev The `admin` of the proxy is invalid.
*/
error ERC1967InvalidAdmin(address admin);
/**
* @dev The `beacon` of the proxy is invalid.
*/
error ERC1967InvalidBeacon(address beacon);
/**
* @dev An upgrade function sees `msg.value > 0` that may be lost.
*/
error ERC1967NonPayable();
/**
* @dev Returns the current implementation address.
*/
function getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(newImplementation);
}
StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Performs implementation upgrade with additional setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) internal {
_setImplementation(newImplementation);
emit IERC1967.Upgraded(newImplementation);
if (data.length > 0) {
Address.functionDelegateCall(newImplementation, data);
} else {
_checkNonPayable();
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
* the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
if (newAdmin == address(0)) {
revert ERC1967InvalidAdmin(address(0));
}
StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {IERC1967-AdminChanged} event.
*/
function changeAdmin(address newAdmin) internal {
emit IERC1967.AdminChanged(getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the ERC-1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
if (newBeacon.code.length == 0) {
revert ERC1967InvalidBeacon(newBeacon);
}
StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
address beaconImplementation = IBeacon(newBeacon).implementation();
if (beaconImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(beaconImplementation);
}
}
/**
* @dev Change the beacon and trigger a setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-BeaconUpgraded} event.
*
* CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
* it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
* efficiency.
*/
function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
_setBeacon(newBeacon);
emit IERC1967.BeaconUpgraded(newBeacon);
if (data.length > 0) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
} else {
_checkNonPayable();
}
}
/**
* @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
* if an upgrade doesn't perform an initialization call.
*/
function _checkNonPayable() private {
if (msg.value > 0) {
revert ERC1967NonPayable();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)
pragma solidity ^0.8.20;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback
* function and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @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.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) 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
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* 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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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 v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { BeaconProxy } from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import { Create2 } from "./libraries/Create2Tron.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { Withdrawal, UserExecution, Call } from "./libraries/DataStruct.sol";
import { ExecuteLib } from "./libraries/ExecuteLib.sol";
import { ZeroAddress, OnlyManager, TransactionFailed, TransferNativeFailed, TransferTokenFailed } from "./libraries/Errors.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IEntrypointMerchant } from "./interfaces/IEntrypointMerchant.sol";
import { IManager } from "./interfaces/IManager.sol";
import { SmartWallet } from "./SmartWallet.sol";
contract EntrypointMerchant is AccessControl, Initializable, IEntrypointMerchant {
using SafeERC20 for IERC20;
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
IManager public manager;
mapping(address => bool) public isWalletExisted;
modifier onlyManager() {
require(msg.sender == address(manager), OnlyManager());
_;
}
function initialize(address _executor, address _manager) external initializer {
require(_executor != address(0) && _manager != address(0), ZeroAddress());
_grantRole(DEFAULT_ADMIN_ROLE, _manager);
_setRoleAdmin(EXECUTOR_ROLE, DEFAULT_ADMIN_ROLE);
_grantRole(EXECUTOR_ROLE, _executor);
manager = IManager(_manager);
}
//
// Executor functions
//
function createWallet(bytes32 salt) external onlyRole(EXECUTOR_ROLE) returns (address) {
address wallet = _createWallet(salt);
emit WalletDeployed(wallet);
return wallet;
}
function createWalletBatch(bytes32[] calldata salts) external onlyRole(EXECUTOR_ROLE) {
uint256 length = salts.length;
address wallet;
for (uint256 i = 0; i < length; ) {
wallet = _createWallet(salts[i]);
emit WalletDeployed(wallet);
unchecked {
++i;
}
}
}
function handleOp(UserExecution calldata userExec) external onlyRole(EXECUTOR_ROLE) {
_handleOp(userExec);
}
function handleOpBatch(UserExecution[] calldata userExecs) external onlyRole(EXECUTOR_ROLE) {
for (uint256 i = 0; i < userExecs.length; ) {
_handleOp(userExecs[i]);
unchecked {
++i;
}
}
}
function execute(Call calldata call) external payable onlyRole(EXECUTOR_ROLE) {
ExecuteLib.execute(call);
}
function executeBatch(Call[] calldata calls) external payable onlyRole(EXECUTOR_ROLE) {
ExecuteLib.executeBatch(calls);
}
function predictAddress(bytes32 salt) external view returns (address) {
bytes memory initData = abi.encodeWithSelector(SmartWallet.initialize.selector, address(this), address(manager));
bytes memory bytecode = abi.encodePacked(
type(BeaconProxy).creationCode,
abi.encode(address(manager.getSmartWalletBeacon()), initData)
);
return Create2.computeAddress(salt, keccak256(bytecode), address(this));
}
function _createWallet(bytes32 salt) internal returns (address) {
bytes memory initData = abi.encodeWithSelector(SmartWallet.initialize.selector, address(this), address(manager));
address payable wallet = payable(address(new BeaconProxy{salt: salt}(address(manager.getSmartWalletBeacon()), initData)));
isWalletExisted[wallet] = true;
return wallet;
}
function _handleOp(UserExecution calldata userExec) internal {
_validateOp(userExec);
_processOp(userExec);
}
function _validateOp(UserExecution calldata userExec) internal view {
require(isWalletExisted[userExec.wallet], WalletIsNotExisted());
}
function _processOp(UserExecution calldata userExec) internal {
(bool success, bytes memory result) = userExec.wallet.call(userExec.callData);
if (!success) {
if (result.length > 0) {
assembly {
let return_data_size := mload(result)
revert(add(32, result), return_data_size)
}
} else {
revert TransactionFailed();
}
}
}
//
// Manager functions
//
function grantRole(bytes32 role, address account) public override onlyManager {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public override onlyManager {
_revokeRole(role, account);
}
function withdraw(Withdrawal[] calldata withdrawals) external onlyManager {
for (uint256 i = 0; i < withdrawals.length; ) {
require(isWalletExisted[withdrawals[i].wallet], WalletIsNotExisted());
SmartWallet(payable(withdrawals[i].wallet)).withdraw(withdrawals[i].withdrawData);
unchecked {
++i;
}
}
}
function sweep (bytes calldata withdrawData) external onlyManager {
address master = IManager(manager).getFeeVault();
(address token, uint256 amount) = abi.decode(withdrawData, (address, uint256));
if (amount == 0) return;
if (token == address(0)) {
(bool success, ) = master.call{ value: amount }("");
require(success, TransferNativeFailed());
} else {
IERC20(token).safeTransfer(master, amount);
}
emit Withdraw(token, amount);
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { ZeroAddress, OnlyManager, TransactionFailed, TransferNativeFailed } from "../libraries/Errors.sol";
import { Withdrawal } from "../libraries/DataStruct.sol";
interface IEntrypointMerchant {
error HandleOpDisabled();
error WalletIsNotExisted();
error WalletAlreadyDeployed();
event WalletDeployed(address indexed wallet);
event Sweep(address indexed token, address indexed collector, uint256 amount);
event HandleOpEnabled(bool handleOpEnabled);
event MasterChanged(address newMaster);
event Withdraw(address indexed token, uint256 amount);
function withdraw(Withdrawal[] calldata withdrawals) external;
function sweep(bytes calldata withdrawData) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { ZeroAddress } from "../libraries/Errors.sol";
interface IManager {
event EntrypointMerchantDeployed(address entrypoint, address deployer, address executor);
event EntrypointMerchantImplementationUpgraded(address oldImplementation, address newImplementation);
event SmartWalletImplementationUpgraded(address oldImplementation, address newImplementation);
event FeeVaultChanged(address newFeeVault);
event Withdraw(address indexed token, uint256 amount);
error EntrypointNotDeployed();
error SameImplementation();
error InvalidImplementation();
error EntrypointAlreadyDeployed();
function getSmartWalletImplementation() external view returns (address);
function getEntrypointMerchantImplementation() external view returns (address);
function getEntrypointMerchantBeacon() external view returns (address);
function getSmartWalletBeacon() external view returns (address);
function getFeeVault() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { Call } from "../libraries/DataStruct.sol";
import { OnlyEntrypoint, OnlyManager, TransactionFailed, InvalidTarget, TransferNativeFailed, TransferTokenFailed } from "../libraries/Errors.sol";
interface ISmartWallet {
error AlreadyInitialized();
event Withdraw(address indexed token, uint256 amount);
event EntrypointChanged(address indexed newEntrypoint);
function withdraw(bytes calldata withdrawData) external;
function changeEntrypoint(address _newEntrypoint) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Create2.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Create2Errors.sol";
/**
* @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
* `CREATE2` can be used to compute in advance the address where a smart
* contract will be deployed, which allows for interesting new mechanisms known
* as 'counterfactual interactions'.
*
* See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
* information.
*/
library Create2 {
/**
* @dev There's no code to deploy.
*/
error Create2EmptyBytecode();
/**
* @dev Deploys a contract using `CREATE2`. The address where the contract
* will be deployed can be known in advance via {computeAddress}.
*
* The bytecode for a contract can be obtained from Solidity with
* `type(contractName).creationCode`.
*
* Requirements:
*
* - `bytecode` must not be empty.
* - `salt` must have not been used for `bytecode` already.
* - the factory must have a balance of at least `amount`.
* - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
*/
function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
if (bytecode.length == 0) {
revert Create2EmptyBytecode();
}
assembly ("memory-safe") {
addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
// if no address was created, and returndata is not empty, bubble revert
if and(iszero(addr), not(iszero(returndatasize()))) {
let p := mload(0x40)
returndatacopy(p, 0, returndatasize())
revert(p, returndatasize())
}
}
if (addr == address(0)) {
revert Errors.FailedDeployment();
}
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
* `bytecodeHash` or `salt` will result in a new destination address.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
return computeAddress(salt, bytecodeHash, address(this));
}
/**
* @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
* `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
*/
function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal view returns (address addr) {
if (isTronNetwork()) {
assembly ("memory-safe") {
let ptr := mload(0x40) // Get free memory pointer
mstore(add(ptr, 0x40), bytecodeHash)
mstore(add(ptr, 0x20), salt)
mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
mstore8(start, 0x41) // Tron prefix
addr := and(keccak256(start, 85), 0xffffffffffffffffffffffffffffffffffffffff)
}
} else {
assembly ("memory-safe") {
let ptr := mload(0x40) // Get free memory pointer
// | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |
// |-------------------|---------------------------------------------------------------------------|
// | bytecodeHash | CCCCCCCCCCCCC...CC |
// | salt | BBBBBBBBBBBBB...BB |
// | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |
// | 0xFF | FF |
// |-------------------|---------------------------------------------------------------------------|
// | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |
// | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |
mstore(add(ptr, 0x40), bytecodeHash)
mstore(add(ptr, 0x20), salt)
mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
mstore8(start, 0xff)
addr := and(keccak256(start, 85), 0xffffffffffffffffffffffffffffffffffffffff)
}
}
}
function isTronNetwork() internal view returns (bool) {
return block.chainid == 728126428 || block.chainid == 3448148188; // Tron mainnet and nile
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
struct Call {
address target;
uint256 value;
bytes data;
}
struct UserExecution {
address wallet;
bytes callData;
}
struct Withdrawal {
address wallet;
bytes withdrawData;
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; // Common errors used across multiple contracts error ZeroAddress(); error OnlyManager(); error TransactionFailed(); error TransferNativeFailed(); error TransferTokenFailed(); error InvalidTarget(); error OnlyEntrypoint();
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { Call } from "./DataStruct.sol";
import { InvalidTarget, TransactionFailed } from "./Errors.sol";
library ExecuteLib {
event TransactionExecuted(address target, bytes data, uint256 value);
function execute(Call calldata call) internal {
require(call.target != address(0), InvalidTarget());
(bool success, bytes memory result) = call.target.call{ value: call.value }(call.data);
if (!success) {
if (result.length > 0) {
assembly {
let return_data_size := mload(result)
revert(add(32, result), return_data_size)
}
} else {
revert TransactionFailed();
}
}
emit TransactionExecuted(call.target, call.data, call.value);
}
function executeBatch(Call[] calldata calls) internal {
for (uint256 i; i < calls.length; ) {
execute(calls[i]);
unchecked {
++i;
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { Call } from "./libraries/DataStruct.sol";
import { ExecuteLib } from "./libraries/ExecuteLib.sol";
import { OnlyEntrypoint, OnlyManager, ZeroAddress, TransferNativeFailed, TransferTokenFailed } from "./libraries/Errors.sol";
import { ISmartWallet } from "./interfaces/ISmartWallet.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IEntrypointMerchant } from "./interfaces/IEntrypointMerchant.sol";
import { IManager } from "./interfaces/IManager.sol";
contract SmartWallet is ISmartWallet, Initializable, ReentrancyGuard {
using SafeERC20 for IERC20;
address public entrypoint;
address public manager;
modifier onlyEntrypoint() {
require(msg.sender == entrypoint, OnlyEntrypoint());
_;
}
modifier onlyManager() {
require(msg.sender == manager, OnlyManager());
_;
}
function initialize(address _entrypoint, address _manager) external initializer {
require(_entrypoint != address(0) && _manager != address(0), ZeroAddress());
entrypoint = _entrypoint;
manager = _manager;
}
function execute(Call calldata call) external payable onlyEntrypoint nonReentrant {
ExecuteLib.execute(call);
}
function executeBatch(Call[] calldata calls) external payable onlyEntrypoint nonReentrant {
ExecuteLib.executeBatch(calls);
}
function withdraw(bytes calldata withdrawData) external onlyEntrypoint nonReentrant {
address master = IManager(manager).getFeeVault();
(address token, uint256 amount) = abi.decode(withdrawData, (address, uint256));
if (amount == 0) return;
if (token == address(0)) {
(bool success, ) = master.call{ value: amount }("");
require(success, TransferNativeFailed());
} else {
IERC20(token).safeTransfer(master, amount);
}
emit Withdraw(token, amount);
}
function changeEntrypoint(address _newEntrypoint) external onlyManager {
require(_newEntrypoint != address(0), ZeroAddress());
entrypoint = _newEntrypoint;
emit EntrypointChanged(_newEntrypoint);
}
function version() external pure returns (string memory) {
return "1.0.0";
}
receive() external payable {}
}{
"optimizer": {
"enabled": true,
"runs": 1
},
"evmVersion": "cancun",
"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":"_defaultAdmin","type":"address"},{"internalType":"address[]","name":"_deployers","type":"address[]"},{"internalType":"address[]","name":"_feeCollectors","type":"address[]"},{"internalType":"address","name":"_feeVault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"EntrypointAlreadyDeployed","type":"error"},{"inputs":[],"name":"EntrypointNotDeployed","type":"error"},{"inputs":[],"name":"InvalidImplementation","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SameImplementation","type":"error"},{"inputs":[],"name":"TransferNativeFailed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"entrypoint","type":"address"},{"indexed":false,"internalType":"address","name":"deployer","type":"address"},{"indexed":false,"internalType":"address","name":"executor","type":"address"}],"name":"EntrypointMerchantDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"EntrypointMerchantImplementationUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newFeeVault","type":"address"}],"name":"FeeVaultChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"SmartWalletImplementationUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_COLLECTOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"smartwallet","type":"address"},{"internalType":"address","name":"newEntrypoint","type":"address"}],"name":"changeEntrypointFromSmartWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFeeVault","type":"address"}],"name":"changeFeeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes32","name":"_salt","type":"bytes32"}],"name":"deployEntrypointMerchant","outputs":[{"internalType":"address payable","name":"entrypoint","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"entrypointMerchantBeacon","outputs":[{"internalType":"contract UpgradeableBeacon","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEntrypointMerchantBeacon","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEntrypointMerchantImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSmartWalletBeacon","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSmartWalletImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"entrypoint","type":"address"},{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRoleOnEntrypointMerchant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isEntrypointDeployed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes32","name":"_salt","type":"bytes32"}],"name":"predictEntrypointMerchantAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"entrypoint","type":"address"},{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRoleOnEntrypointMerchant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smartWalletBeacon","outputs":[{"internalType":"contract UpgradeableBeacon","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"withdrawData","type":"bytes"},{"internalType":"address","name":"collector","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"upgradeEntrypointMerchantImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"upgradeSmartWalletImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"entrypoint","type":"address"},{"components":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"bytes","name":"withdrawData","type":"bytes"}],"internalType":"struct Withdrawal[]","name":"withdrawals","type":"tuple[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"bytes","name":"withdrawData","type":"bytes"}],"internalType":"struct Withdrawal[]","name":"withdrawals","type":"tuple[]"}],"name":"withdrawFromEntrypointMerchant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60c060405234801561000f575f5ffd5b5060405161518a38038061518a83398101604081905261002e916104a1565b6001600160a01b0381161580159061004e57506001600160a01b03841615155b61006b5760405163d92e233d60e01b815260040160405180910390fd5b6100755f856102b5565b5061008d5f51602061516a5f395f51905f525f61035e565b6100a45f51602061514a5f395f51905f525f61035e565b5f5b8351811015610139575f6001600160a01b03168482815181106100cb576100cb610527565b60200260200101516001600160a01b0316036100fa5760405163d92e233d60e01b815260040160405180910390fd5b6101305f51602061516a5f395f51905f5285838151811061011d5761011d610527565b60200260200101516102b560201b60201c565b506001016100a6565b505f5b82518110156101bc575f6001600160a01b031683828151811061016157610161610527565b60200260200101516001600160a01b0316036101905760405163d92e233d60e01b815260040160405180910390fd5b6101b35f51602061514a5f395f51905f5284838151811061011d5761011d610527565b5060010161013c565b505f6040516101ca906103a8565b604051809103905ff0801580156101e3573d5f5f3e3d5ffd5b5090505f6040516101f3906103b5565b604051809103905ff08015801561020c573d5f5f3e3d5ffd5b509050813060405161021d906103c2565b61022892919061053b565b604051809103905ff080158015610241573d5f5f3e3d5ffd5b506001600160a01b03166080526040518190309061025e906103c2565b61026992919061053b565b604051809103905ff080158015610282573d5f5f3e3d5ffd5b506001600160a01b0390811660a052600180546001600160a01b0319169490911693909317909255506105559350505050565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610355575f838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561030d3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610358565b505f5b92915050565b5f82815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b611c7a8061253b83390190565b610b50806141b583390190565b61044580614d0583390190565b80516001600160a01b03811681146103e5575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011261040d575f5ffd5b81516001600160401b03811115610426576104266103ea565b604051600582901b90603f8201601f191681016001600160401b0381118282101715610454576104546103ea565b604052918252602081850181019290810186841115610471575f5ffd5b6020860192505b8383101561049757610489836103cf565b815260209283019201610478565b5095945050505050565b5f5f5f5f608085870312156104b4575f5ffd5b6104bd856103cf565b60208601519094506001600160401b038111156104d8575f5ffd5b6104e4878288016103fe565b604087015190945090506001600160401b03811115610501575f5ffd5b61050d878288016103fe565b92505061051c606086016103cf565b905092959194509250565b634e487b7160e01b5f52603260045260245ffd5b6001600160a01b0392831681529116602082015260400190565b60805160a051611f7f6105bc5f395f81816101d00152818161029b01528181610e7701528181610f8b015261107e01525f8181610388015281816104930152818161060101528181610a0d01528181610b0901528181610bfc0152610efd0152611f7f5ff3fe608060405260043610610154575f3560e01c806301ffc9a71461015f57806319cd6b2a146101935780631b1fce55146101bf5780632069394b146101f25780632464404014610220578063248a9ca31461024157806325ff57cc1461026e57806327854e461461028d5780632a0827ab146102bf5780632f2ff15d146102de57806336568abe146102fd5780633b3b23171461031c578063478222c21461033b57806362a2a47c1461035a5780636735c6771461037a5780636e01fe82146103ac5780636fbd0908146103cb5780637c5475b7146103ea57806391d1485414610409578063a217fddf14610428578063a72d0d221461043b578063bb235cd01461044f578063c1f8bcf814610463578063c80a1ee114610482578063d547741f146104b5578063dcbbdc48146104d4578063ec0f7cf0146104f3578063ecd0026114610510578063f99e41dc14610530575f5ffd5b3661015b57005b5f5ffd5b34801561016a575f5ffd5b5061017e6101793660046114a9565b61054f565b60405190151581526020015b60405180910390f35b34801561019e575f5ffd5b506101b26101ad3660046114e4565b610585565b60405161018a919061150e565b3480156101ca575f5ffd5b506101b27f000000000000000000000000000000000000000000000000000000000000000081565b3480156101fd575f5ffd5b5061017e61020c366004611522565b60026020525f908152604090205460ff1681565b34801561022b575f5ffd5b5061023f61023a366004611522565b610675565b005b34801561024c575f5ffd5b5061026061025b36600461153d565b6106fd565b60405190815260200161018a565b348015610279575f5ffd5b5061023f61028836600461159b565b610711565b348015610298575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000006101b2565b3480156102ca575f5ffd5b5061023f6102d93660046115d9565b61086d565b3480156102e9575f5ffd5b5061023f6102f8366004611610565b610926565b348015610308575f5ffd5b5061023f610317366004611610565b610942565b348015610327575f5ffd5b506101b26103363660046114e4565b61097a565b348015610346575f5ffd5b506001546101b2906001600160a01b031681565b348015610365575f5ffd5b506102605f516020611f0a5f395f51905f5281565b348015610385575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000006101b2565b3480156103b7575f5ffd5b5061023f6103c6366004611522565b610ad5565b3480156103d6575f5ffd5b5061023f6103e5366004611633565b610c9c565b3480156103f5575f5ffd5b5061023f6104043660046116b0565b610da9565b348015610414575f5ffd5b5061017e610423366004611610565b610e4c565b348015610433575f5ffd5b506102605f81565b348015610446575f5ffd5b506101b2610e74565b34801561045a575f5ffd5b506101b2610efa565b34801561046e575f5ffd5b5061023f61047d366004611522565b610f57565b34801561048d575f5ffd5b506101b27f000000000000000000000000000000000000000000000000000000000000000081565b3480156104c0575f5ffd5b5061023f6104cf366004611610565b611111565b3480156104df575f5ffd5b5061023f6104ee3660046116b0565b61112d565b3480156104fe575f5ffd5b506001546001600160a01b03166101b2565b34801561051b575f5ffd5b506102605f516020611f2a5f395f51905f5281565b34801561053b575f5ffd5b5061023f61054a3660046116e4565b61119d565b5f6001600160e01b03198216637965db0b60e01b148061057f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f5f63485cc95560e01b84306040516024016105a2929190611734565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b031990951694909417909352519092505f916105e690820161149c565b601f1982820381018352601f90910116604081905261062b907f000000000000000000000000000000000000000000000000000000000000000090859060200161174e565b60408051601f198184030181529082905261064992916020016117a9565b604051602081830303815290604052905061066c8482805190602001203061121a565b95945050505050565b5f61067f8161128b565b6001600160a01b0382166106a65760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0384161790556040517f6b1a1e7bac1ff3060cc80f286bd9d678e0bbc046c2d46c439444c3562c1abe5a906106f190849061150e565b60405180910390a15050565b5f9081526020819052604090206001015490565b5f516020611f0a5f395f51905f526107288161128b565b5f5b828110156108675760025f858584818110610747576107476117c5565b905060200281019061075991906117d9565b610767906020810190611522565b6001600160a01b0316815260208101919091526040015f205460ff166107a05760405163a763fe3160e01b815260040160405180910390fd5b8383828181106107b2576107b26117c5565b90506020028101906107c491906117d9565b6107d2906020810190611522565b6001600160a01b031663738281988585848181106107f2576107f26117c5565b905060200281019061080491906117d9565b6108129060208101906117f7565b6040518363ffffffff1660e01b815260040161082f929190611861565b5f604051808303815f87803b158015610846575f5ffd5b505af1158015610858573d5f5f3e3d5ffd5b5050505080600101905061072a565b50505050565b5f6108778161128b565b826001600160a01b03163b5f036108a15760405163340aafcd60e11b815260040160405180910390fd5b6001600160a01b0382166108c85760405163d92e233d60e01b815260040160405180910390fd5b6040516321e69b2560e01b81526001600160a01b038416906321e69b25906108f490859060040161150e565b5f604051808303815f87803b15801561090b575f5ffd5b505af115801561091d573d5f5f3e3d5ffd5b50505050505050565b61092f826106fd565b6109388161128b565b6108678383611298565b6001600160a01b038116331461096b5760405163334bd91960e11b815260040160405180910390fd5b6109758282611327565b505050565b5f5f516020611f2a5f395f51905f526109928161128b565b6001600160a01b0384166109b95760405163d92e233d60e01b815260040160405180910390fd5b5f63485cc95560e01b85306040516024016109d5929190611734565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050837f000000000000000000000000000000000000000000000000000000000000000082604051610a399061149c565b610a4492919061174e565b8190604051809103905ff5905080158015610a61573d5f5f3e3d5ffd5b506001600160a01b038181165f81815260026020908152604091829020805460ff1916600117905581519283523390830152918816918101919091529093507f14fdd5ec6e81153bc3040b2d148e7ecac0472aeab700cc3e3734d211781f362a9060600160405180910390a1505092915050565b5f610adf8161128b565b6001600160a01b038216610b065760405163d92e233d60e01b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b63573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b879190611874565b9050826001600160a01b0316816001600160a01b031603610bbb57604051634c3b76bf60e01b815260040160405180910390fd5b826001600160a01b03163b5f03610be55760405163340aafcd60e11b815260040160405180910390fd5b604051631b2ce7f360e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633659cfe690610c3190869060040161150e565b5f604051808303815f87803b158015610c48575f5ffd5b505af1158015610c5a573d5f5f3e3d5ffd5b505050507f4f4dd0e863add7feab296c2a5a63a9e8f13dc8f248d7294d4fde3b619d2424a88184604051610c8f929190611734565b60405180910390a1505050565b5f610ca68161128b565b5f80610cb4858701876114e4565b91509150805f03610cc6575050610867565b6001600160a01b038216610d4a575f846001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610d1d576040519150601f19603f3d011682016040523d82523d5f602084013e610d22565b606091505b5050905080610d4457604051635835233d60e11b815260040160405180910390fd5b50610d5e565b610d5e6001600160a01b0383168583611390565b816001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436482604051610d9991815260200190565b60405180910390a2505050505050565b5f610db38161128b565b6001600160a01b0384165f9081526002602052604090205460ff16610deb5760405163a763fe3160e01b815260040160405180910390fd5b60405163d547741f60e01b81526001600160a01b0385169063d547741f90610e19908690869060040161188f565b5f604051808303815f87803b158015610e30575f5ffd5b505af1158015610e42573d5f5f3e3d5ffd5b5050505050505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef59190611874565b905090565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed1573d5f5f3e3d5ffd5b5f610f618161128b565b6001600160a01b038216610f885760405163d92e233d60e01b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fe5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110099190611874565b9050826001600160a01b0316816001600160a01b03160361103d57604051634c3b76bf60e01b815260040160405180910390fd5b826001600160a01b03163b5f036110675760405163340aafcd60e11b815260040160405180910390fd5b604051631b2ce7f360e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633659cfe6906110b390869060040161150e565b5f604051808303815f87803b1580156110ca575f5ffd5b505af11580156110dc573d5f5f3e3d5ffd5b505050507fea957207b62d349ae45d867accaa0b1f19140e761104ef6318a92f4c712a94f78184604051610c8f929190611734565b61111a826106fd565b6111238161128b565b6108678383611327565b5f6111378161128b565b6001600160a01b0384165f9081526002602052604090205460ff1661116f5760405163a763fe3160e01b815260040160405180910390fd5b604051632f2ff15d60e01b81526001600160a01b03851690632f2ff15d90610e19908690869060040161188f565b5f516020611f0a5f395f51905f526111b48161128b565b6001600160a01b0384165f9081526002602052604090205460ff166111ec5760405163a763fe3160e01b815260040160405180910390fd5b60405163ede0c27960e01b81526001600160a01b0385169063ede0c27990610e1990869086906004016118a6565b5f6112236113e8565b1561125857604051836040820152846020820152828152600b8101905060418153605590206001600160a01b03169050611284565b604051836040820152846020820152828152600b8101905060ff8153605590206001600160a01b031690505b9392505050565b6112958133611401565b50565b5f6112a38383610e4c565b611320575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556112d83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161057f565b505f61057f565b5f6113328383610e4c565b15611320575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161057f565b61097583846001600160a01b031663a9059cbb85856040516024016113b692919061197c565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611439565b5f46632b6653dc1480610ef557505063cd8690dc461490565b61140b8282610e4c565b61143557808260405163e2517d3f60e01b815260040161142c92919061197c565b60405180910390fd5b5050565b5f5f60205f8451602086015f885af180611458576040513d5f823e3d81fd5b50505f513d9150811561146f57806001141561147c565b6001600160a01b0384163b155b156108675783604051635274afe760e01b815260040161142c919061150e565b6105748061199683390190565b5f602082840312156114b9575f5ffd5b81356001600160e01b031981168114611284575f5ffd5b6001600160a01b0381168114611295575f5ffd5b5f5f604083850312156114f5575f5ffd5b8235611500816114d0565b946020939093013593505050565b6001600160a01b0391909116815260200190565b5f60208284031215611532575f5ffd5b8135611284816114d0565b5f6020828403121561154d575f5ffd5b5035919050565b5f5f83601f840112611564575f5ffd5b5081356001600160401b0381111561157a575f5ffd5b6020830191508360208260051b8501011115611594575f5ffd5b9250929050565b5f5f602083850312156115ac575f5ffd5b82356001600160401b038111156115c1575f5ffd5b6115cd85828601611554565b90969095509350505050565b5f5f604083850312156115ea575f5ffd5b82356115f5816114d0565b91506020830135611605816114d0565b809150509250929050565b5f5f60408385031215611621575f5ffd5b823591506020830135611605816114d0565b5f5f5f60408486031215611645575f5ffd5b83356001600160401b0381111561165a575f5ffd5b8401601f8101861361166a575f5ffd5b80356001600160401b0381111561167f575f5ffd5b866020828401011115611690575f5ffd5b6020918201945092508401356116a5816114d0565b809150509250925092565b5f5f5f606084860312156116c2575f5ffd5b83356116cd816114d0565b92506020840135915060408401356116a5816114d0565b5f5f5f604084860312156116f6575f5ffd5b8335611701816114d0565b925060208401356001600160401b0381111561171b575f5ffd5b61172786828701611554565b9497909650939450505050565b6001600160a01b0392831681529116602082015260400190565b60018060a01b0383168152604060208201525f82518060408401528060208501606085015e5f606082850101526060601f19601f8301168401019150509392505050565b5f81518060208401855e5f93019283525090919050565b5f6117bd6117b78386611792565b84611792565b949350505050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e198336030181126117ed575f5ffd5b9190910192915050565b5f5f8335601e1984360301811261180c575f5ffd5b8301803591506001600160401b03821115611825575f5ffd5b602001915036819003821315611594575f5ffd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f6117bd602083018486611839565b5f60208284031215611884575f5ffd5b8151611284816114d0565b9182526001600160a01b0316602082015260400190565b602080825281018290525f6040600584901b830181019083018583603e1936839003015b8782101561196f57868503603f1901845282358181126118e8575f5ffd5b890180356118f5816114d0565b6001600160a01b03168652602081013536829003601e19018112611917575f5ffd5b016020810190356001600160401b03811115611931575f5ffd5b80360382131561193f575f5ffd5b60406020880152611954604088018284611839565b965050506020830192506020840193506001820191506118ca565b5092979650505050505050565b6001600160a01b0392909216825260208201526040019056fe60a06040526040516105743803806105748339810160408190526100229161033d565b61002c828261003e565b506001600160a01b0316608052610442565b610047826100fb565b6040516001600160a01b038316907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e905f90a28051156100ef576100ea826001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e491906103ff565b826101fb565b505050565b6100f761026e565b5050565b806001600160a01b03163b5f036101305780604051631933b43b60e21b81526004016101279190610418565b60405180910390fd5b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392831617905560408051635c60da1b60e01b815290515f92841691635c60da1b9160048083019260209291908290030181865afa1580156101a9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cd91906103ff565b9050806001600160a01b03163b5f036100f75780604051634c9c8ce360e01b81526004016101279190610418565b60605f5f846001600160a01b031684604051610217919061042c565b5f60405180830381855af49150503d805f811461024f576040519150601f19603f3d011682016040523d82523d5f602084013e610254565b606091505b50909250905061026585838361028f565b95945050505050565b341561028d5760405163b398979f60e01b815260040160405180910390fd5b565b6060826102a45761029f826102e5565b6102de565b81511580156102bb57506001600160a01b0384163b155b156102db5783604051639996b31560e01b81526004016101279190610418565b50805b9392505050565b8051156102f55780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80516001600160a01b0381168114610324575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561034e575f5ffd5b6103578361030e565b60208401519092506001600160401b03811115610372575f5ffd5b8301601f81018513610382575f5ffd5b80516001600160401b0381111561039b5761039b610329565b604051601f8201601f19908116603f011681016001600160401b03811182821017156103c9576103c9610329565b6040528181528282016020018710156103e0575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b5f6020828403121561040f575f5ffd5b6102de8261030e565b6001600160a01b0391909116815260200190565b5f82518060208501845e5f920191825250919050565b60805161011b6104595f395f601d015261011b5ff3fe6080604052600a600c565b005b60186014601a565b609d565b565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156076573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906098919060ba565b905090565b365f5f375f5f365f845af43d5f5f3e80801560b6573d5ff35b3d5ffd5b5f6020828403121560c9575f5ffd5b81516001600160a01b038116811460de575f5ffd5b939250505056fea2646970667358221220a4dde2fec3c944d067fa2e5e0e7d511baed62fdf2de1a5a802efd0554afa1ba864736f6c634300081c00332dca0f5ce7e75a4b43fe2b0d6f5d0b7a2bf92ecf89f8f0aa17b8308b67038821fc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184ca2646970667358221220d15f8375dc06f73ef43451046687292c1b3e209b85717066624879cbe84f193464736f6c634300081c00336080604052348015600e575f5ffd5b50611c5e8061001c5f395ff3fe6080604052600436106100f1575f3560e01c806301ffc9a7146100fc57806307bd0265146101305780631d6476051461015e578063248a9ca31461018a5780632f2ff15d146101b857806334fcd5be146101d957806336568abe146101ec578063481c6a751461020b578063485cc9551461022a578063579934dd146102495780635c1c6dcd14610268578063738281981461027b5780637e049ca31461029a57806391d14854146102c85780639c76b654146102e7578063a217fddf14610306578063a453599414610319578063d547741f14610338578063ede0c27914610357578063fb5b0ba414610376575f5ffd5b366100f857005b5f5ffd5b348015610107575f5ffd5b5061011b61011636600461124e565b610395565b60405190151581526020015b60405180910390f35b34801561013b575f5ffd5b506101505f516020611c095f395f51905f5281565b604051908152602001610127565b348015610169575f5ffd5b5061017d610178366004611275565b6103cb565b604051610127919061128c565b348015610195575f5ffd5b506101506101a4366004611275565b5f9081526020819052604090206001015490565b3480156101c3575f5ffd5b506101d76101d23660046112b4565b610417565b005b6101d76101e7366004611329565b610451565b3480156101f7575f5ffd5b506101d76102063660046112b4565b610472565b348015610216575f5ffd5b5060015461017d906001600160a01b031681565b348015610235575f5ffd5b506101d7610244366004611367565b6104a5565b348015610254575f5ffd5b506101d7610263366004611393565b61063a565b6101d76102763660046113c9565b61065e565b348015610286575f5ffd5b506101d76102953660046113ff565b61067e565b3480156102a5575f5ffd5b5061011b6102b436600461146b565b60026020525f908152604090205460ff1681565b3480156102d3575f5ffd5b5061011b6102e23660046112b4565b610818565b3480156102f2575f5ffd5b5061017d610301366004611275565b610840565b348015610311575f5ffd5b506101505f81565b348015610324575f5ffd5b506101d7610333366004611329565b610986565b348015610343575f5ffd5b506101d76103523660046112b4565b6109e1565b348015610362575f5ffd5b506101d7610371366004611329565b610a0c565b348015610381575f5ffd5b506101d7610390366004611329565b610b76565b5f6001600160e01b03198216637965db0b60e01b14806103c557506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f5f516020611c095f395f51905f526103e381610bed565b5f6103ed84610bfa565b6040519091506001600160a01b038216905f516020611be95f395f51905f52905f90a29392505050565b6001546001600160a01b031633146104425760405163605919ad60e11b815260040160405180910390fd5b61044c8282610d24565b505050565b5f516020611c095f395f51905f5261046881610bed565b61044c8383610db3565b6001600160a01b038116331461049b5760405163334bd91960e11b815260040160405180910390fd5b61044c8282610df1565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f811580156104e95750825b90505f826001600160401b031660011480156105045750303b155b905081158015610512575080155b156105305760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b0319166001178555831561055957845460ff60401b1916600160401b1785555b6001600160a01b0387161580159061057957506001600160a01b03861615155b6105965760405163d92e233d60e01b815260040160405180910390fd5b6105a05f87610d24565b506105b85f516020611c095f395f51905f525f610e5a565b6105cf5f516020611c095f395f51905f5288610d24565b50600180546001600160a01b0319166001600160a01b038816179055831561063157845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b5f516020611c095f395f51905f5261065181610bed565b61065a82610ea4565b5050565b5f516020611c095f395f51905f5261067581610bed565b61065a82610eb6565b6001546001600160a01b031633146106a95760405163605919ad60e11b815260040160405180910390fd5b60015460408051630ec0f7cf60e41b815290515f926001600160a01b03169163ec0f7cf09160048083019260209291908290030181865afa1580156106f0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107149190611486565b90505f80610724848601866114a1565b91509150805f03610736575050505050565b6001600160a01b0382166107ba575f836001600160a01b0316826040515f6040518083038185875af1925050503d805f811461078d576040519150601f19603f3d011682016040523d82523d5f602084013e610792565b606091505b50509050806107b457604051635835233d60e11b815260040160405180910390fd5b506107ce565b6107ce6001600160a01b0383168483610ff2565b816001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648260405161080991815260200190565b60405180910390a25050505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6001546040515f91829163485cc95560e01b9161086b9130916001600160a01b0316906024016114cb565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b031990951694909417909352519092505f916108af908201611241565b601f1982820381018352601f9091011660408181526001546313c2a72360e11b835290516001600160a01b03909116916327854e469160048083019260209291908290030181865afa158015610907573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092b9190611486565b8360405160200161093d9291906114e5565b60408051601f198184030181529082905261095b9291602001611540565b604051602081830303815290604052905061097e8482805190602001203061104a565b949350505050565b5f516020611c095f395f51905f5261099d81610bed565b5f5b828110156109db576109d38484838181106109bc576109bc611554565b90506020028101906109ce9190611568565b610ea4565b60010161099f565b50505050565b6001546001600160a01b0316331461049b5760405163605919ad60e11b815260040160405180910390fd5b6001546001600160a01b03163314610a375760405163605919ad60e11b815260040160405180910390fd5b5f5b8181101561044c5760025f848484818110610a5657610a56611554565b9050602002810190610a689190611568565b610a7690602081019061146b565b6001600160a01b0316815260208101919091526040015f205460ff16610aaf5760405163ab2b4fcf60e01b815260040160405180910390fd5b828282818110610ac157610ac1611554565b9050602002810190610ad39190611568565b610ae190602081019061146b565b6001600160a01b0316630968f264848484818110610b0157610b01611554565b9050602002810190610b139190611568565b610b21906020810190611586565b6040518363ffffffff1660e01b8152600401610b3e9291906115f0565b5f604051808303815f87803b158015610b55575f5ffd5b505af1158015610b67573d5f5f3e3d5ffd5b50505050806001019050610a39565b5f516020611c095f395f51905f52610b8d81610bed565b815f805b82811015610be557610bba868683818110610bae57610bae611554565b90506020020135610bfa565b6040519092506001600160a01b038316905f516020611be95f395f51905f52905f90a2600101610b91565b505050505050565b610bf781336110bb565b50565b6001546040515f91829163485cc95560e01b91610c259130916001600160a01b0316906024016114cb565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b03199095169490941790935260015481516313c2a72360e11b815291519294505f9387936001600160a01b03909216926327854e4692600480830193928290030181865afa158015610ca0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cc49190611486565b83604051610cd190611241565b610cdc9291906114e5565b8190604051809103905ff5905080158015610cf9573d5f5f3e3d5ffd5b506001600160a01b0381165f908152600260205260409020805460ff19166001179055949350505050565b5f610d2f8383610818565b610dac575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055610d643390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016103c5565b505f6103c5565b5f5b8181101561044c57610de9838383818110610dd257610dd2611554565b9050602002810190610de49190611603565b610eb6565b600101610db5565b5f610dfc8383610818565b15610dac575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016103c5565b5f82815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b610ead816110ef565b610bf781611138565b5f610ec4602083018361146b565b6001600160a01b031603610eeb5760405163416aebb560e11b815260040160405180910390fd5b5f80610efa602084018461146b565b6001600160a01b03166020840135610f156040860186611586565b604051610f23929190611617565b5f6040518083038185875af1925050503d805f8114610f5d576040519150601f19603f3d011682016040523d82523d5f602084013e610f62565b606091505b509150915081610f9557805115610f7c5780518082602001fd5b6040516317f2c34560e31b815260040160405180910390fd5b7fc4a3a884c4ef135e1313c37cfe406c1857a2934a4f4539659246268bb71b1f3a610fc3602085018561146b565b610fd06040860186611586565b8660200135604051610fe59493929190611626565b60405180910390a1505050565b61044c83846001600160a01b031663a9059cbb858560405160240161101892919061165b565b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506111c3565b5f611053611226565b1561108857604051836040820152846020820152828152600b8101905060418153605590206001600160a01b031690506110b4565b604051836040820152846020820152828152600b8101905060ff8153605590206001600160a01b031690505b9392505050565b6110c58282610818565b61065a57808260405163e2517d3f60e01b81526004016110e692919061165b565b60405180910390fd5b60025f6110ff602084018461146b565b6001600160a01b0316815260208101919091526040015f205460ff16610bf75760405163ab2b4fcf60e01b815260040160405180910390fd5b5f80611147602084018461146b565b6001600160a01b031661115d6020850185611586565b60405161116b929190611617565b5f604051808303815f865af19150503d805f81146111a4576040519150601f19603f3d011682016040523d82523d5f602084013e6111a9565b606091505b50915091508161044c57805115610f7c5780518082602001fd5b5f5f60205f8451602086015f885af1806111e2576040513d5f823e3d81fd5b50505f513d915081156111f9578060011415611206565b6001600160a01b0384163b155b156109db5783604051635274afe760e01b81526004016110e6919061128c565b5f46632b6653dc148061123c57504663cd8690dc145b905090565b6105748061167583390190565b5f6020828403121561125e575f5ffd5b81356001600160e01b0319811681146110b4575f5ffd5b5f60208284031215611285575f5ffd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114610bf7575f5ffd5b5f5f604083850312156112c5575f5ffd5b8235915060208301356112d7816112a0565b809150509250929050565b5f5f83601f8401126112f2575f5ffd5b5081356001600160401b03811115611308575f5ffd5b6020830191508360208260051b8501011115611322575f5ffd5b9250929050565b5f5f6020838503121561133a575f5ffd5b82356001600160401b0381111561134f575f5ffd5b61135b858286016112e2565b90969095509350505050565b5f5f60408385031215611378575f5ffd5b8235611383816112a0565b915060208301356112d7816112a0565b5f602082840312156113a3575f5ffd5b81356001600160401b038111156113b8575f5ffd5b8201604081850312156110b4575f5ffd5b5f602082840312156113d9575f5ffd5b81356001600160401b038111156113ee575f5ffd5b8201606081850312156110b4575f5ffd5b5f5f60208385031215611410575f5ffd5b82356001600160401b03811115611425575f5ffd5b8301601f81018513611435575f5ffd5b80356001600160401b0381111561144a575f5ffd5b85602082840101111561145b575f5ffd5b6020919091019590945092505050565b5f6020828403121561147b575f5ffd5b81356110b4816112a0565b5f60208284031215611496575f5ffd5b81516110b4816112a0565b5f5f604083850312156114b2575f5ffd5b82356114bd816112a0565b946020939093013593505050565b6001600160a01b0392831681529116602082015260400190565b60018060a01b0383168152604060208201525f82518060408401528060208501606085015e5f606082850101526060601f19601f8301168401019150509392505050565b5f81518060208401855e5f93019283525090919050565b5f61097e61154e8386611529565b84611529565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e1983360301811261157c575f5ffd5b9190910192915050565b5f5f8335601e1984360301811261159b575f5ffd5b8301803591506001600160401b038211156115b4575f5ffd5b602001915036819003821315611322575f5ffd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f61097e6020830184866115c8565b5f8235605e1983360301811261157c575f5ffd5b818382375f9101908152919050565b6001600160a01b03851681526060602082018190525f9061164a90830185876115c8565b905082604083015295945050505050565b6001600160a01b0392909216825260208201526040019056fe60a06040526040516105743803806105748339810160408190526100229161033d565b61002c828261003e565b506001600160a01b0316608052610442565b610047826100fb565b6040516001600160a01b038316907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e905f90a28051156100ef576100ea826001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e491906103ff565b826101fb565b505050565b6100f761026e565b5050565b806001600160a01b03163b5f036101305780604051631933b43b60e21b81526004016101279190610418565b60405180910390fd5b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392831617905560408051635c60da1b60e01b815290515f92841691635c60da1b9160048083019260209291908290030181865afa1580156101a9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cd91906103ff565b9050806001600160a01b03163b5f036100f75780604051634c9c8ce360e01b81526004016101279190610418565b60605f5f846001600160a01b031684604051610217919061042c565b5f60405180830381855af49150503d805f811461024f576040519150601f19603f3d011682016040523d82523d5f602084013e610254565b606091505b50909250905061026585838361028f565b95945050505050565b341561028d5760405163b398979f60e01b815260040160405180910390fd5b565b6060826102a45761029f826102e5565b6102de565b81511580156102bb57506001600160a01b0384163b155b156102db5783604051639996b31560e01b81526004016101279190610418565b50805b9392505050565b8051156102f55780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80516001600160a01b0381168114610324575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561034e575f5ffd5b6103578361030e565b60208401519092506001600160401b03811115610372575f5ffd5b8301601f81018513610382575f5ffd5b80516001600160401b0381111561039b5761039b610329565b604051601f8201601f19908116603f011681016001600160401b03811182821017156103c9576103c9610329565b6040528181528282016020018710156103e0575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b5f6020828403121561040f575f5ffd5b6102de8261030e565b6001600160a01b0391909116815260200190565b5f82518060208501845e5f920191825250919050565b60805161011b6104595f395f601d015261011b5ff3fe6080604052600a600c565b005b60186014601a565b609d565b565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156076573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906098919060ba565b905090565b365f5f375f5f365f845af43d5f5f3e80801560b6573d5ff35b3d5ffd5b5f6020828403121560c9575f5ffd5b81516001600160a01b038116811460de575f5ffd5b939250505056fea2646970667358221220a4dde2fec3c944d067fa2e5e0e7d511baed62fdf2de1a5a802efd0554afa1ba864736f6c634300081c0033d45d993e8218db32a9aab497e5559fbbebbf9947f314ff03e4d5b5146a8928bed8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63a26469706673582212202c97e3a5c84e6aaee960854aa8ea8bbefc868676b21d79d1d7a674011dc270ca64736f6c634300081c00336080604052348015600e575f5ffd5b5060015f55610b30806100205f395ff3fe60806040526004361061006d575f3560e01c80630968f2641461007857806321e69b251461009957806334fcd5be146100b8578063481c6a75146100cb578063485cc9551461010057806354fd4d501461011f5780635c1c6dcd14610152578063a65d69d414610165575f5ffd5b3661007457005b5f5ffd5b348015610083575f5ffd5b5061009761009236600461082c565b610184565b005b3480156100a4575f5ffd5b506100976100b33660046108ac565b610331565b6100976100c63660046108ce565b6103cc565b3480156100d6575f5ffd5b506002546100ea906001600160a01b031681565b6040516100f7919061092d565b60405180910390f35b34801561010b575f5ffd5b5061009761011a366004610941565b610409565b34801561012a575f5ffd5b5060408051808201825260058152640312e302e360dc1b602082015290516100f79190610978565b6100976101603660046109ad565b610579565b348015610170575f5ffd5b506001546100ea906001600160a01b031681565b6001546001600160a01b031633146101af576040516301048f7b60e71b815260040160405180910390fd5b6101b76105c1565b60025460408051630ec0f7cf60e41b815290515f926001600160a01b03169163ec0f7cf09160048083019260209291908290030181865afa1580156101fe573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022291906109e3565b90505f80610232848601866109fe565b91509150805f0361024557505050610324565b6001600160a01b0382166102c9575f836001600160a01b0316826040515f6040518083038185875af1925050503d805f811461029c576040519150601f19603f3d011682016040523d82523d5f602084013e6102a1565b606091505b50509050806102c357604051635835233d60e11b815260040160405180910390fd5b506102dd565b6102dd6001600160a01b03831684836105e9565b816001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648260405161031891815260200190565b60405180910390a25050505b61032d60015f55565b5050565b6002546001600160a01b0316331461035c5760405163605919ad60e11b815260040160405180910390fd5b6001600160a01b0381166103835760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517fe6740ae343e8d56af11dca8c372fc6a106dea439f74b7ac9b9f60849eb639479905f90a250565b6001546001600160a01b031633146103f7576040516301048f7b60e71b815260040160405180910390fd5b6103ff6105c1565b6103248282610640565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f8115801561044d5750825b90505f826001600160401b031660011480156104685750303b155b905081158015610476575080155b156104945760405163f92ee8a960e01b815260040160405180910390fd5b84546001600160401b031916600117855583156104bd57845460ff60401b1916600160401b1785555b6001600160a01b038716158015906104dd57506001600160a01b03861615155b6104fa5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b03808a166001600160a01b0319928316179092556002805492891692909116919091179055831561057057845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b6001546001600160a01b031633146105a4576040516301048f7b60e71b815260040160405180910390fd5b6105ac6105c1565b6105b58161067e565b6105be60015f55565b50565b60025f54036105e357604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261063b9084906107ba565b505050565b5f5b8181101561063b5761067683838381811061065f5761065f610a28565b90506020028101906106719190610a3c565b61067e565b600101610642565b5f61068c60208301836108ac565b6001600160a01b0316036106b35760405163416aebb560e11b815260040160405180910390fd5b5f806106c260208401846108ac565b6001600160a01b031660208401356106dd6040860186610a5a565b6040516106eb929190610aa3565b5f6040518083038185875af1925050503d805f8114610725576040519150601f19603f3d011682016040523d82523d5f602084013e61072a565b606091505b50915091508161075d578051156107445780518082602001fd5b6040516317f2c34560e31b815260040160405180910390fd5b7fc4a3a884c4ef135e1313c37cfe406c1857a2934a4f4539659246268bb71b1f3a61078b60208501856108ac565b6107986040860186610a5a565b86602001356040516107ad9493929190610ab2565b60405180910390a1505050565b5f5f60205f8451602086015f885af1806107d9576040513d5f823e3d81fd5b50505f513d915081156107f05780600114156107fd565b6001600160a01b0384163b155b156108265783604051635274afe760e01b815260040161081d919061092d565b60405180910390fd5b50505050565b5f5f6020838503121561083d575f5ffd5b82356001600160401b03811115610852575f5ffd5b8301601f81018513610862575f5ffd5b80356001600160401b03811115610877575f5ffd5b856020828401011115610888575f5ffd5b6020919091019590945092505050565b6001600160a01b03811681146105be575f5ffd5b5f602082840312156108bc575f5ffd5b81356108c781610898565b9392505050565b5f5f602083850312156108df575f5ffd5b82356001600160401b038111156108f4575f5ffd5b8301601f81018513610904575f5ffd5b80356001600160401b03811115610919575f5ffd5b8560208260051b8401011115610888575f5ffd5b6001600160a01b0391909116815260200190565b5f5f60408385031215610952575f5ffd5b823561095d81610898565b9150602083013561096d81610898565b809150509250929050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f602082840312156109bd575f5ffd5b81356001600160401b038111156109d2575f5ffd5b8201606081850312156108c7575f5ffd5b5f602082840312156109f3575f5ffd5b81516108c781610898565b5f5f60408385031215610a0f575f5ffd5b8235610a1a81610898565b946020939093013593505050565b634e487b7160e01b5f52603260045260245ffd5b5f8235605e19833603018112610a50575f5ffd5b9190910192915050565b5f5f8335601e19843603018112610a6f575f5ffd5b8301803591506001600160401b03821115610a88575f5ffd5b602001915036819003821315610a9c575f5ffd5b9250929050565b818382375f9101908152919050565b6001600160a01b03851681526060602082018190528101839052828460808301375f608084830101525f6080601f19601f86011683010190508260408301529594505050505056fea26469706673582212203471b67e7ccd4d326c664f5c324a5ea97ba3f5c389e792d9a5cdeffdbe9f67c764736f6c634300081c0033608060405234801561000f575f5ffd5b5060405161044538038061044583398101604081905261002e9161015a565b806001600160a01b038116610061575f604051631e4fbdf760e01b8152600401610058919061018b565b60405180910390fd5b61006a8161007b565b50610074826100ca565b505061019f565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b5f036100f6578060405163211eb15960e21b8152600401610058919061018b565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b80516001600160a01b0381168114610155575f5ffd5b919050565b5f5f6040838503121561016b575f5ffd5b6101748361013f565b91506101826020840161013f565b90509250929050565b6001600160a01b0391909116815260200190565b610299806101ac5f395ff3fe608060405234801561000f575f5ffd5b5060043610610055575f3560e01c80633659cfe6146100595780635c60da1b1461006e578063715018a6146100915780638da5cb5b14610099578063f2fde38b146100a1575b5f5ffd5b61006c610067366004610222565b6100b4565b005b6001546001600160a01b03165b604051610088919061024f565b60405180910390f35b61006c6100c8565b61007b6100db565b61006c6100af366004610222565b6100e9565b6100bc61012c565b6100c58161015e565b50565b6100d061012c565b6100d95f6101d3565b565b5f546001600160a01b031690565b6100f161012c565b6001600160a01b038116610123575f604051631e4fbdf760e01b815260040161011a919061024f565b60405180910390fd5b6100c5816101d3565b336101356100db565b6001600160a01b0316146100d9573360405163118cdaa760e01b815260040161011a919061024f565b806001600160a01b03163b5f0361018a578060405163211eb15960e21b815260040161011a919061024f565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f60208284031215610232575f5ffd5b81356001600160a01b0381168114610248575f5ffd5b9392505050565b6001600160a01b039190911681526020019056fea264697066735822122027ebacbab2c49b79cebd90a6ec4427ff5594c289f3f7d09601082791e74f824d64736f6c634300081c00332dca0f5ce7e75a4b43fe2b0d6f5d0b7a2bf92ecf89f8f0aa17b8308b67038821fc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184c000000000000000000000000068ce64a52ac261a3eb5fa37c8024e757e9cb204000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000bed752efeefd09f86414d5934acb94503b5a14fa00000000000000000000000000000000000000000000000000000000000000020000000000000000000000005dfd498468dad9768470a71966f578016f3f6ee80000000000000000000000008352b2763b8b8f0e07c0fea1675519bd4be44cb800000000000000000000000000000000000000000000000000000000000000020000000000000000000000007d08981c44b12cc87f0b3072496651f4862daff500000000000000000000000028f751c9cf453866f52b7cea778f6e98240c629b
Deployed Bytecode
0x608060405260043610610154575f3560e01c806301ffc9a71461015f57806319cd6b2a146101935780631b1fce55146101bf5780632069394b146101f25780632464404014610220578063248a9ca31461024157806325ff57cc1461026e57806327854e461461028d5780632a0827ab146102bf5780632f2ff15d146102de57806336568abe146102fd5780633b3b23171461031c578063478222c21461033b57806362a2a47c1461035a5780636735c6771461037a5780636e01fe82146103ac5780636fbd0908146103cb5780637c5475b7146103ea57806391d1485414610409578063a217fddf14610428578063a72d0d221461043b578063bb235cd01461044f578063c1f8bcf814610463578063c80a1ee114610482578063d547741f146104b5578063dcbbdc48146104d4578063ec0f7cf0146104f3578063ecd0026114610510578063f99e41dc14610530575f5ffd5b3661015b57005b5f5ffd5b34801561016a575f5ffd5b5061017e6101793660046114a9565b61054f565b60405190151581526020015b60405180910390f35b34801561019e575f5ffd5b506101b26101ad3660046114e4565b610585565b60405161018a919061150e565b3480156101ca575f5ffd5b506101b27f00000000000000000000000025f9ffd59237816d5ea2c6bd15c05b87da9cb11f81565b3480156101fd575f5ffd5b5061017e61020c366004611522565b60026020525f908152604090205460ff1681565b34801561022b575f5ffd5b5061023f61023a366004611522565b610675565b005b34801561024c575f5ffd5b5061026061025b36600461153d565b6106fd565b60405190815260200161018a565b348015610279575f5ffd5b5061023f61028836600461159b565b610711565b348015610298575f5ffd5b507f00000000000000000000000025f9ffd59237816d5ea2c6bd15c05b87da9cb11f6101b2565b3480156102ca575f5ffd5b5061023f6102d93660046115d9565b61086d565b3480156102e9575f5ffd5b5061023f6102f8366004611610565b610926565b348015610308575f5ffd5b5061023f610317366004611610565b610942565b348015610327575f5ffd5b506101b26103363660046114e4565b61097a565b348015610346575f5ffd5b506001546101b2906001600160a01b031681565b348015610365575f5ffd5b506102605f516020611f0a5f395f51905f5281565b348015610385575f5ffd5b507f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac20296101b2565b3480156103b7575f5ffd5b5061023f6103c6366004611522565b610ad5565b3480156103d6575f5ffd5b5061023f6103e5366004611633565b610c9c565b3480156103f5575f5ffd5b5061023f6104043660046116b0565b610da9565b348015610414575f5ffd5b5061017e610423366004611610565b610e4c565b348015610433575f5ffd5b506102605f81565b348015610446575f5ffd5b506101b2610e74565b34801561045a575f5ffd5b506101b2610efa565b34801561046e575f5ffd5b5061023f61047d366004611522565b610f57565b34801561048d575f5ffd5b506101b27f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac202981565b3480156104c0575f5ffd5b5061023f6104cf366004611610565b611111565b3480156104df575f5ffd5b5061023f6104ee3660046116b0565b61112d565b3480156104fe575f5ffd5b506001546001600160a01b03166101b2565b34801561051b575f5ffd5b506102605f516020611f2a5f395f51905f5281565b34801561053b575f5ffd5b5061023f61054a3660046116e4565b61119d565b5f6001600160e01b03198216637965db0b60e01b148061057f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f5f63485cc95560e01b84306040516024016105a2929190611734565b60408051601f19818403018152918152602080830180516001600160e01b03166001600160e01b031990951694909417909352519092505f916105e690820161149c565b601f1982820381018352601f90910116604081905261062b907f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac202990859060200161174e565b60408051601f198184030181529082905261064992916020016117a9565b604051602081830303815290604052905061066c8482805190602001203061121a565b95945050505050565b5f61067f8161128b565b6001600160a01b0382166106a65760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0384161790556040517f6b1a1e7bac1ff3060cc80f286bd9d678e0bbc046c2d46c439444c3562c1abe5a906106f190849061150e565b60405180910390a15050565b5f9081526020819052604090206001015490565b5f516020611f0a5f395f51905f526107288161128b565b5f5b828110156108675760025f858584818110610747576107476117c5565b905060200281019061075991906117d9565b610767906020810190611522565b6001600160a01b0316815260208101919091526040015f205460ff166107a05760405163a763fe3160e01b815260040160405180910390fd5b8383828181106107b2576107b26117c5565b90506020028101906107c491906117d9565b6107d2906020810190611522565b6001600160a01b031663738281988585848181106107f2576107f26117c5565b905060200281019061080491906117d9565b6108129060208101906117f7565b6040518363ffffffff1660e01b815260040161082f929190611861565b5f604051808303815f87803b158015610846575f5ffd5b505af1158015610858573d5f5f3e3d5ffd5b5050505080600101905061072a565b50505050565b5f6108778161128b565b826001600160a01b03163b5f036108a15760405163340aafcd60e11b815260040160405180910390fd5b6001600160a01b0382166108c85760405163d92e233d60e01b815260040160405180910390fd5b6040516321e69b2560e01b81526001600160a01b038416906321e69b25906108f490859060040161150e565b5f604051808303815f87803b15801561090b575f5ffd5b505af115801561091d573d5f5f3e3d5ffd5b50505050505050565b61092f826106fd565b6109388161128b565b6108678383611298565b6001600160a01b038116331461096b5760405163334bd91960e11b815260040160405180910390fd5b6109758282611327565b505050565b5f5f516020611f2a5f395f51905f526109928161128b565b6001600160a01b0384166109b95760405163d92e233d60e01b815260040160405180910390fd5b5f63485cc95560e01b85306040516024016109d5929190611734565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050837f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac202982604051610a399061149c565b610a4492919061174e565b8190604051809103905ff5905080158015610a61573d5f5f3e3d5ffd5b506001600160a01b038181165f81815260026020908152604091829020805460ff1916600117905581519283523390830152918816918101919091529093507f14fdd5ec6e81153bc3040b2d148e7ecac0472aeab700cc3e3734d211781f362a9060600160405180910390a1505092915050565b5f610adf8161128b565b6001600160a01b038216610b065760405163d92e233d60e01b815260040160405180910390fd5b5f7f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac20296001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b63573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b879190611874565b9050826001600160a01b0316816001600160a01b031603610bbb57604051634c3b76bf60e01b815260040160405180910390fd5b826001600160a01b03163b5f03610be55760405163340aafcd60e11b815260040160405180910390fd5b604051631b2ce7f360e11b81526001600160a01b037f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac20291690633659cfe690610c3190869060040161150e565b5f604051808303815f87803b158015610c48575f5ffd5b505af1158015610c5a573d5f5f3e3d5ffd5b505050507f4f4dd0e863add7feab296c2a5a63a9e8f13dc8f248d7294d4fde3b619d2424a88184604051610c8f929190611734565b60405180910390a1505050565b5f610ca68161128b565b5f80610cb4858701876114e4565b91509150805f03610cc6575050610867565b6001600160a01b038216610d4a575f846001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610d1d576040519150601f19603f3d011682016040523d82523d5f602084013e610d22565b606091505b5050905080610d4457604051635835233d60e11b815260040160405180910390fd5b50610d5e565b610d5e6001600160a01b0383168583611390565b816001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436482604051610d9991815260200190565b60405180910390a2505050505050565b5f610db38161128b565b6001600160a01b0384165f9081526002602052604090205460ff16610deb5760405163a763fe3160e01b815260040160405180910390fd5b60405163d547741f60e01b81526001600160a01b0385169063d547741f90610e19908690869060040161188f565b5f604051808303815f87803b158015610e30575f5ffd5b505af1158015610e42573d5f5f3e3d5ffd5b5050505050505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f7f00000000000000000000000025f9ffd59237816d5ea2c6bd15c05b87da9cb11f6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef59190611874565b905090565b5f7f00000000000000000000000083f5c1d2bfa8f3662eaa2458ead660f770ac20296001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed1573d5f5f3e3d5ffd5b5f610f618161128b565b6001600160a01b038216610f885760405163d92e233d60e01b815260040160405180910390fd5b5f7f00000000000000000000000025f9ffd59237816d5ea2c6bd15c05b87da9cb11f6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fe5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110099190611874565b9050826001600160a01b0316816001600160a01b03160361103d57604051634c3b76bf60e01b815260040160405180910390fd5b826001600160a01b03163b5f036110675760405163340aafcd60e11b815260040160405180910390fd5b604051631b2ce7f360e11b81526001600160a01b037f00000000000000000000000025f9ffd59237816d5ea2c6bd15c05b87da9cb11f1690633659cfe6906110b390869060040161150e565b5f604051808303815f87803b1580156110ca575f5ffd5b505af11580156110dc573d5f5f3e3d5ffd5b505050507fea957207b62d349ae45d867accaa0b1f19140e761104ef6318a92f4c712a94f78184604051610c8f929190611734565b61111a826106fd565b6111238161128b565b6108678383611327565b5f6111378161128b565b6001600160a01b0384165f9081526002602052604090205460ff1661116f5760405163a763fe3160e01b815260040160405180910390fd5b604051632f2ff15d60e01b81526001600160a01b03851690632f2ff15d90610e19908690869060040161188f565b5f516020611f0a5f395f51905f526111b48161128b565b6001600160a01b0384165f9081526002602052604090205460ff166111ec5760405163a763fe3160e01b815260040160405180910390fd5b60405163ede0c27960e01b81526001600160a01b0385169063ede0c27990610e1990869086906004016118a6565b5f6112236113e8565b1561125857604051836040820152846020820152828152600b8101905060418153605590206001600160a01b03169050611284565b604051836040820152846020820152828152600b8101905060ff8153605590206001600160a01b031690505b9392505050565b6112958133611401565b50565b5f6112a38383610e4c565b611320575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556112d83390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161057f565b505f61057f565b5f6113328383610e4c565b15611320575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161057f565b61097583846001600160a01b031663a9059cbb85856040516024016113b692919061197c565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611439565b5f46632b6653dc1480610ef557505063cd8690dc461490565b61140b8282610e4c565b61143557808260405163e2517d3f60e01b815260040161142c92919061197c565b60405180910390fd5b5050565b5f5f60205f8451602086015f885af180611458576040513d5f823e3d81fd5b50505f513d9150811561146f57806001141561147c565b6001600160a01b0384163b155b156108675783604051635274afe760e01b815260040161142c919061150e565b6105748061199683390190565b5f602082840312156114b9575f5ffd5b81356001600160e01b031981168114611284575f5ffd5b6001600160a01b0381168114611295575f5ffd5b5f5f604083850312156114f5575f5ffd5b8235611500816114d0565b946020939093013593505050565b6001600160a01b0391909116815260200190565b5f60208284031215611532575f5ffd5b8135611284816114d0565b5f6020828403121561154d575f5ffd5b5035919050565b5f5f83601f840112611564575f5ffd5b5081356001600160401b0381111561157a575f5ffd5b6020830191508360208260051b8501011115611594575f5ffd5b9250929050565b5f5f602083850312156115ac575f5ffd5b82356001600160401b038111156115c1575f5ffd5b6115cd85828601611554565b90969095509350505050565b5f5f604083850312156115ea575f5ffd5b82356115f5816114d0565b91506020830135611605816114d0565b809150509250929050565b5f5f60408385031215611621575f5ffd5b823591506020830135611605816114d0565b5f5f5f60408486031215611645575f5ffd5b83356001600160401b0381111561165a575f5ffd5b8401601f8101861361166a575f5ffd5b80356001600160401b0381111561167f575f5ffd5b866020828401011115611690575f5ffd5b6020918201945092508401356116a5816114d0565b809150509250925092565b5f5f5f606084860312156116c2575f5ffd5b83356116cd816114d0565b92506020840135915060408401356116a5816114d0565b5f5f5f604084860312156116f6575f5ffd5b8335611701816114d0565b925060208401356001600160401b0381111561171b575f5ffd5b61172786828701611554565b9497909650939450505050565b6001600160a01b0392831681529116602082015260400190565b60018060a01b0383168152604060208201525f82518060408401528060208501606085015e5f606082850101526060601f19601f8301168401019150509392505050565b5f81518060208401855e5f93019283525090919050565b5f6117bd6117b78386611792565b84611792565b949350505050565b634e487b7160e01b5f52603260045260245ffd5b5f8235603e198336030181126117ed575f5ffd5b9190910192915050565b5f5f8335601e1984360301811261180c575f5ffd5b8301803591506001600160401b03821115611825575f5ffd5b602001915036819003821315611594575f5ffd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f6117bd602083018486611839565b5f60208284031215611884575f5ffd5b8151611284816114d0565b9182526001600160a01b0316602082015260400190565b602080825281018290525f6040600584901b830181019083018583603e1936839003015b8782101561196f57868503603f1901845282358181126118e8575f5ffd5b890180356118f5816114d0565b6001600160a01b03168652602081013536829003601e19018112611917575f5ffd5b016020810190356001600160401b03811115611931575f5ffd5b80360382131561193f575f5ffd5b60406020880152611954604088018284611839565b965050506020830192506020840193506001820191506118ca565b5092979650505050505050565b6001600160a01b0392909216825260208201526040019056fe60a06040526040516105743803806105748339810160408190526100229161033d565b61002c828261003e565b506001600160a01b0316608052610442565b610047826100fb565b6040516001600160a01b038316907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e905f90a28051156100ef576100ea826001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100e491906103ff565b826101fb565b505050565b6100f761026e565b5050565b806001600160a01b03163b5f036101305780604051631933b43b60e21b81526004016101279190610418565b60405180910390fd5b807fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392831617905560408051635c60da1b60e01b815290515f92841691635c60da1b9160048083019260209291908290030181865afa1580156101a9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cd91906103ff565b9050806001600160a01b03163b5f036100f75780604051634c9c8ce360e01b81526004016101279190610418565b60605f5f846001600160a01b031684604051610217919061042c565b5f60405180830381855af49150503d805f811461024f576040519150601f19603f3d011682016040523d82523d5f602084013e610254565b606091505b50909250905061026585838361028f565b95945050505050565b341561028d5760405163b398979f60e01b815260040160405180910390fd5b565b6060826102a45761029f826102e5565b6102de565b81511580156102bb57506001600160a01b0384163b155b156102db5783604051639996b31560e01b81526004016101279190610418565b50805b9392505050565b8051156102f55780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80516001600160a01b0381168114610324575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561034e575f5ffd5b6103578361030e565b60208401519092506001600160401b03811115610372575f5ffd5b8301601f81018513610382575f5ffd5b80516001600160401b0381111561039b5761039b610329565b604051601f8201601f19908116603f011681016001600160401b03811182821017156103c9576103c9610329565b6040528181528282016020018710156103e0575f5ffd5b8160208401602083015e5f602083830101528093505050509250929050565b5f6020828403121561040f575f5ffd5b6102de8261030e565b6001600160a01b0391909116815260200190565b5f82518060208501845e5f920191825250919050565b60805161011b6104595f395f601d015261011b5ff3fe6080604052600a600c565b005b60186014601a565b609d565b565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156076573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906098919060ba565b905090565b365f5f375f5f365f845af43d5f5f3e80801560b6573d5ff35b3d5ffd5b5f6020828403121560c9575f5ffd5b81516001600160a01b038116811460de575f5ffd5b939250505056fea2646970667358221220a4dde2fec3c944d067fa2e5e0e7d511baed62fdf2de1a5a802efd0554afa1ba864736f6c634300081c00332dca0f5ce7e75a4b43fe2b0d6f5d0b7a2bf92ecf89f8f0aa17b8308b67038821fc425f2263d0df187444b70e47283d622c70181c5baebb1306a01edba1ce184ca2646970667358221220d15f8375dc06f73ef43451046687292c1b3e209b85717066624879cbe84f193464736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000068ce64a52ac261a3eb5fa37c8024e757e9cb204000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000bed752efeefd09f86414d5934acb94503b5a14fa00000000000000000000000000000000000000000000000000000000000000020000000000000000000000005dfd498468dad9768470a71966f578016f3f6ee80000000000000000000000008352b2763b8b8f0e07c0fea1675519bd4be44cb800000000000000000000000000000000000000000000000000000000000000020000000000000000000000007d08981c44b12cc87f0b3072496651f4862daff500000000000000000000000028f751c9cf453866f52b7cea778f6e98240c629b
-----Decoded View---------------
Arg [0] : _defaultAdmin (address): 0x068CE64a52ac261a3eb5fa37c8024E757e9CB204
Arg [1] : _deployers (address[]): 0x5DfD498468DaD9768470A71966F578016f3f6ee8,0x8352B2763b8b8F0E07C0fea1675519Bd4be44CB8
Arg [2] : _feeCollectors (address[]): 0x7d08981c44B12Cc87f0B3072496651f4862daff5,0x28f751c9cf453866F52B7CEa778F6E98240C629b
Arg [3] : _feeVault (address): 0xbED752eFEefd09F86414d5934ACb94503b5A14fa
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000068ce64a52ac261a3eb5fa37c8024e757e9cb204
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 000000000000000000000000bed752efeefd09f86414d5934acb94503b5a14fa
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [5] : 0000000000000000000000005dfd498468dad9768470a71966f578016f3f6ee8
Arg [6] : 0000000000000000000000008352b2763b8b8f0e07c0fea1675519bd4be44cb8
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [8] : 0000000000000000000000007d08981c44b12cc87f0b3072496651f4862daff5
Arg [9] : 00000000000000000000000028f751c9cf453866f52b7cea778f6e98240c629b
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 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.