Address Contract Verified
Address
0xb58Af2C8E7F5539f03e4aDFb20dA78Be48e34245
Balance
0 ETH
Nonce
1
Code Size
8966 bytes
Creator
0xA8BA7A46...8174 at tx 0x1a795fcb...61201d
Indexed Transactions
0
Contract Bytecode
8966 bytes
0x60806040523661000b57005b6000807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9050809150600082600001600080357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013890611788565b60405180910390fd5b3660008037600080366000845af43d6000803e8060008114610162573d6000f35b3d6000fd5b6000807fc0ea367cb0174dd5521cd2372c76f8c13e6c1f832c71f1d6e0cbc185c9cc8ed490508091505090565b808260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000807f70612f47e27b43eb7f87867b7b8f899a5e08503dcccf1bf322c9eef06483a1fc90508091505090565b6000807f28410b8d07a385aff8eb33686a835d0d735720435533fcd095378d7aea1cd08990508091505090565b6000807f021fe373f7e014154d4f551c37c047b9ed9093c774291911030896b9b2dfef5f90508091505090565b6000807faa3a0910ce5fb062d392dc5a532ff9d50bb9d0f614a8eda1a3ec786de0b761f390508091505090565b6000807f9c1f08fc16fa10f59a3ac18a8c5596ea456f2d66793744df41c7c3e4eb21979090508091505090565b6000807fad41a88d044cfe4c318a78970a1f122259b5b1a56fdee398e17d1e83109ea07590508091505090565b6000807fff923f4a67695a9cdd5da4b8580a5a20edf2183c42aa111dd7fc15dc7bed264090508091505090565b63ffffffff60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361037e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610375906117f4565b60405180910390fd5b80836000016000847bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff021916908315150217905550505050565b60005b83518110156105d257600084828151811061040f5761040e611814565b5b60200260200101516020015190506000600281111561043157610430611843565b5b81600281111561044457610443611843565b5b036104945761048f85838151811061045f5761045e611814565b5b60200260200101516000015186848151811061047e5761047d611814565b5b60200260200101516040015161061d565b6105be565b600160028111156104a8576104a7611843565b5b8160028111156104bb576104ba611843565b5b0361050b576105068583815181106104d6576104d5611814565b5b6020026020010151600001518684815181106104f5576104f4611814565b5b602002602001015160400151610894565b6105bd565b60028081111561051e5761051d611843565b5b81600281111561053157610530611843565b5b036105815761057c85838151811061054c5761054b611814565b5b60200260200101516000015186848151811061056b5761056a611814565b5b602002602001015160400151610b15565b6105bc565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b3906118e4565b60405180910390fd5b5b5b5080806105ca9061193d565b9150506103f1565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67383838360405161060693929190611ca9565b60405180910390a16106188282610ca0565b505050565b6000815111610661576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065890611d60565b60405180910390fd5b600061066b610dc2565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d390611df2565b60405180910390fd5b60008160010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018054905090506000816bffffffffffffffffffffffff1603610749576107488285610def565b5b60005b835181101561088d57600084828151811061076a57610769611814565b5b602002602001015190506000846000016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461085e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085590611e84565b60405180910390fd5b61086a8583868a610eca565b838061087590611ebc565b945050505080806108859061193d565b91505061074c565b5050505050565b60008151116108d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108cf90611d60565b60405180910390fd5b60006108e2610dc2565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094a90611df2565b60405180910390fd5b60008160010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018054905090506000816bffffffffffffffffffffffff16036109c0576109bf8285610def565b5b60005b8351811015610b0e5760008482815181106109e1576109e0611814565b5b602002602001015190506000846000016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acb90611f62565b60405180910390fd5b610adf858284611077565b610aeb8583868a610eca565b8380610af690611ebc565b94505050508080610b069061193d565b9150506109c3565b5050505050565b6000815111610b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5090611d60565b60405180910390fd5b6000610b63610dc2565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610bd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcb90611ff4565b60405180910390fd5b60005b8251811015610c9a576000838281518110610bf557610bf4611814565b5b602002602001015190506000836000016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050610c85848284611077565b50508080610c929061193d565b915050610bd7565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160315610dbe57610cf782604051806060016040528060288152602001612285602891396116d9565b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051610d1f9190612050565b600060405180830381855af49150503d8060008114610d5a576040519150601f19603f3d011682016040523d82523d6000602084013e610d5f565b606091505b509150915081610dbb57600081511115610d7c5780518082602001fd5b83836040517f192105d7000000000000000000000000000000000000000000000000000000008152600401610db2929190612067565b60405180910390fd5b50505b5050565b6000807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90508091505090565b610e11816040518060600160405280602481526020016122ad602491396116d9565b81600201805490508260010160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555081600201819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b81846000016000857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508360010160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018390806001815401808255809150506001900390600052602060002090600891828204019190066004029091909190916101000a81548163ffffffff021916908360e01c021790555080846000016000857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036110e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110dd90612109565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611154576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114b9061219b565b60405180910390fd5b6000836000016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050600060018560010160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018054905061122b91906121bb565b90508082146113bf5760008560010160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001828154811061128c5761128b611814565b5b90600052602060002090600891828204019190066004029054906101000a900460e01b9050808660010160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001848154811061130857611307611814565b5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c021790555082866000016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550505b8460010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001805480611413576114126121ef565b5b60019003818190600052602060002090600891828204019190066004026101000a81549063ffffffff02191690559055846000016000847bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a8154906bffffffffffffffffffffffff02191690555050600081036116d2576000600186600201805490506114fd91906121bb565b905060008660010160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905081811461163e57600087600201838154811061156757611566611814565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050808860020183815481106115ab576115aa611814565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818860010160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550505b86600201805480611652576116516121ef565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558660010160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000905550505b5050505050565b6000823b9050600081118290611725576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171c9190612262565b60405180910390fd5b50505050565b600082825260208201905092915050565b7f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374600082015250565b600061177260208361172b565b915061177d8261173c565b602082019050919050565b600060208201905081810360008301526117a181611765565b9050919050565b7f4552433136353a20696e76616c696420696e7465726661636520696400000000600082015250565b60006117de601c8361172b565b91506117e9826117a8565b602082019050919050565b6000602082019050818103600083015261180d816117d1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560008201527f74416374696f6e00000000000000000000000000000000000000000000000000602082015250565b60006118ce60278361172b565b91506118d982611872565b604082019050919050565b600060208201905081810360008301526118fd816118c1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b600061194882611933565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361197a57611979611904565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119dc826119b1565b9050919050565b6119ec816119d1565b82525050565b60038110611a0357611a02611843565b5b50565b6000819050611a14826119f2565b919050565b6000611a2482611a06565b9050919050565b611a3481611a19565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a9b81611a66565b82525050565b6000611aad8383611a92565b60208301905092915050565b6000602082019050919050565b6000611ad182611a3a565b611adb8185611a45565b9350611ae683611a56565b8060005b83811015611b17578151611afe8882611aa1565b9750611b0983611ab9565b925050600181019050611aea565b5085935050505092915050565b6000606083016000830151611b3c60008601826119e3565b506020830151611b4f6020860182611a2b565b5060408301518482036040860152611b678282611ac6565b9150508091505092915050565b6000611b808383611b24565b905092915050565b6000602082019050919050565b6000611ba082611985565b611baa8185611990565b935083602082028501611bbc856119a1565b8060005b85811015611bf85784840389528151611bd98582611b74565b9450611be483611b88565b925060208a01995050600181019050611bc0565b50829750879550505050505092915050565b611c13816119d1565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c53578082015181840152602081019050611c38565b60008484015250505050565b6000601f19601f8301169050919050565b6000611c7b82611c19565b611c858185611c24565b9350611c95818560208601611c35565b611c9e81611c5f565b840191505092915050565b60006060820190508181036000830152611cc38186611b95565b9050611cd26020830185611c0a565b8181036040830152611ce48184611c70565b9050949350505050565b7f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660008201527f6163657420746f20637574000000000000000000000000000000000000000000602082015250565b6000611d4a602b8361172b565b9150611d5582611cee565b604082019050919050565b60006020820190508181036000830152611d7981611d3d565b9050919050565b7f4c69624469616d6f6e644375743a204164642066616365742063616e2774206260008201527f6520616464726573732830290000000000000000000000000000000000000000602082015250565b6000611ddc602c8361172b565b9150611de782611d80565b604082019050919050565b60006020820190508181036000830152611e0b81611dcf565b9050919050565b7f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60008201527f6e207468617420616c7265616479206578697374730000000000000000000000602082015250565b6000611e6e60358361172b565b9150611e7982611e12565b604082019050919050565b60006020820190508181036000830152611e9d81611e61565b9050919050565b60006bffffffffffffffffffffffff82169050919050565b6000611ec782611ea4565b91506bffffffffffffffffffffffff8203611ee557611ee4611904565b5b600182019050919050565b7f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60008201527f6374696f6e20776974682073616d652066756e6374696f6e0000000000000000602082015250565b6000611f4c60388361172b565b9150611f5782611ef0565b604082019050919050565b60006020820190508181036000830152611f7b81611f3f565b9050919050565b7f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260008201527f657373206d757374206265206164647265737328302900000000000000000000602082015250565b6000611fde60368361172b565b9150611fe982611f82565b604082019050919050565b6000602082019050818103600083015261200d81611fd1565b9050919050565b600081905092915050565b600061202a82611c19565b6120348185612014565b9350612044818560208601611c35565b80840191505092915050565b600061205c828461201f565b915081905092915050565b600060408201905061207c6000830185611c0a565b818103602083015261208e8184611c70565b90509392505050565b7f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360008201527f74696f6e207468617420646f65736e2774206578697374000000000000000000602082015250565b60006120f360378361172b565b91506120fe82612097565b604082019050919050565b60006020820190508181036000830152612122816120e6565b9050919050565b7f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560008201527f7461626c652066756e6374696f6e000000000000000000000000000000000000602082015250565b6000612185602e8361172b565b915061219082612129565b604082019050919050565b600060208201905081810360008301526121b481612178565b9050919050565b60006121c682611933565b91506121d183611933565b92508282039050818111156121e9576121e8611904565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600081519050919050565b60006122348261221e565b61223e818561172b565b935061224e818560208601611c35565b61225781611c5f565b840191505092915050565b6000602082019050818103600083015261227c8184612229565b90509291505056fe4c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a204e657720666163657420686173206e6f20636f6465a264697066735822122098e5dad8285d2e9a2c455e633ce3418c10194e5b1ec02b7e824e1b6e99511a3564736f6c63430008120033
Verified Source Code Full Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: No
Diamond.sol 190 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /******************************************************************************\ * Diamond Contract Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 * * Implementation of a diamond. * @team https://twitter.com/quirkiesnft * @url https://quirkies.io/ * @author GrizzlyDesign * @url https://twitter.com/grizzlywebdev /******************************************************************************/ /* .......................................................................................... ...............,:;;;:,.................................................................... ...........,+?#@@@@@@#%,.................................................................. ........,+%@@@S%%?+;#@@;..............................................:*?%%?;,............ .......+#@@%*?S#%++?@@%,.............................................;@@@SS#@@%:.......... .....,?@@S:*%%*+;?@@@+...............................................S@@:+*.:?@@%:........ .....:@@@%+**?S#@@@@@%:............,,,:::::,,,,......................%@@,+@S*,,%@@;....... .....,?#@@@@@@@@?;,:%@@+.....,:+?%##@@@@@@@@@@##S%*+:,..............,+@@S,*@@@*.*@@;...... .......,;;;::?@@*....*@@?,:*S@@@@@#S%?*++++++++*?%#@@@#%+:,.......:?#@@@@S::%@@;.?@#,..... ..............*@@%:...;#@#@@@S?+:,,................,:+?S@@#%;,..:?@@#*+*#@@?::*?;;@@:..... ...............:%@@+,:*@@#?;,...........................,;?#@#??@@#*,...:@@@@S***#@#,..... .................;#@#@@%;,.................................,;S@@#+,....;%@@%%#@@@@%:...... ................,*@@@?:.....................................:?S+,...,+S@@%;...,::,........ ...............;#@@?,......................................*%;....,*#@@?:................. .............,?@@S:........................................,....:?#@@%,................... ............,S@@?,............................................:%%;:#@#:................... ...........,#@@*..............................................::...:@@S,.................. ..........,S@@?.....................................................*@@+.................. ..........*@@S,.....................................................,@@#,................. .........,#@@;......,*%+.............................................S@@:................. .........;@@#,......,@@@+:*SS+.............::,...,:,.................?@@+................. .........*@@?........*@@@@@@S+............:@@#;:?@@%.................?@@*................. .........*@@*.....,+%@@@@@*:...............+#@@@@@%:.................S@@;................. .........;@@S;...,#@@#%#@@?................,%@@@@*..................:@@@,................. .........?@@+,....;+:,.:#@#,.....,:,.....,*#@@S@@@*,................%@@?.................. ........;@@?............,:,....;S@@#:....:#@S;.;S@S,...............+@@#,.................. ........:@@S,..:S%+:..........;@@@@@?.....,,.....,,............,*,;@@@;................... .........?@@#%?#@@@@%:........;@@@@@*...........................*#@@@;.................... ..........;S#@@#%;:#@@?;.......::,::,...............,,,,,,.......%@@;..................... ............,,,,..*@@%+,.....................,..,;?S@@@@@#?;.....?@#,..................... .................;@@*.......;,..............,?%*#@@#%??S@@?:....+@@?...................... .................?@@,......%S,................;@@#;,....*@@@%?%#@@%,...................... .................?@@+.....+@,.......*+.........%@@,......,+%#@@#%;........................ .................:#@@*,...+#........#?........,#@@,.........,,,,.......................... ..................,?#@@S%%#@?,.....,#%.......:S@@*........................................ ....................,;*%SSS@@@%***%@@@S+:::+%@@#+......................................... ...........................:*S#@@@#%*S@@@@@@@%+,.......................................... ..............................,,,,....,:;;;:,............................................. .......................................................................................... */ 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 { // set owner OwnableStorage.layout().setOwner(_contractOwner); // set metadata MetadataStorage.layout().name = _name; MetadataStorage.layout().symbol = _symbol; // set contract URI PyramidStorage.layout().contractURI = _contractURI; // set BaseURI TokenMetadataStorage.layout().baseURI = _baseURI; TokenMetadataStorage.layout().uriSuffix = _uriSuffix; // set Max Supply ERC721SupplyStorage.layout().maxSupply = _maxSupply; // set royalty enforcement RoyaltyEnforcementStorage.layout().enforceRoyalties = true; // set default royalty IRoyaltyInternal.TokenRoyalty memory royalty = IRoyaltyInternal .TokenRoyalty({recipient: _royaltyRecipient, bps: _bps}); RoyaltyStorage.layout().defaultRoyalty = royalty; // set supported interfaces 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); // Add the diamondCut external function from the diamondCutFacet IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](1); bytes4[] memory functionSelectors = new bytes4[](1); functionSelectors[0] = IDiamondCut.diamondCut.selector; cut[0] = IDiamondCut.FacetCut({ facetAddress: _diamondCutFacet, action: IDiamondCut.FacetCutAction.Add, functionSelectors: functionSelectors }); LibDiamond.diamondCut(cut, address(0), ""); } // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { LibDiamond.DiamondStorage storage ds; bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; // get diamond storage assembly { ds.slot := position } // get facet from function selector address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress; require(facet != address(0), "Diamond: Function does not exist"); // Execute external function from facet using delegatecall and return any value. assembly { // copy function selector and any arguments calldatacopy(0, 0, calldatasize()) // execute function call using the facet let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) // get any return value returndatacopy(0, 0, returndatasize()) // return any return value or error back to the caller switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } receive() external payable {} }
IERC173.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "./IERC173Events.sol";
/**
* @title Contract ownership standard interface
* @dev see https://eips.ethereum.org/EIPS/eip-173
*/
interface IERC173 is IERC173Events {
/**
* @notice get the ERC173 contract owner
* @return conrtact owner
*/
function owner() external view returns (address);
/**
* @notice transfer contract ownership to new account
* @param account address of new owner
*/
function transferOwnership(address account) external;
}
LibDiamond.sol 324 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ import {IDiamondCut} from "../interfaces/IDiamondCut.sol"; // Remember to add the loupe functions from DiamondLoupeFacet to the diamond. // The loupe functions are required by the EIP2535 Diamonds standard error InitializationFunctionReverted( address _initializationContractAddress, bytes _calldata ); library LibDiamond { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct FacetAddressAndPosition { address facetAddress; uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array } struct FacetFunctionSelectors { bytes4[] functionSelectors; uint256 facetAddressPosition; // position of facetAddress in facetAddresses array } struct DiamondStorage { // maps function selector to the facet address and // the position of the selector in the facetFunctionSelectors.selectors array mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition; // maps facet addresses to function selectors mapping(address => FacetFunctionSelectors) facetFunctionSelectors; // facet addresses address[] facetAddresses; } 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 ); // Internal function version of diamondCut function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { for ( uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++ ) { IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action; if (action == IDiamondCut.FacetCutAction.Add) { addFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Replace) { replaceFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else if (action == IDiamondCut.FacetCutAction.Remove) { removeFunctions( _diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors ); } else { revert("LibDiamondCut: Incorrect FacetCutAction"); } } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } function addFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); require( _facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)" ); uint96 selectorPosition = uint96( ds.facetFunctionSelectors[_facetAddress].functionSelectors.length ); // add new facet address if it does not exist if (selectorPosition == 0) { addFacet(ds, _facetAddress); } for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; require( oldFacetAddress == address(0), "LibDiamondCut: Can't add function that already exists" ); addFunction(ds, selector, selectorPosition, _facetAddress); selectorPosition++; } } function replaceFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); require( _facetAddress != address(0), "LibDiamondCut: Add facet can't be address(0)" ); uint96 selectorPosition = uint96( ds.facetFunctionSelectors[_facetAddress].functionSelectors.length ); // add new facet address if it does not exist if (selectorPosition == 0) { addFacet(ds, _facetAddress); } for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; require( oldFacetAddress != _facetAddress, "LibDiamondCut: Can't replace function with same function" ); removeFunction(ds, oldFacetAddress, selector); addFunction(ds, selector, selectorPosition, _facetAddress); selectorPosition++; } } function removeFunctions( address _facetAddress, bytes4[] memory _functionSelectors ) internal { require( _functionSelectors.length > 0, "LibDiamondCut: No selectors in facet to cut" ); DiamondStorage storage ds = diamondStorage(); // if function does not exist then do nothing and return require( _facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)" ); for ( uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++ ) { bytes4 selector = _functionSelectors[selectorIndex]; address oldFacetAddress = ds .selectorToFacetAndPosition[selector] .facetAddress; removeFunction(ds, oldFacetAddress, selector); } } function addFacet( DiamondStorage storage ds, address _facetAddress ) internal { enforceHasContractCode( _facetAddress, "LibDiamondCut: New facet has no code" ); ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds .facetAddresses .length; ds.facetAddresses.push(_facetAddress); } function addFunction( DiamondStorage storage ds, bytes4 _selector, uint96 _selectorPosition, address _facetAddress ) internal { ds .selectorToFacetAndPosition[_selector] .functionSelectorPosition = _selectorPosition; ds.facetFunctionSelectors[_facetAddress].functionSelectors.push( _selector ); ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress; } function removeFunction( DiamondStorage storage ds, address _facetAddress, bytes4 _selector ) internal { require( _facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist" ); // an immutable function is a function defined directly in a diamond require( _facetAddress != address(this), "LibDiamondCut: Can't remove immutable function" ); // replace selector with last selector, then delete last selector uint256 selectorPosition = ds .selectorToFacetAndPosition[_selector] .functionSelectorPosition; uint256 lastSelectorPosition = ds .facetFunctionSelectors[_facetAddress] .functionSelectors .length - 1; // if not the same then replace _selector with lastSelector if (selectorPosition != lastSelectorPosition) { bytes4 lastSelector = ds .facetFunctionSelectors[_facetAddress] .functionSelectors[lastSelectorPosition]; ds.facetFunctionSelectors[_facetAddress].functionSelectors[ selectorPosition ] = lastSelector; ds .selectorToFacetAndPosition[lastSelector] .functionSelectorPosition = uint96(selectorPosition); } // delete the last selector ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop(); delete ds.selectorToFacetAndPosition[_selector]; // if no more selectors for facet address then delete the facet address if (lastSelectorPosition == 0) { // replace facet address with last facet address and delete last facet address uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1; uint256 facetAddressPosition = ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition; if (facetAddressPosition != lastFacetAddressPosition) { address lastFacetAddress = ds.facetAddresses[ lastFacetAddressPosition ]; ds.facetAddresses[facetAddressPosition] = lastFacetAddress; ds .facetFunctionSelectors[lastFacetAddress] .facetAddressPosition = facetAddressPosition; } ds.facetAddresses.pop(); delete ds .facetFunctionSelectors[_facetAddress] .facetAddressPosition; } } function initializeDiamondCut( address _init, bytes memory _calldata ) internal { if (_init == address(0)) { return; } enforceHasContractCode( _init, "LibDiamondCut: _init address has no code" ); (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up error /// @solidity memory-safe-assembly assembly { let returndata_size := mload(error) revert(add(32, error), returndata_size) } } else { revert InitializationFunctionReverted(_init, _calldata); } } } function enforceHasContractCode( address _contract, string memory _errorMessage ) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
IDiamondCut.sol 36 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ interface IDiamondCut { enum FacetCutAction { Add, Replace, Remove } // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
IDiamondLoupe.sol 45 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /******************************************************************************\ * Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen) * EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 /******************************************************************************/ // 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_); }
IERC173Events.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
/**
* @title Contract ownership standard interface (event only)
* @dev see https://eips.ethereum.org/EIPS/eip-173
*/
interface IERC173Events {
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
}
PyramidStorage.sol 49 lines
// SPDX-License-Identifier: MIT
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;
}
}
IRoyalty.sol 26 lines
// SPDX-License-Identifier: AGPL-3.0
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 {
/**
* @dev Default royalty for all tokens without a specific royalty.
*/
function defaultRoyalty() external view returns (TokenRoyalty memory);
/**
* @dev Get the number of token specific overrides. Used to enumerate over all configurations
*/
function getTokenRoyaltiesCount() external view returns (uint256);
/**
* @dev Get a token royalty configuration by index. Use in conjunction with getTokenRoyaltiesCount to get all per token configurations
*/
function getTokenRoyaltyByIndex(uint256 index) external view returns (TokenRoyaltyConfig memory);
}
EnumerableSet.sol 378 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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.
*
* ```
* 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;
}
}
ERC165Storage.sol 31 lines
// SPDX-License-Identifier: MIT
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;
}
}
OwnableStorage.sol 22 lines
// SPDX-License-Identifier: MIT
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;
}
}
RoyaltyStorage.sol 27 lines
// SPDX-License-Identifier: MIT
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
}
}
}
IRoyaltyInternal.sol 20 lines
// SPDX-License-Identifier: MIT
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;
}
}
MetadataStorage.sol 20 lines
// SPDX-License-Identifier: MIT
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
}
}
}
IEIP2981.sol 15 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* EIP-2981
*/
interface IEIP2981 {
/**
* bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
*
* => 0x2a55205a = 0x2a55205a
*/
function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
}
IRarible.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IRaribleV1 {
/*
* bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
* bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
*
* => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584
*/
function getFeeBps(uint256 id) external view returns (uint[] memory);
function getFeeRecipients(uint256 id) external view returns (address payable[] memory);
}
interface IRaribleV2 {
/*
* bytes4(keccak256('getRaribleV2Royalties(uint256)')) == 0xcad96cca
*/
struct Part {
address payable account;
uint96 value;
}
function getRaribleV2Royalties(uint256 id) external view returns (Part[] memory);
}
RoyaltyEnforcementStorage.sol 18 lines
// SPDX-License-Identifier: MIT
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
}
}
}
IFoundation.sol 20 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IFoundation {
/*
* bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
*
* => 0xd5a06d4c = 0xd5a06d4c
*/
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);
}
TokenMetadataStorage.sol 25 lines
// SPDX-License-Identifier: MIT
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
}
}
}
ERC721SupplyStorage.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
library ERC721SupplyStorage {
struct Layout {
// The next token ID to be minted.
uint256 currentIndex;
// The number of tokens burned.
uint256 burnCounter;
// Maximum possible supply of tokens.
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
}
}
}
Recent Transactions
No transactions found for this address