Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
7461324 | 14 hrs ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
ManagementFacet
Compiler Version
v0.8.24+commit.e11b9ed9
ZkSolc Version
v1.5.9
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; import {SharedStorage} from "../../libraries/SharedStorage.sol"; import {LibDiamond} from "../../libraries/LibDiamond.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract ManagementFacet { using SafeERC20 for IERC20; event PlatformFeeUpdated(uint256 newPlatformFee); event PremiumDiscountUpdated(uint256 newPremiumDiscount); event PremiumAddressUpdated(address premiumAddress); event MarketplacePaused(); event WethAddressUpdated(); /** * @notice Set the platform fee * @param _platformFee Fee in BPS */ function setPlatformFee(uint256 _platformFee) external { LibDiamond.enforceIsContractOwner(); require(_platformFee <= 10000, "Fee exceeds maximum limit"); SharedStorage.setPlatformFee(_platformFee); emit PlatformFeeUpdated(_platformFee); } /** * @notice Set the discount for premium NFT holders * @param _premiumDiscount Discount in BPS */ function setPremiumDiscount(uint256 _premiumDiscount) external { LibDiamond.enforceIsContractOwner(); require(_premiumDiscount <= 5000, "Discount exceeds maximum limit"); SharedStorage.setPremiumDiscount(_premiumDiscount); emit PremiumDiscountUpdated(_premiumDiscount); } /** * @notice Set the Premium NFT address * @param _premiumAddress Address of the premium NFT */ function setPremiumNftAddress(address _premiumAddress) external { LibDiamond.enforceIsContractOwner(); SharedStorage.setPremiumNftAddress(_premiumAddress); emit PremiumAddressUpdated(_premiumAddress); } /** * @notice Set pause/unpause for the marketplace * @param _paused Boolean to pause/unpause the marketplace */ function setMarketplacePaused(bool _paused) external { LibDiamond.enforceIsContractOwner(); SharedStorage.setPaused(_paused); emit MarketplacePaused(); } /** * @notice Set weth address * @param _weth address of the weth ERC20 */ function setWethAddress(address _weth) external { LibDiamond.enforceIsContractOwner(); SharedStorage.setWETHAddress(_weth); emit WethAddressUpdated(); } /** * @notice Platform fee getter * @return Platform fee in BPS */ function getPlatformFee() external view returns (uint256) { return SharedStorage.getStorage().platformFee; } /** * @notice Premium discount getter * @return Discount in BPS */ function getPremiumDiscount() external view returns (uint256) { return SharedStorage.getStorage().premiumDiscount; } /** * @notice Premium NFT address getter * @return Premium NFT address */ function getPremiumNftAddress() external view returns (address) { return SharedStorage.getStorage().premiumNftAddress; } /** * @notice Marketplace pause getter * @return Boolean if paused or not */ function getMarketplacePaused() external view returns (bool) { return SharedStorage.getStorage().paused; } /** * @notice Weth address getter * @return Address of the weth ERC20 */ function getWethAddress() external view returns (address) { return SharedStorage.getStorage().wethAddress; } /** * @notice Withdraw ETH available on the contract */ function withdrawETH() external { LibDiamond.enforceIsContractOwner(); payable(msg.sender).call{value: address(this).balance}(""); } /** * @notice Withdraw ERC20 available on the contract * @param erc20Token Address of the ERC20 to withdraw */ function withdrawERC20(IERC20 erc20Token) external { LibDiamond.enforceIsContractOwner(); uint256 erc20Balance = erc20Token.balanceOf(address(this)); erc20Token.safeTransfer(msg.sender, erc20Balance); } // lets also make it a receiver receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; library SharedStorage { struct Storage { uint256 chainId; address wethAddress; address premiumNftAddress; uint256 platformFee; uint256 premiumDiscount; string name; string version; bool paused; mapping (bytes32 => bool) ordersClaimed; // Tracks if a listing has been claimed mapping (address => uint256) ordersCanceledAt; // below the date all orders are canceled } function getStorage() internal pure returns (Storage storage ds) { bytes32 position = keccak256("org.eip2535.diamond.storage"); assembly { ds.slot := position } } function setChainId(uint256 _chainId) internal { getStorage().chainId = _chainId; } function setWETHAddress(address _wethAddress) internal { getStorage().wethAddress = _wethAddress; } function setPremiumNftAddress(address _premiumNftAddress) internal { getStorage().premiumNftAddress = _premiumNftAddress; } function setPlatformFee(uint256 _platformFee) internal { getStorage().platformFee = _platformFee; } function setPremiumDiscount(uint256 _premiumDiscount) internal { getStorage().premiumDiscount = _premiumDiscount; } function setName(string memory _name) internal { getStorage().name = _name; } function setVersion(string memory _version) internal { getStorage().version = _version; } function setPaused(bool _paused) internal { getStorage().paused = _paused; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import { IDiamond } from "../interfaces/IDiamond.sol"; import { IDiamondCut } from "../interfaces/IDiamondCut.sol"; // Remember to add the loupe functions from DiamondLoupeFacet to the diamond. // The loupe functions are required by the EIP2535 Diamonds standard error NoSelectorsGivenToAdd(); error NotContractOwner(address _user, address _contractOwner); error NoSelectorsProvidedForFacetForCut(address _facetAddress); error CannotAddSelectorsToZeroAddress(bytes4[] _selectors); error NoBytecodeAtAddress(address _contractAddress, string _message); error IncorrectFacetCutAction(uint8 _action); error CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector); error CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors); error CannotReplaceImmutableFunction(bytes4 _selector); error CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector); error CannotReplaceFunctionThatDoesNotExists(bytes4 _selector); error RemoveFacetAddressMustBeZeroAddress(address _facetAddress); error CannotRemoveFunctionThatDoesNotExist(bytes4 _selector); error CannotRemoveImmutableFunction(bytes4 _selector); error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata); library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndSelectorPosition { address facetAddress; uint16 selectorPosition; } struct DiamondStorage { // function selector => facet address and selector position in selectors array mapping(bytes4 => FacetAddressAndSelectorPosition) facetAddressAndSelectorPosition; bytes4[] selectors; mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); address previousOwner = ds.contractOwner; ds.contractOwner = _newOwner; emit OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = diamondStorage().contractOwner; } function enforceIsContractOwner() internal view { if(msg.sender != diamondStorage().contractOwner) { revert NotContractOwner(msg.sender, diamondStorage().contractOwner); } } event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); // Internal function version of diamondCut function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { bytes4[] memory functionSelectors = _diamondCut[facetIndex].functionSelectors; address facetAddress = _diamondCut[facetIndex].facetAddress; if(functionSelectors.length == 0) { revert NoSelectorsProvidedForFacetForCut(facetAddress); } IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamond.FacetCutAction.Add) { addFunctions(facetAddress, functionSelectors); } else if (action == IDiamond.FacetCutAction.Replace) { replaceFunctions(facetAddress, functionSelectors); } else if (action == IDiamond.FacetCutAction.Remove) { removeFunctions(facetAddress, functionSelectors); } else { revert IncorrectFacetCutAction(uint8(action)); } } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { if(_facetAddress == address(0)) { revert CannotAddSelectorsToZeroAddress(_functionSelectors); } DiamondStorage storage ds = diamondStorage(); uint16 selectorCount = uint16(ds.selectors.length); enforceHasContractCode(_facetAddress, "LibDiamondCut: Add facet has no code"); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; if(oldFacetAddress != address(0)) { revert CannotAddFunctionToDiamondThatAlreadyExists(selector); } ds.facetAddressAndSelectorPosition[selector] = FacetAddressAndSelectorPosition(_facetAddress, selectorCount); ds.selectors.push(selector); selectorCount++; } } function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { DiamondStorage storage ds = diamondStorage(); if(_facetAddress == address(0)) { revert CannotReplaceFunctionsFromFacetWithZeroAddress(_functionSelectors); } enforceHasContractCode(_facetAddress, "LibDiamondCut: Replace facet has no code"); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.facetAddressAndSelectorPosition[selector].facetAddress; // can't replace immutable functions -- functions defined directly in the diamond in this case if(oldFacetAddress == address(this)) { revert CannotReplaceImmutableFunction(selector); } if(oldFacetAddress == _facetAddress) { revert CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(selector); } if(oldFacetAddress == address(0)) { revert CannotReplaceFunctionThatDoesNotExists(selector); } // replace old facet address ds.facetAddressAndSelectorPosition[selector].facetAddress = _facetAddress; } } function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { DiamondStorage storage ds = diamondStorage(); uint256 selectorCount = ds.selectors.length; if(_facetAddress != address(0)) { revert RemoveFacetAddressMustBeZeroAddress(_facetAddress); } for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; FacetAddressAndSelectorPosition memory oldFacetAddressAndSelectorPosition = ds.facetAddressAndSelectorPosition[selector]; if(oldFacetAddressAndSelectorPosition.facetAddress == address(0)) { revert CannotRemoveFunctionThatDoesNotExist(selector); } // can't remove immutable functions -- functions defined directly in the diamond if(oldFacetAddressAndSelectorPosition.facetAddress == address(this)) { revert CannotRemoveImmutableFunction(selector); } // replace selector with last selector selectorCount--; if (oldFacetAddressAndSelectorPosition.selectorPosition != selectorCount) { bytes4 lastSelector = ds.selectors[selectorCount]; ds.selectors[oldFacetAddressAndSelectorPosition.selectorPosition] = lastSelector; ds.facetAddressAndSelectorPosition[lastSelector].selectorPosition = oldFacetAddressAndSelectorPosition.selectorPosition; } // delete last selector ds.selectors.pop(); delete ds.facetAddressAndSelectorPosition[selector]; } } function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { return; } enforceHasContractCode(_init, "LibDiamondCut: _init address has no code"); (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up error /// @solidity memory-safe-assembly assembly { let returndata_size := mload(error) revert(add(32, error), returndata_size) } } else { revert InitializationFunctionReverted(_init, _calldata); } } } function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } if(contractSize == 0) { revert NoBytecodeAtAddress(_contract, _errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import { IDiamond } from "./IDiamond.sol"; interface IDiamondCut is IDiamond { /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.23; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamond { enum FacetCutAction {Add, Replace, Remove} // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
{ "optimizer": { "enabled": true, "mode": "3" }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "abi" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": false, "libraries": {} }
Contract ABI
API[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_contractOwner","type":"address"}],"name":"NotContractOwner","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[],"name":"MarketplacePaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPlatformFee","type":"uint256"}],"name":"PlatformFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"premiumAddress","type":"address"}],"name":"PremiumAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPremiumDiscount","type":"uint256"}],"name":"PremiumDiscountUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"WethAddressUpdated","type":"event"},{"inputs":[],"name":"getMarketplacePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlatformFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPremiumDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPremiumNftAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setMarketplacePaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_platformFee","type":"uint256"}],"name":"setPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_premiumDiscount","type":"uint256"}],"name":"setPremiumDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_premiumAddress","type":"address"}],"name":"setPremiumNftAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"name":"setWethAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"erc20Token","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
9c4d535b0000000000000000000000000000000000000000000000000000000000000000010000d9f8a65028843fe353efb543e906197d70b0abbb14b68e3cc827f0cfd400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0002000000000002000300000000000200000060031002700000009e0330019700010000003103550000008004000039000000400040043f00000001002001900000001c0000c13d000000040030008c000000240000413d000000000201043b000000e002200270000000a00020009c000000280000213d000000a80020009c000000490000213d000000ac0020009c000000f10000613d000000ad0020009c000000fc0000613d000000ae0020009c000001bf0000c13d0000000001000416000000000001004b000001bf0000c13d000000cc010000410000013c0000013d0000000001000416000000000001004b000001bf0000c13d0000002001000039000001000010044300000120000004430000009f01000041000002760001042e000000000003004b000001bf0000c13d0000000001000019000002760001042e000000a10020009c0000006e0000213d000000a50020009c000001150000613d000000a60020009c0000011a0000613d000000a70020009c000001bf0000c13d000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000b002000041000000000202041a000000af022001970000000003000411000000000023004b000001920000c13d000013890010008c0000019f0000413d000000c901000041000000800010043f0000002001000039000000840010043f0000001e01000039000000a40010043f000000ca01000041000000c40010043f000000cb010000410000027700010430000000a90020009c000001380000613d000000aa0020009c000001410000613d000000ab0020009c000001bf0000c13d000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000af0010009c000001bf0000213d000000b002000041000000000202041a000000af022001970000000003000411000000000023004b000001920000c13d000000af01100197000000d002000041000000000302041a000000cd03300197000000000313019f000000000032041b000000800010043f00000000010004140000009e0010009c0000009e01008041000000c001100210000000c7011001c70000800d020000390000000103000039000000d104000041000001bc0000013d000000a20020009c000001610000613d000000a30020009c0000018a0000613d000000a40020009c000001bf0000c13d000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000af0010009c000001bf0000213d000000b002000041000000000202041a000000af032001970000000002000411000000000032004b000001ab0000c13d000200000003001d000000af02100197000000b301000041000000800010043f0000000001000410000000840010043f00000000010004140000009e0010009c0000009e01008041000000c001100210000000b4011001c7000300000002001d027502700000040f00000060031002700000009e03300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000080057001bf0000009f0000613d0000008008000039000000000901034f000000009a09043c0000000008a80436000000000058004b0000009b0000c13d000000000006004b000000ac0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000000003001f00010000000103550000000100200190000001c10000613d0000001f01400039000000600210018f00000080012001bf000000400010043f000000200030008c000001bf0000413d000000c403200039000000800400043d0000000000430435000000a003200039000000b6040000410000000000430435000000a404200039000000020500002900000000005404350000004404000039000000000041043500000100022001bf000000400020043f000000400230021000000000010104330000009e0010009c0000009e010080410000006001100210000000000121019f00000000020004140000009e0020009c0000009e02008041000000c002200210000000000121019f00000003020000290275026b0000040f000100000001035500000060031002700000009e0030019d0000009e03300198000001df0000c13d000000600a000039000000800900003900000000010a04330000000100200190000002070000613d00020000000a001d000000000001004b000002240000c13d000100000009001d000000be0100004100000000001004430000000301000029000000040010044300000000010004140000009e0010009c0000009e01008041000000c001100210000000bf011001c70000800202000039027502700000040f00000001002001900000019e0000613d000000000101043b000000000001004b0000021f0000c13d000000400100043d000000c202000041000002320000013d0000000001000416000000000001004b000001bf0000c13d000000d201000041000000000101041a000000ff001001900000000001000039000000010100c039000000800010043f000000c401000041000002760001042e000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000b002000041000000000202041a000000af022001970000000003000411000000000023004b000001920000c13d000027110010008c000001b10000413d000000c901000041000000800010043f0000002001000039000000840010043f0000001901000039000000a40010043f000000d501000041000000c40010043f000000cb0100004100000277000104300000000001000416000000000001004b000001bf0000c13d000000cf010000410000018e0000013d000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000af0010009c000001bf0000213d000000b002000041000000000202041a000000af022001970000000003000411000000000023004b000001920000c13d000000af01100197000000cc02000041000000000302041a000000cd03300197000000000113019f000000000012041b00000000010004140000009e0010009c0000009e01008041000000c001100210000000c6011001c70000800d020000390000000103000039000000ce04000041000001bc0000013d0000000001000416000000000001004b000001bf0000c13d000000d001000041000000000101041a000000af01100197000000800010043f000000c401000041000002760001042e000000240030008c000001bf0000413d0000000002000416000000000002004b000001bf0000c13d0000000401100370000000000101043b000000000001004b0000000002000039000000010200c039000000000021004b000001bf0000c13d000000b002000041000000000202041a000000af022001970000000003000411000000000023004b000001920000c13d000000d202000041000000000302041a000000d603300197000000000113019f000000000012041b00000000010004140000009e0010009c0000009e01008041000000c001100210000000c6011001c70000800d020000390000000103000039000000d304000041000001bc0000013d0000000001000416000000000001004b000001bf0000c13d000000b001000041000000000101041a000000af031001970000000001000411000000000031004b000001980000c13d000300000003001d000000c50100004100000000001004430000000001000410000000040010044300000000010004140000009e0010009c0000009e01008041000000c001100210000000bf011001c70000800a02000039027502700000040f00000001002001900000019e0000613d000000000301043b00000000010004140000009e0010009c0000009e01008041000000c001100210000000000003004b000000c60110c1c700000003040000290000800902000039000000000204601900000000050000190275026b0000040f00000060021002700000009e0020019d00010000000103550275023b0000040f0000000001000019000002760001042e0000000001000416000000000001004b000001bf0000c13d000000c301000041000000000101041a000000800010043f000000c401000041000002760001042e000000b101000041000000800010043f000000840030043f000000a40020043f000000b2010000410000027700010430000000b102000041000000800020043f000000840010043f000000a40030043f000000b2010000410000027700010430000000000001042f000000c302000041000000000012041b000000800010043f00000000010004140000009e0010009c0000009e01008041000000c001100210000000c7011001c70000800d020000390000000103000039000000c804000041000001bc0000013d000000b101000041000000800010043f000000840020043f000000a40030043f000000b2010000410000027700010430000000cf02000041000000000012041b000000800010043f00000000010004140000009e0010009c0000009e01008041000000c001100210000000c7011001c70000800d020000390000000103000039000000d4040000410275026b0000040f0000000100200190000000260000c13d000000000100001900000277000104300000001f0530018f000000b506300198000000400200043d0000000004620019000001cc0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000001c80000c13d000000000005004b000001d90000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f000000000014043500000060013002100000009e0020009c0000009e020080410000004002200210000000000112019f00000277000104300000001f04300039000000b7044001970000003f04400039000000b804400197000000400a00043d00000000044a00190000000000a4004b00000000050000390000000105004039000000b90040009c000002110000213d0000000100500190000002110000c13d000000400040043f0000001f0430018f00000000063a0436000000b50530019800000000090600190000000003560019000001f90000613d000000000601034f0000000007090019000000006806043c0000000007870436000000000037004b000001f50000c13d000000000004004b000000d70000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000130435000000d70000013d000000000001004b000002170000c13d000000400100043d000000bc0200004100000000002104350000009e0010009c0000009e010080410000004001100210000000bd011001c70000027700010430000000ba01000041000000000010043f0000004101000039000000040010043f000000bb0100004100000277000104300000009e0090009c0000009e0900804100000040029002100000009e0010009c0000009e010080410000006001100210000000000121019f000002770001043000000002010000290000000001010433000000000001004b0000000109000029000000260000613d000000c00010009c000001bf0000213d000000200010008c000001bf0000413d0000000001090433000000000001004b0000000002000039000000010200c039000000000021004b000001bf0000c13d000000000001004b000000260000c13d000000400100043d000000c10200004100000000002104350000000402100039000000030300002900000000003204350000009e0010009c0000009e010080410000004001100210000000bb011001c700000277000104300000000001000032000002630000613d0000001f03100039000000d7033001970000003f03300039000000d704300197000000400300043d0000000004430019000000000034004b00000000050000390000000105004039000000b90040009c000002640000213d0000000100500190000002640000c13d000000400040043f0000000005130436000000d7021001980000001f0310018f00000000012500190000000104000367000002560000613d000000000604034f000000006706043c0000000005750436000000000015004b000002520000c13d000000000003004b000002630000613d000000000224034f0000000303300210000000000401043300000000043401cf000000000434022f000000000202043b0000010003300089000000000232022f00000000023201cf000000000242019f0000000000210435000000000001042d000000ba01000041000000000010043f0000004101000039000000040010043f000000bb010000410000027700010430000000000001042f0000026e002104210000000102000039000000000001042d0000000002000019000000000001042d00000273002104230000000102000039000000000001042d0000000002000019000000000001042d0000027500000432000002760001042e000002770001043000000000000000000000000000000000000000000000000000000000ffffffff0000000200000000000000000000000000000040000001000000000000000000000000000000000000000000000000000000000000000000000000006ea8bc0f00000000000000000000000000000000000000000000000000000000e086e5eb00000000000000000000000000000000000000000000000000000000e086e5ec00000000000000000000000000000000000000000000000000000000ed3471da00000000000000000000000000000000000000000000000000000000f4f3b200000000000000000000000000000000000000000000000000000000006ea8bc1000000000000000000000000000000000000000000000000000000000a96e242300000000000000000000000000000000000000000000000000000000d13f1b3e0000000000000000000000000000000000000000000000000000000024838bb00000000000000000000000000000000000000000000000000000000024838bb100000000000000000000000000000000000000000000000000000000418d0cdf000000000000000000000000000000000000000000000000000000006b0e78b2000000000000000000000000000000000000000000000000000000000df262590000000000000000000000000000000000000000000000000000000012e8e2c30000000000000000000000000000000000000000000000000000000023a7b42a000000000000000000000000ffffffffffffffffffffffffffffffffffffffffc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131fff4127cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004400000080000000000000000070a0823100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000080000000000000000000000000000000000000000000000000000000000000000000000000ffffffe0a9059cbb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000003ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff4e487b710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000001425ea420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b8302000002000000000000000000000000000000240000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5274afe7000000000000000000000000000000000000000000000000000000009996b31500000000000000000000000000000000000000000000000000000000c48fed42ba98a7f089dad48ac4009ba5d776a9dfb9f8c82b0294ff480536a1d500000000000000000000000000000000000000200000008000000000000000009cc7f708afc65944829bd487b90b72536b1951864fbfc14e125fc972a6507f39020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000200000008000000000000000002c524758b986b6dd8f808fae54ddaeefca71c51da0cfa80257573d916c1a5d3608c379a000000000000000000000000000000000000000000000000000000000446973636f756e742065786365656473206d6178696d756d206c696d697400000000000000000000000000000000000000000064000000800000000000000000c48fed42ba98a7f089dad48ac4009ba5d776a9dfb9f8c82b0294ff480536a1d2ffffffffffffffffffffffff0000000000000000000000000000000000000000c15a3bda887dff2e59893bb2cfa8bb1ee921e63804e248afecd8e242c47bef0ec48fed42ba98a7f089dad48ac4009ba5d776a9dfb9f8c82b0294ff480536a1d4c48fed42ba98a7f089dad48ac4009ba5d776a9dfb9f8c82b0294ff480536a1d3ba075ff32279ce2f170a0c8c01c9589e0cfb241320a0eee9f7c1a1ef3491da44c48fed42ba98a7f089dad48ac4009ba5d776a9dfb9f8c82b0294ff480536a1d8f9ecce735cbdc09411aea95fac8e250d8ba45591e555673cff75969cd667391145610d581145924dd7090a5017e5f2b1d6f42213bb2e95707ff86846bbfcb1ca4665652065786365656473206d6178696d756d206c696d697400000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0142dd5d6b637db7413faa0058099ca5cb4a8eac1c82451a34dfe68ec93c8c3ab
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.