Latest 25 from a total of 741,675 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Bonk Reveal | 43217129 | 28 secs ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43217128 | 30 secs ago | IN | 0 ETH | 0.00000087 | ||||
| Bonk Reveal | 43216971 | 5 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Reveal | 43216971 | 5 mins ago | IN | 0 ETH | 0.00000077 | ||||
| Bonk Commit | 43216970 | 5 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Commit | 43216970 | 5 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216937 | 6 mins ago | IN | 0 ETH | 0.00000077 | ||||
| Bonk Reveal | 43216936 | 6 mins ago | IN | 0 ETH | 0.00000093 | ||||
| Bonk Commit | 43216935 | 6 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Commit | 43216934 | 6 mins ago | IN | 0 ETH | 0.00000103 | ||||
| Bonk Reveal | 43216855 | 9 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43216854 | 9 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216853 | 9 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Reveal | 43216853 | 9 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43216852 | 9 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Commit | 43216852 | 9 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216851 | 9 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43216850 | 9 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216848 | 9 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43216847 | 9 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216830 | 10 mins ago | IN | 0 ETH | 0.00000078 | ||||
| Bonk Commit | 43216829 | 10 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216803 | 11 mins ago | IN | 0 ETH | 0.00000077 | ||||
| Bonk Commit | 43216799 | 11 mins ago | IN | 0 ETH | 0.00000086 | ||||
| Bonk Reveal | 43216785 | 11 mins ago | IN | 0 ETH | 0.00000078 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 43216004 | 37 mins ago | 0 ETH | ||||
| 43215999 | 38 mins ago | 0 ETH | ||||
| 43215992 | 38 mins ago | 0 ETH | ||||
| 43215986 | 38 mins ago | 0 ETH | ||||
| 43215981 | 38 mins ago | 0 ETH | ||||
| 43215976 | 38 mins ago | 0 ETH | ||||
| 43212497 | 2 hrs ago | 0.0005446 ETH | ||||
| 43212478 | 2 hrs ago | 0.0005446 ETH | ||||
| 43212456 | 2 hrs ago | 0.0005446 ETH | ||||
| 43212286 | 2 hrs ago | 0.00000001 ETH | ||||
| 43212280 | 2 hrs ago | 0 ETH | ||||
| 43212279 | 2 hrs ago | 0 ETH | ||||
| 43212277 | 2 hrs ago | 0.00000001 ETH | ||||
| 43208319 | 4 hrs ago | 0 ETH | ||||
| 43204640 | 6 hrs ago | 0.00079008 ETH | ||||
| 43203487 | 7 hrs ago | 0 ETH | ||||
| 43203484 | 7 hrs ago | 0 ETH | ||||
| 43203480 | 7 hrs ago | 0 ETH | ||||
| 43203477 | 7 hrs ago | 0 ETH | ||||
| 43203474 | 7 hrs ago | 0 ETH | ||||
| 43203470 | 7 hrs ago | 0.00000004 ETH | ||||
| 43201969 | 8 hrs ago | 0.00054112 ETH | ||||
| 43201947 | 8 hrs ago | 0.00054112 ETH | ||||
| 43201940 | 8 hrs ago | 0.00054112 ETH | ||||
| 43201928 | 8 hrs ago | 0.00054112 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Diamond
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 * * Implementation of a diamond. /******************************************************************************/ // import {AppStorage} from "./libraries/LibAppStorage.sol"; import {LibDiamond} from "./libraries/LibDiamond.sol"; import {AppStorage, LibAppStorage} from "./libraries/LibAppStorage.sol"; import {IDiamondCut} from "./interfaces/IDiamondCut.sol"; import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol"; // import {IERC173} from "./interfaces/IERC173.sol"; //import { IERC165} from "./interfaces/IERC165.sol"; import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; // When no function exists for function called error FunctionNotFound(bytes4 _functionSelector); // This is used in diamond constructor // more arguments are added to this struct // this avoids stack too deep errors struct DiamondArgs { address owner; address init; bytes initCalldata; } contract Diamond { using FixedPointMathLib for uint256; constructor( IDiamondCut.FacetCut[] memory _diamondCut, DiamondArgs memory _args ) payable { LibDiamond.setContractOwner(_args.owner); LibDiamond.diamondCut(_diamondCut, _args.init, _args.initCalldata); // Code can be added here to perform actions and set state variables. } // 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 .facetAddressAndSelectorPosition[msg.sig] .facetAddress; if (facet == address(0)) { revert FunctionNotFound(msg.sig); } // 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 { AppStorage storage s = LibAppStorage.appStorage(); s.ethAccPerShare += msg.value.mulDivDown(s.PRECISION, s.totalScores); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; /******************************************************************************\ * 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.13;
import {LibDiamond} from "./LibDiamond.sol";
import {EnumerableMap} from "openzeppelin/utils/structs/EnumerableMap.sol";
import {IERC20Extended} from "../interfaces/IERC20Extended.sol";
import {IERC721Extended} from "../interfaces/IERC721Extended.sol";
// using EnumerableMap for EnumerableMap.UintToAddressMap;
// Declare a set state variable
// EnumerableMap.UintToAddressMap private myMap;
struct AppStorage {
bool diamondInitialized;
IERC20Extended token;
IERC721Extended nft;
address DIAMOND_ADDRESS; // facet where getters are stored, need to add a setter too in game manager facet
// dutch auction
uint256 duration;
uint256 minPrice;
uint256 startingPrice;
uint256 startAt;
uint256 discountRate;
mapping(uint256 => uint256[]) petDna;
// shop and items
mapping(uint256 => uint256) itemPrice; //shop item id to price name this diff than items later
mapping(uint256 => uint256) itemPoints;
mapping(uint256 => string) itemName;
mapping(uint256 => uint256) itemTimeExtension;
mapping(uint256 => uint256) itemDelta; //item delta for pricing and selling
mapping(uint256 => uint256) itemEquipExpires; //when long after consumed it expires
mapping(uint256 => bool) itemIsSellable;
mapping(uint256 => mapping(uint256 => uint256)) petItemExpires; // pet=>item=>expires time
mapping(uint256 => uint256) itemSupply; //supply of items
mapping(uint256 => EnumerableMap.UintToUintMap) itemsOwned; // items pet currently owns
uint256 PRECISION;
uint256 _tokenIds;
uint256 _itemIds;
uint256 la;
uint256 lb;
// pet properties
mapping(uint256 => string) petName;
mapping(uint256 => uint256) timeUntilStarving;
mapping(uint256 => uint256) petScore;
mapping(uint256 => uint256) timePetBorn;
mapping(uint256 => uint256) lastAttackUsed;
mapping(uint256 => uint256) lastAttacked;
mapping(uint256 => uint256) stars;
// vritual staking
mapping(uint256 => uint256) ethOwed;
mapping(uint256 => uint256) petRewardDebt;
uint256 ethAccPerShare;
uint256 totalScores;
// migration
mapping(uint256 => bool) petMigrated; //if pet migrated from v1 to this v2
uint256 hasTheDiamond; //add this to the contractor instead
mapping(uint256 => uint256) itemBought; //total bought to keep track of supply
}
library LibAppStorage {
bytes32 internal constant DIAMOND_APP_STORAGE_POSITION =
keccak256("diamond.app.storage");
function appStorage() internal pure returns (AppStorage storage ds) {
bytes32 position = DIAMOND_APP_STORAGE_POSITION;
assembly {
ds.slot := position
}
}
// function diamondStorage() internal pure returns (AppStorage storage ds) {
// assembly {
// ds.slot := 0
// }
// }
// function abs(int256 x) internal pure returns (uint256) {
// return uint256(x >= 0 ? x : -x);
// }
}
contract Modifiers {
modifier onlyOwner() {
LibDiamond.enforceIsContractOwner();
_;
}
modifier isApproved(uint256 id) {
AppStorage storage s = LibAppStorage.appStorage();
require(
s.nft.ownerOf(id) == msg.sender ||
s.nft.getApproved(id) == msg.sender,
"Not approved"
);
_;
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; /******************************************************************************\ * 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.13; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ // A loupe is a small magnifying glass used to look at diamonds. // These functions look at diamonds interface IDiamondLoupe { /// These functions are expected to be called frequently /// by tools. struct Facet { address facetAddress; bytes4[] functionSelectors; } /// @notice Gets all facet addresses and their four byte function selectors. /// @return facets_ Facet function facets() external view returns (Facet[] memory facets_); /// @notice Gets all the function selectors supported by a specific facet. /// @param _facet The facet address. /// @return facetFunctionSelectors_ function facetFunctionSelectors( address _facet ) external view returns (bytes4[] memory facetFunctionSelectors_); /// @notice Get all the facet addresses used by a diamond. /// @return facetAddresses_ function facetAddresses() external view returns (address[] memory facetAddresses_); /// @notice Gets the facet that supports the given selector. /// @dev If facet is not found return address(0). /// @param _functionSelector The function selector. /// @return facetAddress_ The facet address. function facetAddress( bytes4 _functionSelector ) external view returns (address facetAddress_); }
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib {
/*//////////////////////////////////////////////////////////////
SIMPLIFIED FIXED POINT OPERATIONS
//////////////////////////////////////////////////////////////*/
uint256 internal constant MAX_UINT256 = 2**256 - 1;
uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.
function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.
}
function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.
}
function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.
}
function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.
}
/*//////////////////////////////////////////////////////////////
LOW LEVEL FIXED POINT OPERATIONS
//////////////////////////////////////////////////////////////*/
function mulDivDown(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
revert(0, 0)
}
// Divide x * y by the denominator.
z := div(mul(x, y), denominator)
}
}
function mulDivUp(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
revert(0, 0)
}
// If x * y modulo the denominator is strictly greater than 0,
// 1 is added to round up the division of x * y by the denominator.
z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))
}
}
function rpow(
uint256 x,
uint256 n,
uint256 scalar
) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
switch x
case 0 {
switch n
case 0 {
// 0 ** 0 = 1
z := scalar
}
default {
// 0 ** n = 0
z := 0
}
}
default {
switch mod(n, 2)
case 0 {
// If n is even, store scalar in z for now.
z := scalar
}
default {
// If n is odd, store x in z for now.
z := x
}
// Shifting right by 1 is like dividing by 2.
let half := shr(1, scalar)
for {
// Shift n right by 1 before looping to halve it.
n := shr(1, n)
} n {
// Shift n right by 1 each iteration to halve it.
n := shr(1, n)
} {
// Revert immediately if x ** 2 would overflow.
// Equivalent to iszero(eq(div(xx, x), x)) here.
if shr(128, x) {
revert(0, 0)
}
// Store x squared.
let xx := mul(x, x)
// Round to the nearest number.
let xxRound := add(xx, half)
// Revert if xx + half overflowed.
if lt(xxRound, xx) {
revert(0, 0)
}
// Set x to scaled xxRound.
x := div(xxRound, scalar)
// If n is even:
if mod(n, 2) {
// Compute z * x.
let zx := mul(z, x)
// If z * x overflowed:
if iszero(eq(div(zx, x), z)) {
// Revert if x is non-zero.
if iszero(iszero(x)) {
revert(0, 0)
}
}
// Round to the nearest number.
let zxRound := add(zx, half)
// Revert if zx + half overflowed.
if lt(zxRound, zx) {
revert(0, 0)
}
// Return properly scaled zxRound.
z := div(zxRound, scalar)
}
}
}
}
}
/*//////////////////////////////////////////////////////////////
GENERAL NUMBER UTILITIES
//////////////////////////////////////////////////////////////*/
function sqrt(uint256 x) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
let y := x // We start y at x, which will help us make our initial estimate.
z := 181 // The "correct" value is 1, but this saves a multiplication later.
// This segment is to get a reasonable initial estimate for the Babylonian method. With a bad
// start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.
// We check y >= 2^(k + 8) but shift right by k bits
// each branch to ensure that if x >= 256, then y >= 256.
if iszero(lt(y, 0x10000000000000000000000000000000000)) {
y := shr(128, y)
z := shl(64, z)
}
if iszero(lt(y, 0x1000000000000000000)) {
y := shr(64, y)
z := shl(32, z)
}
if iszero(lt(y, 0x10000000000)) {
y := shr(32, y)
z := shl(16, z)
}
if iszero(lt(y, 0x1000000)) {
y := shr(16, y)
z := shl(8, z)
}
// Goal was to get z*z*y within a small factor of x. More iterations could
// get y in a tighter range. Currently, we will have y in [256, 256*2^16).
// We ensured y >= 256 so that the relative difference between y and y+1 is small.
// That's not possible if x < 256 but we can just verify those cases exhaustively.
// Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.
// Correctness can be checked exhaustively for x < 256, so we assume y >= 256.
// Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.
// For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range
// (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.
// Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate
// sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.
// There is no overflow risk here since y < 2^136 after the first branch above.
z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.
// Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
z := shr(1, add(z, div(x, z)))
// If x+1 is a perfect square, the Babylonian method cycles between
// floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.
// See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
// Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.
// If you don't care whether the floor or ceil square root is returned, you can remove this statement.
z := sub(z, lt(div(x, z), z))
}
}
function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// Mod x by y. Note this will return
// 0 instead of reverting if y is zero.
z := mod(x, y)
}
}
function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {
/// @solidity memory-safe-assembly
assembly {
// Divide x by y. Note this will return
// 0 instead of reverting if y is zero.
r := div(x, y)
}
}
function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
/// @solidity memory-safe-assembly
assembly {
// Add 1 to x * y if x % y > 0. Note this will
// return 0 instead of reverting if y is zero.
z := add(gt(mod(x, y), 0), div(x, y))
}
}
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; /******************************************************************************\ * 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 v4.9.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.
pragma solidity ^0.8.0;
import "./EnumerableSet.sol";
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* The following map types are supported:
*
* - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
* - `address -> uint256` (`AddressToUintMap`) since v4.6.0
* - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
* - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
* - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableMap.
* ====
*/
library EnumerableMap {
using EnumerableSet for EnumerableSet.Bytes32Set;
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct Bytes32ToBytes32Map {
// Storage of keys
EnumerableSet.Bytes32Set _keys;
mapping(bytes32 => bytes32) _values;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
map._values[key] = value;
return map._keys.add(key);
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
delete map._values[key];
return map._keys.remove(key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
return map._keys.contains(key);
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
return map._keys.length();
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
bytes32 key = map._keys.at(index);
return (key, map._values[key]);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
bytes32 value = map._values[key];
if (value == bytes32(0)) {
return (contains(map, key), bytes32(0));
} else {
return (true, value);
}
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToBytes32Map storage map,
bytes32 key,
string memory errorMessage
) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), errorMessage);
return value;
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
return map._keys.values();
}
// UintToUintMap
struct UintToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key)));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintToAddressMap
struct UintToAddressMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToAddressMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), address(uint160(uint256(value))));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
UintToAddressMap storage map,
uint256 key,
string memory errorMessage
) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressToUintMap
struct AddressToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(AddressToUintMap storage map, address key) internal returns (bool) {
return remove(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
return contains(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(AddressToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (address(uint160(uint256(key))), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
AddressToUintMap storage map,
address key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(AddressToUintMap storage map) internal view returns (address[] memory) {
bytes32[] memory store = keys(map._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// Bytes32ToUintMap
struct Bytes32ToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
return set(map._inner, key, bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
return remove(map._inner, key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {
return contains(map._inner, key);
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (key, uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, key);
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
return uint256(get(map._inner, key));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToUintMap storage map,
bytes32 key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, key, errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
bytes32[] memory store = keys(map._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IERC20Extended {
function balanceOf(
address tokenOwner
) external view returns (uint256 balance);
function totalSupply() external view returns (uint256 supply);
function transfer(
address to,
uint256 tokens
) external returns (bool success);
function transferFrom(
address from,
address to,
uint256 tokens
) external returns (bool success);
function burn(uint256 amount) external;
function burnFrom(address account, uint256 amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IERC721Extended {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool approved) external;
function getApproved(
uint256 tokenId
) external view returns (address operator);
function isApprovedForAll(
address owner,
address operator
) external view returns (bool);
function burn(uint256 id) external;
function burnInGame(uint256 id) external;
function mint(address to) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}{
"remappings": [
"openzeppelin/=lib/openzeppelin-contracts/contracts/",
"solmate/=lib/solmate/src/",
"prb-math/=lib/prb-math/src/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@chainlink/=lib/chainlink/",
"@prb/test/=lib/prb-math/lib/prb-test/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"prb-test/=lib/prb-math/lib/prb-test/src/",
"solidity-stringutils/=lib/solidity-stringutils/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum IDiamond.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct IDiamond.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"init","type":"address"},{"internalType":"bytes","name":"initCalldata","type":"bytes"}],"internalType":"struct DiamondArgs","name":"_args","type":"tuple"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotAddFunctionToDiamondThatAlreadyExists","type":"error"},{"inputs":[{"internalType":"bytes4[]","name":"_selectors","type":"bytes4[]"}],"name":"CannotAddSelectorsToZeroAddress","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotRemoveFunctionThatDoesNotExist","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotRemoveImmutableFunction","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotReplaceFunctionThatDoesNotExists","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet","type":"error"},{"inputs":[{"internalType":"bytes4[]","name":"_selectors","type":"bytes4[]"}],"name":"CannotReplaceFunctionsFromFacetWithZeroAddress","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"name":"CannotReplaceImmutableFunction","type":"error"},{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"FunctionNotFound","type":"error"},{"inputs":[{"internalType":"uint8","name":"_action","type":"uint8"}],"name":"IncorrectFacetCutAction","type":"error"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"inputs":[{"internalType":"address","name":"_contractAddress","type":"address"},{"internalType":"string","name":"_message","type":"string"}],"name":"NoBytecodeAtAddress","type":"error"},{"inputs":[{"internalType":"address","name":"_facetAddress","type":"address"}],"name":"NoSelectorsProvidedForFacetForCut","type":"error"},{"inputs":[{"internalType":"address","name":"_facetAddress","type":"address"}],"name":"RemoveFacetAddressMustBeZeroAddress","type":"error"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040526040516200120238038062001202833981016040819052620000269162000b75565b8051620000339062000056565b6200004e8282602001518360400151620000da60201b60201c565b505062000f92565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f80546001600160a01b031981166001600160a01b038481169182179093556040516000805160206200114e833981519152939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60005b83518110156200026c576000848281518110620000fe57620000fe62000d33565b6020026020010151604001519050600085838151811062000123576200012362000d33565b60200260200101516000015190508151600003620001645760405163e767f91f60e01b81526001600160a01b03821660048201526024015b60405180910390fd5b60008684815181106200017b576200017b62000d33565b6020026020010151602001519050600060028111156200019f576200019f62000d49565b816002811115620001b457620001b462000d49565b03620001cc57620001c68284620002bb565b62000253565b6001816002811115620001e357620001e362000d49565b03620001f557620001c6828462000481565b60028160028111156200020c576200020c62000d49565b036200021e57620001c6828462000628565b80600281111562000233576200023362000d49565b604051633ff4d20f60e11b815260ff90911660048201526024016200015b565b5050508080620002639062000d75565b915050620000dd565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673838383604051620002a29392919062000e06565b60405180910390a1620002b68282620008cc565b505050565b6001600160a01b038216620002e757806040516302b8da0760e21b81526004016200015b919062000ed6565b600080516020620011ba83398151915254604080516060810190915260248082526000805160206200114e833981519152929162000331918691906200116e60208301396200099e565b60005b83518110156200047a57600084828151811062000355576200035562000d33565b6020908102919091018101516001600160e01b031981166000908152918690526040909120549091506001600160a01b03168015620003b45760405163ebbf5d0760e01b81526001600160e01b0319831660048201526024016200015b565b6040805180820182526001600160a01b03808a16825261ffff80881660208085019182526001600160e01b0319881660009081528b8252958620945185549251909316600160a01b026001600160b01b0319909216929093169190911717909155600180880180549182018155835291206008820401805460e085901c60046007909416939093026101000a92830263ffffffff9093021916919091179055836200045f8162000ef2565b94505050508080620004719062000d75565b91505062000334565b5050505050565b6000805160206200114e8339815191526001600160a01b038316620004bd578160405163cd98a96f60e01b81526004016200015b919062000ed6565b620004e283604051806060016040528060288152602001620011da602891396200099e565b60005b82518110156200062257600083828151811062000506576200050662000d33565b6020908102919091018101516001600160e01b031981166000908152918590526040909120549091506001600160a01b03163081036200056657604051632901806d60e11b81526001600160e01b0319831660048201526024016200015b565b856001600160a01b0316816001600160a01b031603620005a657604051631ac6ce8d60e11b81526001600160e01b0319831660048201526024016200015b565b6001600160a01b038116620005db57604051637479f93960e01b81526001600160e01b0319831660048201526024016200015b565b506001600160e01b031916600090815260208390526040902080546001600160a01b0319166001600160a01b03861617905580620006198162000d75565b915050620004e5565b50505050565b600080516020620011ba833981519152546000805160206200114e833981519152906001600160a01b038416156200067f5760405163d091bc8160e01b81526001600160a01b03851660048201526024016200015b565b60005b83518110156200047a576000848281518110620006a357620006a362000d33565b6020908102919091018101516001600160e01b0319811660009081528683526040908190208151808301909252546001600160a01b038116808352600160a01b90910461ffff1693820193909352909250906200072057604051637a08a22d60e01b81526001600160e01b0319831660048201526024016200015b565b8051306001600160a01b03909116036200075a57604051630df5fd6160e31b81526001600160e01b0319831660048201526024016200015b565b83620007668162000f16565b94505083816020015161ffff16146200084b57600085600101858154811062000793576200079362000d33565b90600052602060002090600891828204019190066004029054906101000a900460e01b90508086600101836020015161ffff1681548110620007d957620007d962000d33565b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c92909202939093179055838201516001600160e01b03199390931681529087905260409020805461ffff60a01b1916600160a01b61ffff909316929092029190911790555b8460010180548062000861576200086162000f30565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a0219169055919092556001600160e01b0319909316815291859052506040902080546001600160b01b031916905580620008c38162000d75565b91505062000682565b6001600160a01b038216620008df575050565b620009048260405180606001604052806028815260200162001192602891396200099e565b600080836001600160a01b03168360405162000921919062000f46565b600060405180830381855af49150503d80600081146200095e576040519150601f19603f3d011682016040523d82523d6000602084013e62000963565b606091505b50915091508162000622578051156200097f5780518082602001fd5b838360405163192105d760e01b81526004016200015b92919062000f64565b813b6000819003620002b657828260405163919834b960e01b81526004016200015b92919062000f64565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171562000a045762000a04620009c9565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000a355762000a35620009c9565b604052919050565b60006001600160401b0382111562000a595762000a59620009c9565b5060051b60200190565b80516001600160a01b038116811462000a7b57600080fd5b919050565b60005b8381101562000a9d57818101518382015260200162000a83565b50506000910152565b60006060828403121562000ab957600080fd5b62000ac3620009df565b905062000ad08262000a63565b8152602062000ae181840162000a63565b8282015260408301516001600160401b038082111562000b0057600080fd5b818501915085601f83011262000b1557600080fd5b81518181111562000b2a5762000b2a620009c9565b62000b3e601f8201601f1916850162000a0a565b9150808252868482850101111562000b5557600080fd5b62000b668185840186860162000a80565b50604084015250909392505050565b6000806040838503121562000b8957600080fd5b82516001600160401b038082111562000ba157600080fd5b818501915085601f83011262000bb657600080fd5b8151602062000bcf62000bc98362000a3d565b62000a0a565b82815260059290921b8401810191818101908984111562000bef57600080fd5b8286015b8481101562000cff5780518681111562000c0c57600080fd5b87016060818d03601f1901121562000c2357600080fd5b62000c2d620009df565b62000c3a86830162000a63565b815260408201516003811062000c4f57600080fd5b8187015260608201518881111562000c6657600080fd5b8083019250508c603f83011262000c7c57600080fd5b8582015162000c8f62000bc98262000a3d565b81815260059190911b830160400190878101908f83111562000cb057600080fd5b6040850194505b8285101562000ce95784516001600160e01b03198116811462000cd957600080fd5b8252938801939088019062000cb7565b6040840152505084525091830191830162000bf3565b509188015191965090935050508082111562000d1a57600080fd5b5062000d298582860162000aa6565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000d8a5762000d8a62000d5f565b5060010190565b600081518084526020808501945080840160005b8381101562000dcd5781516001600160e01b0319168752958201959082019060010162000da5565b509495945050505050565b6000815180845262000df281602086016020860162000a80565b601f01601f19169290920160200192915050565b6000606080830181845280875180835260808601915060808160051b87010192506020808a016000805b8481101562000ea457898703607f19018652825180516001600160a01b03168852848101516003811062000e7257634e487b7160e01b84526021600452602484fd5b8886015260409081015190880189905262000e908989018262000d91565b975050948301949183019160010162000e30565b5050506001600160a01b038916908701525050838103604085015262000ecb818662000dd8565b979650505050505050565b60208152600062000eeb602083018462000d91565b9392505050565b600061ffff80831681810362000f0c5762000f0c62000d5f565b6001019392505050565b60008162000f285762000f2862000d5f565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6000825162000f5a81846020870162000a80565b9190910192915050565b6001600160a01b038316815260406020820181905260009062000f8a9083018462000dd8565b949350505050565b6101ac8062000fa26000396000f3fe608060405236610096577f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50cf3547f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50d02547f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50ce09161007b91349190610131565b81602101600082825461008e919061014f565b925050819055005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602081905260409091205481906001600160a01b03168061010d57604051630a82dd7360e31b81526001600160e01b031960003516600482015260240160405180910390fd5b3660008037600080366000845af43d6000803e80801561012c573d6000f35b3d6000fd5b600082600019048411830215820261014857600080fd5b5091020490565b8082018082111561017057634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212206741ef906a187b566d9cd1fbb1cd9c1e90d86318961903f9a4035e46e5a8f1ff64736f6c63430008130033c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f6465c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131d4c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f64650000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000366f400e50aabbd29869fec46a62462a1a98792a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000011f931c1c00000000000000000000000000000000000000000000000000000000000000000000000000000000047f606fd5b2baa5f5c6c4ab8958e45cb6b054b700000000000000000000000090a4bc11b79b2d234372118f03466554050f37a8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a402ccf8a2000000000000000000000000ff0c532fdb8cd566ae169c1cb157ff2bdc83e1050000000000000000000000005b51cf49cb48617084ef35e7c7d7a21914769ff1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000006c6b935b8bbd40000000000000000000000000000000000000000000000000000000000000654d85070000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000004de57ce8c5c688f9b841b89cb08b2c8178557f970000000000000000000000004a84c33ebe4824feb1943fc6a85d81058a7e68a900000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405236610096577f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50cf3547f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50d02547f31c1f8402397e5b1e3d75f3da7207ce6f54556b27afe723742768c4e4be50ce09161007b91349190610131565b81602101600082825461008e919061014f565b925050819055005b600080356001600160e01b03191681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c602081905260409091205481906001600160a01b03168061010d57604051630a82dd7360e31b81526001600160e01b031960003516600482015260240160405180910390fd5b3660008037600080366000845af43d6000803e80801561012c573d6000f35b3d6000fd5b600082600019048411830215820261014857600080fd5b5091020490565b8082018082111561017057634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212206741ef906a187b566d9cd1fbb1cd9c1e90d86318961903f9a4035e46e5a8f1ff64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000366f400e50aabbd29869fec46a62462a1a98792a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000011f931c1c00000000000000000000000000000000000000000000000000000000000000000000000000000000047f606fd5b2baa5f5c6c4ab8958e45cb6b054b700000000000000000000000090a4bc11b79b2d234372118f03466554050f37a8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a402ccf8a2000000000000000000000000ff0c532fdb8cd566ae169c1cb157ff2bdc83e1050000000000000000000000005b51cf49cb48617084ef35e7c7d7a21914769ff1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000006c6b935b8bbd40000000000000000000000000000000000000000000000000000000000000654d85070000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000004de57ce8c5c688f9b841b89cb08b2c8178557f970000000000000000000000004a84c33ebe4824feb1943fc6a85d81058a7e68a900000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _diamondCut (tuple[]):
Arg [1] : facetAddress (address): 0x366f400e50AAbbD29869Fec46A62462a1A98792a
Arg [2] : action (uint8): 0
Arg [3] : functionSelectors (bytes4[]): 0x1f931c1
Arg [1] : _args (tuple):
Arg [1] : owner (address): 0x047F606fD5b2BaA5f5C6c4aB8958E45CB6B054B7
Arg [2] : init (address): 0x90a4bc11B79B2D234372118f03466554050F37a8
Arg [3] : initCalldata (bytes): 0x02ccf8a2000000000000000000000000ff0c532fdb8cd566ae169c1cb157ff2bdc83e1050000000000000000000000005b51cf49cb48617084ef35e7c7d7a21914769ff1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002580000000000000000000000000000000000000000000000056bc75e2d6310000000000000000000000000000000000000000000000000006c6b935b8bbd40000000000000000000000000000000000000000000000000000000000000654d85070000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000004de57ce8c5c688f9b841b89cb08b2c8178557f970000000000000000000000004a84c33ebe4824feb1943fc6a85d81058a7e68a9
-----Encoded View---------------
27 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [4] : 000000000000000000000000366f400e50aabbd29869fec46a62462a1a98792a
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [8] : 1f931c1c00000000000000000000000000000000000000000000000000000000
Arg [9] : 000000000000000000000000047f606fd5b2baa5f5c6c4ab8958e45cb6b054b7
Arg [10] : 00000000000000000000000090a4bc11b79b2d234372118f03466554050f37a8
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [12] : 00000000000000000000000000000000000000000000000000000000000001a4
Arg [13] : 02ccf8a2000000000000000000000000ff0c532fdb8cd566ae169c1cb157ff2b
Arg [14] : dc83e1050000000000000000000000005b51cf49cb48617084ef35e7c7d7a219
Arg [15] : 14769ff100000000000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [17] : 000002580000000000000000000000000000000000000000000000056bc75e2d
Arg [18] : 6310000000000000000000000000000000000000000000000000006c6b935b8b
Arg [19] : bd40000000000000000000000000000000000000000000000000000000000000
Arg [20] : 654d850700000000000000000000000000000000000000000000000000000000
Arg [21] : 0000000100000000000000000000000000000000000000000000000000000000
Arg [22] : 0000000200000000000000000000000000000000000000000000000000000000
Arg [23] : 000000020000000000000000000000000000000000000000000000056bc75e2d
Arg [24] : 631000000000000000000000000000004de57ce8c5c688f9b841b89cb08b2c81
Arg [25] : 78557f970000000000000000000000004a84c33ebe4824feb1943fc6a85d8105
Arg [26] : 8a7e68a900000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$94,919.13
Net Worth in ETH
46.966376
Token Allocations
FREN PET
65.57%
ETH
34.43%
BNB
0.00%
Others
0.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BASE | 65.57% | $0.092076 | 675,935.8712 | $62,237.47 | |
| BASE | 34.34% | $2,018.87 | 16.1476 | $32,599.92 | |
| BASE | <0.01% | <$0.000001 | 29,577,464 | $0.2721 | |
| ETH | 0.04% | $2,019.85 | 0.0185 | $37.41 | |
| ARB | 0.02% | $2,020.12 | 0.0111 | $22.39 | |
| BLAST | 0.02% | $2,019.67 | 0.00720496 | $14.55 | |
| LINEA | <0.01% | $2,021.38 | 0.00221517 | $4.48 | |
| OP | <0.01% | $2,019.93 | 0.00053046 | $1.07 | |
| SCROLL | <0.01% | $2,019.85 | 0.00044499 | $0.898812 | |
| BSC | <0.01% | $640.69 | 0.00100018 | $0.640799 | |
| AVAX | <0.01% | $9.55 | 0.00186908 | $0.017841 | |
| GLMR | <0.01% | $0.01214 | 0.00149037 | $0.000018 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.