Overview
ETH Balance
0.001449993899398002 ETH
ETH Value
$2.57 (@ $1,770.65/ETH)More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 16 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2494265 | 366 days ago | 0.00103239 ETH | ||||
2176470 | 373 days ago | 0.00024921 ETH | ||||
2012741 | 377 days ago | 0.00012239 ETH | ||||
1446766 | 390 days ago | Contract Creation | 0 ETH | |||
1446745 | 390 days ago | Contract Creation | 0 ETH | |||
1446744 | 390 days ago | Contract Creation | 0 ETH | |||
1446670 | 390 days ago | Contract Creation | 0 ETH | |||
1446653 | 390 days ago | Contract Creation | 0 ETH | |||
1446607 | 390 days ago | Contract Creation | 0 ETH | |||
1446537 | 390 days ago | Contract Creation | 0 ETH | |||
1446519 | 390 days ago | Contract Creation | 0 ETH | |||
1446488 | 390 days ago | Contract Creation | 0 ETH | |||
1446473 | 390 days ago | Contract Creation | 0 ETH | |||
1446446 | 390 days ago | Contract Creation | 0 ETH | |||
1442202 | 390 days ago | 0.00000071 ETH | ||||
1440329 | 390 days 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:
MOPNDiamond
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 * * Implementation of a diamond. /******************************************************************************/ import {LibDiamond} from "./libraries/LibDiamond.sol"; import {LibMOPN} from "./libraries/LibMOPN.sol"; import {IDiamondCut} from "./interfaces/IDiamondCut.sol"; import {Events} from "./libraries/Events.sol"; import "@openzeppelin/contracts/utils/Multicall.sol"; contract MOPNDiamond is Multicall { constructor(address _contractOwner, address _diamondCutFacet) payable { // open when deploy real network LibMOPN.BLAST.configureClaimableGas(); LibMOPN.BLAST.configureAutomaticYield(); LibDiamond.setContractOwner(_contractOwner); LibDiamond.setContractOperator(_contractOwner); // Add the diamondCut external function from the diamondCutFacet IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1); bytes4[] memory functionSelectors = new bytes4[](1); functionSelectors[0] = IDiamondCut.diamondCut.selector; cut[0] = IDiamondCut.FacetCut({facetAddress: _diamondCutFacet, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors}); LibDiamond.diamondCut(cut, address(0), ""); } // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; // get diamond storage assembly { ds.slot := position } // get facet from function selector address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress; require(facet != address(0), "Diamond: Function does not exist"); // Execute external function from facet using delegatecall and return any value. assembly { // copy function selector and any arguments calldatacopy(0, 0, calldatasize()) // execute function call using the facet let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) // get any return value returndatacopy(0, 0, returndatasize()) // return any return value or error back to the caller switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.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); }
// 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) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Multicall.sol) pragma solidity ^0.8.20; import {Address} from "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol) pragma solidity ^0.8.20; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential. * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. * * BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type. * Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot, * unlike the regular `bool` which would consume an entire slot for a single value. * * This results in gas savings in two ways: * * - Setting a zero value to non-zero only once every 256 times * - Accessing the same warm slot for every 256 _sequential_ indices */ library BitMaps { struct BitMap { mapping(uint256 bucket => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo(BitMap storage bitmap, uint256 index, bool value) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] &= ~mask; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @dev the ERC-165 identifier for this interface is `0x6faff5f1` interface IERC6551Account { /** * @dev Allows the account to receive Ether * * Accounts MUST implement a `receive` function. * * Accounts MAY perform arbitrary logic to restrict conditions * under which Ether can be received. */ receive() external payable; /** * @dev Returns the identifier of the non-fungible token which owns the account * * The return value of this function MUST be constant - it MUST NOT change * over time * * @return chainId The EIP-155 ID of the chain the token exists on * @return tokenContract The contract address of the token * @return tokenId The ID of the token */ function token() external view returns (uint256 chainId, address tokenContract, uint256 tokenId); /** * @dev Returns a value that SHOULD be modified each time the account changes state * * @return The current account state */ function state() external view returns (uint256); /** * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf of the account * * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid * * By default, the holder of the non-fungible token the account is bound to MUST be considered a valid * signer * * Accounts MAY implement additional authorization logic which invalidates the holder as a * signer or grants signing permissions to other non-holder accounts * * @param signer The address to check signing authorization for * @param context Additional data used to determine whether the signer is valid * @return magicValue Magic value indicating whether the signer is valid */ function isValidSigner( address signer, bytes calldata context ) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @dev the ERC-165 identifier for this interface is `0x74420f4c` interface IERC6551Executable { /** * @dev Executes a low-level operation if the caller is a valid signer on the account * * Reverts and bubbles up error if operation fails * * @param to The target address of the operation * @param value The Ether value to be sent to the target * @param data The encoded operation calldata * @param operation A value indicating the type of operation to perform * * Accounts implementing this interface MUST accept the following operation parameter values: * - 0 = CALL * - 1 = DELEGATECALL * - 2 = CREATE * - 3 = CREATE2 * * Accounts implementing this interface MAY support additional operations or restrict a signer's * ability to execute certain operations * * @return The result of the operation */ function execute( address to, uint256 value, bytes calldata data, uint256 operation ) external payable returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC6551Account.sol"; import "./IERC6551Executable.sol"; interface IMOPNERC6551Account is IERC6551Account, IERC6551Executable { function executeProxy( address to, uint256 value, bytes calldata data, uint256 operation, address msgsender ) external payable returns (bytes memory); function isOwner(address caller) external view returns (bool); function owner() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; enum YieldMode { AUTOMATIC, VOID, CLAIMABLE } enum GasMode { VOID, CLAIMABLE } interface IBlast { // configure function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external; function configure(YieldMode _yield, GasMode gasMode, address governor) external; // base configuration options function configureClaimableYield() external; function configureClaimableYieldOnBehalf(address contractAddress) external; function configureAutomaticYield() external; function configureAutomaticYieldOnBehalf(address contractAddress) external; function configureVoidYield() external; function configureVoidYieldOnBehalf(address contractAddress) external; function configureClaimableGas() external; function configureClaimableGasOnBehalf(address contractAddress) external; function configureVoidGas() external; function configureVoidGasOnBehalf(address contractAddress) external; function configureGovernor(address _governor) external; function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external; // claim yield function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256); function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256); // claim gas function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256); function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256); function claimGas(address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume) external returns (uint256); // read functions function readClaimableYield(address contractAddress) external view returns (uint256); function readYieldConfiguration(address contractAddress) external view returns (uint8); function readGasParams(address contractAddress) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction { Add, Replace, Remove } // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @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; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title ERC-173 Contract Ownership Standard /// Note: the ERC-165 identifier for this interface is 0x7f5828d0 /* is ERC165 */ interface IERC173 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Get the address of the owner /// @return owner_ The address of the owner. function owner() external view returns (address owner_); /// @notice Set the address of the new owner of the contract /// @dev Set _newOwner to address(0) to renounce any ownership. /// @param _newOwner The address of the new owner of the contract function transferOwnership(address _newOwner) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/interfaces/IERC20.sol"; interface IMOPNCollectionVault is IERC20 { struct AskStruct { uint256 vaultStatus; uint256 startTimestamp; uint256 bidAcceptPrice; uint256 tokenId; uint256 currentPrice; } struct BidStruct { uint256 vaultStatus; uint256 startTimestamp; uint256 askAcceptPrice; uint256 currentPrice; } event BidAccept(address indexed operator, uint256 tokenId, uint256 price); event AskAccept(address indexed operator, uint256 tokenId, uint256 price); event MTDeposit(address indexed operator, uint256 MTAmount, uint256 VTAmount); event MTWithdraw(address indexed operator, uint256 MTAmount, uint256 VTAmount); function getAskInfo() external view returns (AskStruct memory ask); function getBidInfo() external view returns (BidStruct memory bid); function AskAcceptPrice() external view returns (uint64); function getCollectionMOPNPoint() external view returns (uint24 point); function MTBalance() external view returns (uint256 balance); function collectionAddress() external view returns (address); function V2MTAmountRealtime(uint256 VAmount) external view returns (uint256 MTAmount); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; library Constants { uint256 public constant MTReduceInterval = 604800; uint256 public constant MaxCollectionOnMapNum = 10000; uint8 internal constant NOT_ENTERED = 1; uint8 internal constant ENTERED = 2; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; library Errors { error ReentrantCall(); error ReentrantCallView(); error NotDiamond(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; library Events { /** * @notice This event emit when an avatar jump into the map * @param account account wallet address * @param LandId MOPN Land Id * @param tileCoordinate tile coordinate */ event AccountJumpIn(address indexed account, uint16 indexed LandId, uint24 tileCoordinate, address agentPlacer, uint16 AgentAssignPercentage); /** * @notice This event emit when an avatar move on map * @param account account wallet address * @param LandId MOPN Land Id * @param fromCoordinate tile coordinate * @param toCoordinate tile coordinate */ event AccountMove(address indexed account, uint16 indexed LandId, uint24 fromCoordinate, uint24 toCoordinate); /** * @notice BombUse Event emit when a Bomb is used at a coordinate by an avatar * @param account account wallet address * @param victim the victim that bombed out of the map * @param tileCoordinate the tileCoordinate */ event BombUse(address indexed account, address victim, uint24 tileCoordinate); event AccountMTMinted(address indexed account, uint256 amount, uint16 AgentAssignPercentage); event CollectionMTMinted(address indexed collectionAddress, uint256 amount); event LandHolderMTMinted(uint16 indexed LandId, uint256 amount); event CollectionPointChange(address collectionAddress, uint256 CollectionPoint); event CollectionVaultCreated(address indexed collectionAddress, address indexed collectionVault); event BombSold(address indexed buyer, uint256 amount, uint256 price); event ManualClaimGas(address indexed wallet, uint256 amount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import {IDiamondCut} from "../interfaces/IDiamondCut.sol"; import "../interfaces/IERC173.sol"; // Remember to add the loupe functions from DiamondLoupeFacet to the diamond. // The loupe functions are required by the EIP2535 Diamonds standard error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata); library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndPosition { address facetAddress; uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array } struct FacetFunctionSelectors { bytes4[] functionSelectors; uint256 facetAddressPosition; // position of facetAddress in facetAddresses array } struct DiamondStorage { // maps function selector to the facet address and // the position of the selector in the facetFunctionSelectors.selectors array mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition; // maps facet addresses to function selectors mapping(address => FacetFunctionSelectors) facetFunctionSelectors; // facet addresses address[] facetAddresses; // Used to query if a contract implements an interface. // Used to implement ERC-165. mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; // operator of the contract address contractOperator; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } function setContractOwner(address _newOwner) internal { DiamondStorage storage ds = diamondStorage(); address previousOwner = ds.contractOwner; ds.contractOwner = _newOwner; emit IERC173.OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = diamondStorage().contractOwner; } function enforceIsContractOwner() internal view { require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner"); } function setContractOperator(address _newOperator) internal { DiamondStorage storage ds = diamondStorage(); address previousOperator = ds.contractOperator; ds.contractOperator = _newOperator; emit IERC173.OwnershipTransferred(previousOperator, _newOperator); } function contractOperator() internal view returns (address contractOperator_) { contractOperator_ = diamondStorage().contractOperator; } function enforceIsContractOperator() internal view { require(msg.sender == diamondStorage().contractOperator, "LibDiamond: Must be contract opearator"); } // Internal function version of diamondCut function diamondCut(IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata) internal { for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamondCut.FacetCutAction.Add) { addFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors); } else if (action == IDiamondCut.FacetCutAction.Replace) { replaceFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors); } else if (action == IDiamondCut.FacetCutAction.Remove) { removeFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors); } else { revert("LibDiamondCut: Incorrect FacetCutAction"); } } emit IDiamondCut.DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); require(_facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)"); uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length); // add new facet address if it does not exist if (selectorPosition == 0) { addFacet(ds, _facetAddress); } for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress; require(oldFacetAddress == address(0), "LibDiamondCut: Can't add function that already exists"); addFunction(ds, selector, selectorPosition, _facetAddress); selectorPosition++; } } function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); require(_facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)"); uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length); // add new facet address if it does not exist if (selectorPosition == 0) { addFacet(ds, _facetAddress); } for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress; require(oldFacetAddress != _facetAddress, "LibDiamondCut: Can't replace function with same function"); removeFunction(ds, oldFacetAddress, selector); addFunction(ds, selector, selectorPosition, _facetAddress); selectorPosition++; } } function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal { require(_functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); DiamondStorage storage ds = diamondStorage(); // if function does not exist then do nothing and return require(_facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)"); for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress; removeFunction(ds, oldFacetAddress, selector); } } function addFacet(DiamondStorage storage ds, address _facetAddress) internal { enforceHasContractCode(_facetAddress, "LibDiamondCut: New facet has no code"); ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds.facetAddresses.length; ds.facetAddresses.push(_facetAddress); } function addFunction(DiamondStorage storage ds, bytes4 _selector, uint96 _selectorPosition, address _facetAddress) internal { ds.selectorToFacetAndPosition[_selector].functionSelectorPosition = _selectorPosition; ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(_selector); ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress; } function removeFunction(DiamondStorage storage ds, address _facetAddress, bytes4 _selector) internal { require(_facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist"); // an immutable function is a function defined directly in a diamond require(_facetAddress != address(this), "LibDiamondCut: Can't remove immutable function"); // replace selector with last selector, then delete last selector uint256 selectorPosition = ds.selectorToFacetAndPosition[_selector].functionSelectorPosition; uint256 lastSelectorPosition = ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - 1; // if not the same then replace _selector with lastSelector if (selectorPosition != lastSelectorPosition) { bytes4 lastSelector = ds.facetFunctionSelectors[_facetAddress].functionSelectors[lastSelectorPosition]; ds.facetFunctionSelectors[_facetAddress].functionSelectors[selectorPosition] = lastSelector; ds.selectorToFacetAndPosition[lastSelector].functionSelectorPosition = uint96(selectorPosition); } // delete the last selector ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); delete ds.selectorToFacetAndPosition[_selector]; // if no more selectors for facet address then delete the facet address if (lastSelectorPosition == 0) { // replace facet address with last facet address and delete last facet address uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1; uint256 facetAddressPosition = ds.facetFunctionSelectors[_facetAddress].facetAddressPosition; if (facetAddressPosition != lastFacetAddressPosition) { address lastFacetAddress = ds.facetAddresses[lastFacetAddressPosition]; ds.facetAddresses[facetAddressPosition] = lastFacetAddress; ds.facetFunctionSelectors[lastFacetAddress].facetAddressPosition = facetAddressPosition; } ds.facetAddresses.pop(); delete ds.facetFunctionSelectors[_facetAddress].facetAddressPosition; } } 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) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; import {Constants} from "contracts/libraries/Constants.sol"; import {Errors} from "contracts/libraries/Errors.sol"; import "../erc6551/interfaces/IMOPNERC6551Account.sol"; import {IBlast} from "../interfaces/IBlast.sol"; import "../interfaces/IMOPNCollectionVault.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/structs/BitMaps.sol"; library LibMOPN { IBlast public constant BLAST = IBlast(0x4300000000000000000000000000000000000002); bytes32 constant MOPN_STORAGE_POSITION = keccak256("diamond.standard.mopn.storage"); struct AccountDataStruct { uint16 LandId; uint24 Coordinate; uint48 PerMOPNPointMinted; uint48 SettledMT; uint48 PerCollectionNFTMinted; uint16 AgentAssignPercentage; address AgentPlacer; } struct CollectionDataStruct { uint24 CollectionMOPNPoint; uint48 OnMapMOPNPoints; uint16 OnMapNftNumber; uint16 OnMapAgentPlaceNftNumber; uint48 PerCollectionNFTMinted; uint48 PerMOPNPointMinted; uint48 SettledMT; address vaultAddress; uint48 vaultIndex; } struct BombSoldStruct { uint16[24] hourSolds; uint32 lastSellTimestamp; } struct NFTParams { address collectionAddress; uint256 tokenId; } struct AccountDataOutput { address account; address contractAddress; uint256 tokenId; uint256 CollectionMOPNPoint; uint256 MTBalance; uint256 OnMapMOPNPoint; uint256 TotalMOPNPoint; uint32 tileCoordinate; address owner; address AgentPlacer; uint256 AgentAssignPercentage; } struct CollectionDataOutput { address contractAddress; address collectionVault; uint256 OnMapNum; uint256 MTBalance; uint256 UnclaimMTBalance; uint256 CollectionMOPNPoints; uint256 OnMapMOPNPoints; uint256 CollectionMOPNPoint; uint256 PMTTotalSupply; uint256 OnMapAgentPlaceNftNumber; IMOPNCollectionVault.AskStruct AskStruct; IMOPNCollectionVault.BidStruct BidStruct; } struct MOPNStorage { uint32 LastTickTimestamp; uint48 TotalMOPNPoints; uint48 PerMOPNPointMinted; uint64 MTTotalMinted; uint32 MTOutputPerTimestamp; uint32 MTStepStartTimestamp; uint16 nextLandId; uint48 vaultIndex; uint8 reentrantStatus; address bombContract; address tokenContract; address landContract; address vaultContract; address ERC6551Registry; address ERC6551AccountProxy; address ERC6551AccountHelper; address gasrecipient; bool whitelist; BombSoldStruct bombsold; BitMaps.BitMap tilesbitmap; mapping(address => AccountDataStruct) ADs; mapping(address => CollectionDataStruct) CDs; mapping(uint32 => uint256) Lands; bytes32 whiteListRoot; } function mopnStorage() internal pure returns (MOPNStorage storage ms) { bytes32 position = MOPN_STORAGE_POSITION; assembly { ms.slot := position } } function tileneighbor(uint24 tileCoordinate, uint256 direction) internal pure returns (uint24) { unchecked { if (direction == 1) { return tileCoordinate - 1; } else if (direction == 2) { return tileCoordinate - 10000; } else if (direction == 3) { return tileCoordinate - 9999; } else if (direction == 4) { return tileCoordinate + 1; } else if (direction == 5) { return tileCoordinate + 10000; } else { return tileCoordinate + 9999; } } } function tilepoint(uint24 tileCoordinate) internal pure returns (uint48) { if (tileCoordinate == 0) { return 0; } unchecked { if ((tileCoordinate / 10000) % 10 == 0) { if (tileCoordinate % 10 == 0) { return 1500; } return 500; } else if (tileCoordinate % 10 == 0) { return 500; } return 100; } } function tiledistance(uint24 a, uint24 b) internal pure returns (uint24 d) { unchecked { uint24 at = a / 10000; uint24 bt = b / 10000; d += at > bt ? at - bt : bt - at; at = a % 10000; bt = b % 10000; d += at > bt ? at - bt : bt - at; at = 3000 - a / 10000 - at; bt = 3000 - b / 10000 - bt; d += at > bt ? at - bt : bt - at; d /= 2; } } function tileAtLandCenter(uint256 LandId) internal pure returns (uint24) { if (LandId == 0) { return 10001000; } unchecked { uint256 n = (Math.sqrt(9 + 12 * LandId) - 3) / 6; if ((3 * n * n + 3 * n) != LandId) { n++; } uint256 startTile = 10001000 - n * 49989; uint256 z = 3000 - startTile / 10000 - (startTile % 10000); n--; uint256 LandIdRingPos_ = LandId - (3 * n * n + 3 * n); n++; uint256 side = Math.ceilDiv(LandIdRingPos_, n); uint256 sidepos = 0; if (n > 1) { sidepos = (LandIdRingPos_ - 1) % n; } if (side == 1) { startTile = startTile + sidepos * 110000 - sidepos * 6; } else if (side == 2) { startTile = (2000 - z) * 10000 + (2000 - startTile / 10000); startTile = startTile + sidepos * 49989; } else if (side == 3) { startTile = (startTile % 10000) * 10000 + z; startTile = startTile - sidepos * 60005; } else if (side == 4) { startTile = 20002000 - startTile; startTile = startTile - sidepos * 109994; } else if (side == 5) { startTile = z * 10000 + startTile / 10000; startTile = startTile - sidepos * 49989; } else if (side == 6) { startTile = (2000 - (startTile % 10000)) * 10000 + (2000 - z); startTile = startTile + sidepos * 60005; } return uint24(startTile); } } function getAccountCollection(address account) internal view returns (address collectionAddress) { (, collectionAddress, ) = IMOPNERC6551Account(payable(account)).token(); } } contract Modifiers { modifier onlyCollectionVault(address collectionAddress) { require(msg.sender == LibMOPN.mopnStorage().CDs[collectionAddress].vaultAddress, "only collection vault allowed"); _; } modifier nonReentrant() { if (LibMOPN.mopnStorage().reentrantStatus == Constants.ENTERED) revert Errors.ReentrantCall(); LibMOPN.mopnStorage().reentrantStatus = Constants.ENTERED; _; LibMOPN.mopnStorage().reentrantStatus = Constants.NOT_ENTERED; } modifier nonReentrantView() { if (LibMOPN.mopnStorage().reentrantStatus == Constants.ENTERED) revert Errors.ReentrantCallView(); _; } }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_diamondCutFacet","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum IDiamondCut.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"indexed":false,"internalType":"struct IDiamondCut.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"_init","type":"address"},{"indexed":false,"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"DiamondCut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405260405162001ab038038062001ab083398101604081905262000026916200112a565b7343000000000000000000000000000000000000026001600160a01b0316634e606c476040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156200007657600080fd5b505af11580156200008b573d6000803e3d6000fd5b505050507343000000000000000000000000000000000000026001600160a01b0316637114177a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620000df57600080fd5b505af1158015620000f4573d6000803e3d6000fd5b5050505062000109826200022960201b60201c565b62000114826200029c565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816200012b5750506040805160018082528183019092529192506000919060208083019080368337019050509050631f931c1c60e01b816000815181106200019e576200019e62001162565b6001600160e01b031990921660209283029190910182015260408051606081019091526001600160a01b0385168152908101600081526020018281525082600081518110620001f157620001f162001162565b60200260200101819052506200021f826000604051806020016040528060008152506200030f60201b60201c565b50505050620013cd565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132080546001600160a01b031981166001600160a01b03848116918217909355604051600080516020620019e48339815191529390921691829060008051602062001a7083398151915290600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180546001600160a01b031981166001600160a01b03848116918217909355604051600080516020620019e48339815191529390921691829060008051602062001a7083398151915290600090a3505050565b60005b83518110156200050f57600084828151811062000333576200033362001162565b60200260200101516020015190506000600281111562000357576200035762001178565b8160028111156200036c576200036c62001178565b03620003ca57620003c48583815181106200038b576200038b62001162565b602002602001015160000151868481518110620003ac57620003ac62001162565b6020026020010151604001516200055e60201b60201c565b62000505565b6001816002811115620003e157620003e162001178565b036200043957620003c485838151811062000400576200040062001162565b60200260200101516000015186848151811062000421576200042162001162565b602002602001015160400151620007e260201b60201c565b600281600281111562000450576200045062001178565b03620004a857620003c48583815181106200046f576200046f62001162565b60200260200101516000015186848151811062000490576200049062001162565b60200260200101516040015162000a7160201b60201c565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084015b60405180910390fd5b5060010162000312565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb6738383836040516200054593929190620011e2565b60405180910390a162000559828262000bca565b505050565b6000815111620005b45760405162461bcd60e51b815260206004820152602b602482015260008051602062001a9083398151915260448201526a1858d95d081d1bc818dd5d60aa1b6064820152608401620004fc565b600080516020620019e48339815191526001600160a01b038316620006205760405162461bcd60e51b815260206004820152602c602482015260008051602062001a2c83398151915260448201526b65206164647265737328302960a01b6064820152608401620004fc565b6001600160a01b0383166000908152600182016020526040812054906001600160601b0382169003620006595762000659828562000c9c565b60005b8351811015620007db5760008482815181106200067d576200067d62001162565b6020908102919091018101516001600160e01b031981166000908152918690526040909120549091506001600160a01b03168015620007255760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c72656164792065786973747300000000000000000000006064820152608401620004fc565b6001600160e01b0319821660008181526020878152604080832080546001600160a01b03908116600160a01b6001600160601b038c16021782558c168085526001808c0185529285208054938401815585528385206008840401805463ffffffff60079095166004026101000a948502191660e08a901c94909402939093179092559390925287905281546001600160a01b03191617905583620007c98162001302565b945050600190920191506200065c9050565b5050505050565b6000815111620008385760405162461bcd60e51b815260206004820152602b602482015260008051602062001a9083398151915260448201526a1858d95d081d1bc818dd5d60aa1b6064820152608401620004fc565b600080516020620019e48339815191526001600160a01b038316620008a45760405162461bcd60e51b815260206004820152602c602482015260008051602062001a2c83398151915260448201526b65206164647265737328302960a01b6064820152608401620004fc565b6001600160a01b0383166000908152600182016020526040812054906001600160601b0382169003620008dd57620008dd828562000c9c565b60005b8351811015620007db57600084828151811062000901576200090162001162565b6020908102919091018101516001600160e01b031981166000908152918690526040909120549091506001600160a01b039081169087168103620009ae5760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e00000000000000006064820152608401620004fc565b620009bb85828462000d09565b6001600160e01b0319821660008181526020878152604080832080546001600160a01b03908116600160a01b6001600160601b038c16021782558c168085526001808c0185529285208054938401815585528385206008840401805463ffffffff60079095166004026101000a948502191660e08a901c94909402939093179092559390925287905281546001600160a01b0319161790558362000a5f8162001302565b94505060019092019150620008e09050565b600081511162000ac75760405162461bcd60e51b815260206004820152602b602482015260008051602062001a9083398151915260448201526a1858d95d081d1bc818dd5d60aa1b6064820152608401620004fc565b600080516020620019e48339815191526001600160a01b0383161562000b565760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d7573742062652061646472657373283029000000000000000000006064820152608401620004fc565b60005b825181101562000bc457600083828151811062000b7a5762000b7a62001162565b6020908102919091018101516001600160e01b031981166000908152918590526040909120549091506001600160a01b031662000bb984828462000d09565b505060010162000b59565b50505050565b6001600160a01b03821662000bdd575050565b62000c028260405180606001604052806028815260200162001a0460289139620010e9565b600080836001600160a01b03168360405162000c1f919062001333565b600060405180830381855af49150503d806000811462000c5c576040519150601f19603f3d011682016040523d82523d6000602084013e62000c61565b606091505b50915091508162000bc45780511562000c7d5780518082602001fd5b838360405163192105d760e01b8152600401620004fc92919062001351565b62000cc18160405180606001604052806024815260200162001a4c60249139620010e9565b6002820180546001600160a01b0390921660008181526001948501602090815260408220860185905594840183559182529290200180546001600160a01b0319169091179055565b6001600160a01b03821662000d875760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e27742065786973740000000000000000006064820152608401620004fc565b306001600160a01b0383160362000df85760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b6064820152608401620004fc565b6001600160e01b03198116600090815260208481526040808320546001600160a01b0386168452600180880190935290832054600160a01b9091046001600160601b0316929162000e49916200137f565b905080821462000f42576001600160a01b0384166000908152600186016020526040812080548390811062000e825762000e8262001162565b600091825260208083206008830401546001600160a01b038916845260018a019091526040909220805460079092166004026101000a90920460e01b92508291908590811062000ed65762000ed662001162565b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c929092029390931790556001600160e01b03199290921682528690526040902080546001600160a01b0316600160a01b6001600160601b038516021790555b6001600160a01b0384166000908152600186016020526040902080548062000f6e5762000f6e6200139b565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b03198516825286905260408120819055819003620007db57600285015460009062000fd4906001906200137f565b6001600160a01b03861660009081526001808901602052604090912001549091508082146200108a57600087600201838154811062001017576200101762001162565b6000918252602090912001546002890180546001600160a01b0390921692508291849081106200104b576200104b62001162565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055929091168152600189810190925260409020018190555b86600201805480620010a057620010a06200139b565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0388168252600189810190915260408220015550505050505050565b813b818162000bc45760405162461bcd60e51b8152600401620004fc9190620013b1565b80516001600160a01b03811681146200112557600080fd5b919050565b600080604083850312156200113e57600080fd5b62001149836200110d565b915062001159602084016200110d565b90509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60005b83811015620011ab57818101518382015260200162001191565b50506000910152565b60008151808452620011ce8160208601602086016200118e565b601f01601f19169290920160200192915050565b60006060808301606084528087518083526080925060808601915060808160051b8701016020808b0160005b84811015620012ba57898403607f19018652815180516001600160a01b031685528381015189860190600381106200125657634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b80831015620012a45783516001600160e01b031916825292860192600192909201919086019062001278565b509785019795505050908201906001016200120e565b50506001600160a01b038a16908801528681036040880152620012de8189620011b4565b9a9950505050505050505050565b634e487b7160e01b600052601160045260246000fd5b60006001600160601b038281166002600160601b03198101620013295762001329620012ec565b6001019392505050565b60008251620013478184602087016200118e565b9190910192915050565b6001600160a01b03831681526040602082018190526000906200137790830184620011b4565b949350505050565b81810381811115620013955762001395620012ec565b92915050565b634e487b7160e01b600052603160045260246000fd5b602081526000620013c66020830184620011b4565b9392505050565b61060780620013dd6000396000f3fe6080604052600436106100225760003560e01c8063ac9650d81461012557610029565b3661002957005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819073ffffffffffffffffffffffffffffffffffffffff1680610101576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e808015610120573d6000f35b3d6000fd5b34801561013157600080fd5b5061014561014036600461039c565b61015b565b6040516101529190610435565b60405180910390f35b60608167ffffffffffffffff811115610176576101766104eb565b6040519080825280602002602001820160405280156101a957816020015b60608152602001906001900390816101945790505b50905060005b8281101561023e57610219308585848181106101cd576101cd61051a565b90506020028101906101df9190610549565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061024592505050565b82828151811061022b5761022b61051a565b60209081029190910101526001016101af565b5092915050565b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405161026f91906105b5565b600060405180830381855af49150503d80600081146102aa576040519150601f19603f3d011682016040523d82523d6000602084013e6102af565b606091505b50915091506102bf8583836102c8565b95945050505050565b6060826102dd576102d88261035a565b610353565b8151158015610301575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610350576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016100f8565b50805b9392505050565b80511561036a5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080602083850312156103af57600080fd5b823567ffffffffffffffff808211156103c757600080fd5b818501915085601f8301126103db57600080fd5b8135818111156103ea57600080fd5b8660208260051b85010111156103ff57600080fd5b60209290920196919550909350505050565b60005b8381101561042c578181015183820152602001610414565b50506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156104de577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452815180518087526104a1818989018a8501610411565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169590950186019450928501929085019060010161045c565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261057e57600080fd5b83018035915067ffffffffffffffff82111561059957600080fd5b6020019150368190038213156105ae57600080fd5b9250929050565b600082516105c7818460208701610411565b919091019291505056fea26469706673582212204c5b27b8fed36393e357c7b6a0f4ed9410a6a92ffbc5e34044539040ece45b0d64736f6c63430008170033c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a204164642066616365742063616e277420624c69624469616d6f6e644375743a204e657720666163657420686173206e6f20636f64658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e2066000000000000000000000000c9ea36e82c647dc36012c586bf16823d598afc36000000000000000000000000ab464058d6305233cc71e9c446810b3b997d4e36
Deployed Bytecode
0x6080604052600436106100225760003560e01c8063ac9650d81461012557610029565b3661002957005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819073ffffffffffffffffffffffffffffffffffffffff1680610101576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e808015610120573d6000f35b3d6000fd5b34801561013157600080fd5b5061014561014036600461039c565b61015b565b6040516101529190610435565b60405180910390f35b60608167ffffffffffffffff811115610176576101766104eb565b6040519080825280602002602001820160405280156101a957816020015b60608152602001906001900390816101945790505b50905060005b8281101561023e57610219308585848181106101cd576101cd61051a565b90506020028101906101df9190610549565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061024592505050565b82828151811061022b5761022b61051a565b60209081029190910101526001016101af565b5092915050565b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405161026f91906105b5565b600060405180830381855af49150503d80600081146102aa576040519150601f19603f3d011682016040523d82523d6000602084013e6102af565b606091505b50915091506102bf8583836102c8565b95945050505050565b6060826102dd576102d88261035a565b610353565b8151158015610301575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610350576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016100f8565b50805b9392505050565b80511561036a5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080602083850312156103af57600080fd5b823567ffffffffffffffff808211156103c757600080fd5b818501915085601f8301126103db57600080fd5b8135818111156103ea57600080fd5b8660208260051b85010111156103ff57600080fd5b60209290920196919550909350505050565b60005b8381101561042c578181015183820152602001610414565b50506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156104de577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452815180518087526104a1818989018a8501610411565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169590950186019450928501929085019060010161045c565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261057e57600080fd5b83018035915067ffffffffffffffff82111561059957600080fd5b6020019150368190038213156105ae57600080fd5b9250929050565b600082516105c7818460208701610411565b919091019291505056fea26469706673582212204c5b27b8fed36393e357c7b6a0f4ed9410a6a92ffbc5e34044539040ece45b0d64736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c9ea36e82c647dc36012c586bf16823d598afc36000000000000000000000000ab464058d6305233cc71e9c446810b3b997d4e36
-----Decoded View---------------
Arg [0] : _contractOwner (address): 0xC9ea36e82C647DC36012c586BF16823D598AFC36
Arg [1] : _diamondCutFacet (address): 0xAb464058d6305233cc71E9c446810B3B997D4E36
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000c9ea36e82c647dc36012c586bf16823d598afc36
Arg [1] : 000000000000000000000000ab464058d6305233cc71e9c446810b3b997d4e36
Loading...
Loading
Loading...
Loading
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.