编译器
0.8.18+commit.87f61d96
文件 1 的 20:Diamond.sol
pragma solidity ^0.8.18;
import {LibDiamond} from "./libraries/LibDiamond.sol";
import {IDiamondCut} from "./interfaces/IDiamondCut.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
import {IERC173} from "./interfaces/IERC173.sol";
import "@flair-sdk/contracts/src/access/ownable/OwnableStorage.sol";
import "@flair-sdk/contracts/src/token/common/metadata/MetadataStorage.sol";
import "@flair-sdk/contracts/src/token/common/metadata/TokenMetadataStorage.sol";
import "./libraries/PyramidStorage.sol";
import "@flair-sdk/contracts/src/finance/royalty/RoyaltyEnforcementStorage.sol";
import "@flair-sdk/contracts/src/token/ERC721/extensions/supply/ERC721SupplyStorage.sol";
import "@flair-sdk/contracts/src/finance/royalty/RoyaltyStorage.sol";
import "@flair-sdk/contracts/src/introspection/ERC165Storage.sol";
contract QuirkiesDiamond {
using OwnableStorage for OwnableStorage.Layout;
using MetadataStorage for MetadataStorage.Layout;
using PyramidStorage for PyramidStorage.Layout;
using TokenMetadataStorage for TokenMetadataStorage.Layout;
using RoyaltyEnforcementStorage for RoyaltyEnforcementStorage.Layout;
using RoyaltyStorage for RoyaltyStorage.Layout;
using ERC721SupplyStorage for ERC721SupplyStorage.Layout;
using ERC165Storage for ERC165Storage.Layout;
constructor(
address _contractOwner,
address _diamondCutFacet,
string memory _name,
string memory _symbol,
string memory _contractURI,
string memory _baseURI,
string memory _uriSuffix,
uint256 _maxSupply,
address _royaltyRecipient,
uint16 _bps
) payable {
OwnableStorage.layout().setOwner(_contractOwner);
MetadataStorage.layout().name = _name;
MetadataStorage.layout().symbol = _symbol;
PyramidStorage.layout().contractURI = _contractURI;
TokenMetadataStorage.layout().baseURI = _baseURI;
TokenMetadataStorage.layout().uriSuffix = _uriSuffix;
ERC721SupplyStorage.layout().maxSupply = _maxSupply;
RoyaltyEnforcementStorage.layout().enforceRoyalties = true;
IRoyaltyInternal.TokenRoyalty memory royalty = IRoyaltyInternal
.TokenRoyalty({recipient: _royaltyRecipient, bps: _bps});
RoyaltyStorage.layout().defaultRoyalty = royalty;
ERC165Storage.layout().setSupportedInterface(0x01ffc9a7, true);
ERC165Storage.layout().setSupportedInterface(0x1f931c1c, true);
ERC165Storage.layout().setSupportedInterface(0x48e2b093, true);
ERC165Storage.layout().setSupportedInterface(0x2a848091, true);
ERC165Storage.layout().setSupportedInterface(0x8153916a, true);
ERC165Storage.layout().setSupportedInterface(0xb45a3c0e, true);
ERC165Storage.layout().setSupportedInterface(0x80ac58cd, true);
ERC165Storage.layout().setSupportedInterface(0xcdbde6dc, true);
ERC165Storage.layout().setSupportedInterface(0xf69e0366, true);
ERC165Storage.layout().setSupportedInterface(0x459bd11c, true);
ERC165Storage.layout().setSupportedInterface(0xc82b5d4d, true);
ERC165Storage.layout().setSupportedInterface(0xffa6b6b8, true);
ERC165Storage.layout().setSupportedInterface(0x5b5e139f, true);
ERC165Storage.layout().setSupportedInterface(0x93254542, true);
ERC165Storage.layout().setSupportedInterface(0x1f0b49eb, true);
ERC165Storage.layout().setSupportedInterface(0x7f5828d0, true);
ERC165Storage.layout().setSupportedInterface(0x06ad59bc, true);
ERC165Storage.layout().setSupportedInterface(0xbe561268, true);
ERC165Storage.layout().setSupportedInterface(0x52ef6f9a, true);
ERC165Storage.layout().setSupportedInterface(0x3f963a7f, true);
ERC165Storage.layout().setSupportedInterface(0x2a55205a, true);
ERC165Storage.layout().setSupportedInterface(0x821be678, true);
ERC165Storage.layout().setSupportedInterface(0xb7799584, true);
ERC165Storage.layout().setSupportedInterface(0xd5a06d4c, true);
ERC165Storage.layout().setSupportedInterface(0xc7627428, true);
ERC165Storage.layout().setSupportedInterface(0x150b7a02, true);
ERC165Storage.layout().setSupportedInterface(0x49064906, true);
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), "");
}
fallback() external payable {
LibDiamond.DiamondStorage storage ds;
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;
require(facet != address(0), "Diamond: Function does not exist");
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
receive() external payable {}
}
文件 2 的 20:ERC165Storage.sol
pragma solidity ^0.8.15;
library ERC165Storage {
struct Layout {
mapping(bytes4 => bool) supportedInterfaces;
}
bytes32 internal constant STORAGE_SLOT = keccak256("openzeppelin.contracts.storage.ERC165");
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
function isSupportedInterface(Layout storage l, bytes4 interfaceId) internal view returns (bool) {
return l.supportedInterfaces[interfaceId];
}
function setSupportedInterface(
Layout storage l,
bytes4 interfaceId,
bool status
) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
l.supportedInterfaces[interfaceId] = status;
}
}
文件 3 的 20:ERC721SupplyStorage.sol
pragma solidity ^0.8.15;
library ERC721SupplyStorage {
struct Layout {
uint256 currentIndex;
uint256 burnCounter;
uint256 maxSupply;
}
bytes32 internal constant STORAGE_SLOT = keccak256("v2.flair.contracts.storage.ERC721Supply");
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
文件 4 的 20:EnumerableSet.sol
pragma solidity ^0.8.0;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping(bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
set._values[toDeleteIndex] = lastValue;
set._indexes[lastValue] = valueIndex;
}
set._values.pop();
delete set._indexes[value];
return true;
} else {
return false;
}
}
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
struct Bytes32Set {
Set _inner;
}
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly {
result := store
}
return result;
}
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
文件 5 的 20:IDiamondCut.sol
pragma solidity ^0.8.0;
interface IDiamondCut {
enum FacetCutAction {
Add,
Replace,
Remove
}
struct FacetCut {
address facetAddress;
FacetCutAction action;
bytes4[] functionSelectors;
}
function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external;
event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}
文件 6 的 20:IDiamondLoupe.sol
pragma solidity ^0.8.0;
interface IDiamondLoupe {
struct Facet {
address facetAddress;
bytes4[] functionSelectors;
}
function facets() external view returns (Facet[] memory facets_);
function facetFunctionSelectors(
address _facet
) external view returns (bytes4[] memory facetFunctionSelectors_);
function facetAddresses()
external
view
returns (address[] memory facetAddresses_);
function facetAddress(
bytes4 _functionSelector
) external view returns (address facetAddress_);
}
文件 7 的 20:IEIP2981.sol
pragma solidity ^0.8.0;
interface IEIP2981 {
function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
}
文件 8 的 20:IERC173.sol
pragma solidity ^0.8.15;
import "./IERC173Events.sol";
interface IERC173 is IERC173Events {
function owner() external view returns (address);
function transferOwnership(address account) external;
}
文件 9 的 20:IERC173Events.sol
pragma solidity ^0.8.15;
interface IERC173Events {
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
}
文件 10 的 20:IFoundation.sol
pragma solidity ^0.8.0;
interface IFoundation {
function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
}
interface IFoundationTreasuryNode {
function getFoundationTreasury() external view returns (address payable);
}
interface IFoundationTreasury {
function isAdmin(address account) external view returns (bool);
}
文件 11 的 20:IRarible.sol
pragma solidity ^0.8.0;
interface IRaribleV1 {
function getFeeBps(uint256 id) external view returns (uint[] memory);
function getFeeRecipients(uint256 id) external view returns (address payable[] memory);
}
interface IRaribleV2 {
struct Part {
address payable account;
uint96 value;
}
function getRaribleV2Royalties(uint256 id) external view returns (Part[] memory);
}
文件 12 的 20:IRoyalty.sol
pragma solidity ^0.8.15;
import "@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol";
import "@manifoldxyz/royalty-registry-solidity/contracts/specs/IRarible.sol";
import "@manifoldxyz/royalty-registry-solidity/contracts/specs/IFoundation.sol";
import "./IRoyaltyInternal.sol";
interface IRoyalty is IEIP2981, IRaribleV1, IRaribleV2, IFoundation, IRoyaltyInternal {
function defaultRoyalty() external view returns (TokenRoyalty memory);
function getTokenRoyaltiesCount() external view returns (uint256);
function getTokenRoyaltyByIndex(uint256 index) external view returns (TokenRoyaltyConfig memory);
}
文件 13 的 20:IRoyaltyInternal.sol
pragma solidity ^0.8.15;
interface IRoyaltyInternal {
event TokenRoyaltyRemoved(uint256 tokenId);
event TokenRoyaltySet(uint256 tokenId, address recipient, uint16 bps);
event DefaultRoyaltySet(address recipient, uint16 bps);
struct TokenRoyalty {
address recipient;
uint16 bps;
}
struct TokenRoyaltyConfig {
uint256 tokenId;
address recipient;
uint16 bps;
}
}
文件 14 的 20:LibDiamond.sol
pragma solidity ^0.8.0;
import {IDiamondCut} from "../interfaces/IDiamondCut.sol";
error InitializationFunctionReverted(
address _initializationContractAddress,
bytes _calldata
);
library LibDiamond {
bytes32 constant DIAMOND_STORAGE_POSITION =
keccak256("diamond.standard.diamond.storage");
struct FacetAddressAndPosition {
address facetAddress;
uint96 functionSelectorPosition;
}
struct FacetFunctionSelectors {
bytes4[] functionSelectors;
uint256 facetAddressPosition;
}
struct DiamondStorage {
mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;
mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
address[] facetAddresses;
}
function diamondStorage()
internal
pure
returns (DiamondStorage storage ds)
{
bytes32 position = DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
}
event DiamondCut(
IDiamondCut.FacetCut[] _diamondCut,
address _init,
bytes _calldata
);
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 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
);
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
);
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();
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"
);
require(
_facetAddress != address(this),
"LibDiamondCut: Can't remove immutable function"
);
uint256 selectorPosition = ds
.selectorToFacetAndPosition[_selector]
.functionSelectorPosition;
uint256 lastSelectorPosition = ds
.facetFunctionSelectors[_facetAddress]
.functionSelectors
.length - 1;
if (selectorPosition != lastSelectorPosition) {
bytes4 lastSelector = ds
.facetFunctionSelectors[_facetAddress]
.functionSelectors[lastSelectorPosition];
ds.facetFunctionSelectors[_facetAddress].functionSelectors[
selectorPosition
] = lastSelector;
ds
.selectorToFacetAndPosition[lastSelector]
.functionSelectorPosition = uint96(selectorPosition);
}
ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop();
delete ds.selectorToFacetAndPosition[_selector];
if (lastSelectorPosition == 0) {
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) {
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);
}
}
文件 15 的 20:MetadataStorage.sol
pragma solidity ^0.8.15;
library MetadataStorage {
bytes32 internal constant STORAGE_SLOT = keccak256("v2.flair.contracts.storage.Metadata");
struct Layout {
string name;
string symbol;
bool nameAndSymbolLocked;
}
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
文件 16 的 20:OwnableStorage.sol
pragma solidity ^0.8.15;
library OwnableStorage {
struct Layout {
address owner;
}
bytes32 internal constant STORAGE_SLOT = keccak256("openzeppelin.contracts.storage.Ownable");
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
function setOwner(Layout storage l, address owner) internal {
l.owner = owner;
}
}
文件 17 的 20:PyramidStorage.sol
pragma solidity ^0.8.15;
library PyramidStorage {
struct TokenSlot {
uint16 tokenId;
bool occupied;
}
struct Layout {
mapping(uint16 => TokenSlot[4]) pyramidToSlots;
mapping(bytes32 => bool) usedMessages;
address itemsContract;
address applicationAddress;
string contractURI;
}
bytes32 internal constant STORAGE_SLOT =
keccak256("grizzly.contracts.storage.Pyramid");
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
function setItemsContract(
Layout storage l,
address _itemsContract
) internal {
l.itemsContract = _itemsContract;
}
function setApplicationAddress(
Layout storage l,
address _applicationAddress
) internal {
l.applicationAddress = _applicationAddress;
}
function setContractURI(
Layout storage l,
string memory _contractURI
) internal {
l.contractURI = _contractURI;
}
}
文件 18 的 20:RoyaltyEnforcementStorage.sol
pragma solidity ^0.8.15;
library RoyaltyEnforcementStorage {
bytes32 internal constant STORAGE_SLOT = keccak256("v2.flair.contracts.storage.RoyaltyEnforcement");
struct Layout {
bool enforceRoyalties;
}
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
文件 19 的 20:RoyaltyStorage.sol
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./IRoyaltyInternal.sol";
import "./IRoyalty.sol";
library RoyaltyStorage {
using EnumerableSet for EnumerableSet.UintSet;
struct Layout {
IRoyaltyInternal.TokenRoyalty defaultRoyalty;
mapping(uint256 => IRoyaltyInternal.TokenRoyalty) tokenRoyalties;
EnumerableSet.UintSet tokensWithRoyalties;
}
bytes32 internal constant STORAGE_SLOT = keccak256("v2.flair.contracts.storage.Royalty");
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
文件 20 的 20:TokenMetadataStorage.sol
pragma solidity ^0.8.15;
library TokenMetadataStorage {
bytes32 internal constant STORAGE_SLOT = keccak256("v2.flair.contracts.storage.TokenMetadata");
struct Layout {
string baseURI;
bool baseURILocked;
string fallbackURI;
bool fallbackURILocked;
string uriSuffix;
bool uriSuffixLocked;
uint256 lastUnlockedTokenId;
mapping(uint256 => string) tokenURIs;
}
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
{
"compilationTarget": {
"contracts/Diamond.sol": "QuirkiesDiamond"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_diamondCutFacet","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"string","name":"_baseURI","type":"string"},{"internalType":"string","name":"_uriSuffix","type":"string"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint16","name":"_bps","type":"uint16"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]