Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PulseMarket
- Optimization enabled
- true
- Compiler version
- v0.8.18+commit.87f61d96
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2023-08-01T21:46:43.803623Z
Constructor Arguments
0x000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34
Arg [0] (address) : 0xf8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34
contracts/PulseMarket.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;
import "./marketplace/entrypoint/MarketplaceV3.sol";
contract PulseMarket is MarketplaceV3 {
constructor(address _pluginMap) MarketplaceV3(_pluginMap) {
}
}
@thirdweb-dev/contracts/extension/plugin/PermissionsStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @author thirdweb.com
*/
library PermissionsStorage {
bytes32 public constant PERMISSIONS_STORAGE_POSITION = keccak256("permissions.storage");
struct Data {
/// @dev Map from keccak256 hash of a role => a map from address => whether address has role.
mapping(bytes32 => mapping(address => bool)) _hasRole;
/// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}.
mapping(bytes32 => bytes32) _getRoleAdmin;
}
function permissionsStorage() internal pure returns (Data storage permissionsData) {
bytes32 position = PERMISSIONS_STORAGE_POSITION;
assembly {
permissionsData.slot := position
}
}
}
@thirdweb-dev/contracts/marketplace/entrypoint/InitStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
/// @author thirdweb
/**
* @author thirdweb.com
*/
library InitStorage {
/// @dev The location of the storage of the entrypoint contract's data.
bytes32 constant INIT_STORAGE_POSITION = keccak256("init.storage");
/// @dev Layout of the entrypoint contract's storage.
struct Data {
bool initialized;
}
/// @dev Returns the entrypoint contract's data at the relevant storage location.
function initStorage() internal pure returns (Data storage initData) {
bytes32 position = INIT_STORAGE_POSITION;
assembly {
initData.slot := position
}
}
}
contracts/marketplace/entrypoint/MarketplaceV3.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
// $$\ $$\ $$\ $$\ $$\
// $$ | $$ | \__| $$ | $$ |
// $$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$\ $$$$$$\ $$$$$$$\
// \_$$ _| $$ __$$\ $$ |$$ __$$\ $$ __$$ |$$ | $$ | $$ |$$ __$$\ $$ __$$\
// $$ | $$ | $$ |$$ |$$ | \__|$$ / $$ |$$ | $$ | $$ |$$$$$$$$ |$$ | $$ |
// $$ |$$\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ |
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
// ====== External imports ======
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
// ========== Internal imports ==========
import "@thirdweb-dev/contracts/marketplace/entrypoint/InitStorage.sol";
import { RouterImmutable, Router } from "@thirdweb-dev/contracts/extension/plugin/RouterImmutable.sol";
import "@thirdweb-dev/contracts/extension/plugin/ContractMetadataLogic.sol";
import "@thirdweb-dev/contracts/extension/plugin/PlatformFeeLogic.sol";
import "@thirdweb-dev/contracts/extension/plugin/PermissionsEnumerableLogic.sol";
import "@thirdweb-dev/contracts/extension/plugin/ReentrancyGuardLogic.sol";
import "@thirdweb-dev/contracts/extension/plugin/ERC2771ContextUpgradeableLogic.sol";
/**
* @author thirdweb.com
*/
contract MarketplaceV3 is
ContractMetadataLogic,
PlatformFeeLogic,
PermissionsEnumerableLogic,
ReentrancyGuardLogic,
ERC2771ContextUpgradeableLogic,
RouterImmutable,
IERC721Receiver,
IERC1155Receiver
{
/*///////////////////////////////////////////////////////////////
State variables
//////////////////////////////////////////////////////////////*/
bytes32 private constant MODULE_TYPE = bytes32("MarketplaceV3");
uint256 private constant VERSION = 1;
/*///////////////////////////////////////////////////////////////
Constructor + initializer logic
//////////////////////////////////////////////////////////////*/
constructor(address _pluginMap) RouterImmutable(_pluginMap) {}
/// @dev Initiliazes the contract, like a constructor.
function initialize(
address _defaultAdmin,
string memory _contractURI,
address[] memory _trustedForwarders,
address _platformFeeRecipient,
uint16 _platformFeeBps
) external {
InitStorage.Data storage data = InitStorage.initStorage();
require(!data.initialized, "Already initialized.");
data.initialized = true;
// Initialize inherited contracts, most base-like -> most derived.
__ReentrancyGuard_init();
__ERC2771Context_init(_trustedForwarders);
// Initialize this contract's state.
_setupContractURI(_contractURI);
_setupPlatformFeeInfo(_platformFeeRecipient, _platformFeeBps);
_setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
_setupRole(keccak256("LISTER_ROLE"), address(0));
_setupRole(keccak256("ASSET_ROLE"), address(0));
}
/*///////////////////////////////////////////////////////////////
Generic contract logic
//////////////////////////////////////////////////////////////*/
/// @dev Returns the type of the contract.
function contractType() external pure returns (bytes32) {
return MODULE_TYPE;
}
/// @dev Returns the version of the contract.
function contractVersion() external pure returns (uint8) {
return uint8(VERSION);
}
/*///////////////////////////////////////////////////////////////
ERC 165 / 721 / 1155 logic
//////////////////////////////////////////////////////////////*/
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external pure override returns (bytes4) {
return this.onERC721Received.selector;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(Router, IERC165) returns (bool) {
return
interfaceId == type(IERC1155Receiver).interfaceId ||
interfaceId == type(IERC721Receiver).interfaceId ||
super.supportsInterface(interfaceId);
}
/*///////////////////////////////////////////////////////////////
Overridable Permissions
//////////////////////////////////////////////////////////////*/
/// @dev Checks whether platform fee info can be set in the given execution context.
function _canSetPlatformFeeInfo() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
/// @dev Checks whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function _msgSender()
internal
view
override(ERC2771ContextUpgradeableLogic, PermissionsLogic)
returns (address sender)
{
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return msg.sender;
}
}
function _msgData()
internal
view
override(ERC2771ContextUpgradeableLogic, PermissionsLogic)
returns (bytes calldata)
{
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return msg.data;
}
}
}
@thirdweb-dev/contracts/extension/plugin/PermissionsEnumerableLogic.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./PermissionsEnumerableStorage.sol";
import "./PermissionsLogic.sol";
/**
* @author thirdweb.com
*
* @title PermissionsEnumerable
* @dev This contracts provides extending-contracts with role-based access control mechanisms.
* Also provides interfaces to view all members with a given role, and total count of members.
*/
contract PermissionsEnumerableLogic is IPermissionsEnumerable, PermissionsLogic {
/**
* @notice Returns the role-member from a list of members for a role,
* at a given index.
* @dev Returns `member` who has `role`, at `index` of role-members list.
* See struct {RoleMembers}, and mapping {roleMembers}
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param index Index in list of current members for the role.
*
* @return member Address of account that has `role`
*/
function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {
PermissionsEnumerableStorage.Data storage data = PermissionsEnumerableStorage.permissionsEnumerableStorage();
uint256 currentIndex = data.roleMembers[role].index;
uint256 check;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (data.roleMembers[role].members[i] != address(0)) {
if (check == index) {
member = data.roleMembers[role].members[i];
return member;
}
check += 1;
} else if (hasRole(role, address(0)) && i == data.roleMembers[role].indexOf[address(0)]) {
check += 1;
}
}
}
/**
* @notice Returns total number of accounts that have a role.
* @dev Returns `count` of accounts that have `role`.
* See struct {RoleMembers}, and mapping {roleMembers}
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
*
* @return count Total number of accounts that have `role`
*/
function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {
PermissionsEnumerableStorage.Data storage data = PermissionsEnumerableStorage.permissionsEnumerableStorage();
uint256 currentIndex = data.roleMembers[role].index;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (data.roleMembers[role].members[i] != address(0)) {
count += 1;
}
}
if (hasRole(role, address(0))) {
count += 1;
}
}
/// @dev Revokes `role` from `account`, and removes `account` from {roleMembers}
/// See {_removeMember}
function _revokeRole(bytes32 role, address account) internal override {
super._revokeRole(role, account);
_removeMember(role, account);
}
/// @dev Grants `role` to `account`, and adds `account` to {roleMembers}
/// See {_addMember}
function _setupRole(bytes32 role, address account) internal override {
super._setupRole(role, account);
_addMember(role, account);
}
/// @dev adds `account` to {roleMembers}, for `role`
function _addMember(bytes32 role, address account) internal {
PermissionsEnumerableStorage.Data storage data = PermissionsEnumerableStorage.permissionsEnumerableStorage();
uint256 idx = data.roleMembers[role].index;
data.roleMembers[role].index += 1;
data.roleMembers[role].members[idx] = account;
data.roleMembers[role].indexOf[account] = idx;
}
/// @dev removes `account` from {roleMembers}, for `role`
function _removeMember(bytes32 role, address account) internal {
PermissionsEnumerableStorage.Data storage data = PermissionsEnumerableStorage.permissionsEnumerableStorage();
uint256 idx = data.roleMembers[role].indexOf[account];
delete data.roleMembers[role].members[idx];
delete data.roleMembers[role].indexOf[account];
}
}
@thirdweb-dev/contracts/extension/interface/plugin/IPluginMap.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
/// @author thirdweb
interface IPluginMap {
/**
* @notice An interface to describe a plug-in.
*
* @param functionSelector 4-byte function selector.
* @param functionSignature Function representation as a string. E.g. "transfer(address,address,uint256)"
* @param pluginAddress Address of the contract containing the function.
*/
struct Plugin {
bytes4 functionSelector;
string functionSignature;
address pluginAddress;
}
/// @dev Emitted when a function selector is mapped to a particular plug-in smart contract, during construction of Map.
event PluginSet(bytes4 indexed functionSelector, string indexed functionSignature, address indexed pluginAddress);
/// @dev Returns the plug-in contract for a given function.
function getPluginForFunction(bytes4 functionSelector) external view returns (address);
/// @dev Returns all functions that are mapped to the given plug-in contract.
function getAllFunctionsOfPlugin(address pluginAddress) external view returns (bytes4[] memory);
/// @dev Returns all plug-ins known by Map.
function getAllPlugins() external view returns (Plugin[] memory);
}
@thirdweb-dev/contracts/extension/plugin/PermissionsLogic.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../../extension/interface/IPermissions.sol";
import "./PermissionsStorage.sol";
import "../../lib/TWStrings.sol";
/**
* @author thirdweb.com
*
* @title Permissions
* @dev This contracts provides extending-contracts with role-based access control mechanisms
*/
contract PermissionsLogic is IPermissions {
/// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles.
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @dev Modifier that checks if an account has the specified role; reverts otherwise.
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @notice Checks whether an account has a particular role.
* @dev Returns `true` if `account` has been granted `role`.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param account Address of the account for which the role is being checked.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
return data._hasRole[role][account];
}
/**
* @notice Checks whether an account has a particular role;
* role restrictions can be swtiched on and off.
*
* @dev Returns `true` if `account` has been granted `role`.
* Role restrictions can be swtiched on and off:
* - If address(0) has ROLE, then the ROLE restrictions
* don't apply.
* - If address(0) does not have ROLE, then the ROLE
* restrictions will apply.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param account Address of the account for which the role is being checked.
*/
function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][address(0)]) {
return data._hasRole[role][account];
}
return true;
}
/**
* @notice Returns the admin role that controls the specified role.
* @dev See {grantRole} and {revokeRole}.
* To change a role's admin, use {_setRoleAdmin}.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
*/
function getRoleAdmin(bytes32 role) external view override returns (bytes32) {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
return data._getRoleAdmin[role];
}
/**
* @notice Grants a role to an account, if not previously granted.
* @dev Caller must have admin role for the `role`.
* Emits {RoleGranted Event}.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param account Address of the account to which the role is being granted.
*/
function grantRole(bytes32 role, address account) public virtual override {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
_checkRole(data._getRoleAdmin[role], _msgSender());
if (data._hasRole[role][account]) {
revert("Can only grant to non holders");
}
_setupRole(role, account);
}
/**
* @notice Revokes role from an account.
* @dev Caller must have admin role for the `role`.
* Emits {RoleRevoked Event}.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param account Address of the account from which the role is being revoked.
*/
function revokeRole(bytes32 role, address account) public virtual override {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
_checkRole(data._getRoleAdmin[role], _msgSender());
_revokeRole(role, account);
}
/**
* @notice Revokes role from the account.
* @dev Caller must have the `role`, with caller being the same as `account`.
* Emits {RoleRevoked Event}.
*
* @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
* @param account Address of the account from which the role is being revoked.
*/
function renounceRole(bytes32 role, address account) public virtual override {
if (_msgSender() != account) {
revert("Can only renounce for self");
}
_revokeRole(role, account);
}
/// @dev Sets `adminRole` as `role`'s admin role.
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
bytes32 previousAdminRole = data._getRoleAdmin[role];
data._getRoleAdmin[role] = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/// @dev Sets up `role` for `account`
function _setupRole(bytes32 role, address account) internal virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
data._hasRole[role][account] = true;
emit RoleGranted(role, account, _msgSender());
}
/// @dev Revokes `role` from `account`
function _revokeRole(bytes32 role, address account) internal virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
_checkRole(role, account);
delete data._hasRole[role][account];
emit RoleRevoked(role, account, _msgSender());
}
/// @dev Checks `role` for `account`. Reverts with a message including the required role.
function _checkRole(bytes32 role, address account) internal view virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
/// @dev Checks `role` for `account`. Reverts with a message including the required role.
function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {
if (!hasRoleWithSwitch(role, account)) {
revert(
string(
abi.encodePacked(
"Permissions: account ",
TWStrings.toHexString(uint160(account), 20),
" is missing role ",
TWStrings.toHexString(uint256(role), 32)
)
)
);
}
}
function _msgSender() internal view virtual returns (address sender) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
@thirdweb-dev/contracts/extension/interface/IContractMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
* for you contract.
*
* Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
*/
interface IContractMetadata {
/// @dev Returns the metadata URI of the contract.
function contractURI() external view returns (string memory);
/**
* @dev Sets contract URI for the storefront-level metadata of the contract.
* Only module admin can call this function.
*/
function setContractURI(string calldata _uri) external;
/// @dev Emitted when the contract URI is updated.
event ContractURIUpdated(string prevURI, string newURI);
}
@thirdweb-dev/contracts/extension/plugin/ReentrancyGuardStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
library ReentrancyGuardStorage {
bytes32 public constant REENTRANCY_GUARD_STORAGE_POSITION = keccak256("reentrancy.guard.storage");
struct Data {
uint256 _status;
}
function reentrancyGuardStorage() internal pure returns (Data storage reentrancyGuardData) {
bytes32 position = REENTRANCY_GUARD_STORAGE_POSITION;
assembly {
reentrancyGuardData.slot := position
}
}
}
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
@thirdweb-dev/contracts/extension/Multicall.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../lib/TWAddress.sol";
import "./interface/IMulticall.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
contract Multicall is IMulticall {
/**
* @notice Receives and executes a batch of function calls on this contract.
* @dev Receives and executes a batch of function calls on this contract.
*
* @param data The bytes data that makes up the batch of function calls to execute.
* @return results The bytes data that makes up the result of the batch of function calls executed.
*/
function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = TWAddress.functionDelegateCall(address(this), data[i]);
}
return results;
}
}
@thirdweb-dev/contracts/extension/plugin/ReentrancyGuardLogic.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./ReentrancyGuardStorage.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardLogic {
// 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;
function __ReentrancyGuard_init() internal {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal {
ReentrancyGuardStorage.Data storage data = ReentrancyGuardStorage.reentrancyGuardStorage();
data._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() {
ReentrancyGuardStorage.Data storage data = ReentrancyGuardStorage.reentrancyGuardStorage();
// On the first call to nonReentrant, _notEntered will be true
require(data._status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
data._status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
data._status = _NOT_ENTERED;
}
}
@thirdweb-dev/contracts/extension/plugin/ContractMetadataLogic.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./ContractMetadataStorage.sol";
import "../../extension/interface/IContractMetadata.sol";
/**
* @author thirdweb.com
*
* @title Contract Metadata
* @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
* for you contract.
* Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
*/
abstract contract ContractMetadataLogic is IContractMetadata {
/// @dev Returns the metadata URI of the contract.
function contractURI() public view returns (string memory) {
ContractMetadataStorage.Data storage data = ContractMetadataStorage.contractMetadataStorage();
return data.contractURI;
}
/**
* @notice Lets a contract admin set the URI for contract-level metadata.
* @dev Caller should be authorized to setup contractURI, e.g. contract admin.
* See {_canSetContractURI}.
* Emits {ContractURIUpdated Event}.
*
* @param _uri keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
*/
function setContractURI(string memory _uri) external override {
if (!_canSetContractURI()) {
revert("Not authorized");
}
_setupContractURI(_uri);
}
/// @dev Lets a contract admin set the URI for contract-level metadata.
function _setupContractURI(string memory _uri) internal {
ContractMetadataStorage.Data storage data = ContractMetadataStorage.contractMetadataStorage();
string memory prevURI = data.contractURI;
data.contractURI = _uri;
emit ContractURIUpdated(prevURI, _uri);
}
/// @dev Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view virtual returns (bool);
}
@thirdweb-dev/contracts/extension/plugin/ERC2771ContextStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
library ERC2771ContextStorage {
bytes32 public constant ERC2771_CONTEXT_STORAGE_POSITION = keccak256("erc2771.context.storage");
struct Data {
mapping(address => bool) _trustedForwarder;
}
function erc2771ContextStorage() internal pure returns (Data storage erc2771ContextData) {
bytes32 position = ERC2771_CONTEXT_STORAGE_POSITION;
assembly {
erc2771ContextData.slot := position
}
}
}
@thirdweb-dev/contracts/extension/plugin/PlatformFeeLogic.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./PlatformFeeStorage.sol";
import "../../extension/interface/IPlatformFee.sol";
/**
* @author thirdweb.com
*
* @title Platform Fee
* @notice Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about platform fees, if desired.
*/
abstract contract PlatformFeeLogic is IPlatformFee {
/// @dev Returns the platform fee recipient and bps.
function getPlatformFeeInfo() public view override returns (address, uint16) {
PlatformFeeStorage.Data storage data = PlatformFeeStorage.platformFeeStorage();
return (data.platformFeeRecipient, uint16(data.platformFeeBps));
}
/**
* @notice Updates the platform fee recipient and bps.
* @dev Caller should be authorized to set platform fee info.
* See {_canSetPlatformFeeInfo}.
* Emits {PlatformFeeInfoUpdated Event}; See {_setupPlatformFeeInfo}.
*
* @param _platformFeeRecipient Address to be set as new platformFeeRecipient.
* @param _platformFeeBps Updated platformFeeBps.
*/
function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external override {
if (!_canSetPlatformFeeInfo()) {
revert("Not authorized");
}
_setupPlatformFeeInfo(_platformFeeRecipient, _platformFeeBps);
}
/// @dev Lets a contract admin update the platform fee recipient and bps
function _setupPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) internal {
PlatformFeeStorage.Data storage data = PlatformFeeStorage.platformFeeStorage();
if (_platformFeeBps > 10_000) {
revert("Exceeds max bps");
}
data.platformFeeBps = uint16(_platformFeeBps);
data.platformFeeRecipient = _platformFeeRecipient;
emit PlatformFeeInfoUpdated(_platformFeeRecipient, _platformFeeBps);
}
/// @dev Returns whether platform fee info can be set in the given execution context.
function _canSetPlatformFeeInfo() internal view virtual returns (bool);
}
@thirdweb-dev/contracts/openzeppelin-presets/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
@thirdweb-dev/contracts/extension/plugin/Router.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../interface/plugin/IRouter.sol";
import "../../extension/Multicall.sol";
import "../../eip/ERC165.sol";
import "../../openzeppelin-presets/utils/EnumerableSet.sol";
/**
* @author thirdweb.com
*/
library RouterStorage {
bytes32 public constant ROUTER_STORAGE_POSITION = keccak256("router.storage");
struct Data {
EnumerableSet.Bytes32Set allSelectors;
mapping(address => EnumerableSet.Bytes32Set) selectorsForPlugin;
mapping(bytes4 => IPluginMap.Plugin) pluginForSelector;
}
function routerStorage() internal pure returns (Data storage routerData) {
bytes32 position = ROUTER_STORAGE_POSITION;
assembly {
routerData.slot := position
}
}
}
abstract contract Router is Multicall, ERC165, IRouter {
using EnumerableSet for EnumerableSet.Bytes32Set;
/*///////////////////////////////////////////////////////////////
State variables
//////////////////////////////////////////////////////////////*/
address public immutable pluginMap;
/*///////////////////////////////////////////////////////////////
Constructor + initializer logic
//////////////////////////////////////////////////////////////*/
constructor(address _pluginMap) {
pluginMap = _pluginMap;
}
/*///////////////////////////////////////////////////////////////
ERC 165
//////////////////////////////////////////////////////////////*/
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IRouter).interfaceId || super.supportsInterface(interfaceId);
}
/*///////////////////////////////////////////////////////////////
Generic contract logic
//////////////////////////////////////////////////////////////*/
fallback() external payable virtual {
address _pluginAddress = _getPluginForFunction(msg.sig);
if (_pluginAddress == address(0)) {
_pluginAddress = IPluginMap(pluginMap).getPluginForFunction(msg.sig);
}
_delegate(_pluginAddress);
}
receive() external payable {}
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())
}
}
}
/*///////////////////////////////////////////////////////////////
External functions
//////////////////////////////////////////////////////////////*/
/// @dev Add functionality to the contract.
function addPlugin(Plugin memory _plugin) external {
require(_canSetPlugin(), "Router: Not authorized");
_addPlugin(_plugin);
}
/// @dev Update or override existing functionality.
function updatePlugin(Plugin memory _plugin) external {
require(_canSetPlugin(), "Map: Not authorized");
_updatePlugin(_plugin);
}
/// @dev Remove existing functionality from the contract.
function removePlugin(bytes4 _selector) external {
require(_canSetPlugin(), "Map: Not authorized");
_removePlugin(_selector);
}
/*///////////////////////////////////////////////////////////////
View functions
//////////////////////////////////////////////////////////////*/
/// @dev View address of the plugged-in functionality contract for a given function signature.
function getPluginForFunction(bytes4 _selector) public view returns (address) {
address pluginAddress = _getPluginForFunction(_selector);
return pluginAddress != address(0) ? pluginAddress : IPluginMap(pluginMap).getPluginForFunction(_selector);
}
/// @dev View all funtionality as list of function signatures.
function getAllFunctionsOfPlugin(address _pluginAddress) external view returns (bytes4[] memory registered) {
RouterStorage.Data storage data = RouterStorage.routerStorage();
EnumerableSet.Bytes32Set storage selectorsForPlugin = data.selectorsForPlugin[_pluginAddress];
bytes4[] memory defaultSelectors = IPluginMap(pluginMap).getAllFunctionsOfPlugin(_pluginAddress);
uint256 len = defaultSelectors.length;
uint256 count = selectorsForPlugin.length() + defaultSelectors.length;
for (uint256 i = 0; i < len; i += 1) {
if (selectorsForPlugin.contains(defaultSelectors[i])) {
count -= 1;
defaultSelectors[i] = bytes4(0);
}
}
registered = new bytes4[](count);
uint256 index;
for (uint256 i = 0; i < len; i += 1) {
if (defaultSelectors[i] != bytes4(0)) {
registered[index++] = defaultSelectors[i];
}
}
len = selectorsForPlugin.length();
for (uint256 i = 0; i < len; i += 1) {
registered[index++] = bytes4(data.selectorsForPlugin[_pluginAddress].at(i));
}
}
/// @dev View all funtionality existing on the contract.
function getAllPlugins() external view returns (Plugin[] memory registered) {
RouterStorage.Data storage data = RouterStorage.routerStorage();
EnumerableSet.Bytes32Set storage overrideSelectors = data.allSelectors;
Plugin[] memory defaultPlugins = IPluginMap(pluginMap).getAllPlugins();
uint256 overrideSelectorsLen = overrideSelectors.length();
uint256 defaultPluginsLen = defaultPlugins.length;
uint256 totalCount = overrideSelectorsLen + defaultPluginsLen;
for (uint256 i = 0; i < overrideSelectorsLen; i += 1) {
for (uint256 j = 0; j < defaultPluginsLen; j += 1) {
if (bytes4(overrideSelectors.at(i)) == defaultPlugins[j].functionSelector) {
totalCount -= 1;
defaultPlugins[j].functionSelector = bytes4(0);
}
}
}
registered = new Plugin[](totalCount);
uint256 index;
for (uint256 i = 0; i < defaultPluginsLen; i += 1) {
if (defaultPlugins[i].functionSelector != bytes4(0)) {
registered[index] = defaultPlugins[i];
index += 1;
}
}
for (uint256 i = 0; i < overrideSelectorsLen; i += 1) {
registered[index] = data.pluginForSelector[bytes4(overrideSelectors.at(i))];
index += 1;
}
}
/*///////////////////////////////////////////////////////////////
Internal functions
//////////////////////////////////////////////////////////////*/
/// @dev View address of the plugged-in functionality contract for a given function signature.
function _getPluginForFunction(bytes4 _selector) public view returns (address) {
RouterStorage.Data storage data = RouterStorage.routerStorage();
address _pluginAddress = data.pluginForSelector[_selector].pluginAddress;
return _pluginAddress;
}
/// @dev Add functionality to the contract.
function _addPlugin(Plugin memory _plugin) internal {
RouterStorage.Data storage data = RouterStorage.routerStorage();
// Revert: default plugin exists for function; use updatePlugin instead.
try IPluginMap(pluginMap).getPluginForFunction(_plugin.functionSelector) returns (address) {
revert("Router: default plugin exists for function.");
} catch {
require(data.allSelectors.add(bytes32(_plugin.functionSelector)), "Router: plugin exists for function.");
}
require(
_plugin.functionSelector == bytes4(keccak256(abi.encodePacked(_plugin.functionSignature))),
"Router: fn selector and signature mismatch."
);
data.pluginForSelector[_plugin.functionSelector] = _plugin;
data.selectorsForPlugin[_plugin.pluginAddress].add(bytes32(_plugin.functionSelector));
emit PluginAdded(_plugin.functionSelector, _plugin.pluginAddress);
}
/// @dev Update or override existing functionality.
function _updatePlugin(Plugin memory _plugin) internal {
address currentPlugin = getPluginForFunction(_plugin.functionSelector);
require(
_plugin.functionSelector == bytes4(keccak256(abi.encodePacked(_plugin.functionSignature))),
"Router: fn selector and signature mismatch."
);
RouterStorage.Data storage data = RouterStorage.routerStorage();
data.allSelectors.add(bytes32(_plugin.functionSelector));
data.pluginForSelector[_plugin.functionSelector] = _plugin;
data.selectorsForPlugin[currentPlugin].remove(bytes32(_plugin.functionSelector));
data.selectorsForPlugin[_plugin.pluginAddress].add(bytes32(_plugin.functionSelector));
emit PluginUpdated(_plugin.functionSelector, currentPlugin, _plugin.pluginAddress);
}
/// @dev Remove existing functionality from the contract.
function _removePlugin(bytes4 _selector) internal {
RouterStorage.Data storage data = RouterStorage.routerStorage();
address currentPlugin = _getPluginForFunction(_selector);
require(currentPlugin != address(0), "Router: No plugin available for selector");
delete data.pluginForSelector[_selector];
data.allSelectors.remove(_selector);
data.selectorsForPlugin[currentPlugin].remove(bytes32(_selector));
emit PluginRemoved(_selector, currentPlugin);
}
function _canSetPlugin() internal view virtual returns (bool);
}
@thirdweb-dev/contracts/eip/interface/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
*
* 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
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* 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);
}
@thirdweb-dev/contracts/lib/TWStrings.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @dev String operations.
*/
library TWStrings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
@thirdweb-dev/contracts/lib/TWAddress.sol
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @dev Collection of functions related to the address type
*/
library TWAddress {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* [EIP1884](https://eips.ethereum.org/EIPS/eip-1884) 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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// 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 {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@thirdweb-dev/contracts/extension/interface/IPlatformFee.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* Thirdweb's `PlatformFee` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of platform fee and the platform fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about platform fees, if desired.
*/
interface IPlatformFee {
/// @dev Fee type variants: percentage fee and flat fee
enum PlatformFeeType {
Bps,
Flat
}
/// @dev Returns the platform fee bps and recipient.
function getPlatformFeeInfo() external view returns (address, uint16);
/// @dev Lets a module admin update the fees on primary sales.
function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external;
/// @dev Emitted when fee on primary sales is updated.
event PlatformFeeInfoUpdated(address indexed platformFeeRecipient, uint256 platformFeeBps);
/// @dev Emitted when the flat platform fee is updated.
event FlatPlatformFeeUpdated(address platformFeeRecipient, uint256 flatFee);
/// @dev Emitted when the platform fee type is updated.
event PlatformFeeTypeUpdated(PlatformFeeType feeType);
}
@thirdweb-dev/contracts/extension/plugin/PlatformFeeStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @author thirdweb.com
*/
library PlatformFeeStorage {
bytes32 public constant PLATFORM_FEE_STORAGE_POSITION = keccak256("platform.fee.storage");
struct Data {
/// @dev The address that receives all platform fees from all sales.
address platformFeeRecipient;
/// @dev The % of primary sales collected as platform fees.
uint16 platformFeeBps;
}
function platformFeeStorage() internal pure returns (Data storage platformFeeData) {
bytes32 position = PLATFORM_FEE_STORAGE_POSITION;
assembly {
platformFeeData.slot := position
}
}
}
@thirdweb-dev/contracts/extension/plugin/ContractMetadataStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @author thirdweb.com
*/
library ContractMetadataStorage {
bytes32 public constant CONTRACT_METADATA_STORAGE_POSITION = keccak256("contract.metadata.storage");
struct Data {
string contractURI;
}
function contractMetadataStorage() internal pure returns (Data storage contractMetadataData) {
bytes32 position = CONTRACT_METADATA_STORAGE_POSITION;
assembly {
contractMetadataData.slot := position
}
}
}
@thirdweb-dev/contracts/eip/ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./interface/IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
@thirdweb-dev/contracts/extension/plugin/PermissionsEnumerableStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "../../extension/interface/IPermissionsEnumerable.sol";
/**
* @author thirdweb.com
*/
library PermissionsEnumerableStorage {
bytes32 public constant PERMISSIONS_ENUMERABLE_STORAGE_POSITION = keccak256("permissions.enumerable.storage");
/**
* @notice A data structure to store data of members for a given role.
*
* @param index Current index in the list of accounts that have a role.
* @param members map from index => address of account that has a role
* @param indexOf map from address => index which the account has.
*/
struct RoleMembers {
uint256 index;
mapping(uint256 => address) members;
mapping(address => uint256) indexOf;
}
struct Data {
/// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}.
mapping(bytes32 => RoleMembers) roleMembers;
}
function permissionsEnumerableStorage() internal pure returns (Data storage permissionsEnumerableData) {
bytes32 position = PERMISSIONS_ENUMERABLE_STORAGE_POSITION;
assembly {
permissionsEnumerableData.slot := position
}
}
}
@thirdweb-dev/contracts/extension/interface/plugin/IRouter.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
/// @author thirdweb
import "./IPluginMap.sol";
interface IRouter is IPluginMap {
/// @dev Emitted when a functionality is added, or plugged-in.
event PluginAdded(bytes4 indexed functionSelector, address indexed pluginAddress);
/// @dev Emitted when a functionality is updated or overridden.
event PluginUpdated(
bytes4 indexed functionSelector,
address indexed oldPluginAddress,
address indexed newPluginAddress
);
/// @dev Emitted when a functionality is removed.
event PluginRemoved(bytes4 indexed functionSelector, address indexed pluginAddress);
/// @dev Add a new plugin to the contract.
function addPlugin(Plugin memory plugin) external;
/// @dev Update / override an existing plugin.
function updatePlugin(Plugin memory plugin) external;
/// @dev Remove an existing plugin from the contract.
function removePlugin(bytes4 functionSelector) external;
}
@thirdweb-dev/contracts/extension/interface/IPermissionsEnumerable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./IPermissions.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IPermissionsEnumerable is IPermissions {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296)
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
@thirdweb-dev/contracts/extension/plugin/RouterImmutable.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./Router.sol";
/**
* @author thirdweb.com
*/
contract RouterImmutable is Router {
/*///////////////////////////////////////////////////////////////
Constructor + initializer logic
//////////////////////////////////////////////////////////////*/
constructor(address _pluginMap) Router(_pluginMap) {}
/*///////////////////////////////////////////////////////////////
Internal functions
//////////////////////////////////////////////////////////////*/
/// @dev Returns whether plug-in can be set in the given execution context.
function _canSetPlugin() internal pure override returns (bool) {
return false;
}
}
@thirdweb-dev/contracts/extension/interface/IPermissions.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IPermissions {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
@thirdweb-dev/contracts/extension/plugin/ERC2771ContextUpgradeableLogic.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @author thirdweb
import "./ERC2771ContextStorage.sol";
/**
* @dev Context variant with ERC2771 support.
*/
abstract contract ERC2771ContextUpgradeableLogic {
function __ERC2771Context_init(address[] memory trustedForwarder) internal {
__ERC2771Context_init_unchained(trustedForwarder);
}
function __ERC2771Context_init_unchained(address[] memory trustedForwarder) internal {
ERC2771ContextStorage.Data storage data = ERC2771ContextStorage.erc2771ContextStorage();
for (uint256 i = 0; i < trustedForwarder.length; i++) {
data._trustedForwarder[trustedForwarder[i]] = true;
}
}
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
ERC2771ContextStorage.Data storage data = ERC2771ContextStorage.erc2771ContextStorage();
return data._trustedForwarder[forwarder];
}
function _msgSender() internal view virtual returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return msg.sender;
}
}
function _msgData() internal view virtual returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return msg.data;
}
}
}
@thirdweb-dev/contracts/extension/interface/IMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author thirdweb
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
interface IMulticall {
/**
* @dev Receives and executes a batch of function calls on this contract.
*/
function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}
Compiler Settings
{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":1000,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","inputs":[{"type":"address","name":"_pluginMap","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_getPluginForFunction","inputs":[{"type":"bytes4","name":"_selector","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addPlugin","inputs":[{"type":"tuple","name":"_plugin","internalType":"struct IPluginMap.Plugin","components":[{"type":"bytes4"},{"type":"string"},{"type":"address"}]}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"contractType","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"contractURI","inputs":[]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"contractVersion","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes4[]","name":"registered","internalType":"bytes4[]"}],"name":"getAllFunctionsOfPlugin","inputs":[{"type":"address","name":"_pluginAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"registered","internalType":"struct IPluginMap.Plugin[]","components":[{"type":"bytes4"},{"type":"string"},{"type":"address"}]}],"name":"getAllPlugins","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint16","name":"","internalType":"uint16"}],"name":"getPlatformFeeInfo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getPluginForFunction","inputs":[{"type":"bytes4","name":"_selector","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"member","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"count","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRoleWithSwitch","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_defaultAdmin","internalType":"address"},{"type":"string","name":"_contractURI","internalType":"string"},{"type":"address[]","name":"_trustedForwarders","internalType":"address[]"},{"type":"address","name":"_platformFeeRecipient","internalType":"address"},{"type":"uint16","name":"_platformFeeBps","internalType":"uint16"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedForwarder","inputs":[{"type":"address","name":"forwarder","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes[]","name":"results","internalType":"bytes[]"}],"name":"multicall","inputs":[{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155BatchReceived","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pluginMap","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removePlugin","inputs":[{"type":"bytes4","name":"_selector","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setContractURI","inputs":[{"type":"string","name":"_uri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPlatformFeeInfo","inputs":[{"type":"address","name":"_platformFeeRecipient","internalType":"address"},{"type":"uint256","name":"_platformFeeBps","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePlugin","inputs":[{"type":"tuple","name":"_plugin","internalType":"struct IPluginMap.Plugin","components":[{"type":"bytes4"},{"type":"string"},{"type":"address"}]}]},{"type":"event","name":"ContractURIUpdated","inputs":[{"type":"string","name":"prevURI","indexed":false},{"type":"string","name":"newURI","indexed":false}],"anonymous":false},{"type":"event","name":"FlatPlatformFeeUpdated","inputs":[{"type":"address","name":"platformFeeRecipient","indexed":false},{"type":"uint256","name":"flatFee","indexed":false}],"anonymous":false},{"type":"event","name":"PlatformFeeInfoUpdated","inputs":[{"type":"address","name":"platformFeeRecipient","indexed":true},{"type":"uint256","name":"platformFeeBps","indexed":false}],"anonymous":false},{"type":"event","name":"PlatformFeeTypeUpdated","inputs":[{"type":"uint8","name":"feeType","indexed":false}],"anonymous":false},{"type":"event","name":"PluginAdded","inputs":[{"type":"bytes4","name":"functionSelector","indexed":true},{"type":"address","name":"pluginAddress","indexed":true}],"anonymous":false},{"type":"event","name":"PluginRemoved","inputs":[{"type":"bytes4","name":"functionSelector","indexed":true},{"type":"address","name":"pluginAddress","indexed":true}],"anonymous":false},{"type":"event","name":"PluginSet","inputs":[{"type":"bytes4","name":"functionSelector","indexed":true},{"type":"string","name":"functionSignature","indexed":true},{"type":"address","name":"pluginAddress","indexed":true}],"anonymous":false},{"type":"event","name":"PluginUpdated","inputs":[{"type":"bytes4","name":"functionSelector","indexed":true},{"type":"address","name":"oldPluginAddress","indexed":true},{"type":"address","name":"newPluginAddress","indexed":true}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"bytes32","name":"previousAdminRole","indexed":true},{"type":"bytes32","name":"newAdminRole","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"receive"},{"type":"fallback"}]
Contract Creation Code
0x60a03461008857601f62002f6138819003918201601f19168301916001600160401b0383118484101761008d5780849260209460405283398101031261008857516001600160a01b038116810361008857608052604051612ebd9081620000a482396080518181816108cc01528181610bca01528181610fd80152818161123d01526125de0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe60806040526004361015610015575b3661253d57005b60003560e01c806301ffc9a7146101f5578063150b7a02146101f05780631ab6b705146101eb5780631e7ac488146101e6578063248a9ca3146101e15780632f2ff15d146101dc57806336568abe146101d75780634cb5d8fd146101d2578063572b6c05146101cd5780635c573f2e146101c85780636b86400e146101c35780639010d07c146101be57806391d14854146101b9578063938e3d7b146101b4578063a0a8e460146101af578063a217fddf146101aa578063a32fa5b3146101a5578063a520a38a146101a0578063a5342fdf1461019b578063aaae563314610196578063ac9650d814610191578063b48912da1461018c578063bc197c8114610187578063c511f8fb14610182578063ca15c8731461017d578063cb2ef6f714610178578063d45573f614610173578063d547741f1461016e578063e8a3d485146101695763f23a6e610361000e576115fb565b6115cb565b611559565b611507565b6114cc565b61139c565b611365565b6112bf565b61121d565b6111b7565b611088565b61103e565b610f2d565b610ef9565b610edd565b610ec1565b610e7a565b610e10565b610dde565b610b83565b610828565b61077b565b610767565b6106e0565b6105e1565b610596565b610514565b6104c1565b610305565b610211565b6001600160e01b031981160361020c57565b600080fd5b3461020c57602036600319011261020c5760206001600160e01b0319600435610239816101fa565b167f4e2312e00000000000000000000000000000000000000000000000000000000081149081156102d4575b8115610277575b506040519015158152f35b7ff3374027000000000000000000000000000000000000000000000000000000008114915081156102aa575b503861026c565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014386102a3565b630a85bd0160e11b81149150610265565b6001600160a01b0381160361020c57565b60643590610303826102e5565b565b3461020c57608036600319011261020c576103216004356102e5565b61032c6024356102e5565b60643567ffffffffffffffff80821161020c573660238301121561020c57816004013590811161020c573691016024011161020c57604051630a85bd0160e11b8152602090f35b0390f35b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff8211176103a957604052565b610377565b90601f8019910116810190811067ffffffffffffffff8211176103a957604052565b67ffffffffffffffff81116103a957601f01601f191660200190565b9291926103f8826103d0565b9161040660405193846103ae565b82948184528183011161020c578281602093846000960137010152565b9080601f8301121561020c5781602061043e933591016103ec565b90565b6003199060208183011261020c5760043567ffffffffffffffff9283821161020c57606090828403011261020c576040519261047c8461038d565b816004013561048a816101fa565b8452602482013590811161020c5760449260046104a992840101610423565b602084015201356104b9816102e5565b604082015290565b3461020c576104cf36610441565b50606460405162461bcd60e51b815260206004820152601660248201527f526f757465723a204e6f7420617574686f72697a6564000000000000000000006044820152fd5b3461020c57604036600319011261020c57600435610531816102e5565b610539612dec565b1561054d5761054b9060243590612424565b005b60405162461bcd60e51b815260206004820152600e60248201527f4e6f7420617574686f72697a65640000000000000000000000000000000000006044820152606490fd5b0390fd5b3461020c57602036600319011261020c576004356000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed66020526020604060002054604051908152f35b3461020c57604036600319011261020c57602435600435610601826102e5565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed6602052610641604084205461063b612e32565b9061229a565b8183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205260ff61068a8260408620906001600160a01b0316600052602052604060002090565b541661069c576106999161200e565b80f35b606460405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152fd5b3461020c57604036600319011261020c576024356106fd816102e5565b610705612e32565b6001600160a01b038083169116036107235761054b90600435612144565b606460405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152fd5b3461020c5761077536610441565b50612637565b3461020c57602036600319011261020c57602060ff6107d760043561079f816102e5565b6001600160a01b03166000527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604060002090565b54166040519015158152f35b6020908160408183019282815285518094520193019160005b82811061080a575050505090565b83516001600160e01b031916855293810193928101926001016107fc565b3461020c57602036600319011261020c57600435610845816102e5565b610881816001600160a01b03166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec47602052604060002090565b6040517f5c573f2e0000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526000928382806024810103816001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165afa918215610aa3578492610a7f575b5081519383549361090d8686611ae3565b90825b878110610a225750506109229061270e565b948193825b8281106109cf575050505b838110610947576040518061037387826107e3565b806109c56109a36109966109ca94610991876001600160a01b03166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec47602052604060002090565b612c89565b6001600160e01b03191690565b6109b66109af87611683565b96896116a8565b906001600160e01b0319169052565b611ad5565b610932565b806109f16109966109e36109fa94866116a8565b516001600160e01b03191690565b6109ff57611ad5565b610927565b6109c5610a0f6109e383866116a8565b6109b6610a1b8a611683565b998c6116a8565b610a4b610a356109966109e3848a6116a8565b8360019160005201602052604060002054151590565b610a5e575b610a5990611ad5565b610910565b91610a6b610a59916126ff565b9284610a7782896116a8565b529050610a50565b610a9c9192503d8086833e610a9481836103ae565b81019061267b565b90386108fc565b612531565b60005b838110610abb5750506000910152565b8181015183820152602001610aab565b90602091610ae481518092818552858086019101610aa8565b601f01601f1916010190565b602080820190808352835180925260409283810182858560051b8401019601946000925b858410610b25575050505050505090565b909192939495968580600192603f198582030187528a51906001600160e01b03198251168152866001600160a01b0381610b6b8686015160608089880152860190610acb565b94015116910152990194019401929594939190610b14565b3461020c57600080600319360112610ddb576040517f6b86400e00000000000000000000000000000000000000000000000000000000815281816004816001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165afa908115610aa3578291610db9575b507f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec455490805192610c2b8484611ae3565b815b848110610d445750610c3e9061285c565b938192825b828110610ce257505050905b828210610c6457604051806103738682610af0565b610cd6610cdc91610cbb610cb6610c7d61099687612c36565b6001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b6128c3565b610cc582886116a8565b52610cd081876116a8565b50611ad5565b91611ad5565b90610c4f565b610d01610996610cf283856116a8565b51516001600160e01b03191690565b610d14575b610d0f90611ad5565b610c43565b93610d3c610d0f91610d2687856116a8565b51610d31828b6116a8565b52610cd0818a6116a8565b949050610d06565b825b868110610d5c5750610d5790611ad5565b610c2d565b610d6861099683612c36565b6001600160e01b0319610d81610996610cf2858a6116a8565b911614610d97575b610d9290611ad5565b610d46565b91610da4610d92916126ff565b9284610db082886116a8565b51529050610d89565b610dd591503d8084833e610dcd81836103ae565b810190612740565b38610bfa565b80fd5b3461020c57604036600319011261020c576020610dff602435600435611af0565b6001600160a01b0360405191168152f35b3461020c57604036600319011261020c57602060ff6107d7602435610e34816102e5565b6004356000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed584526040600020906001600160a01b0316600052602052604060002090565b3461020c57602036600319011261020c5760043567ffffffffffffffff811161020c57610eab903690600401610423565b610eb3612dec565b1561054d5761054b90611951565b3461020c57600036600319011261020c57602060405160018152f35b3461020c57600036600319011261020c57602060405160008152f35b3461020c57604036600319011261020c576020610f23602435610f1b816102e5565b600435611c9f565b6040519015158152f35b3461020c57602036600319011261020c57600435610f4a816101fa565b6001600160a01b03806002610f92846001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b01546000939116908115610fb0575060209250905b60405191168152f35b90506001600160e01b03196040519163529051c560e11b8352166004820152602081602481857f0000000000000000000000000000000000000000000000000000000000000000165afa908115610aa35760209391611011575b5090610fa7565b6110319150833d8111611037575b61102981836103ae565b81019061251c565b3861100a565b503d61101f565b3461020c57602036600319011261020c5761105a6004356101fa565b612637565b67ffffffffffffffff81116103a95760051b60200190565b6084359061ffff8216820361020c57565b3461020c5760a036600319011261020c576004356110a5816102e5565b67ffffffffffffffff9060243582811161020c576110c7903690600401610423565b60443592831161020c573660238401121561020c578260040135926110eb8461105f565b906110f960405192836103ae565b84825260209460248684019160051b8301019136831161020c57602401905b82821061113c5761054b86868661112d6102f6565b91611136611077565b93612c9f565b868091833561114a816102e5565b815201910190611118565b602080820190808352835180925260408301928160408460051b8301019501936000915b8483106111895750505050505090565b90919293949584806111a7600193603f198682030187528a51610acb565b9801930193019194939290611179565b3461020c57602036600319011261020c5767ffffffffffffffff60043581811161020c573660238201121561020c57806004013591821161020c573660248360051b8301011161020c5761037391602461121192016116c1565b60405191829182611155565b3461020c57600036600319011261020c5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b81601f8201121561020c578035916112788361105f565b9261128660405194856103ae565b808452602092838086019260051b82010192831161020c578301905b8282106112b0575050505090565b813581529083019083016112a2565b3461020c5760a036600319011261020c576112db6004356102e5565b6112e66024356102e5565b67ffffffffffffffff60443581811161020c57611307903690600401611261565b5060643581811161020c57611320903690600401611261565b5060843590811161020c57611339903690600401610423565b506040517fbc197c81000000000000000000000000000000000000000000000000000000008152602090f35b3461020c57602036600319011261020c5760206001600160a01b036002611391600435610c7d816101fa565b015416604051908152f35b3461020c5760208060031936011261020c57600435906000908282527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c908181526040918284205491845b83811061146557610373868661144261143b61142c8c6000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed5602052604060002090565b60008052602052604060002090565b5460ff1690565b611455575b519081529081906020820190565b9061145f90611ad5565b90611447565b866000528282526114a561149961148c836001896000200190600052602052604060002090565b546001600160a01b031690565b6001600160a01b031690565b6114bc575b60018101809111156113e7575b61166d565b946114c690611ad5565b946114aa565b3461020c57600036600319011261020c5760206040517f4d61726b6574706c6163655633000000000000000000000000000000000000008152f35b3461020c57600036600319011261020c5760407f4aeb3f25cc46659cf4e4966e5c48b11e9400e6e4bfafae7e3dc6cc3fbc858deb5461ffff8251916001600160a01b038116835260a01c166020820152f35b3461020c57604036600319011261020c5761054b60243560043561157c826102e5565b806000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed66020526115b560406000205461063b612e32565b612144565b90602061043e928181520190610acb565b3461020c57600036600319011261020c576103736115e76117be565b604051918291602083526020830190610acb565b3461020c5760a036600319011261020c576116176004356102e5565b6116226024356102e5565b60843567ffffffffffffffff811161020c57611642903690600401610423565b5060206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b634e487b7160e01b600052601160045260246000fd5b60001981146114b75760010190565b634e487b7160e01b600052603260045260246000fd5b80518210156116bc5760209160051b010190565b611692565b906116cb8161105f565b916116d960405193846103ae565b818352601f196116e88361105f565b0160005b81811061177357505060005b8281106117055750505090565b8060051b820135601e198336030181121561020c5782019081359167ffffffffffffffff831161020c57602001823603811361020c5761174d6117539161176e9436916103ec565b306129a2565b61175d82876116a8565b5261176881866116a8565b50611683565b6116f8565b8060606020809388010152016116ec565b90600182811c921680156117b4575b602083101461179e57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611793565b604051906000827fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce32819182546117f281611784565b80845293600191808316908115611878575060011461181a575b5050610303925003836103ae565b600090815291507fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f55b84831061185d57506103039350508101602001388061180c565b81935090816020925483858a01015201910190918592611843565b9150506020925061030394915060ff191682840152151560051b820101388061180c565b601f81116118a8575050565b6000907fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce328182527fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f5906020601f850160051c83019410611922575b601f0160051c01915b82811061191757505050565b81815560010161190b565b9092508290611902565b909161194361043e93604084526040840190610acb565b916020818403910152610acb565b9061195a6117be565b9180519267ffffffffffffffff84116103a9577fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce32816119a18561199c8354611784565b61189c565b602080601f8711600114611a10575094807fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a169596600091611a05575b508160011b916000199060031b1c19161790555b611a006040519283928361192c565b0390a1565b9050840151386119dd565b7fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce328160005290601f1987167fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f5926000905b828210611abd5750509187917fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a16979860019410611aa4575b5050811b0190556119f1565b86015160001960f88460031b161c191690553880611a98565b80600185968294968b01518155019501930190611a60565b90600182018092116114b757565b919082018092116114b757565b60008181527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c60205260408120549093928492835b838510611b33575050505050565b6001611b8361149961148c8884611b73886000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b0190600052602052604060002090565b15611bea57838214611ba85750611b9c611ba291611ad5565b94611ad5565b93611b25565b92505061043e94955061148c939250611b73906000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b5093611c2561143b61142c846000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed5602052604060002090565b80611c4e575b611c39575b611ba290611ad5565b93611c46611ba291611ad5565b949050611c30565b50611c976002611c87846000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b0160008052602052604060002090565b548114611c2b565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed591826020526040842084805260205260ff60408520541615611ceb5750505050600190565b83611d139360409260ff965260205220906001600160a01b0316600052602052604060002090565b541690565b6001600160a01b03811660009081527f15e2acbe0ae50b645cb1c4f3ba34bd0377967eb1d6a695c66d22a86a41e66a3260205260408120909190805460ff191660011790556001600160a01b0380611d6e612e32565b16908216837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a48180527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c9081602052604083209283549360018501918286116114b757611e41946002936040935581805280602052600183832001878352602052611e2185848420906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b8180526020522001906001600160a01b0316600052602052604060002090565b55565b60008080527f7ec928306457e915ec3398f18440fe270e048dc31efa4f1f6c051e0fd913850560209081527f3a64d962e1ba4f37b5d9b7a262a0bde9da2a20112d0dfec455fca3146ee944aa805460ff19166001179055907ff94103142c1baabe9ac2b5d1487bf783de9e69cfeea9a72f5c9c94afd7877b8c9060406001600160a01b03611ed0612e32565b1682847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8280a48282527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c918285528181209283549560018701958688116114b757611e4196600296558084528282526001858520018885528252611f6e85852073ffffffffffffffffffffffffffffffffffffffff198154169055565b835252200160008052602052604060002090565b60008080527f827dc0cf3d2abe4eaee1183708c8e6367b8470402f275973ae04e25759c6119560209081527faeb0b87b17fa8e03343e235eca7c43efe301e1f59c45d9513bd7ace99ea93cce805460ff19166001179055907f86d5cf0a6bdc8d859ba3bdc97043337c82a0e609035f378e419298b6a3e00ae69060406001600160a01b03611ed0612e32565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed56020526120588160408520906001600160a01b0316600052602052604060002090565b805460ff191660011790556001600160a01b0380612074612e32565b16908216837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8680a48183527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c806020526040842080549460018601928387116114b757611e4195600294604094558083528160205260018484200188845260205261212586858520906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b82526020522001906001600160a01b0316600052602052604060002090565b90611e4190612153818461229a565b6000928084527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205261219d8260408620906001600160a01b0316600052602052604060002090565b805460ff191690556001600160a01b03806121b6612e32565b16908316827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8780a48084527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c908160205261222b8360026040882001906001600160a01b0316600052602052604060002090565b5481865282602052600160408720019086526020526040852073ffffffffffffffffffffffffffffffffffffffff198154169055845260205260026040842001906001600160a01b0316600052602052604060002090565b9061229660209282815194859201610aa8565b0190565b90816000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205260ff6122e6826040600020906001600160a01b0316600052602052604060002090565b5416156122f1575050565b6001600160a01b031690612303612af8565b91603061230f84612b13565b53607861231b84612b20565b5360295b600181116123d6576105926123876123be866123b0612347886123428915612b4e565b612b99565b612381604051958694612381602087016015907f5065726d697373696f6e733a206163636f756e7420000000000000000000000081520190565b90612283565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190565b03601f1981018352826103ae565b60405191829162461bcd60e51b8352600483016115ba565b90600f81169060108210156116bc577f303132333435363738396162636465660000000000000000000000000000000061241f921a6124158487612b30565b5360041c91612b41565b61231f565b9061271081116124cd5760207fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f18304917f4aeb3f25cc46659cf4e4966e5c48b11e9400e6e4bfafae7e3dc6cc3fbc858deb6001600160a01b038154951680957fffffffffffffffffffff0000000000000000000000000000000000000000000075ffff00000000000000000000000000000000000000008560a01b16911617179055604051908152a2565b606460405162461bcd60e51b815260206004820152600f60248201527f45786365656473206d61782062707300000000000000000000000000000000006044820152fd5b5190610303826102e5565b9081602091031261020c575161043e816102e5565b6040513d6000823e3d90fd5b60006001600160e01b0319813516816001600160a01b0391826002612595836001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b0154169081156125be575b50819250368280378136915af43d82803e156125ba573d90f35b3d90fd5b90506020915060246040518094819363529051c560e11b835260048301527f0000000000000000000000000000000000000000000000000000000000000000165afa908115610aa357829182918291612619575b50386125a0565b612631915060203d81116110375761102981836103ae565b38612612565b606460405162461bcd60e51b815260206004820152601360248201527f4d61703a204e6f7420617574686f72697a6564000000000000000000000000006044820152fd5b602090818184031261020c5780519067ffffffffffffffff821161020c57019180601f8401121561020c5782516126b18161105f565b936126bf60405195866103ae565b818552838086019260051b82010192831161020c578301905b8282106126e6575050505090565b83809183516126f4816101fa565b8152019101906126d8565b6000198101919082116114b757565b906127188261105f565b61272560405191826103ae565b8281528092612736601f199161105f565b0190602036910137565b90602090818382031261020c57825167ffffffffffffffff9384821161020c57019080601f8301121561020c5781516127788161105f565b946040612787815197886103ae565b828752858088019360051b8601019484861161020c57868101935b8685106127b457505050505050505090565b845184811161020c5782019060609081601f19848a03011261020c5784516127db8161038d565b8a8401516127e8816101fa565b81528584015187811161020c5784019289603f8501121561020c578b84015190612811826103d0565b9561281e895197886103ae565b8287528b89848801011161020c57866128438f989489988c8a61284d98019101610aa8565b8685015201612511565b868201528152019401936127a2565b906128668261105f565b604090612875825191826103ae565b8381528093612886601f199161105f565b0191600091825b84811061289b575050505050565b60209083516128a98161038d565b85815282606081830152868683015282850101520161288d565b906040516128d08161038d565b80926001600160e01b0319815460e01b1682526001808201604051916000918054906128fb82611784565b80865291838116908115612978575060011461293c575b5050506040928261292f6001600160a01b039460029403826103ae565b6020860152015416910152565b90925060005260209182600020916000925b82841061296557505050820101828261292f612912565b805486850186015292840192810161294e565b60ff191660208088019190915292151560051b8601909201935085925084915061292f9050612912565b90604051906129b08261038d565b602782527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208301527f206661696c6564000000000000000000000000000000000000000000000000006040830152823b15612a4e5760008161043e9460208394519201905af43d15612a46573d90612a29826103d0565b91612a3760405193846103ae565b82523d6000602084013e612ab8565b606090612ab8565b608460405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152fd5b90919015612ac4575090565b815115612ad45750805190602001fd5b6105929060405191829162461bcd60e51b8352602060048401526024830190610acb565b60405190612b058261038d565b602a82526040366020840137565b8051156116bc5760200190565b8051600110156116bc5760210190565b9081518110156116bc570160200190565b80156114b7576000190190565b15612b5557565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b604051906080820182811067ffffffffffffffff8211176103a9576040526042825260603660208401376030612bce83612b13565b536078612bda83612b20565b536041905b60018211612bf25761043e915015612b4e565b600f81169060108210156116bc577f3031323334353637383961626364656600000000000000000000000000000000612c30921a6124158486612b30565b90612bdf565b7f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec4580548210156116bc576000527f21fbb2f7ddba3f9991e90f387f1abccacf68c38163646dd66c242d7a37419646015490565b80548210156116bc576000526020600020015490565b9291949390947f627d6cbb4eb558f37de3c2ec08b04710e54e06be936a302f087f7bfb80f39ae0805460ff8116612da8576001918260ff19809316179055817fbbf78d3411d42a81effd97bb8c69faae4e77e75cec462245c1001191a0634c6f556000928284905b612d42575b50505050509061ffff612d2d92612d26612d329697611951565b1690612424565b611d18565b612d3a611e44565b610303611f82565b8151811015612da35790612d9c826001600160a01b03612d638795856116a8565b511687527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604087208486825416179055611683565b9091612d07565b612d0c565b606460405162461bcd60e51b815260206004820152601460248201527f416c726561647920696e697469616c697a65642e0000000000000000000000006044820152fd5b60ff611d13612df9612e32565b6001600160a01b031660009081527f15e2acbe0ae50b645cb1c4f3ba34bd0377967eb1d6a695c66d22a86a41e66a326020526040902090565b60ff612e70336001600160a01b03166000527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604060002090565b541615612e835736601319013560601c90565b339056fea2646970667358221220d9a5b094ac5947262112b7f4af4b8b16c63ea87eef2fee90d12b3806328d6f5a64736f6c63430008120033000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34
Deployed ByteCode
0x60806040526004361015610015575b3661253d57005b60003560e01c806301ffc9a7146101f5578063150b7a02146101f05780631ab6b705146101eb5780631e7ac488146101e6578063248a9ca3146101e15780632f2ff15d146101dc57806336568abe146101d75780634cb5d8fd146101d2578063572b6c05146101cd5780635c573f2e146101c85780636b86400e146101c35780639010d07c146101be57806391d14854146101b9578063938e3d7b146101b4578063a0a8e460146101af578063a217fddf146101aa578063a32fa5b3146101a5578063a520a38a146101a0578063a5342fdf1461019b578063aaae563314610196578063ac9650d814610191578063b48912da1461018c578063bc197c8114610187578063c511f8fb14610182578063ca15c8731461017d578063cb2ef6f714610178578063d45573f614610173578063d547741f1461016e578063e8a3d485146101695763f23a6e610361000e576115fb565b6115cb565b611559565b611507565b6114cc565b61139c565b611365565b6112bf565b61121d565b6111b7565b611088565b61103e565b610f2d565b610ef9565b610edd565b610ec1565b610e7a565b610e10565b610dde565b610b83565b610828565b61077b565b610767565b6106e0565b6105e1565b610596565b610514565b6104c1565b610305565b610211565b6001600160e01b031981160361020c57565b600080fd5b3461020c57602036600319011261020c5760206001600160e01b0319600435610239816101fa565b167f4e2312e00000000000000000000000000000000000000000000000000000000081149081156102d4575b8115610277575b506040519015158152f35b7ff3374027000000000000000000000000000000000000000000000000000000008114915081156102aa575b503861026c565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014386102a3565b630a85bd0160e11b81149150610265565b6001600160a01b0381160361020c57565b60643590610303826102e5565b565b3461020c57608036600319011261020c576103216004356102e5565b61032c6024356102e5565b60643567ffffffffffffffff80821161020c573660238301121561020c57816004013590811161020c573691016024011161020c57604051630a85bd0160e11b8152602090f35b0390f35b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff8211176103a957604052565b610377565b90601f8019910116810190811067ffffffffffffffff8211176103a957604052565b67ffffffffffffffff81116103a957601f01601f191660200190565b9291926103f8826103d0565b9161040660405193846103ae565b82948184528183011161020c578281602093846000960137010152565b9080601f8301121561020c5781602061043e933591016103ec565b90565b6003199060208183011261020c5760043567ffffffffffffffff9283821161020c57606090828403011261020c576040519261047c8461038d565b816004013561048a816101fa565b8452602482013590811161020c5760449260046104a992840101610423565b602084015201356104b9816102e5565b604082015290565b3461020c576104cf36610441565b50606460405162461bcd60e51b815260206004820152601660248201527f526f757465723a204e6f7420617574686f72697a6564000000000000000000006044820152fd5b3461020c57604036600319011261020c57600435610531816102e5565b610539612dec565b1561054d5761054b9060243590612424565b005b60405162461bcd60e51b815260206004820152600e60248201527f4e6f7420617574686f72697a65640000000000000000000000000000000000006044820152606490fd5b0390fd5b3461020c57602036600319011261020c576004356000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed66020526020604060002054604051908152f35b3461020c57604036600319011261020c57602435600435610601826102e5565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed6602052610641604084205461063b612e32565b9061229a565b8183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205260ff61068a8260408620906001600160a01b0316600052602052604060002090565b541661069c576106999161200e565b80f35b606460405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152fd5b3461020c57604036600319011261020c576024356106fd816102e5565b610705612e32565b6001600160a01b038083169116036107235761054b90600435612144565b606460405162461bcd60e51b815260206004820152601a60248201527f43616e206f6e6c792072656e6f756e636520666f722073656c660000000000006044820152fd5b3461020c5761077536610441565b50612637565b3461020c57602036600319011261020c57602060ff6107d760043561079f816102e5565b6001600160a01b03166000527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604060002090565b54166040519015158152f35b6020908160408183019282815285518094520193019160005b82811061080a575050505090565b83516001600160e01b031916855293810193928101926001016107fc565b3461020c57602036600319011261020c57600435610845816102e5565b610881816001600160a01b03166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec47602052604060002090565b6040517f5c573f2e0000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526000928382806024810103816001600160a01b037f000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34165afa918215610aa3578492610a7f575b5081519383549361090d8686611ae3565b90825b878110610a225750506109229061270e565b948193825b8281106109cf575050505b838110610947576040518061037387826107e3565b806109c56109a36109966109ca94610991876001600160a01b03166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec47602052604060002090565b612c89565b6001600160e01b03191690565b6109b66109af87611683565b96896116a8565b906001600160e01b0319169052565b611ad5565b610932565b806109f16109966109e36109fa94866116a8565b516001600160e01b03191690565b6109ff57611ad5565b610927565b6109c5610a0f6109e383866116a8565b6109b6610a1b8a611683565b998c6116a8565b610a4b610a356109966109e3848a6116a8565b8360019160005201602052604060002054151590565b610a5e575b610a5990611ad5565b610910565b91610a6b610a59916126ff565b9284610a7782896116a8565b529050610a50565b610a9c9192503d8086833e610a9481836103ae565b81019061267b565b90386108fc565b612531565b60005b838110610abb5750506000910152565b8181015183820152602001610aab565b90602091610ae481518092818552858086019101610aa8565b601f01601f1916010190565b602080820190808352835180925260409283810182858560051b8401019601946000925b858410610b25575050505050505090565b909192939495968580600192603f198582030187528a51906001600160e01b03198251168152866001600160a01b0381610b6b8686015160608089880152860190610acb565b94015116910152990194019401929594939190610b14565b3461020c57600080600319360112610ddb576040517f6b86400e00000000000000000000000000000000000000000000000000000000815281816004816001600160a01b037f000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34165afa908115610aa3578291610db9575b507f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec455490805192610c2b8484611ae3565b815b848110610d445750610c3e9061285c565b938192825b828110610ce257505050905b828210610c6457604051806103738682610af0565b610cd6610cdc91610cbb610cb6610c7d61099687612c36565b6001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b6128c3565b610cc582886116a8565b52610cd081876116a8565b50611ad5565b91611ad5565b90610c4f565b610d01610996610cf283856116a8565b51516001600160e01b03191690565b610d14575b610d0f90611ad5565b610c43565b93610d3c610d0f91610d2687856116a8565b51610d31828b6116a8565b52610cd0818a6116a8565b949050610d06565b825b868110610d5c5750610d5790611ad5565b610c2d565b610d6861099683612c36565b6001600160e01b0319610d81610996610cf2858a6116a8565b911614610d97575b610d9290611ad5565b610d46565b91610da4610d92916126ff565b9284610db082886116a8565b51529050610d89565b610dd591503d8084833e610dcd81836103ae565b810190612740565b38610bfa565b80fd5b3461020c57604036600319011261020c576020610dff602435600435611af0565b6001600160a01b0360405191168152f35b3461020c57604036600319011261020c57602060ff6107d7602435610e34816102e5565b6004356000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed584526040600020906001600160a01b0316600052602052604060002090565b3461020c57602036600319011261020c5760043567ffffffffffffffff811161020c57610eab903690600401610423565b610eb3612dec565b1561054d5761054b90611951565b3461020c57600036600319011261020c57602060405160018152f35b3461020c57600036600319011261020c57602060405160008152f35b3461020c57604036600319011261020c576020610f23602435610f1b816102e5565b600435611c9f565b6040519015158152f35b3461020c57602036600319011261020c57600435610f4a816101fa565b6001600160a01b03806002610f92846001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b01546000939116908115610fb0575060209250905b60405191168152f35b90506001600160e01b03196040519163529051c560e11b8352166004820152602081602481857f000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34165afa908115610aa35760209391611011575b5090610fa7565b6110319150833d8111611037575b61102981836103ae565b81019061251c565b3861100a565b503d61101f565b3461020c57602036600319011261020c5761105a6004356101fa565b612637565b67ffffffffffffffff81116103a95760051b60200190565b6084359061ffff8216820361020c57565b3461020c5760a036600319011261020c576004356110a5816102e5565b67ffffffffffffffff9060243582811161020c576110c7903690600401610423565b60443592831161020c573660238401121561020c578260040135926110eb8461105f565b906110f960405192836103ae565b84825260209460248684019160051b8301019136831161020c57602401905b82821061113c5761054b86868661112d6102f6565b91611136611077565b93612c9f565b868091833561114a816102e5565b815201910190611118565b602080820190808352835180925260408301928160408460051b8301019501936000915b8483106111895750505050505090565b90919293949584806111a7600193603f198682030187528a51610acb565b9801930193019194939290611179565b3461020c57602036600319011261020c5767ffffffffffffffff60043581811161020c573660238201121561020c57806004013591821161020c573660248360051b8301011161020c5761037391602461121192016116c1565b60405191829182611155565b3461020c57600036600319011261020c5760206040516001600160a01b037f000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34168152f35b81601f8201121561020c578035916112788361105f565b9261128660405194856103ae565b808452602092838086019260051b82010192831161020c578301905b8282106112b0575050505090565b813581529083019083016112a2565b3461020c5760a036600319011261020c576112db6004356102e5565b6112e66024356102e5565b67ffffffffffffffff60443581811161020c57611307903690600401611261565b5060643581811161020c57611320903690600401611261565b5060843590811161020c57611339903690600401610423565b506040517fbc197c81000000000000000000000000000000000000000000000000000000008152602090f35b3461020c57602036600319011261020c5760206001600160a01b036002611391600435610c7d816101fa565b015416604051908152f35b3461020c5760208060031936011261020c57600435906000908282527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c908181526040918284205491845b83811061146557610373868661144261143b61142c8c6000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed5602052604060002090565b60008052602052604060002090565b5460ff1690565b611455575b519081529081906020820190565b9061145f90611ad5565b90611447565b866000528282526114a561149961148c836001896000200190600052602052604060002090565b546001600160a01b031690565b6001600160a01b031690565b6114bc575b60018101809111156113e7575b61166d565b946114c690611ad5565b946114aa565b3461020c57600036600319011261020c5760206040517f4d61726b6574706c6163655633000000000000000000000000000000000000008152f35b3461020c57600036600319011261020c5760407f4aeb3f25cc46659cf4e4966e5c48b11e9400e6e4bfafae7e3dc6cc3fbc858deb5461ffff8251916001600160a01b038116835260a01c166020820152f35b3461020c57604036600319011261020c5761054b60243560043561157c826102e5565b806000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed66020526115b560406000205461063b612e32565b612144565b90602061043e928181520190610acb565b3461020c57600036600319011261020c576103736115e76117be565b604051918291602083526020830190610acb565b3461020c5760a036600319011261020c576116176004356102e5565b6116226024356102e5565b60843567ffffffffffffffff811161020c57611642903690600401610423565b5060206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b634e487b7160e01b600052601160045260246000fd5b60001981146114b75760010190565b634e487b7160e01b600052603260045260246000fd5b80518210156116bc5760209160051b010190565b611692565b906116cb8161105f565b916116d960405193846103ae565b818352601f196116e88361105f565b0160005b81811061177357505060005b8281106117055750505090565b8060051b820135601e198336030181121561020c5782019081359167ffffffffffffffff831161020c57602001823603811361020c5761174d6117539161176e9436916103ec565b306129a2565b61175d82876116a8565b5261176881866116a8565b50611683565b6116f8565b8060606020809388010152016116ec565b90600182811c921680156117b4575b602083101461179e57565b634e487b7160e01b600052602260045260246000fd5b91607f1691611793565b604051906000827fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce32819182546117f281611784565b80845293600191808316908115611878575060011461181a575b5050610303925003836103ae565b600090815291507fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f55b84831061185d57506103039350508101602001388061180c565b81935090816020925483858a01015201910190918592611843565b9150506020925061030394915060ff191682840152151560051b820101388061180c565b601f81116118a8575050565b6000907fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce328182527fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f5906020601f850160051c83019410611922575b601f0160051c01915b82811061191757505050565b81815560010161190b565b9092508290611902565b909161194361043e93604084526040840190610acb565b916020818403910152610acb565b9061195a6117be565b9180519267ffffffffffffffff84116103a9577fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce32816119a18561199c8354611784565b61189c565b602080601f8711600114611a10575094807fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a169596600091611a05575b508160011b916000199060031b1c19161790555b611a006040519283928361192c565b0390a1565b9050840151386119dd565b7fa7d40346e44ca145e94a946aa34a7d4a67245577dc18699a626fe0ffc6ce328160005290601f1987167fda7a00e86a29b6586c98fb759fac91130668b90be84000b58b771b6c157375f5926000905b828210611abd5750509187917fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a16979860019410611aa4575b5050811b0190556119f1565b86015160001960f88460031b161c191690553880611a98565b80600185968294968b01518155019501930190611a60565b90600182018092116114b757565b919082018092116114b757565b60008181527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c60205260408120549093928492835b838510611b33575050505050565b6001611b8361149961148c8884611b73886000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b0190600052602052604060002090565b15611bea57838214611ba85750611b9c611ba291611ad5565b94611ad5565b93611b25565b92505061043e94955061148c939250611b73906000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b5093611c2561143b61142c846000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed5602052604060002090565b80611c4e575b611c39575b611ba290611ad5565b93611c46611ba291611ad5565b949050611c30565b50611c976002611c87846000527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c602052604060002090565b0160008052602052604060002090565b548114611c2b565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed591826020526040842084805260205260ff60408520541615611ceb5750505050600190565b83611d139360409260ff965260205220906001600160a01b0316600052602052604060002090565b541690565b6001600160a01b03811660009081527f15e2acbe0ae50b645cb1c4f3ba34bd0377967eb1d6a695c66d22a86a41e66a3260205260408120909190805460ff191660011790556001600160a01b0380611d6e612e32565b16908216837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a48180527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c9081602052604083209283549360018501918286116114b757611e41946002936040935581805280602052600183832001878352602052611e2185848420906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b8180526020522001906001600160a01b0316600052602052604060002090565b55565b60008080527f7ec928306457e915ec3398f18440fe270e048dc31efa4f1f6c051e0fd913850560209081527f3a64d962e1ba4f37b5d9b7a262a0bde9da2a20112d0dfec455fca3146ee944aa805460ff19166001179055907ff94103142c1baabe9ac2b5d1487bf783de9e69cfeea9a72f5c9c94afd7877b8c9060406001600160a01b03611ed0612e32565b1682847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8280a48282527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c918285528181209283549560018701958688116114b757611e4196600296558084528282526001858520018885528252611f6e85852073ffffffffffffffffffffffffffffffffffffffff198154169055565b835252200160008052602052604060002090565b60008080527f827dc0cf3d2abe4eaee1183708c8e6367b8470402f275973ae04e25759c6119560209081527faeb0b87b17fa8e03343e235eca7c43efe301e1f59c45d9513bd7ace99ea93cce805460ff19166001179055907f86d5cf0a6bdc8d859ba3bdc97043337c82a0e609035f378e419298b6a3e00ae69060406001600160a01b03611ed0612e32565b6000918183527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed56020526120588160408520906001600160a01b0316600052602052604060002090565b805460ff191660011790556001600160a01b0380612074612e32565b16908216837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8680a48183527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c806020526040842080549460018601928387116114b757611e4195600294604094558083528160205260018484200188845260205261212586858520906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b82526020522001906001600160a01b0316600052602052604060002090565b90611e4190612153818461229a565b6000928084527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205261219d8260408620906001600160a01b0316600052602052604060002090565b805460ff191690556001600160a01b03806121b6612e32565b16908316827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8780a48084527f0c4ba382c0009cf238e4c1ca1a52f51c61e6248a70bdfb34e5ed49d5578a5c0c908160205261222b8360026040882001906001600160a01b0316600052602052604060002090565b5481865282602052600160408720019086526020526040852073ffffffffffffffffffffffffffffffffffffffff198154169055845260205260026040842001906001600160a01b0316600052602052604060002090565b9061229660209282815194859201610aa8565b0190565b90816000527fd0ebebe8e6445c62babf8fef767eb39f1002bb957bb5b83258275a4e46428ed560205260ff6122e6826040600020906001600160a01b0316600052602052604060002090565b5416156122f1575050565b6001600160a01b031690612303612af8565b91603061230f84612b13565b53607861231b84612b20565b5360295b600181116123d6576105926123876123be866123b0612347886123428915612b4e565b612b99565b612381604051958694612381602087016015907f5065726d697373696f6e733a206163636f756e7420000000000000000000000081520190565b90612283565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000815260110190565b03601f1981018352826103ae565b60405191829162461bcd60e51b8352600483016115ba565b90600f81169060108210156116bc577f303132333435363738396162636465660000000000000000000000000000000061241f921a6124158487612b30565b5360041c91612b41565b61231f565b9061271081116124cd5760207fe2497bd806ec41a6e0dd992c29a72efc0ef8fec9092d1978fd4a1e00b2f18304917f4aeb3f25cc46659cf4e4966e5c48b11e9400e6e4bfafae7e3dc6cc3fbc858deb6001600160a01b038154951680957fffffffffffffffffffff0000000000000000000000000000000000000000000075ffff00000000000000000000000000000000000000008560a01b16911617179055604051908152a2565b606460405162461bcd60e51b815260206004820152600f60248201527f45786365656473206d61782062707300000000000000000000000000000000006044820152fd5b5190610303826102e5565b9081602091031261020c575161043e816102e5565b6040513d6000823e3d90fd5b60006001600160e01b0319813516816001600160a01b0391826002612595836001600160e01b0319166000527f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec48602052604060002090565b0154169081156125be575b50819250368280378136915af43d82803e156125ba573d90f35b3d90fd5b90506020915060246040518094819363529051c560e11b835260048301527f000000000000000000000000f8cbbfc94a015d6ad4e5138ab8e3233f2bdbeb34165afa908115610aa357829182918291612619575b50386125a0565b612631915060203d81116110375761102981836103ae565b38612612565b606460405162461bcd60e51b815260206004820152601360248201527f4d61703a204e6f7420617574686f72697a6564000000000000000000000000006044820152fd5b602090818184031261020c5780519067ffffffffffffffff821161020c57019180601f8401121561020c5782516126b18161105f565b936126bf60405195866103ae565b818552838086019260051b82010192831161020c578301905b8282106126e6575050505090565b83809183516126f4816101fa565b8152019101906126d8565b6000198101919082116114b757565b906127188261105f565b61272560405191826103ae565b8281528092612736601f199161105f565b0190602036910137565b90602090818382031261020c57825167ffffffffffffffff9384821161020c57019080601f8301121561020c5781516127788161105f565b946040612787815197886103ae565b828752858088019360051b8601019484861161020c57868101935b8685106127b457505050505050505090565b845184811161020c5782019060609081601f19848a03011261020c5784516127db8161038d565b8a8401516127e8816101fa565b81528584015187811161020c5784019289603f8501121561020c578b84015190612811826103d0565b9561281e895197886103ae565b8287528b89848801011161020c57866128438f989489988c8a61284d98019101610aa8565b8685015201612511565b868201528152019401936127a2565b906128668261105f565b604090612875825191826103ae565b8381528093612886601f199161105f565b0191600091825b84811061289b575050505050565b60209083516128a98161038d565b85815282606081830152868683015282850101520161288d565b906040516128d08161038d565b80926001600160e01b0319815460e01b1682526001808201604051916000918054906128fb82611784565b80865291838116908115612978575060011461293c575b5050506040928261292f6001600160a01b039460029403826103ae565b6020860152015416910152565b90925060005260209182600020916000925b82841061296557505050820101828261292f612912565b805486850186015292840192810161294e565b60ff191660208088019190915292151560051b8601909201935085925084915061292f9050612912565b90604051906129b08261038d565b602782527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208301527f206661696c6564000000000000000000000000000000000000000000000000006040830152823b15612a4e5760008161043e9460208394519201905af43d15612a46573d90612a29826103d0565b91612a3760405193846103ae565b82523d6000602084013e612ab8565b606090612ab8565b608460405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152fd5b90919015612ac4575090565b815115612ad45750805190602001fd5b6105929060405191829162461bcd60e51b8352602060048401526024830190610acb565b60405190612b058261038d565b602a82526040366020840137565b8051156116bc5760200190565b8051600110156116bc5760210190565b9081518110156116bc570160200190565b80156114b7576000190190565b15612b5557565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b604051906080820182811067ffffffffffffffff8211176103a9576040526042825260603660208401376030612bce83612b13565b536078612bda83612b20565b536041905b60018211612bf25761043e915015612b4e565b600f81169060108210156116bc577f3031323334353637383961626364656600000000000000000000000000000000612c30921a6124158486612b30565b90612bdf565b7f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec4580548210156116bc576000527f21fbb2f7ddba3f9991e90f387f1abccacf68c38163646dd66c242d7a37419646015490565b80548210156116bc576000526020600020015490565b9291949390947f627d6cbb4eb558f37de3c2ec08b04710e54e06be936a302f087f7bfb80f39ae0805460ff8116612da8576001918260ff19809316179055817fbbf78d3411d42a81effd97bb8c69faae4e77e75cec462245c1001191a0634c6f556000928284905b612d42575b50505050509061ffff612d2d92612d26612d329697611951565b1690612424565b611d18565b612d3a611e44565b610303611f82565b8151811015612da35790612d9c826001600160a01b03612d638795856116a8565b511687527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604087208486825416179055611683565b9091612d07565b612d0c565b606460405162461bcd60e51b815260206004820152601460248201527f416c726561647920696e697469616c697a65642e0000000000000000000000006044820152fd5b60ff611d13612df9612e32565b6001600160a01b031660009081527f15e2acbe0ae50b645cb1c4f3ba34bd0377967eb1d6a695c66d22a86a41e66a326020526040902090565b60ff612e70336001600160a01b03166000527fa140e363058a6cf3ca062c5e378319d7ddd21cedfbdca620f1c65b05028f156c602052604060002090565b541615612e835736601319013560601c90565b339056fea2646970667358221220d9a5b094ac5947262112b7f4af4b8b16c63ea87eef2fee90d12b3806328d6f5a64736f6c63430008120033