├── .github ├── pull_request_template.md └── workflows │ ├── deploy-core.yml │ ├── deploy-module.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── .husky ├── .gitignore └── pre-commit ├── .prettierignore ├── .prettierrc ├── .solhint.json ├── LICENSE ├── README.md ├── addresses ├── 1.json ├── 137.json ├── 3.json ├── 4.json ├── 42.json ├── 5.json ├── 7777777.json ├── 80001.json └── 999999999.json ├── contracts ├── ZoraModuleManager.sol ├── auxiliary │ └── ZoraProtocolFeeSettings │ │ └── ZoraProtocolFeeSettings.sol ├── common │ ├── FeePayoutSupport │ │ └── FeePayoutSupportV1.sol │ ├── IncomingTransferSupport │ │ └── V1 │ │ │ └── IncomingTransferSupportV1.sol │ ├── ModuleNamingSupport │ │ └── ModuleNamingSupportV1.sol │ ├── OutgoingTransferSupport │ │ └── V1 │ │ │ ├── IWETH.sol │ │ │ └── OutgoingTransferSupportV1.sol │ └── UniversalExchangeEvent │ │ └── V1 │ │ └── UniversalExchangeEventV1.sol ├── modules │ ├── Asks │ │ ├── Core │ │ │ ├── ERC20 │ │ │ │ ├── AsksCoreErc20.sol │ │ │ │ └── IAsksCoreErc20.sol │ │ │ └── ETH │ │ │ │ ├── AsksCoreEth.sol │ │ │ │ └── IAsksCoreEth.sol │ │ ├── Omnibus │ │ │ ├── AsksDataStorage.sol │ │ │ ├── AsksOmnibus.sol │ │ │ └── IAsksOmnibus.sol │ │ ├── Private │ │ │ └── ETH │ │ │ │ ├── AsksPrivateEth.sol │ │ │ │ └── IAsksPrivateEth.sol │ │ └── V1.1 │ │ │ └── AsksV1_1.sol │ ├── Offers │ │ ├── Omnibus │ │ │ ├── IOffersOmnibus.sol │ │ │ ├── OffersDataStorage.sol │ │ │ └── OffersOmnibus.sol │ │ └── V1 │ │ │ └── OffersV1.sol │ └── ReserveAuction │ │ ├── Core │ │ ├── ERC20 │ │ │ ├── IReserveAuctionCoreErc20.sol │ │ │ └── ReserveAuctionCoreErc20.sol │ │ └── ETH │ │ │ ├── IReserveAuctionCoreEth.sol │ │ │ └── ReserveAuctionCoreEth.sol │ │ ├── Finders │ │ ├── ERC20 │ │ │ ├── IReserveAuctionFindersErc20.sol │ │ │ └── ReserveAuctionFindersErc20.sol │ │ └── ETH │ │ │ ├── IReserveAuctionFindersEth.sol │ │ │ └── ReserveAuctionFindersEth.sol │ │ ├── Listing │ │ ├── ERC20 │ │ │ ├── IReserveAuctionListingErc20.sol │ │ │ └── ReserveAuctionListingErc20.sol │ │ └── ETH │ │ │ ├── IReserveAuctionListingEth.sol │ │ │ └── ReserveAuctionListingEth.sol │ │ ├── Omnibus │ │ ├── IReserveAuctionOmnibus.sol │ │ ├── ReserveAuctionDataStorage.sol │ │ └── ReserveAuctionOmnibus.sol │ │ └── V3 │ │ ├── IReserveAuctionV3.sol │ │ └── ReserveAuctionV3.sol ├── test │ ├── ZoraModuleManager.t.sol │ ├── auxiliary │ │ └── ZoraProtocolFeeSettings.t.sol │ ├── modules │ │ ├── Asks │ │ │ ├── Core │ │ │ │ ├── ERC20 │ │ │ │ │ ├── AsksCoreErc20.integration.t.sol │ │ │ │ │ └── AsksCoreErc20.t.sol │ │ │ │ └── ETH │ │ │ │ │ ├── AsksCoreEth.integration.t.sol │ │ │ │ │ └── AsksCoreEth.t.sol │ │ │ ├── Omnibus │ │ │ │ ├── AsksDataStorage.t.sol │ │ │ │ └── AsksOmnibus.t.sol │ │ │ ├── Private │ │ │ │ └── ETH │ │ │ │ │ ├── AsksPrivateEth.integration.t.sol │ │ │ │ │ └── AsksPrivateEth.t.sol │ │ │ └── V1.1 │ │ │ │ ├── AsksV1_1.integration.t.sol │ │ │ │ └── AsksV1_1.t.sol │ │ ├── Offers │ │ │ ├── Omnibus │ │ │ │ ├── OffersOmnibus.integration.t.sol │ │ │ │ └── OffersOmnibus.t.sol │ │ │ └── V1 │ │ │ │ ├── Offers.integration.t.sol │ │ │ │ └── Offers.t.sol │ │ └── ReserveAuction │ │ │ ├── Core │ │ │ ├── ERC20 │ │ │ │ ├── ReserveAuctionCoreErc20.t.integration.sol │ │ │ │ └── ReserveAuctionCoreErc20.t.sol │ │ │ └── ETH │ │ │ │ ├── ReserveAuctionCoreEth.integration.t.sol │ │ │ │ └── ReserveAuctionCoreEth.t.sol │ │ │ ├── Finders │ │ │ ├── ERC20 │ │ │ │ ├── ReserveAuctionFindersErc20.integration.t.sol │ │ │ │ └── ReserveAuctionFindersErc20.t.sol │ │ │ └── ETH │ │ │ │ ├── ReserveAuctionFindersEth.integration.t.sol │ │ │ │ └── ReserveAuctionFindersEth.t.sol │ │ │ ├── Listing │ │ │ ├── ERC20 │ │ │ │ ├── ReserveAuctionListingErc20.integration.t.sol │ │ │ │ └── ReserveAuctionListingErc20.t.sol │ │ │ └── ETH │ │ │ │ ├── ReserveAuctionListingEth.integration.t.sol │ │ │ │ └── ReserveAuctionListingEth.t.sol │ │ │ └── Omnibus │ │ │ ├── ReserveAuctionDataStorage.t.sol │ │ │ └── ReserveAuctionOmnibus.t.sol │ ├── transferHelpers │ │ ├── ERC1155TransferHelper.t.sol │ │ ├── ERC20TransferHelper.t.sol │ │ └── ERC721TransferHelper.t.sol │ └── utils │ │ ├── VM.sol │ │ ├── modules │ │ ├── RoyaltyEngine.sol │ │ ├── SimpleModule.sol │ │ └── TransferModule.sol │ │ ├── tokens │ │ ├── TestERC1155.sol │ │ ├── TestERC20.sol │ │ ├── TestERC721.sol │ │ └── WETH.sol │ │ └── users │ │ ├── ZoraRegistrar.sol │ │ └── Zorb.sol └── transferHelpers │ ├── BaseTransferHelper.sol │ ├── ERC1155TransferHelper.sol │ ├── ERC20TransferHelper.sol │ └── ERC721TransferHelper.sol ├── deploy ├── deploy-core.sh ├── deploy-module.sh └── update-addresses.py ├── foundry.toml ├── package.json ├── remappings.txt ├── uml ├── Asks │ ├── Core │ │ ├── ERC20 │ │ │ ├── cancelAsk.atxt │ │ │ ├── cancelAsk.txt │ │ │ ├── createAsk.atxt │ │ │ ├── createAsk.txt │ │ │ ├── fillAsk.atxt │ │ │ ├── fillAsk.txt │ │ │ ├── setAskPrice.atxt │ │ │ └── setAskPrice.txt │ │ └── ETH │ │ │ ├── cancelAsk.atxt │ │ │ ├── cancelAsk.txt │ │ │ ├── createAsk.atxt │ │ │ ├── createAsk.txt │ │ │ ├── fillAsk.atxt │ │ │ ├── fillAsk.txt │ │ │ ├── setAskPrice.atxt │ │ │ └── setAskPrice.txt │ ├── Private │ │ └── ETH │ │ │ ├── cancelAsk.atxt │ │ │ ├── cancelAsk.txt │ │ │ ├── createAsk.atxt │ │ │ ├── createAsk.txt │ │ │ ├── fillAsk.atxt │ │ │ ├── fillAsk.txt │ │ │ ├── setAskPrice.atxt │ │ │ └── setAskPrice.txt │ └── V1_1 │ │ ├── cancelAsk.atxt │ │ ├── cancelAsk.txt │ │ ├── createAsk.atxt │ │ ├── createAsk.txt │ │ ├── fillAsk.atxt │ │ ├── fillAsk.txt │ │ ├── setAskPrice.atxt │ │ └── setAskPrice.txt ├── OffersV1 │ ├── cancelOffer.atxt │ ├── cancelOffer.txt │ ├── createOffer.atxt │ ├── createOffer.txt │ ├── fillOffer.atxt │ ├── fillOffer.txt │ ├── setOfferAmount.atxt │ └── setOfferAmount.txt ├── ReserveAuction │ ├── Core │ │ ├── ERC20 │ │ │ ├── cancelAuction.atxt │ │ │ ├── cancelAuction.txt │ │ │ ├── createAuction.atxt │ │ │ ├── createAuction.txt │ │ │ ├── createBid.atxt │ │ │ ├── createBid.txt │ │ │ ├── setAuctionReservePrice.atxt │ │ │ ├── setAuctionReservePrice.txt │ │ │ ├── settleAuction.atxt │ │ │ └── settleAuction.txt │ │ └── ETH │ │ │ ├── cancelAuction.atxt │ │ │ ├── cancelAuction.txt │ │ │ ├── createAuction.atxt │ │ │ ├── createAuction.txt │ │ │ ├── createBid.atxt │ │ │ ├── createBid.txt │ │ │ ├── setAuctionReservePrice.atxt │ │ │ ├── setAuctionReservePrice.txt │ │ │ ├── settleAuction.atxt │ │ │ └── settleAuction.txt │ ├── Finders │ │ ├── ERC20 │ │ │ ├── cancelAuction.atxt │ │ │ ├── cancelAuction.txt │ │ │ ├── createAuction.atxt │ │ │ ├── createAuction.txt │ │ │ ├── createBid.atxt │ │ │ ├── createBid.txt │ │ │ ├── setAuctionReservePrice.atxt │ │ │ ├── setAuctionReservePrice.txt │ │ │ ├── settleAuction.atxt │ │ │ └── settleAuction.txt │ │ └── ETH │ │ │ ├── cancelAuction.atxt │ │ │ ├── cancelAuction.txt │ │ │ ├── createAuction.atxt │ │ │ ├── createAuction.txt │ │ │ ├── createBid.atxt │ │ │ ├── createBid.txt │ │ │ ├── setAuctionReservePrice.atxt │ │ │ ├── setAuctionReservePrice.txt │ │ │ ├── settleAuction.atxt │ │ │ └── settleAuction.txt │ └── Listing │ │ ├── ERC20 │ │ ├── cancelAuction.atxt │ │ ├── cancelAuction.txt │ │ ├── createAuction.atxt │ │ ├── createAuction.txt │ │ ├── createBid.atxt │ │ ├── createBid.txt │ │ ├── setAuctionReservePrice.atxt │ │ ├── setAuctionReservePrice.txt │ │ ├── settleAuction.atxt │ │ └── settleAuction.txt │ │ └── ETH │ │ ├── cancelAuction.atxt │ │ ├── cancelAuction.txt │ │ ├── createAuction.atxt │ │ ├── createAuction.txt │ │ ├── createBid.atxt │ │ ├── createBid.txt │ │ ├── setAuctionReservePrice.atxt │ │ ├── setAuctionReservePrice.txt │ │ ├── settleAuction.atxt │ │ └── settleAuction.txt ├── ZoraModuleManager │ ├── registerModule.atxt │ ├── registerModule.txt │ ├── setApprovalForModule.atxt │ ├── setApprovalForModule.txt │ ├── setApprovalForModuleBySig.atxt │ ├── setApprovalForModuleBySig.txt │ ├── setBatchApprovalForModules.atxt │ ├── setBatchApprovalForModules.txt │ ├── setRegistrar.atxt │ └── setRegistrar.txt └── ZoraProtocolFeeSettings │ ├── mint.atxt │ ├── mint.txt │ ├── setFeeParams.atxt │ ├── setFeeParams.txt │ ├── setMetadata.atxt │ ├── setMetadata.txt │ ├── setOwner.atxt │ └── setOwner.txt └── yarn.lock /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # New Module Proposal 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Motivation and Context 8 | 9 | 10 | 11 | ## How has this been tested? 12 | 13 | 14 | 15 | 16 | 17 | ## Checklist: 18 | 19 | 20 | 21 | 22 | - [ ] The module includes tests written for Foundry 23 | - [ ] The module is documented with [NATSPEC](https://docs.soliditylang.org/en/v0.5.10/natspec-format.html) 24 | - [ ] The documentation includes [UML Diagrams](https://plantuml.com/ascii-art) for external and public functions 25 | - [ ] The module is a [Hyperstructure](https://www.jacob.energy/hyperstructures.html) 26 | -------------------------------------------------------------------------------- /.github/workflows/deploy-core.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Core 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | environment: 7 | description: "Name of github environment, i.e. rinkeby. Environment can be named anything as long as it includes the following vars: NPM_TOKEN, ETHERSCAN_API_KEY, RPC_URL, PRIVATE_KEY, WALLET_ADDRESS, REGISTRAR, FEE_SETTINGS_OWNER." 8 | required: true 9 | chainid: 10 | description: "Chain id for corresponding environment. This can't be an environment variable due to an annoying technicality." 11 | required: true 12 | overwrite: 13 | description: 'Optional. Enter "overwrite" to deploy even if core contracts already have addresses in addresses/.json file.' 14 | 15 | jobs: 16 | deploy: 17 | runs-on: ubuntu-latest 18 | environment: ${{ github.event.inputs.environment }} 19 | steps: 20 | - uses: actions/checkout@v2 21 | with: 22 | submodules: recursive 23 | - uses: actions/setup-node@v2 24 | with: 25 | node-version: "16" 26 | - run: npm install && npm install --global yarn 27 | - name: Install Foundry 28 | uses: onbjerg/foundry-toolchain@v1 29 | with: 30 | version: nightly 31 | - name: Build 32 | run: forge build 33 | - name: Run deploy script 34 | run: bash ./deploy/deploy-core.sh ${{ github.event.inputs.overwrite }} 35 | - name: Bump version 36 | run: npm i -g json-bump && json-bump package.json && yarn prettier --write package.json && npm i -g json && echo "TAG=v$(cat package.json | json version)" >> $GITHUB_ENV 37 | - name: Push new addresses and package.json 38 | uses: EndBug/add-and-commit@v9 39 | with: 40 | add: '["addresses/${{ github.event.inputs.chainid }}.json", "package.json"]' 41 | message: "Commit from Github Actions (deploy core)" 42 | new_branch: main 43 | pathspec_error_handling: ignore 44 | tag: ${{ env.TAG }} 45 | - uses: JS-DevTools/npm-publish@v1 46 | with: 47 | token: ${{ secrets.NPM_TOKEN }} 48 | dry-run: false 49 | - name: Bundle release 50 | run: sudo apt-get install zip && zip -r ${{ env.TAG }}.zip dist package.json LICENSE README.md 51 | - uses: ncipollo/release-action@v1 52 | with: 53 | artifacts: ${{ env.TAG }}.zip 54 | token: ${{ secrets.GITHUB_TOKEN }} 55 | tag: ${{ env.TAG }} 56 | env: 57 | ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} 58 | CHAIN_ID: ${{ github.event.inputs.chainid }} 59 | RPC_URL: ${{ secrets.RPC_URL }} 60 | PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} 61 | WALLET_ADDRESS: ${{ secrets.WALLET_ADDRESS }} 62 | REGISTRAR: ${{ secrets.REGISTRAR }} 63 | FEE_SETTINGS_OWNER: ${{ secrets.FEE_SETTINGS_OWNER }} 64 | -------------------------------------------------------------------------------- /.github/workflows/deploy-module.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Module 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | environment: 7 | description: "Name of github environment, i.e. rinkeby. Environment can be named anything as long as it includes the following vars: NPM_TOKEN, ETHERSCAN_API_KEY, RPC_URL, PRIVATE_KEY, WALLET_ADDRESS." 8 | required: true 9 | chainid: 10 | description: "Chain id for corresponding environment. This can't be an environment variable due to an annoying technicality." 11 | required: true 12 | overwrite: 13 | description: 'Optional. Enter "overwrite" to deploy and update address even if address already exists in addresses/.json file.' 14 | default: "dontoverwrite" 15 | module_name: 16 | description: "Name of contract in solidity file, i.e. AsksV1_1" 17 | required: true 18 | module_path: 19 | description: "Starting from modules folder, i.e Asks/V1.1/AsksV1_1.sol" 20 | required: true 21 | constructor_abi: 22 | description: 'Constructor abi in quotes, using f as the function name i.e. "f(address,string)"' 23 | required: true 24 | constructor_args: 25 | description: 'Arbitrary constructor args, exactly how you pass them into cli. i.e.: 0x123 0 1 "This 4th arg is a string with spaces"' 26 | 27 | jobs: 28 | deploy: 29 | runs-on: ubuntu-latest 30 | environment: ${{ github.event.inputs.environment }} 31 | steps: 32 | - uses: actions/checkout@v2 33 | with: 34 | submodules: recursive 35 | - uses: actions/setup-node@v2 36 | with: 37 | node-version: "16" 38 | - run: npm install && npm install --global yarn 39 | - name: Install Foundry 40 | uses: onbjerg/foundry-toolchain@v1 41 | with: 42 | version: nightly 43 | - name: Build 44 | run: forge build 45 | - name: Run deploy script 46 | run: bash ./deploy/deploy-module.sh ${{ github.event.inputs.overwrite }} ${{ github.event.inputs.module_path }} ${{ github.event.inputs.module_name }} ${{ github.event.inputs.constructor_abi }} ${{ github.event.inputs.constructor_args }} 47 | - name: Bump version 48 | run: npm i -g json-bump && json-bump package.json && yarn prettier --write package.json && npm i -g json && echo "TAG=v$(cat package.json | json version)" >> $GITHUB_ENV 49 | - name: Push new addresses and package.json 50 | uses: EndBug/add-and-commit@v9 51 | with: 52 | add: '["addresses/${{ github.event.inputs.chainid }}.json", "package.json"]' 53 | message: "Commit from Github Actions (deploy module)" 54 | new_branch: main 55 | pathspec_error_handling: ignore 56 | tag: ${{ env.TAG }} 57 | - uses: JS-DevTools/npm-publish@v1 58 | with: 59 | token: ${{ secrets.NPM_TOKEN }} 60 | dry-run: false 61 | - name: Bundle release 62 | run: sudo apt-get install zip && zip -r ${{ env.TAG }}.zip dist package.json LICENSE README.md 63 | - uses: ncipollo/release-action@v1 64 | with: 65 | artifacts: ${{ env.TAG }}.zip 66 | token: ${{ secrets.GITHUB_TOKEN }} 67 | tag: ${{ env.TAG }} 68 | env: 69 | ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} 70 | CHAIN_ID: ${{ github.event.inputs.chainid }} 71 | RPC_URL: ${{ secrets.RPC_URL }} 72 | PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} 73 | WALLET_ADDRESS: ${{ secrets.WALLET_ADDRESS }} 74 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | on: [push] 3 | jobs: 4 | build: 5 | name: Test 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | with: 10 | submodules: recursive 11 | - uses: actions/setup-node@v2 12 | with: 13 | node-version: "16" 14 | - run: npm install 15 | - uses: onbjerg/foundry-toolchain@v1 16 | with: 17 | version: nightly 18 | - run: forge test 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | cache 3 | dist 4 | .env 5 | .DS_Store 6 | coverage 7 | coverage.json 8 | .idea -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/ds-test"] 2 | path = lib/ds-test 3 | url = https://github.com/dapphub/ds-test 4 | [submodule "forge-std"] 5 | path = lib/forge-std 6 | url = https://github.com/foundry-rs/forge-std 7 | [submodule "lib/forge-std"] 8 | path = lib/forge-std 9 | url = https://github.com/foundry-rs/forge-std 10 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # directories 2 | .yarn/ 3 | **/broadcast 4 | **/cache 5 | **/lib 6 | **/out 7 | **/node_modules 8 | 9 | # files 10 | *.env 11 | *.log 12 | .pnp.* 13 | coverage.json 14 | yarn-debug.log* 15 | yarn-error.log* 16 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "printWidth": 100, 4 | "overrides": [ 5 | { 6 | "files": "*.sol", 7 | "options": { 8 | "printWidth": 150, 9 | "tabWidth": 4 10 | } 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier"], 3 | "rules": { 4 | "prettier/prettier": "error" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 Zora Labs Inc 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /addresses/1.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0x0385603ab55642cb4dd5de3ae9e306809991804f", 3 | "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 4 | "ZoraProtocolFeeSettings": "0x9641169A1374b77E052E1001c5a096C29Cd67d35", 5 | "ZoraModuleManager": "0x850A7c6fE2CF48eea1393554C8A3bA23f20CC401", 6 | "ERC20TransferHelper": "0xCCA379FDF4Beda63c4bB0e2A3179Ae62c8716794", 7 | "ERC721TransferHelper": "0x909e9efE4D87d1a6018C2065aE642b6D0447bc91", 8 | "AsksV1": "0xCe6cEf2A9028e1C3B21647ae3B4251038109f42a", 9 | "AsksV1_1": "0x6170B3C3A54C3d8c854934cBC314eD479b2B29A3", 10 | "AsksCoreEth": "0x34Aa9CBb80dc0b3d82D04900C02FB81468DafcAb", 11 | "AsksPrivateEth": "0xfbf87e6c2c242d0166E2Ddb60Db5A94cD4dAe00e", 12 | "OffersV1": "0x76744367ae5a056381868f716bdf0b13ae1aeaa3", 13 | "ReserveAuctionCoreEth": "0x5f7072E1fA7c01dfAc7Cf54289621AFAaD2184d0", 14 | "ReserveAuctionCoreErc20": "0x53172d999a299198a935f9E424f9f8544e3d4292", 15 | "ReserveAuctionFindersEth": "0x9458E29713B98BF452ee9B2C099289f533A5F377", 16 | "ReserveAuctionFindersErc20": "0xd1adAF05575295710dE1145c3c9427c364A70a7f", 17 | "ReserveAuctionListingEth": "0x1E58bE778aCae2744c1185ea1cE542f304860B96", 18 | "ReserveAuctionListingErc20": "0x1e009dEC13A2A441b3Aa133Bd320FF5B16B22E71" 19 | } 20 | -------------------------------------------------------------------------------- /addresses/137.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0x28EdFcF0Be7E86b07493466e7631a213bDe8eEF2", 3 | "WETH": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", 4 | "ZoraProtocolFeeSettings": "0x9641169A1374b77E052E1001c5a096C29Cd67d35", 5 | "ZoraModuleManager": "0xCCA379FDF4Beda63c4bB0e2A3179Ae62c8716794", 6 | "ERC20TransferHelper": "0x909e9efE4D87d1a6018C2065aE642b6D0447bc91", 7 | "ERC721TransferHelper": "0xCe6cEf2A9028e1C3B21647ae3B4251038109f42a", 8 | "AsksV1_1": "0x3634e984Ba0373Cfa178986FD19F03ba4dD8E469" 9 | } 10 | -------------------------------------------------------------------------------- /addresses/3.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0xFf5A6F7f36764aAD301B7C9E85A5277614Df5E26", 3 | "WETH": "0xc778417e063141139fce010982780140aa0cd5ab", 4 | "ZoraProtocolFeeSettings": "0x5312484b5b23Cb01A52DC22111BbcF7Ebb198328", 5 | "ZoraModuleManager": "0x3120f8A161bf8ae8C4287A66920E7Fd875b41805", 6 | "ERC20TransferHelper": "0x88880cF1c91CD117040120813D28FEdC1CeCac41", 7 | "ERC721TransferHelper": "0x0afB6A47C303f85c5A6e0DC6c9b4c2001E6987ED", 8 | "AsksV1": "0x3e80102228295fFD120990d54e954C473EDE7280", 9 | "AsksV1_1": "0x03abaccb86f7bc2990181b71c2ef85927bf41044", 10 | "AsksCoreEth": "0x032e29122873bE11F7885ed636b1f06135D6A033", 11 | "AsksPrivateEth": "0x251A5B6D0563f602e469176240E4Db8CA765C4d1", 12 | "ReserveAuctionCoreEth": "0xF57A73D355680Df3945Da7853A1F1F9149C7DA4D", 13 | "ReserveAuctionCoreErc20": "0x818F7A204B7C82ae1CAE37E1921B855584da67D9", 14 | "ReserveAuctionFindersEth": "0xbfF7B9C643bDE6fDb43b4f7c60Ea29C31D4621Df", 15 | "ReserveAuctionFindersErc20": "0xB447467220617330445FABce737d1512A0205531" 16 | } 17 | -------------------------------------------------------------------------------- /addresses/4.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0x8d17687ea9a6bb6efA24ec11DcFab01661b2ddcd", 3 | "WETH": "0xc778417e063141139fce010982780140aa0cd5ab", 4 | "ZoraProtocolFeeSettings": "0x8Ecd14bd28bf992B6d0595B3E35d5C206e2e2dbb", 5 | "ZoraModuleManager": "0xa248736d3b73A231D95A5F99965857ebbBD42D85", 6 | "ERC20TransferHelper": "0x408AbC192a5e9696085EBaFC7C5A88e19e66241b", 7 | "ERC721TransferHelper": "0x029AA5a949C9C90916729D50537062cb73b5Ac92", 8 | "AsksV1": "0x850356153abBdFA1B473e2D86F2DF11a85B408B8", 9 | "AsksV1_1": "0xA98D3729265C88c5b3f861a0c501622750fF4806", 10 | "AsksCoreEth": "0xA8389b0FBe3508bB10925D9f0C1618d0DaF54c74", 11 | "OffersV1": "0x1240ef9f9c56ee981d10cffc6ba5807b6c7fecaa", 12 | "ReserveAuctionCoreEth": "0x3feAf4c06211680e5969A86aDB1423Fc8AD9e994", 13 | "ReserveAuctionCoreErc20": "0x9eb86B88D13eD0e38348AB951b55a26cA468A262", 14 | "ReserveAuctionFindersEth": "0x1b5A56DEa3d9760c6b14B709B9cf0ef9AaCD2730", 15 | "ReserveAuctionFindersErc20": "0x81950e0CD9c51564583bFB80EC3d40f2B915A956", 16 | "ReserveAuctionListingEth": "0x665814dA60D1Ddc23Fa1F69C1F5B5CAF63ab24b3", 17 | "ReserveAuctionListingErc20": "0x7a91CfC8C1Aec9EfdBaaCb47C6D41268524D47D4" 18 | } 19 | -------------------------------------------------------------------------------- /addresses/42.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0x54D88324cBedfFe1e62c9A59eBb310A11C295198", 3 | "WETH": "0xd0A1E359811322d97991E03f863a0C30C2cF029C", 4 | "ZoraProtocolFeeSettings": "0x53172d999a299198a935f9E424f9f8544e3d4292", 5 | "ZoraModuleManager": "0xd1adAF05575295710dE1145c3c9427c364A70a7f", 6 | "ERC20TransferHelper": "0x1E58bE778aCae2744c1185ea1cE542f304860B96", 7 | "ERC721TransferHelper": "0x1e009dEC13A2A441b3Aa133Bd320FF5B16B22E71", 8 | "ReserveAuctionCoreEth": "", 9 | "ReserveAuctionCoreErc20": "", 10 | "ReserveAuctionFindersEth": "", 11 | "ReserveAuctionFindersErc20": "" 12 | } 13 | -------------------------------------------------------------------------------- /addresses/5.json: -------------------------------------------------------------------------------- 1 | { 2 | "AsksCoreErc20": "0x7cEaC932ebd7987C4E2cB11Ed094c5E511E666Fb", 3 | "AsksCoreEth": "0x8b6ca514D2f3A2682743b49b7dE117c9004CD122", 4 | "AsksOmnibus": "0x88eECe2AeA8c53dC6862617B3a9A3cB0295E2C6e", 5 | "AsksV1_1": "0xd8be3E8A8648c4547F06E607174BAC36f5684756", 6 | "ERC20TransferHelper": "0x53172d999a299198a935f9E424f9f8544e3d4292", 7 | "ERC721TransferHelper": "0xd1adAF05575295710dE1145c3c9427c364A70a7f", 8 | "OffersV1": "0x3a98377E8e67D01a3D21E30eCE6A4703eeB4d25a", 9 | "ReserveAuctionCoreErc20": "0x1Ee71c10e7Dd6c7FbDC891dE4E902e041e1F5d33", 10 | "ReserveAuctionCoreEth": "0x2506D9F5A2b0E1A2619bCCe01CD3e7C289A13163", 11 | "ReserveAuctionFindersErc20": "0x36aB5200426715a9dD414513912970cb7d659b3C", 12 | "ReserveAuctionFindersEth": "0x29a6237e646A5A189dB197A48cB96fa7944A32a2", 13 | "ReserveAuctionListingErc20": "0x517F7721F3c3762F7048E03919761E027D900082", 14 | "ReserveAuctionListingEth": "0xfcebE0788D5772Df2CBCF5079815dE98A4d62B09", 15 | "RoyaltyEngineV1": "0xe7c9Cb6D966f76f3B5142167088927Bf34966a1f", 16 | "WETH": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", 17 | "ZoraModuleManager": "0x9458E29713B98BF452ee9B2C099289f533A5F377", 18 | "ZoraProtocolFeeSettings": "0x5f7072E1fA7c01dfAc7Cf54289621AFAaD2184d0" 19 | } 20 | -------------------------------------------------------------------------------- /addresses/7777777.json: -------------------------------------------------------------------------------- 1 | { 2 | "WETH": "0x4200000000000000000000000000000000000006", 3 | "REGISTRAR": "0x12125c8a52B8E4ed1A28e1f964023b4477f11300", 4 | "RoyaltyEngineV1": "0x0000000000000000000000000000000000000000", 5 | "ZoraProtocolFeeSettings": "0x13D48CF16917Bbc91810153d4D4e3284609C3CDc", 6 | "ZoraModuleManager": "0x69E2a5D39ed608Dfb75e29d7a4aa361C889FD25f", 7 | "ERC20TransferHelper": "0x0f92db11b60E7D9d80843588eefDDA17644a9aaa", 8 | "ERC721TransferHelper": "0x89a53404d3e29c6e5431d73e04F44045d37D01FE", 9 | "ReserveAuctionV3": "0xA06262157905913f855573f53AD48DE2D4ba1F4A" 10 | } 11 | -------------------------------------------------------------------------------- /addresses/80001.json: -------------------------------------------------------------------------------- 1 | { 2 | "RoyaltyEngineV1": "0x0a01E11887f727D1b1Cd81251eeEE9BEE4262D07", 3 | "WETH": "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889", 4 | "ZoraProtocolFeeSettings": "0x9641169A1374b77E052E1001c5a096C29Cd67d35", 5 | "ZoraModuleManager": "0x850A7c6fE2CF48eea1393554C8A3bA23f20CC401", 6 | "ERC20TransferHelper": "0xCCA379FDF4Beda63c4bB0e2A3179Ae62c8716794", 7 | "ERC721TransferHelper": "0x909e9efE4D87d1a6018C2065aE642b6D0447bc91", 8 | "AsksV1_1": "0xCe6cEf2A9028e1C3B21647ae3B4251038109f42a" 9 | } 10 | -------------------------------------------------------------------------------- /addresses/999999999.json: -------------------------------------------------------------------------------- 1 | { 2 | "WETH": "0x4200000000000000000000000000000000000006", 3 | "REGISTRAR": "0x12125c8a52B8E4ed1A28e1f964023b4477f11300", 4 | "RoyaltyEngineV1": "0x0000000000000000000000000000000000000000", 5 | "ZoraProtocolFeeSettings": "0x824dD1cCd0824A15913B454A7E5D3Bf0C6b2BeEd", 6 | "ZoraModuleManager": "0x2E0c148C1AeD0360Df9a86112fD7C4EAb8045779", 7 | "ERC20TransferHelper": "0x421B6ad0CdD20bE3636F3511B6ae244d8F668dB1", 8 | "ERC721TransferHelper": "0x0ABdD5AA61E9107519DB7cD626442B905284B7eb", 9 | "ReserveAuctionV3": "0x0fbAB7302F9351dD1DB6674cc3bB855f0C55840B" 10 | } 11 | -------------------------------------------------------------------------------- /contracts/common/IncomingTransferSupport/V1/IncomingTransferSupportV1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; 6 | import {ERC20TransferHelper} from "../../../transferHelpers/ERC20TransferHelper.sol"; 7 | 8 | /// @title IncomingTransferSupportV1 9 | /// @author tbtstl 10 | /// @notice This contract extension supports receiving funds from an external user 11 | contract IncomingTransferSupportV1 { 12 | using SafeERC20 for IERC20; 13 | 14 | /// @notice The ZORA ERC-20 Transfer Helper 15 | ERC20TransferHelper public immutable erc20TransferHelper; 16 | 17 | constructor(address _erc20TransferHelper) { 18 | erc20TransferHelper = ERC20TransferHelper(_erc20TransferHelper); 19 | } 20 | 21 | /// @notice Handle an incoming funds transfer, ensuring the sent amount is valid and the sender is solvent 22 | /// @param _amount The amount to be received 23 | /// @param _currency The currency to receive funds in, or address(0) for ETH 24 | function _handleIncomingTransfer(uint256 _amount, address _currency) internal { 25 | if (_currency == address(0)) { 26 | require(msg.value >= _amount, "_handleIncomingTransfer msg value less than expected amount"); 27 | } else { 28 | // We must check the balance that was actually transferred to this contract, 29 | // as some tokens impose a transfer fee and would not actually transfer the 30 | // full amount to the market, resulting in potentally locked funds 31 | IERC20 token = IERC20(_currency); 32 | uint256 beforeBalance = token.balanceOf(address(this)); 33 | erc20TransferHelper.safeTransferFrom(_currency, msg.sender, address(this), _amount); 34 | uint256 afterBalance = token.balanceOf(address(this)); 35 | require(beforeBalance + _amount == afterBalance, "_handleIncomingTransfer token transfer call did not transfer expected amount"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /contracts/common/ModuleNamingSupport/ModuleNamingSupportV1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title Module Naming Support V1 5 | /// @author kulkarohan 6 | /// @notice This contract extension supports naming modules 7 | contract ModuleNamingSupportV1 { 8 | /// @notice The module name 9 | string public name; 10 | 11 | /// @notice Sets the name of a module 12 | /// @param _name The module name to set 13 | constructor(string memory _name) { 14 | name = _name; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /contracts/common/OutgoingTransferSupport/V1/IWETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | 6 | interface IWETH is IERC20 { 7 | function deposit() external payable; 8 | 9 | function withdraw(uint256 wad) external; 10 | } 11 | -------------------------------------------------------------------------------- /contracts/common/OutgoingTransferSupport/V1/OutgoingTransferSupportV1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; 6 | 7 | import {IWETH} from "./IWETH.sol"; 8 | 9 | /// @title OutgoingTransferSupportV1 10 | /// @author tbtstl 11 | /// @notice This contract extension supports paying out funds to an external recipient 12 | contract OutgoingTransferSupportV1 { 13 | using SafeERC20 for IERC20; 14 | 15 | IWETH immutable weth; 16 | 17 | constructor(address _wethAddress) { 18 | weth = IWETH(_wethAddress); 19 | } 20 | 21 | /// @notice Handle an outgoing funds transfer 22 | /// @dev Wraps ETH in WETH if the receiver cannot receive ETH, noop if the funds to be sent are 0 or recipient is invalid 23 | /// @param _dest The destination for the funds 24 | /// @param _amount The amount to be sent 25 | /// @param _currency The currency to send funds in, or address(0) for ETH 26 | /// @param _gasLimit The gas limit to use when attempting a payment (if 0, gasleft() is used) 27 | function _handleOutgoingTransfer( 28 | address _dest, 29 | uint256 _amount, 30 | address _currency, 31 | uint256 _gasLimit 32 | ) internal { 33 | if (_amount == 0 || _dest == address(0)) { 34 | return; 35 | } 36 | 37 | // Handle ETH payment 38 | if (_currency == address(0)) { 39 | require(address(this).balance >= _amount, "_handleOutgoingTransfer insolvent"); 40 | 41 | // If no gas limit was provided or provided gas limit greater than gas left, just use the remaining gas. 42 | uint256 gas = (_gasLimit == 0 || _gasLimit > gasleft()) ? gasleft() : _gasLimit; 43 | (bool success, ) = _dest.call{value: _amount, gas: gas}(""); 44 | // If the ETH transfer fails (sigh), wrap the ETH and try send it as WETH. 45 | if (!success) { 46 | weth.deposit{value: _amount}(); 47 | IERC20(address(weth)).safeTransfer(_dest, _amount); 48 | } 49 | } else { 50 | IERC20(_currency).safeTransfer(_dest, _amount); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /contracts/common/UniversalExchangeEvent/V1/UniversalExchangeEventV1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title UniversalExchangeEvent V1 5 | /// @author kulkarohan 6 | /// @notice This module generalizes indexing token exchanges across all of V3 7 | contract UniversalExchangeEventV1 { 8 | /// @notice The metadata of a token exchange 9 | /// @param tokenContract The address of the token contract 10 | /// @param tokenId The id of the token 11 | /// @param amount The number of tokens sent 12 | struct ExchangeDetails { 13 | address tokenContract; 14 | uint256 tokenId; 15 | uint256 amount; 16 | } 17 | 18 | /// @notice Emitted when a token exchange is executed 19 | /// @param userA The address of user A 20 | /// @param userB The address of a user B 21 | /// @param a The metadata of user A's exchange 22 | /// @param b The metadata of user B's exchange 23 | event ExchangeExecuted(address indexed userA, address indexed userB, ExchangeDetails a, ExchangeDetails b); 24 | } 25 | -------------------------------------------------------------------------------- /contracts/modules/Asks/Core/ERC20/IAsksCoreErc20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IAsksCoreErc20 5 | /// @author kulkarohan 6 | /// @notice Interface for Asks Core ERC-20 7 | interface IAsksCoreErc20 { 8 | /// @notice Creates an ask for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _price The price to fill the ask 12 | /// @param _currency The currency of the ask price 13 | function createAsk( 14 | address _tokenContract, 15 | uint256 _tokenId, 16 | uint256 _price, 17 | address _currency 18 | ) external; 19 | 20 | /// @notice Updates the ask for a given NFT 21 | /// @param _tokenContract The address of the ERC-721 token 22 | /// @param _tokenId The id of the ERC-721 token 23 | /// @param _price The price to fill the ask 24 | /// @param _currency The currency of the ask price 25 | function setAskPrice( 26 | address _tokenContract, 27 | uint256 _tokenId, 28 | uint256 _price, 29 | address _currency 30 | ) external; 31 | 32 | /// @notice Cancels the ask for a given NFT 33 | /// @param _tokenContract The address of the ERC-721 token 34 | /// @param _tokenId The id of the ERC-721 token 35 | function cancelAsk(address _tokenContract, uint256 _tokenId) external; 36 | 37 | /// @notice Fills the ask for a given NFT 38 | /// @param _tokenContract The address of the ERC-721 token 39 | /// @param _tokenId The id of the ERC-721 token 40 | /// @param _price The price to fill the ask 41 | /// @param _currency The currency to fill the ask 42 | function fillAsk( 43 | address _tokenContract, 44 | uint256 _tokenId, 45 | uint256 _price, 46 | address _currency 47 | ) external payable; 48 | } 49 | -------------------------------------------------------------------------------- /contracts/modules/Asks/Core/ETH/IAsksCoreEth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IAsksCoreEth 5 | /// @author kulkarohan 6 | /// @notice Interface for Asks Core ETH 7 | interface IAsksCoreEth { 8 | /// @notice Creates an ask for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _price The price to fill the ask 12 | function createAsk( 13 | address _tokenContract, 14 | uint256 _tokenId, 15 | uint256 _price 16 | ) external; 17 | 18 | /// @notice Updates the ask price for a given NFT 19 | /// @param _tokenContract The address of the ERC-721 token 20 | /// @param _tokenId The id of the ERC-721 token 21 | /// @param _price The ask price to set 22 | function setAskPrice( 23 | address _tokenContract, 24 | uint256 _tokenId, 25 | uint256 _price 26 | ) external; 27 | 28 | /// @notice Cancels the ask for a given NFT 29 | /// @param _tokenContract The address of the ERC-721 token 30 | /// @param _tokenId The id of the ERC-721 token 31 | function cancelAsk(address _tokenContract, uint256 _tokenId) external; 32 | 33 | /// @notice Fills the ask for a given NFT 34 | /// @param _tokenContract The address of the ERC-721 token 35 | /// @param _tokenId The id of the ERC-721 token 36 | function fillAsk(address _tokenContract, uint256 _tokenId) external payable; 37 | } 38 | -------------------------------------------------------------------------------- /contracts/modules/Asks/Omnibus/IAsksOmnibus.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {AsksDataStorage} from "./AsksDataStorage.sol"; 5 | 6 | /// @title IReserveAuctionOmnibus 7 | /// @author kulkarohan 8 | /// @notice Interface for Reserve Auction Core ERC-20 9 | interface IAsksOmnibus { 10 | error NOT_TOKEN_OWNER_OR_OPERATOR(); 11 | 12 | error MODULE_NOT_APPROVED(); 13 | 14 | error TRANSFER_HELPER_NOT_APPROVED(); 15 | 16 | error INVALID_LISTING_FEE(); 17 | 18 | error INVALID_FEES(); 19 | 20 | error INVALID_TOKEN_GATE(); 21 | 22 | error INVALID_EXPIRY(); 23 | 24 | error ASK_INACTIVE(); 25 | 26 | error ASK_EXPIRED(); 27 | 28 | error INCORRECT_CURRENCY_OR_AMOUNT(); 29 | 30 | error TOKEN_GATE_INSUFFICIENT_BALANCE(); 31 | 32 | error NOT_DESIGNATED_BUYER(); 33 | 34 | function createAskMinimal( 35 | address _tokenContract, 36 | uint256 _tokenId, 37 | uint256 _askPrice 38 | ) external; 39 | 40 | function createAsk( 41 | address _tokenContract, 42 | uint256 _tokenId, 43 | uint96 _expiry, 44 | uint256 _askPrice, 45 | address _sellerFundsRecipient, 46 | address _askCurrency, 47 | address _buyer, 48 | uint16 _findersFeeBps, 49 | uint16 _listingFeeBps, 50 | address _listingFeeRecipient, 51 | address _tokenGateToken, 52 | uint256 _tokenGateMinAmount 53 | ) external; 54 | 55 | function cancelAsk(address _tokenContract, uint256 _tokenId) external; 56 | 57 | function setAskPrice( 58 | address _tokenContract, 59 | uint256 _tokenId, 60 | uint256 _askPrice, 61 | address _askCurrency 62 | ) external; 63 | 64 | function fillAsk( 65 | address _tokenContract, 66 | uint256 _tokenId, 67 | uint256 _price, 68 | address _currency, 69 | address _finder 70 | ) external payable; 71 | } 72 | -------------------------------------------------------------------------------- /contracts/modules/Asks/Private/ETH/IAsksPrivateEth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IAsksPrivateEth 5 | /// @author kulkarohan 6 | /// @notice Interface for Asks Private ETH 7 | interface IAsksPrivateEth { 8 | /// @notice Creates an ask for a given NFT 9 | /// @param _tokenContract The ERC-721 token address 10 | /// @param _tokenId The ERC-721 token id 11 | /// @param _price The price to fill the ask 12 | /// @param _buyer The address to fill the ask 13 | function createAsk( 14 | address _tokenContract, 15 | uint256 _tokenId, 16 | uint256 _price, 17 | address _buyer 18 | ) external; 19 | 20 | /// @notice Updates the ask price for a given NFT 21 | /// @param _tokenContract The address of the ERC-721 token 22 | /// @param _tokenId The id of the ERC-721 token 23 | /// @param _price The ask price to set 24 | function setAskPrice( 25 | address _tokenContract, 26 | uint256 _tokenId, 27 | uint256 _price 28 | ) external; 29 | 30 | /// @notice Cancels the ask for a given NFT 31 | /// @param _tokenContract The address of the ERC-721 token 32 | /// @param _tokenId The id of the ERC-721 token 33 | function cancelAsk(address _tokenContract, uint256 _tokenId) external; 34 | 35 | /// @notice Fills the ask for a given NFT 36 | /// @param _tokenContract The address of the ERC-721 token 37 | /// @param _tokenId The id of the ERC-721 token 38 | function fillAsk(address _tokenContract, uint256 _tokenId) external payable; 39 | } 40 | -------------------------------------------------------------------------------- /contracts/modules/Offers/Omnibus/IOffersOmnibus.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {OffersDataStorage} from "./OffersDataStorage.sol"; 5 | 6 | /// @title IOffersOmnibus 7 | /// @author jgeary 8 | /// @notice Interface for Offers Omnibus 9 | interface IOffersOmnibus { 10 | error INSUFFICIENT_ALLOWANCE(); 11 | 12 | error MODULE_NOT_APPROVED(); 13 | 14 | error NO_ZERO_OFFERS(); 15 | 16 | error MSG_VALUE_NEQ_ZERO_WITH_OTHER_CURRENCY(); 17 | 18 | error INSUFFICIENT_BALANCE(); 19 | 20 | error MSG_VALUE_NEQ_OFFER_AMOUNT(); 21 | 22 | error INVALID_FEES(); 23 | 24 | error INVALID_EXPIRY(); 25 | 26 | error CALLER_NOT_MAKER(); 27 | 28 | error SAME_OFFER(); 29 | 30 | error INACTIVE_OFFER(); 31 | 32 | error NOT_TOKEN_OWNER(); 33 | 34 | error INCORRECT_CURRENCY_OR_AMOUNT(); 35 | 36 | error TOKEN_TRANSFER_AMOUNT_INCORRECT(); 37 | 38 | error OFFER_EXPIRED(); 39 | 40 | function createOfferMinimal(address _tokenContract, uint256 _tokenId) external payable returns (uint256); 41 | 42 | function createOffer( 43 | address _tokenContract, 44 | uint256 _tokenId, 45 | address _offerCurrency, 46 | uint256 _offerAmount, 47 | uint96 _expiry, 48 | uint16 _findersFeeBps, 49 | uint16 _listingFeeBps, 50 | address _listingFeeRecipient 51 | ) external payable returns (uint256); 52 | 53 | function setOfferAmount( 54 | address _tokenContract, 55 | uint256 _tokenId, 56 | uint256 _offerId, 57 | address _offerCurrency, 58 | uint256 _offerAmount 59 | ) external payable; 60 | 61 | function cancelOffer( 62 | address _tokenContract, 63 | uint256 _tokenId, 64 | uint256 _offerId 65 | ) external; 66 | 67 | function fillOffer( 68 | address _tokenContract, 69 | uint256 _tokenId, 70 | uint256 _offerId, 71 | uint256 _amount, 72 | address _currency, 73 | address _finder 74 | ) external; 75 | 76 | function getFullOffer( 77 | address _tokenContract, 78 | uint256 _tokenId, 79 | uint256 _offerId 80 | ) external view returns (OffersDataStorage.FullOffer memory); 81 | } 82 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Core/ERC20/IReserveAuctionCoreErc20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionCoreErc20 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Core ERC-20 7 | interface IReserveAuctionCoreErc20 { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | /// @param _bidCurrency The address of the ERC-20 token, or address(0) for ETH, that users must bid with 16 | function createAuction( 17 | address _tokenContract, 18 | uint256 _tokenId, 19 | uint256 _duration, 20 | uint256 _reservePrice, 21 | address _sellerFundsRecipient, 22 | uint256 _startTime, 23 | address _bidCurrency 24 | ) external; 25 | 26 | /// @notice Updates the reserve price for a given auction 27 | /// @param _tokenContract The address of the ERC-721 token 28 | /// @param _tokenId The id of the ERC-721 token 29 | /// @param _reservePrice The new reserve price 30 | function setAuctionReservePrice( 31 | address _tokenContract, 32 | uint256 _tokenId, 33 | uint256 _reservePrice 34 | ) external; 35 | 36 | /// @notice Cancels the auction for a given NFT 37 | /// @param _tokenContract The address of the ERC-721 token 38 | /// @param _tokenId The id of the ERC-721 token 39 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 40 | 41 | /// @notice Places a bid on the auction for a given NFT 42 | /// @param _tokenContract The address of the ERC-721 token 43 | /// @param _tokenId The id of the ERC-721 token 44 | /// @param _amount The amount to bid 45 | function createBid( 46 | address _tokenContract, 47 | uint256 _tokenId, 48 | uint256 _amount 49 | ) external payable; 50 | 51 | /// @notice Ends the auction for a given NFT 52 | /// @param _tokenContract The address of the ERC-721 token 53 | /// @param _tokenId The id of the ERC-721 token 54 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 55 | } 56 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Core/ETH/IReserveAuctionCoreEth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionCoreEth 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Core ETH 7 | interface IReserveAuctionCoreEth { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | function createAuction( 16 | address _tokenContract, 17 | uint256 _tokenId, 18 | uint256 _duration, 19 | uint256 _reservePrice, 20 | address _sellerFundsRecipient, 21 | uint256 _startTime 22 | ) external; 23 | 24 | /// @notice Updates the auction reserve price for a given NFT 25 | /// @param _tokenContract The address of the ERC-721 token 26 | /// @param _tokenId The id of the ERC-721 token 27 | /// @param _reservePrice The new reserve price 28 | function setAuctionReservePrice( 29 | address _tokenContract, 30 | uint256 _tokenId, 31 | uint256 _reservePrice 32 | ) external; 33 | 34 | /// @notice Cancels the auction for a given NFT 35 | /// @param _tokenContract The address of the ERC-721 token 36 | /// @param _tokenId The id of the ERC-721 token 37 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 38 | 39 | /// @notice Places a bid on the auction for a given NFT 40 | /// @param _tokenContract The address of the ERC-721 token 41 | /// @param _tokenId The id of the ERC-721 token 42 | function createBid(address _tokenContract, uint256 _tokenId) external payable; 43 | 44 | /// @notice Ends the auction for a given NFT 45 | /// @param _tokenContract The address of the ERC-721 token 46 | /// @param _tokenId The id of the ERC-721 token 47 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 48 | } 49 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Finders/ERC20/IReserveAuctionFindersErc20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionFindersErc20 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Finders ERC-20 7 | interface IReserveAuctionFindersErc20 { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | /// @param _bidCurrency The address of the ERC-20 token, or address(0) for ETH, that users must bid with 16 | /// @param _findersFeeBps The fee to send to the referrer of the winning bid 17 | function createAuction( 18 | address _tokenContract, 19 | uint256 _tokenId, 20 | uint256 _duration, 21 | uint256 _reservePrice, 22 | address _sellerFundsRecipient, 23 | uint256 _startTime, 24 | address _bidCurrency, 25 | uint256 _findersFeeBps 26 | ) external; 27 | 28 | /// @notice Updates the reserve price for a given auction 29 | /// @param _tokenContract The address of the ERC-721 token 30 | /// @param _tokenId The id of the ERC-721 token 31 | /// @param _reservePrice The new reserve price 32 | function setAuctionReservePrice( 33 | address _tokenContract, 34 | uint256 _tokenId, 35 | uint256 _reservePrice 36 | ) external; 37 | 38 | /// @notice Cancels the auction for a given NFT 39 | /// @param _tokenContract The address of the ERC-721 token 40 | /// @param _tokenId The id of the ERC-721 token 41 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 42 | 43 | /// @notice Places a bid on the auction for a given NFT 44 | /// @param _tokenContract The address of the ERC-721 token 45 | /// @param _tokenId The id of the ERC-721 token 46 | /// @param _amount The amount to bid 47 | /// @param _finder The referrer of the bid 48 | function createBid( 49 | address _tokenContract, 50 | uint256 _tokenId, 51 | uint256 _amount, 52 | address _finder 53 | ) external payable; 54 | 55 | /// @notice Ends the auction for a given NFT 56 | /// @param _tokenContract The address of the ERC-721 token 57 | /// @param _tokenId The id of the ERC-721 token 58 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 59 | } 60 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Finders/ETH/IReserveAuctionFindersEth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionFindersEth 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Finders ETH 7 | interface IReserveAuctionFindersEth { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | /// @param _findersFeeBps The fee to send to the referrer of the winning bid 16 | function createAuction( 17 | address _tokenContract, 18 | uint256 _tokenId, 19 | uint256 _duration, 20 | uint256 _reservePrice, 21 | address _sellerFundsRecipient, 22 | uint256 _startTime, 23 | uint256 _findersFeeBps 24 | ) external; 25 | 26 | /// @notice Updates the reserve price for a given auction 27 | /// @param _tokenContract The address of the ERC-721 token 28 | /// @param _tokenId The id of the ERC-721 token 29 | /// @param _reservePrice The new reserve price 30 | function setAuctionReservePrice( 31 | address _tokenContract, 32 | uint256 _tokenId, 33 | uint256 _reservePrice 34 | ) external; 35 | 36 | /// @notice Cancels the auction for a given NFT 37 | /// @param _tokenContract The address of the ERC-721 token 38 | /// @param _tokenId The id of the ERC-721 token 39 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 40 | 41 | /// @notice Places a bid on the auction for a given NFT 42 | /// @param _tokenContract The address of the ERC-721 token 43 | /// @param _tokenId The id of the ERC-721 token 44 | /// @param _finder The referrer of the bid 45 | function createBid( 46 | address _tokenContract, 47 | uint256 _tokenId, 48 | address _finder 49 | ) external payable; 50 | 51 | /// @notice Ends the auction for a given NFT 52 | /// @param _tokenContract The address of the ERC-721 token 53 | /// @param _tokenId The id of the ERC-721 token 54 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 55 | } 56 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Listing/ERC20/IReserveAuctionListingErc20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionListingErc20 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Listing ERC-20 7 | interface IReserveAuctionListingErc20 { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | /// @param _bidCurrency The address of the ERC-20 token, or address(0) for ETH, that users must bid with 16 | /// @param _listingFeeBps The fee to send to the lister of the auction 17 | /// @param _listingFeeRecipient The address listing the auction 18 | function createAuction( 19 | address _tokenContract, 20 | uint256 _tokenId, 21 | uint256 _duration, 22 | uint256 _reservePrice, 23 | address _sellerFundsRecipient, 24 | uint256 _startTime, 25 | address _bidCurrency, 26 | uint256 _listingFeeBps, 27 | address _listingFeeRecipient 28 | ) external; 29 | 30 | /// @notice Updates the reserve price for a given auction 31 | /// @param _tokenContract The address of the ERC-721 token 32 | /// @param _tokenId The id of the ERC-721 token 33 | /// @param _reservePrice The new reserve price 34 | function setAuctionReservePrice( 35 | address _tokenContract, 36 | uint256 _tokenId, 37 | uint256 _reservePrice 38 | ) external; 39 | 40 | /// @notice Cancels the auction for a given NFT 41 | /// @param _tokenContract The address of the ERC-721 token 42 | /// @param _tokenId The id of the ERC-721 token 43 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 44 | 45 | /// @notice Places a bid on the auction for a given NFT 46 | /// @param _tokenContract The address of the ERC-721 token 47 | /// @param _tokenId The id of the ERC-721 token 48 | /// @param _amount The amount to bid 49 | function createBid( 50 | address _tokenContract, 51 | uint256 _tokenId, 52 | uint256 _amount 53 | ) external payable; 54 | 55 | /// @notice Ends the auction for a given NFT 56 | /// @param _tokenContract The address of the ERC-721 token 57 | /// @param _tokenId The id of the ERC-721 token 58 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 59 | } 60 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Listing/ETH/IReserveAuctionListingEth.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title IReserveAuctionListingEth 5 | /// @author kulkarohan 6 | /// @notice Interface for Reserve Auction Listing ETH 7 | interface IReserveAuctionListingEth { 8 | /// @notice Creates an auction for a given NFT 9 | /// @param _tokenContract The address of the ERC-721 token 10 | /// @param _tokenId The id of the ERC-721 token 11 | /// @param _duration The length of time the auction should run after the first bid 12 | /// @param _reservePrice The minimum bid amount to start the auction 13 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 14 | /// @param _startTime The time that users can begin placing bids 15 | /// @param _listingFeeBps The fee to send to the lister of the auction 16 | /// @param _listingFeeRecipient The address listing the auction 17 | function createAuction( 18 | address _tokenContract, 19 | uint256 _tokenId, 20 | uint256 _duration, 21 | uint256 _reservePrice, 22 | address _sellerFundsRecipient, 23 | uint256 _startTime, 24 | uint256 _listingFeeBps, 25 | address _listingFeeRecipient 26 | ) external; 27 | 28 | /// @notice Updates the reserve price for a given auction 29 | /// @param _tokenContract The address of the ERC-721 token 30 | /// @param _tokenId The id of the ERC-721 token 31 | /// @param _reservePrice The new reserve price 32 | function setAuctionReservePrice( 33 | address _tokenContract, 34 | uint256 _tokenId, 35 | uint256 _reservePrice 36 | ) external; 37 | 38 | /// @notice Cancels the auction for a given NFT 39 | /// @param _tokenContract The address of the ERC-721 token 40 | /// @param _tokenId The id of the ERC-721 token 41 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 42 | 43 | /// @notice Places a bid on the auction for a given NFT 44 | /// @param _tokenContract The address of the ERC-721 token 45 | /// @param _tokenId The id of the ERC-721 token 46 | function createBid(address _tokenContract, uint256 _tokenId) external payable; 47 | 48 | /// @notice Ends the auction for a given NFT 49 | /// @param _tokenContract The address of the ERC-721 token 50 | /// @param _tokenId The id of the ERC-721 token 51 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 52 | } 53 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/Omnibus/IReserveAuctionOmnibus.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ReserveAuctionDataStorage} from "./ReserveAuctionDataStorage.sol"; 5 | 6 | /// @title IReserveAuctionOmnibus 7 | /// @author kulkarohan 8 | /// @notice Interface for Reserve Auction Core ERC-20 9 | interface IReserveAuctionOmnibus { 10 | error NOT_TOKEN_OWNER_OR_OPERATOR(); 11 | 12 | error MODULE_NOT_APPROVED(); 13 | 14 | error TRANSFER_HELPER_NOT_APPROVED(); 15 | 16 | error DURATION_LTE_TIME_BUFFER(); 17 | 18 | error INVALID_EXPIRY(); 19 | 20 | error INVALID_LISTING_FEE(); 21 | 22 | error INVALID_FEES(); 23 | 24 | error INVALID_TOKEN_GATE(); 25 | 26 | error INVALID_START_TIME(); 27 | 28 | error INVALID_TIME_BUFFER(); 29 | 30 | error INVALID_PERCENT_INCREMENT(); 31 | 32 | error RESERVE_PRICE_NOT_MET(); 33 | 34 | error AUCTION_STARTED(); 35 | 36 | error AUCTION_OVER(); 37 | 38 | error AUCTION_NOT_STARTED(); 39 | 40 | error AUCTION_NOT_OVER(); 41 | 42 | error AUCTION_DOES_NOT_EXIST(); 43 | 44 | error AUCTION_EXPIRED(); 45 | 46 | error TOKEN_GATE_INSUFFICIENT_BALANCE(); 47 | 48 | error MINIMUM_BID_NOT_MET(); 49 | 50 | struct CreateAuctionParameters { 51 | uint256 tokenId; 52 | uint256 reservePrice; 53 | uint256 startTime; 54 | uint256 tokenGateMinAmount; 55 | address tokenContract; 56 | uint64 duration; 57 | uint16 findersFeeBps; 58 | uint16 timeBuffer; 59 | address fundsRecipient; 60 | uint96 expiry; 61 | address listingFeeRecipient; 62 | uint16 listingFeeBps; 63 | uint8 percentIncrement; 64 | address tokenGateToken; 65 | address bidCurrency; 66 | } 67 | 68 | function createAuctionMinimal( 69 | address _tokenContract, 70 | uint256 _tokenId, 71 | uint256 _reservePrice, 72 | uint64 _duration 73 | ) external; 74 | 75 | function createAuction(CreateAuctionParameters calldata auctionData) external; 76 | 77 | function setAuctionReservePrice( 78 | address _tokenContract, 79 | uint256 _tokenId, 80 | uint256 _reservePrice 81 | ) external; 82 | 83 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 84 | 85 | function createBid( 86 | address _tokenContract, 87 | uint256 _tokenId, 88 | uint256 _amount, 89 | address finder 90 | ) external payable; 91 | 92 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 93 | } 94 | -------------------------------------------------------------------------------- /contracts/modules/ReserveAuction/V3/IReserveAuctionV3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | interface IReserveAuctionV3 { 5 | /// @notice Creates an auction for a given NFT 6 | /// @param _tokenContract The address of the ERC-721 token 7 | /// @param _tokenId The id of the ERC-721 token 8 | /// @param _duration The length of time the auction should run after the first bid 9 | /// @param _reservePrice The minimum bid amount to start the auction 10 | /// @param _sellerFundsRecipient The address to send funds to once the auction is complete 11 | /// @param _startTime The time that users can begin placing bids 12 | /// @param _bidCurrency The address of the ERC-20 token, or address(0) for ETH, that users must bid with 13 | /// @param _findersFeeBps The fee to send to the referrer of the winning bid 14 | function createAuction( 15 | address _tokenContract, 16 | uint256 _tokenId, 17 | uint256 _duration, 18 | uint256 _reservePrice, 19 | address _sellerFundsRecipient, 20 | uint256 _startTime, 21 | address _bidCurrency, 22 | uint256 _findersFeeBps 23 | ) external; 24 | 25 | /// @notice Updates the reserve price for a given auction 26 | /// @param _tokenContract The address of the ERC-721 token 27 | /// @param _tokenId The id of the ERC-721 token 28 | /// @param _reservePrice The new reserve price 29 | function setAuctionReservePrice(address _tokenContract, uint256 _tokenId, uint256 _reservePrice) external; 30 | 31 | /// @notice Cancels the auction for a given NFT 32 | /// @param _tokenContract The address of the ERC-721 token 33 | /// @param _tokenId The id of the ERC-721 token 34 | function cancelAuction(address _tokenContract, uint256 _tokenId) external; 35 | 36 | /// @notice Places a bid on the auction for a given NFT 37 | /// @param _tokenContract The address of the ERC-721 token 38 | /// @param _tokenId The id of the ERC-721 token 39 | /// @param _amount The amount to bid 40 | /// @param _finder The referrer of the bid 41 | function createBid(address _tokenContract, uint256 _tokenId, uint256 _amount, address _finder) external payable; 42 | 43 | /// @notice Ends the auction for a given NFT 44 | /// @param _tokenContract The address of the ERC-721 token 45 | /// @param _tokenId The id of the ERC-721 token 46 | function settleAuction(address _tokenContract, uint256 _tokenId) external; 47 | } -------------------------------------------------------------------------------- /contracts/test/ZoraModuleManager.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {DSTest} from "ds-test/test.sol"; 5 | 6 | import {ZoraModuleManager} from "../ZoraModuleManager.sol"; 7 | import {ZoraProtocolFeeSettings} from "../auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol"; 8 | import {ZoraRegistrar} from "./utils/users/ZoraRegistrar.sol"; 9 | import {Zorb} from "./utils/users/Zorb.sol"; 10 | 11 | import {SimpleModule} from "./utils/modules/SimpleModule.sol"; 12 | import {VM} from "./utils/VM.sol"; 13 | 14 | /// @title ZoraModuleManagerTest 15 | /// @notice Unit Tests for the ZORA Module Manager 16 | contract ZoraModuleManagerTest is DSTest { 17 | VM internal vm; 18 | 19 | ZoraRegistrar internal registrar; 20 | ZoraProtocolFeeSettings internal ZPFS; 21 | ZoraModuleManager internal ZMM; 22 | 23 | Zorb internal alice; 24 | Zorb internal bob; 25 | 26 | address[] internal batchModules; 27 | address internal module; 28 | 29 | function setUp() public { 30 | // Cheatcodes 31 | vm = VM(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); 32 | 33 | // Deploy V3 34 | registrar = new ZoraRegistrar(); 35 | ZPFS = new ZoraProtocolFeeSettings(); 36 | ZMM = new ZoraModuleManager(address(registrar), address(ZPFS)); 37 | 38 | // Init V3 39 | registrar.init(ZMM); 40 | ZPFS.init(address(ZMM), address(0)); 41 | 42 | // Create users 43 | alice = new Zorb(address(ZMM)); 44 | bob = new Zorb(address(ZMM)); 45 | 46 | // Deploy mocks 47 | batchModules = [address(new SimpleModule()), address(new SimpleModule()), address(new SimpleModule())]; 48 | module = batchModules[0]; 49 | } 50 | 51 | /// ------------ APPROVE MODULE ------------ /// 52 | 53 | function test_SetApproval() public { 54 | registrar.registerModule(module); 55 | 56 | bob.setApprovalForModule(module, true); 57 | 58 | require(ZMM.isModuleApproved(address(bob), module)); 59 | } 60 | 61 | function testFail_CannotApproveModuleNotRegistered() public { 62 | bob.setApprovalForModule(module, true); 63 | } 64 | 65 | /// ------------ APPROVE MODULE BATCH ------------ /// 66 | 67 | function test_SetBatchApproval() public { 68 | for (uint256 i = 0; i < 3; i++) { 69 | registrar.registerModule(batchModules[i]); 70 | } 71 | 72 | bob.setBatchApprovalForModules(batchModules, true); 73 | 74 | require( 75 | ZMM.isModuleApproved(address(bob), batchModules[0]) && 76 | ZMM.isModuleApproved(address(bob), batchModules[1]) && 77 | ZMM.isModuleApproved(address(bob), batchModules[2]) 78 | ); 79 | } 80 | 81 | /// ------------ REGISTER MODULE ------------ /// 82 | 83 | function test_RegisterModule() public { 84 | registrar.registerModule(module); 85 | require(ZMM.moduleRegistered(module)); 86 | } 87 | 88 | function testRevert_ModuleAlreadyRegistered() public { 89 | registrar.registerModule(module); 90 | 91 | vm.expectRevert("ZMM::registerModule module already registered"); 92 | registrar.registerModule(module); 93 | } 94 | 95 | /// ------------ SET REGISTRAR ------------ /// 96 | 97 | function test_SetRegistrar() public { 98 | registrar.setRegistrar(address(3)); 99 | require(ZMM.registrar() == address(3)); 100 | } 101 | 102 | function testRevert_CannotSetRegistrarToAddressZero() public { 103 | vm.expectRevert("ZMM::setRegistrar must set registrar to non-zero address"); 104 | registrar.setRegistrar(address(0)); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /contracts/test/transferHelpers/ERC721TransferHelper.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {DSTest} from "ds-test/test.sol"; 5 | 6 | import {ZoraModuleManager} from "../../ZoraModuleManager.sol"; 7 | import {ZoraProtocolFeeSettings} from "../../auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol"; 8 | import {ZoraRegistrar} from "../utils/users/ZoraRegistrar.sol"; 9 | import {Zorb} from "../utils/users/Zorb.sol"; 10 | import {ERC20TransferHelper} from "../../transferHelpers/ERC20TransferHelper.sol"; 11 | import {ERC721TransferHelper} from "../../transferHelpers/ERC721TransferHelper.sol"; 12 | import {ERC1155TransferHelper} from "../../transferHelpers/ERC1155TransferHelper.sol"; 13 | 14 | import {TransferModule} from "../utils/modules/TransferModule.sol"; 15 | import {TestERC721} from "../utils/tokens/TestERC721.sol"; 16 | import {VM} from "../utils//VM.sol"; 17 | 18 | /// @title ERC721TransferHelperTest 19 | /// @notice Unit Tests for the ZORA ERC-721 Transfer Helper 20 | contract ERC721TransferHelperTest is DSTest { 21 | VM internal vm; 22 | 23 | Zorb internal alice; 24 | TransferModule internal module; 25 | TestERC721 internal token; 26 | 27 | ZoraRegistrar internal registrar; 28 | ZoraProtocolFeeSettings internal ZPFS; 29 | ZoraModuleManager internal ZMM; 30 | 31 | ERC20TransferHelper internal erc20TransferHelper; 32 | ERC721TransferHelper internal erc721TransferHelper; 33 | ERC1155TransferHelper internal erc1155TransferHelper; 34 | 35 | function setUp() public { 36 | // Cheatcodes 37 | vm = VM(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); 38 | 39 | // Deploy V3 40 | registrar = new ZoraRegistrar(); 41 | ZPFS = new ZoraProtocolFeeSettings(); 42 | ZMM = new ZoraModuleManager(address(registrar), address(ZPFS)); 43 | erc20TransferHelper = new ERC20TransferHelper(address(ZMM)); 44 | erc721TransferHelper = new ERC721TransferHelper(address(ZMM)); 45 | erc1155TransferHelper = new ERC1155TransferHelper(address(ZMM)); 46 | 47 | // Init V3 48 | registrar.init(ZMM); 49 | ZPFS.init(address(ZMM), address(0)); 50 | 51 | // Create user 52 | alice = new Zorb(address(ZMM)); 53 | 54 | // Deploy mocks 55 | token = new TestERC721(); 56 | module = new TransferModule(address(erc20TransferHelper), address(erc721TransferHelper), address(erc1155TransferHelper)); 57 | registrar.registerModule(address(module)); 58 | 59 | // Mint user token 60 | token.mint(address(alice), 0); 61 | } 62 | 63 | function test_ERC721Transfer() public { 64 | vm.startPrank(address(alice)); 65 | 66 | // Approve ERC721TransferHelper as operator 67 | token.setApprovalForAll(address(erc721TransferHelper), true); 68 | // Approve module in ZMM 69 | alice.setApprovalForModule(address(module), true); 70 | // Transfer token to module 71 | module.depositERC721(address(token), address(alice), 0); 72 | 73 | vm.stopPrank(); 74 | 75 | require(token.ownerOf(0) == address(module)); 76 | } 77 | 78 | function testRevert_UserMustApproveModule() public { 79 | vm.startPrank(address(alice)); 80 | 81 | // Approve ERC721TransferHelper as operator 82 | token.setApprovalForAll(address(erc721TransferHelper), true); 83 | // Attempt token transfer without ZMM approval 84 | vm.expectRevert("module has not been approved by user"); 85 | module.depositERC721(address(token), address(alice), 0); 86 | 87 | vm.stopPrank(); 88 | } 89 | 90 | function testFail_UserMustApproveTransferHelper() public { 91 | // Approve module in ZMM 92 | alice.setApprovalForModule(address(module), true); 93 | 94 | // Attempt token transfer without ERC721TransferHelper approval 95 | vm.prank(address(alice)); 96 | module.depositERC721(address(token), address(alice), 0); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /contracts/test/utils/VM.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | interface VM { 5 | /// @dev Set block.timestamp (newTimestamp) 6 | function warp(uint256) external; 7 | 8 | /// @dev Set block.height (newHeight) 9 | function roll(uint256) external; 10 | 11 | /// @dev Loads a storage slot from an address (who, slot) 12 | function load(address, bytes32) external returns (bytes32); 13 | 14 | /// @dev Stores a value to an address' storage slot, (who, slot, value) 15 | function store( 16 | address, 17 | bytes32, 18 | bytes32 19 | ) external; 20 | 21 | /// @dev Signs data, (privateKey, digest) => (r, v, s) 22 | function sign(uint256, bytes32) 23 | external 24 | returns ( 25 | uint8, 26 | bytes32, 27 | bytes32 28 | ); 29 | 30 | /// @dev Gets address for a given private key, (privateKey) => (address) 31 | function addr(uint256) external returns (address); 32 | 33 | /// @dev Performs a foreign function call via terminal, (stringInputs) => (result) 34 | function ffi(string[] calldata) external returns (bytes memory); 35 | 36 | /// @dev Performs the next smart contract call with specified `msg.sender`, (newSender) 37 | function prank(address) external; 38 | 39 | /// @dev Performs all the following smart contract calls with specified `msg.sender`, (newSender) 40 | function startPrank(address) external; 41 | 42 | /// @dev Stop smart contract calls using the specified address with startPrank() 43 | function stopPrank() external; 44 | 45 | /// @dev Sets an address' balance, (who, newBalance) 46 | function deal(address, uint256) external; 47 | 48 | /// @dev Sets an address' code, (who, newCode) 49 | function etch(address, bytes calldata) external; 50 | 51 | /// @dev Expects an error on next call 52 | function expectRevert(bytes calldata) external; 53 | 54 | /// @dev Expects the next emitted event. Params check topic 1, topic 2, topic 3 and data are the same. 55 | function expectEmit( 56 | bool, 57 | bool, 58 | bool, 59 | bool 60 | ) external; 61 | 62 | /// @dev Mocks a call to an address, returning specified data. 63 | /// Calldata can either be strict or a partial match, e.g. if you only 64 | /// pass a Solidity selector to the expected calldata, then the entire Solidity 65 | /// function will be mocked. 66 | function mockCall( 67 | address, 68 | bytes calldata, 69 | bytes calldata 70 | ) external; 71 | 72 | /// @dev Clears all mocked calls 73 | function clearMockedCalls() external; 74 | 75 | /// @dev Expect a call to an address with the specified calldata. 76 | /// @dev Calldata can either be strict or a partial match 77 | function expectCall(address, bytes calldata) external; 78 | } 79 | -------------------------------------------------------------------------------- /contracts/test/utils/modules/RoyaltyEngine.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title RoyaltyEngine 5 | /// @notice FOR TEST PURPOSES ONLY. 6 | contract RoyaltyEngine { 7 | address public recipient; 8 | 9 | constructor(address _royaltyRecipient) { 10 | recipient = _royaltyRecipient; 11 | } 12 | 13 | event RoyaltyView(address tokenAddress, uint256 tokenId, uint256 value); 14 | 15 | function getRoyalty( 16 | address tokenAddress, 17 | uint256 tokenId, 18 | uint256 value 19 | ) public returns (address payable[] memory, uint256[] memory) { 20 | address payable[] memory recipients = new address payable[](1); 21 | recipients[0] = payable(address(recipient)); 22 | 23 | uint256[] memory amounts = new uint256[](1); 24 | amounts[0] = 0.05 ether; // Hardcoded royalty amount 25 | 26 | emit RoyaltyView(tokenAddress, tokenId, value); 27 | 28 | return (recipients, amounts); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/test/utils/modules/SimpleModule.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title SimpleModule 5 | /// @notice FOR TEST PURPOSES ONLY. 6 | contract SimpleModule { 7 | function ok() public pure returns (uint256) { 8 | return 1; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /contracts/test/utils/modules/TransferModule.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; 5 | import {ERC20TransferHelper} from "../../../transferHelpers/ERC20TransferHelper.sol"; 6 | import {ERC721TransferHelper} from "../../../transferHelpers/ERC721TransferHelper.sol"; 7 | import {ERC1155TransferHelper} from "../../../transferHelpers/ERC1155TransferHelper.sol"; 8 | 9 | /// @title TransferModule 10 | /// @notice FOR TEST PURPOSES ONLY. 11 | contract TransferModule is ERC1155Holder { 12 | address erc20TransferHelper; 13 | address erc721TransferHelper; 14 | address erc1155TransferHelper; 15 | 16 | constructor( 17 | address _erc20TransferHelper, 18 | address _erc721TransferHelper, 19 | address _erc1155TransferHelper 20 | ) { 21 | erc20TransferHelper = _erc20TransferHelper; 22 | erc721TransferHelper = _erc721TransferHelper; 23 | erc1155TransferHelper = _erc1155TransferHelper; 24 | } 25 | 26 | function depositERC20( 27 | address _tokenContract, 28 | address _from, 29 | uint256 _amount 30 | ) public { 31 | ERC20TransferHelper(erc20TransferHelper).safeTransferFrom(_tokenContract, _from, address(this), _amount); 32 | } 33 | 34 | function depositERC721( 35 | address _tokenContract, 36 | address _from, 37 | uint256 _tokenId 38 | ) public { 39 | ERC721TransferHelper(erc721TransferHelper).transferFrom(_tokenContract, _from, address(this), _tokenId); 40 | } 41 | 42 | function safeDepositERC721( 43 | address _tokenContract, 44 | address _from, 45 | uint256 _tokenId 46 | ) public { 47 | ERC721TransferHelper(erc721TransferHelper).safeTransferFrom(_tokenContract, _from, address(this), _tokenId); 48 | } 49 | 50 | function safeDepositERC1155( 51 | address _tokenContract, 52 | address _from, 53 | uint256 _tokenId, 54 | uint256 _amount 55 | ) public { 56 | ERC1155TransferHelper(erc1155TransferHelper).safeTransferFrom(_tokenContract, _from, address(this), _tokenId, _amount, ""); 57 | } 58 | 59 | function safeBatchDepositERC1155( 60 | address _tokenContract, 61 | address _from, 62 | uint256[] memory _tokenIds, 63 | uint256[] memory _amounts 64 | ) public { 65 | ERC1155TransferHelper(erc1155TransferHelper).safeBatchTransferFrom(_tokenContract, _from, address(this), _tokenIds, _amounts, ""); 66 | } 67 | 68 | function withdrawERC20( 69 | address _tokenContract, 70 | address _to, 71 | uint256 _amount 72 | ) public { 73 | ERC20TransferHelper(erc20TransferHelper).safeTransferFrom(_tokenContract, address(this), _to, _amount); 74 | } 75 | 76 | function withdrawERC721( 77 | address _tokenContract, 78 | address _to, 79 | uint256 _tokenId 80 | ) public { 81 | ERC721TransferHelper(erc721TransferHelper).transferFrom(_tokenContract, address(this), _to, _tokenId); 82 | } 83 | 84 | function safeWithdrawERC721( 85 | address _tokenContract, 86 | address _to, 87 | uint256 _tokenId 88 | ) public { 89 | ERC721TransferHelper(erc721TransferHelper).safeTransferFrom(_tokenContract, address(this), _to, _tokenId); 90 | } 91 | 92 | function safeWithdrawERC1155( 93 | address _tokenContract, 94 | address _to, 95 | uint256 _tokenId, 96 | uint256 _amount 97 | ) public { 98 | ERC1155TransferHelper(erc1155TransferHelper).safeTransferFrom(_tokenContract, address(this), _to, _tokenId, _amount, ""); 99 | } 100 | 101 | function safeBatchWithdrawERC1155( 102 | address _tokenContract, 103 | address _to, 104 | uint256[] memory _tokenIds, 105 | uint256[] memory _amounts 106 | ) public { 107 | ERC1155TransferHelper(erc1155TransferHelper).safeBatchTransferFrom(_tokenContract, address(this), _to, _tokenIds, _amounts, ""); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /contracts/test/utils/tokens/TestERC1155.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; 5 | 6 | /// @title TestERC1155 7 | /// @notice FOR TEST PURPOSES ONLY. 8 | contract TestERC1155 is ERC1155 { 9 | constructor() ERC1155("") {} 10 | 11 | function mint( 12 | address _to, 13 | uint256 _tokenId, 14 | uint256 _amount 15 | ) public { 16 | _mint(_to, _tokenId, _amount, ""); 17 | } 18 | 19 | function mintBatch( 20 | address _to, 21 | uint256[] memory _tokenIds, 22 | uint256[] memory _amounts 23 | ) public { 24 | _mintBatch(_to, _tokenIds, _amounts, ""); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /contracts/test/utils/tokens/TestERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | 6 | /// @title TestERC20 7 | /// @notice FOR TEST PURPOSES ONLY. 8 | contract TestERC20 is ERC20 { 9 | constructor() ERC20("TestERC20", "TEST") {} 10 | 11 | function mint(address _to, uint256 _amount) public { 12 | _mint(_to, _amount); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/test/utils/tokens/TestERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; 5 | import "@openzeppelin/contracts/access/Ownable.sol"; 6 | 7 | /// @title TestERC721 8 | /// @notice FOR TEST PURPOSES ONLY. 9 | contract TestERC721 is ERC721, Ownable { 10 | constructor() ERC721("TestERC721", "TEST") {} 11 | 12 | function mint(address to, uint256 tokenId) public { 13 | _safeMint(to, tokenId); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/test/utils/tokens/WETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | /// @title WETH 5 | /// @notice FOR TEST PURPOSES ONLY. Source: https://github.com/gnosis/canonical-weth/blob/0dd1ea3e295eef916d0c6223ec63141137d22d67/contracts/WETH9.sol 6 | contract WETH { 7 | string public name = "Wrapped Ether"; 8 | string public symbol = "WETH"; 9 | uint8 public decimals = 18; 10 | 11 | event Approval(address indexed src, address indexed guy, uint256 wad); 12 | event Transfer(address indexed src, address indexed dst, uint256 wad); 13 | event Deposit(address indexed dst, uint256 wad); 14 | event Withdrawal(address indexed src, uint256 wad); 15 | 16 | mapping(address => uint256) public balanceOf; 17 | mapping(address => mapping(address => uint256)) public allowance; 18 | 19 | fallback() external payable { 20 | deposit(); 21 | } 22 | 23 | receive() external payable { 24 | deposit(); 25 | } 26 | 27 | function deposit() public payable { 28 | balanceOf[msg.sender] += msg.value; 29 | emit Deposit(msg.sender, msg.value); 30 | } 31 | 32 | function withdraw(uint256 wad) public { 33 | require(balanceOf[msg.sender] >= wad); 34 | balanceOf[msg.sender] -= wad; 35 | payable(msg.sender).transfer(wad); 36 | emit Withdrawal(msg.sender, wad); 37 | } 38 | 39 | function totalSupply() public view returns (uint256) { 40 | return address(this).balance; 41 | } 42 | 43 | function approve(address guy, uint256 wad) public returns (bool) { 44 | allowance[msg.sender][guy] = wad; 45 | emit Approval(msg.sender, guy, wad); 46 | return true; 47 | } 48 | 49 | function transfer(address dst, uint256 wad) public returns (bool) { 50 | return transferFrom(msg.sender, dst, wad); 51 | } 52 | 53 | function transferFrom( 54 | address src, 55 | address dst, 56 | uint256 wad 57 | ) public returns (bool) { 58 | require(balanceOf[src] >= wad); 59 | 60 | if (src != msg.sender && allowance[src][msg.sender] != type(uint128).max) { 61 | require(allowance[src][msg.sender] >= wad); 62 | allowance[src][msg.sender] -= wad; 63 | } 64 | 65 | balanceOf[src] -= wad; 66 | balanceOf[dst] += wad; 67 | 68 | emit Transfer(src, dst, wad); 69 | 70 | return true; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /contracts/test/utils/users/ZoraRegistrar.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ZoraModuleManager} from "../../../ZoraModuleManager.sol"; 5 | 6 | /// @title ZoraRegistrar 7 | /// @notice Mock ZORA V3 Registrar 8 | contract ZoraRegistrar { 9 | ZoraModuleManager internal ZMM; 10 | 11 | function init(ZoraModuleManager _ZMM) public { 12 | ZMM = _ZMM; 13 | } 14 | 15 | function registerModule(address _module) public { 16 | ZMM.registerModule(_module); 17 | } 18 | 19 | function setRegistrar(address _registrar) public { 20 | ZMM.setRegistrar(_registrar); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/test/utils/users/Zorb.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; 5 | import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; 6 | 7 | import {ZoraModuleManager} from "../../../ZoraModuleManager.sol"; 8 | 9 | /// @title Zorb 10 | /// @notice Mock ZORA V3 User 11 | contract Zorb is ERC721Holder, ERC1155Holder { 12 | ZoraModuleManager internal ZMM; 13 | 14 | constructor(address _ZMM) { 15 | ZMM = ZoraModuleManager(_ZMM); 16 | } 17 | 18 | /// ------------ ZORA Module Approvals ------------ 19 | 20 | function setApprovalForModule(address _module, bool _approved) public { 21 | ZMM.setApprovalForModule(_module, _approved); 22 | } 23 | 24 | function setBatchApprovalForModules(address[] memory _modules, bool _approved) public { 25 | ZMM.setBatchApprovalForModules(_modules, _approved); 26 | } 27 | 28 | function setApprovalForModuleBySig( 29 | address _module, 30 | address _user, 31 | bool _approved, 32 | uint256 _deadline, 33 | uint8 v, 34 | bytes32 r, 35 | bytes32 s 36 | ) public { 37 | ZMM.setApprovalForModuleBySig(_module, _user, _approved, _deadline, v, r, s); 38 | } 39 | 40 | /// ------------ ETH Receivable ------------ 41 | 42 | event Received(address sender, uint256 amount, uint256 balance); 43 | 44 | receive() external payable { 45 | emit Received(msg.sender, msg.value, address(this).balance); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /contracts/transferHelpers/BaseTransferHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {ZoraModuleManager} from "../ZoraModuleManager.sol"; 5 | 6 | /// @title Base Transfer Helper 7 | /// @author tbtstl 8 | /// @notice This contract provides shared utility for ZORA transfer helpers 9 | contract BaseTransferHelper { 10 | /// @notice The ZORA Module Manager 11 | ZoraModuleManager public immutable ZMM; 12 | 13 | /// @param _moduleManager The ZORA Module Manager referred to for transfer permissions 14 | constructor(address _moduleManager) { 15 | require(_moduleManager != address(0), "must set module manager to non-zero address"); 16 | 17 | ZMM = ZoraModuleManager(_moduleManager); 18 | } 19 | 20 | /// @notice Ensures a user has approved the module they're calling 21 | /// @param _user The address of the user 22 | modifier onlyApprovedModule(address _user) { 23 | require(isModuleApproved(_user), "module has not been approved by user"); 24 | _; 25 | } 26 | 27 | /// @notice If a user has approved the module they're calling 28 | /// @param _user The address of the user 29 | function isModuleApproved(address _user) public view returns (bool) { 30 | return ZMM.isModuleApproved(_user, msg.sender); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/transferHelpers/ERC1155TransferHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; 5 | import {BaseTransferHelper} from "./BaseTransferHelper.sol"; 6 | 7 | /// @title ERC-1155 Transfer Helper 8 | /// @author kulkarohan 9 | /// @notice This contract provides modules the ability to transfer ZORA user ERC-1155s with their permission 10 | contract ERC1155TransferHelper is BaseTransferHelper { 11 | constructor(address _approvalsManager) BaseTransferHelper(_approvalsManager) {} 12 | 13 | function safeTransferFrom( 14 | address _token, 15 | address _from, 16 | address _to, 17 | uint256 _tokenId, 18 | uint256 _amount, 19 | bytes memory _data 20 | ) public onlyApprovedModule(_from) { 21 | IERC1155(_token).safeTransferFrom(_from, _to, _tokenId, _amount, _data); 22 | } 23 | 24 | function safeBatchTransferFrom( 25 | address _token, 26 | address _from, 27 | address _to, 28 | uint256[] memory _tokenIds, 29 | uint256[] memory _amounts, 30 | bytes memory _data 31 | ) public onlyApprovedModule(_from) { 32 | IERC1155(_token).safeBatchTransferFrom(_from, _to, _tokenIds, _amounts, _data); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /contracts/transferHelpers/ERC20TransferHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; 6 | import {BaseTransferHelper} from "./BaseTransferHelper.sol"; 7 | 8 | /// @title ERC-20 Transfer Helper 9 | /// @author tbtstl 10 | /// @notice This contract provides modules the ability to transfer ZORA user ERC-20s with their permission 11 | contract ERC20TransferHelper is BaseTransferHelper { 12 | using SafeERC20 for IERC20; 13 | 14 | constructor(address _approvalsManager) BaseTransferHelper(_approvalsManager) {} 15 | 16 | function safeTransferFrom( 17 | address _token, 18 | address _from, 19 | address _to, 20 | uint256 _value 21 | ) public onlyApprovedModule(_from) { 22 | IERC20(_token).safeTransferFrom(_from, _to, _value); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /contracts/transferHelpers/ERC721TransferHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.10; 3 | 4 | import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; 5 | import {BaseTransferHelper} from "./BaseTransferHelper.sol"; 6 | 7 | /// @title ERC-721 Transfer Helper 8 | /// @author tbtstl 9 | /// @notice This contract provides modules the ability to transfer ZORA user ERC-721s with their permission 10 | contract ERC721TransferHelper is BaseTransferHelper { 11 | constructor(address _approvalsManager) BaseTransferHelper(_approvalsManager) {} 12 | 13 | function safeTransferFrom( 14 | address _token, 15 | address _from, 16 | address _to, 17 | uint256 _tokenId 18 | ) public onlyApprovedModule(_from) { 19 | IERC721(_token).safeTransferFrom(_from, _to, _tokenId); 20 | } 21 | 22 | function transferFrom( 23 | address _token, 24 | address _from, 25 | address _to, 26 | uint256 _tokenId 27 | ) public onlyApprovedModule(_from) { 28 | IERC721(_token).transferFrom(_from, _to, _tokenId); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /deploy/update-addresses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # must be run from root folder, not from inside deploy 4 | 5 | import sys, json 6 | from os.path import exists 7 | 8 | if __name__ == '__main__': 9 | num_args = len(sys.argv) 10 | if num_args % 2 != 0 or num_args < 4: 11 | raise Exception('args must be chainid followed by pairs of contract name, contract address') 12 | chain_id = sys.argv[1] 13 | file_path = 'addresses/' + chain_id + '.json' 14 | file_exists = exists(file_path) 15 | addrs_dict = {} 16 | if (file_exists): 17 | with open(file_path) as f: 18 | addrs_dict = json.load(f) 19 | for i in list(range(2, num_args, 2)): 20 | addrs_dict[sys.argv[i]] = sys.argv[i+1] 21 | with open(file_path, "w") as write_file: 22 | json.dump(addrs_dict, write_file, indent=2, sort_keys=True) 23 | write_file.write("\n") 24 | -------------------------------------------------------------------------------- /foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | auto_detect_solc = true 3 | libs = ['lib'] 4 | optimizer = true 5 | optimizer_runs = 500000 6 | out = 'dist/artifacts' 7 | src = 'contracts' 8 | test = 'test' 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@zoralabs/v3", 3 | "version": "1.0.14", 4 | "private": false, 5 | "homepage": "https://github.com/ourzora/v3", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/ourzora/v3.git" 9 | }, 10 | "files": [ 11 | "dist/**/*", 12 | "dist/*" 13 | ], 14 | "dependencies": { 15 | "@manifoldxyz/royalty-registry-solidity": "^1.0.9", 16 | "@openzeppelin/contracts": "^4.5.0", 17 | "@rari-capital/solmate": "^6.2.0" 18 | }, 19 | "devDependencies": { 20 | "@typechain/ethers-v5": "^10.0.0", 21 | "husky": "^7.0.0", 22 | "lint-staged": "^12.3.7", 23 | "prettier": "^2.6.1", 24 | "prettier-plugin-solidity": "^1.0.0-beta.19", 25 | "solhint": "^3.3.7", 26 | "solhint-plugin-prettier": "^0.0.5", 27 | "typechain": "^8.0.0", 28 | "typescript": "^4.6.3" 29 | }, 30 | "lint-staged": { 31 | "*.{ts,js,css,md,sol}": "prettier --write", 32 | "*.sol": "solhint" 33 | }, 34 | "scripts": { 35 | "build": "forge build && yarn typechain", 36 | "clean": "forge clean && rm -rf ./dist", 37 | "prepublishOnly": "rm -rf ./dist && forge clean && forge build && yarn typechain && cp -R contracts dist && cp -R addresses dist", 38 | "prettier": "prettier --config \"./.prettierrc\" --write \"**/*.{js,md,sol,yml}\"", 39 | "test": "forge test", 40 | "typechain": "typechain --target=ethers-v5 'dist/artifacts/*/*.json' --out-dir dist/typechain" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /remappings.txt: -------------------------------------------------------------------------------- 1 | ds-test/=lib/ds-test/src/ 2 | @openzeppelin/=node_modules/@openzeppelin/ 3 | @rari-capital/=node_modules/@rari-capital/ 4 | @manifoldxyz/=node_modules/@manifoldxyz/ -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/cancelAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-------------. 5 | / \ |AsksCoreErc20| 6 | Caller `------+------' 7 | | cancelAsk() | 8 | | ------------------->| 9 | | | 10 | | ----. 11 | | | emit AskCanceled() 12 | | <---' 13 | | | 14 | | ----. 15 | | | delete ask 16 | | <---' 17 | Caller ,------+------. 18 | ,-. |AsksCoreErc20| 19 | `-' `-------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/cancelAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreErc20 4 | 5 | Caller -> AsksCoreErc20 : cancelAsk() 6 | AsksCoreErc20 -> AsksCoreErc20 : emit AskCanceled() 7 | AsksCoreErc20 -> AsksCoreErc20 : delete ask 8 | 9 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/createAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-------------. 5 | / \ |AsksCoreErc20| 6 | Caller `------+------' 7 | | createAsk() | 8 | | ------------------->| 9 | | | 10 | | ----. 11 | | | store ask metadata 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AskCreated() 16 | | <---' 17 | Caller ,------+------. 18 | ,-. |AsksCoreErc20| 19 | `-' `-------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/createAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreErc20 4 | 5 | Caller -> AsksCoreErc20 : createAsk() 6 | 7 | AsksCoreErc20 -> AsksCoreErc20 : store ask metadata 8 | AsksCoreErc20 -> AsksCoreErc20 : emit AskCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/fillAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-------------. ,--------------------. 5 | / \ |AsksCoreErc20| |ERC721TransferHelper| 6 | Caller `------+------' `---------+----------' 7 | | fillAsk() | | 8 | | ------------------->| | 9 | | | | 10 | | ----. 11 | | | validate received payment 12 | | <---' 13 | | | | 14 | | ----. | 15 | | | handle royalty payouts | 16 | | <---' | 17 | | | | 18 | | ----. | 19 | | | handle seller payout | 20 | | <---' | 21 | | | | 22 | | | transferFrom() | 23 | | |-----------------------------> 24 | | | | 25 | | | |----. 26 | | | | | transfer NFT from seller to buyer 27 | | | |<---' 28 | | | | 29 | | ----. | 30 | | | emit AskFilled() | 31 | | <---' | 32 | | | | 33 | | ----. | 34 | | | delete ask from contract| 35 | | <---' | 36 | Caller ,------+------. ,---------+----------. 37 | ,-. |AsksCoreErc20| |ERC721TransferHelper| 38 | `-' `-------------' `--------------------' 39 | /|\ 40 | | 41 | / \ 42 | -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/fillAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreErc20 4 | participant ERC721TransferHelper 5 | 6 | Caller -> AsksCoreErc20 : fillAsk() 7 | 8 | AsksCoreErc20 -> AsksCoreErc20 : validate received payment 9 | AsksCoreErc20 -> AsksCoreErc20 : handle royalty payouts 10 | AsksCoreErc20 -> AsksCoreErc20 : handle seller payout 11 | 12 | AsksCoreErc20 -> ERC721TransferHelper : transferFrom() 13 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to buyer 14 | 15 | AsksCoreErc20 -> AsksCoreErc20 : emit AskFilled() 16 | AsksCoreErc20 -> AsksCoreErc20 : delete ask from contract 17 | 18 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/setAskPrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-------------. 5 | / \ |AsksCoreErc20| 6 | Caller `------+------' 7 | | setAskPrice() | 8 | | ------------------->| 9 | | | 10 | | | 11 | | _______________________________________ 12 | | ! ALT / price change? ! 13 | | !_____/ | ! 14 | | ! ----. ! 15 | | ! | update price ! 16 | | ! <---' ! 17 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 18 | | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 19 | | | 20 | | | 21 | | __________________________________________ 22 | | ! ALT / currency change? ! 23 | | !_____/ | ! 24 | | ! ----. ! 25 | | ! | update currency ! 26 | | ! <---' ! 27 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 28 | | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 29 | | | 30 | | ----. 31 | | | emit AskPriceUpdated() 32 | | <---' 33 | Caller ,------+------. 34 | ,-. |AsksCoreErc20| 35 | `-' `-------------' 36 | /|\ 37 | | 38 | / \ 39 | -------------------------------------------------------------------------------- /uml/Asks/Core/ERC20/setAskPrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreErc20 4 | 5 | Caller -> AsksCoreErc20 : setAskPrice() 6 | 7 | alt price change? 8 | 9 | AsksCoreErc20 -> AsksCoreErc20 : update price 10 | 11 | else noop 12 | 13 | end 14 | 15 | alt currency change? 16 | 17 | AsksCoreErc20 -> AsksCoreErc20 : update currency 18 | 19 | else noop 20 | 21 | end 22 | 23 | AsksCoreErc20 -> AsksCoreErc20 : emit AskPriceUpdated() 24 | 25 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/cancelAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------. 5 | / \ |AsksCoreEth| 6 | Caller `-----+-----' 7 | | cancelAsk() | 8 | | ------------------>| 9 | | | 10 | | ----. 11 | | | emit AskCanceled() 12 | | <---' 13 | | | 14 | | ----. 15 | | | delete ask 16 | | <---' 17 | Caller ,-----+-----. 18 | ,-. |AsksCoreEth| 19 | `-' `-----------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/cancelAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreEth 4 | 5 | Caller -> AsksCoreEth : cancelAsk() 6 | AsksCoreEth -> AsksCoreEth : emit AskCanceled() 7 | AsksCoreEth -> AsksCoreEth : delete ask 8 | 9 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/createAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------. 5 | / \ |AsksCoreEth| 6 | Caller `-----+-----' 7 | | createAsk() | 8 | | ------------------>| 9 | | | 10 | | ----. 11 | | | store ask metadata 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AskCreated() 16 | | <---' 17 | Caller ,-----+-----. 18 | ,-. |AsksCoreEth| 19 | `-' `-----------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/createAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreEth 4 | 5 | Caller -> AsksCoreEth : createAsk() 6 | 7 | AsksCoreEth -> AsksCoreEth : store ask metadata 8 | AsksCoreEth -> AsksCoreEth : emit AskCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/fillAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------. ,--------------------. 5 | / \ |AsksCoreEth| |ERC721TransferHelper| 6 | Caller `-----+-----' `---------+----------' 7 | | fillAsk() | | 8 | | ------------------>| | 9 | | | | 10 | | ----. | 11 | | | validate received ETH | 12 | | <---' | 13 | | | | 14 | | ----. | 15 | | | handle royalty payouts | 16 | | <---' | 17 | | | | 18 | | ----. | 19 | | | handle seller payout | 20 | | <---' | 21 | | | | 22 | | | transferFrom() | 23 | | |----------------------------> 24 | | | | 25 | | | |----. 26 | | | | | transfer NFT from seller to buyer 27 | | | |<---' 28 | | | | 29 | | ----. | 30 | | | emit AskFilled() | 31 | | <---' | 32 | | | | 33 | | ----. 34 | | | delete ask from contract 35 | | <---' 36 | Caller ,-----+-----. ,---------+----------. 37 | ,-. |AsksCoreEth| |ERC721TransferHelper| 38 | `-' `-----------' `--------------------' 39 | /|\ 40 | | 41 | / \ 42 | -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/fillAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreEth 4 | participant ERC721TransferHelper 5 | 6 | Caller -> AsksCoreEth : fillAsk() 7 | 8 | AsksCoreEth -> AsksCoreEth : validate received ETH 9 | AsksCoreEth -> AsksCoreEth : handle royalty payouts 10 | AsksCoreEth -> AsksCoreEth : handle seller payout 11 | 12 | AsksCoreEth -> ERC721TransferHelper : transferFrom() 13 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to buyer 14 | 15 | AsksCoreEth -> AsksCoreEth : emit AskFilled() 16 | AsksCoreEth -> AsksCoreEth : delete ask from contract 17 | 18 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/setAskPrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------. 5 | / \ |AsksCoreEth| 6 | Caller `-----+-----' 7 | | setAskPrice() | 8 | | ------------------>| 9 | | | 10 | | ----. 11 | | | update ask price 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AskPriceUpdated() 16 | | <---' 17 | Caller ,-----+-----. 18 | ,-. |AsksCoreEth| 19 | `-' `-----------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Core/ETH/setAskPrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksCoreEth 4 | 5 | Caller -> AsksCoreEth : setAskPrice() 6 | AsksCoreEth -> AsksCoreEth : update ask price 7 | AsksCoreEth -> AsksCoreEth : emit AskPriceUpdated() 8 | 9 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/cancelAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------. 5 | / \ |AsksPrivateEth| 6 | Caller `------+-------' 7 | | cancelAsk() | 8 | | --------------------> 9 | | | 10 | | |----. 11 | | | | emit AskCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete ask 16 | | |<---' 17 | Caller ,------+-------. 18 | ,-. |AsksPrivateEth| 19 | `-' `--------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/cancelAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksPrivateEth 4 | 5 | Caller -> AsksPrivateEth : cancelAsk() 6 | AsksPrivateEth -> AsksPrivateEth : emit AskCanceled() 7 | AsksPrivateEth -> AsksPrivateEth : delete ask 8 | 9 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/createAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------. 5 | / \ |AsksPrivateEth| 6 | Caller `------+-------' 7 | | createAsk() | 8 | | --------------------> 9 | | | 10 | | |----. 11 | | | | store ask metadata 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AskCreated() 16 | | |<---' 17 | Caller ,------+-------. 18 | ,-. |AsksPrivateEth| 19 | `-' `--------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/createAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksPrivateEth 4 | 5 | Caller -> AsksPrivateEth : createAsk() 6 | 7 | AsksPrivateEth -> AsksPrivateEth : store ask metadata 8 | AsksPrivateEth -> AsksPrivateEth : emit AskCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/fillAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksPrivateEth 4 | participant ERC721TransferHelper 5 | 6 | Caller -> AsksPrivateEth : fillAsk() 7 | 8 | AsksPrivateEth -> AsksPrivateEth : validate caller 9 | AsksPrivateEth -> AsksPrivateEth : validate received ETH 10 | AsksPrivateEth -> AsksPrivateEth : handle royalty payouts 11 | AsksPrivateEth -> AsksPrivateEth : handle seller payout 12 | 13 | AsksPrivateEth -> ERC721TransferHelper : transferFrom() 14 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to buyer 15 | 16 | AsksPrivateEth -> AsksPrivateEth : emit AskFilled() 17 | AsksPrivateEth -> AsksPrivateEth : delete ask from contract 18 | 19 | @enduml -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/setAskPrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------. 5 | / \ |AsksPrivateEth| 6 | Caller `------+-------' 7 | | setAskPrice() | 8 | | --------------------> 9 | | | 10 | | |----. 11 | | | | update ask price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AskPriceUpdated() 16 | | |<---' 17 | Caller ,------+-------. 18 | ,-. |AsksPrivateEth| 19 | `-' `--------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/Private/ETH/setAskPrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksPrivateEth 4 | 5 | Caller -> AsksPrivateEth : setAskPrice() 6 | AsksPrivateEth -> AsksPrivateEth : update ask price 7 | AsksPrivateEth -> AsksPrivateEth : emit AskPriceUpdated() 8 | 9 | @enduml -------------------------------------------------------------------------------- /uml/Asks/V1_1/cancelAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------. 5 | / \ |AsksV1| 6 | Caller `--+---' 7 | | cancelAsk() | 8 | | ----------------> 9 | | | 10 | | |----. 11 | | | | emit AskCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete ask 16 | | |<---' 17 | Caller ,--+---. 18 | ,-. |AsksV1| 19 | `-' `------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/cancelAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksV1 4 | 5 | Caller -> AsksV1 : cancelAsk() 6 | AsksV1 -> AsksV1 : emit AskCanceled() 7 | AsksV1 -> AsksV1 : delete ask 8 | 9 | @enduml 10 | 11 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/createAsk.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------. 5 | / \ |AsksV1| 6 | Caller `--+---' 7 | | createAsk() | 8 | | ----------------> 9 | | | 10 | | | 11 | | ____________________________________________________________ 12 | | ! ALT / Ask already exists for this token? ! 13 | | !_____/ | ! 14 | | ! |----. ! 15 | | ! | | _cancelAsk(_tokenContract, _tokenId) ! 16 | | ! |<---' ! 17 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 18 | | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 19 | | | 20 | | |----. 21 | | | | create ask 22 | | |<---' 23 | | | 24 | | |----. 25 | | | | emit AskCreated() 26 | | |<---' 27 | Caller ,--+---. 28 | ,-. |AsksV1| 29 | `-' `------' 30 | /|\ 31 | | 32 | / \ 33 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/createAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksV1 4 | 5 | Caller -> AsksV1 : createAsk() 6 | 7 | alt Ask already exists for this token? 8 | 9 | AsksV1 -> AsksV1 : _cancelAsk(_tokenContract, _tokenId) 10 | 11 | else noop 12 | 13 | end 14 | 15 | AsksV1 -> AsksV1 : create ask 16 | 17 | AsksV1 -> AsksV1 : emit AskCreated() 18 | 19 | @enduml 20 | 21 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/fillAsk.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksV1 4 | participant ERC721TransferHelper 5 | 6 | Caller -> AsksV1 : fillAsk() 7 | 8 | AsksV1 -> AsksV1 : validate received funds 9 | 10 | AsksV1 -> AsksV1 : handle royalty payouts 11 | 12 | alt finders fee configured for this ask? 13 | 14 | AsksV1 -> AsksV1 : handle finders fee payout 15 | 16 | else noop 17 | 18 | end 19 | 20 | AsksV1 -> AsksV1 : handle seller funds recipient payout 21 | AsksV1 -> ERC721TransferHelper : transferFrom() 22 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to buyer 23 | AsksV1 -> AsksV1 : emit ExchangeExecuted() 24 | AsksV1 -> AsksV1 : emit AskFilled() 25 | AsksV1 -> AsksV1 : delete ask from contract 26 | 27 | @enduml 28 | 29 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/setAskPrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------. 5 | / \ |AsksV1| 6 | Caller `--+---' 7 | | setAskPrice() | 8 | | ----------------> 9 | | | 10 | | |----. 11 | | | | update ask price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AskPriceUpdated() 16 | | |<---' 17 | Caller ,--+---. 18 | ,-. |AsksV1| 19 | `-' `------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/Asks/V1_1/setAskPrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant AsksV1 4 | 5 | Caller -> AsksV1 : setAskPrice() 6 | AsksV1 -> AsksV1 : update ask price 7 | AsksV1 -> AsksV1 : emit AskPriceUpdated() 8 | 9 | @enduml 10 | 11 | -------------------------------------------------------------------------------- /uml/OffersV1/cancelOffer.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------. ,-------------------. 5 | / \ |OffersV1| |ERC20TransferHelper| 6 | Caller `---+----' `---------+---------' 7 | | cancelOffer() | | 8 | | -----------------> | 9 | | | | 10 | | | transferFrom() | 11 | | | ------------------------> 12 | | | | 13 | | | |----. 14 | | | | | refund tokens from escrow 15 | | | |<---' 16 | | | | 17 | | |----. 18 | | | | emit OfferCanceled() 19 | | |<---' 20 | | | | 21 | | |----. | 22 | | | | delete offer | 23 | | |<---' | 24 | Caller ,---+----. ,---------+---------. 25 | ,-. |OffersV1| |ERC20TransferHelper| 26 | `-' `--------' `-------------------' 27 | /|\ 28 | | 29 | / \ 30 | -------------------------------------------------------------------------------- /uml/OffersV1/cancelOffer.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant OffersV1 4 | participant ERC20TransferHelper 5 | 6 | Caller -> OffersV1 : cancelOffer() 7 | OffersV1 -> ERC20TransferHelper : transferFrom() 8 | ERC20TransferHelper -> ERC20TransferHelper : refund tokens from escrow 9 | OffersV1 -> OffersV1 : emit OfferCanceled() 10 | OffersV1 -> OffersV1 : delete offer 11 | 12 | @enduml 13 | 14 | -------------------------------------------------------------------------------- /uml/OffersV1/createOffer.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------. ,-------------------. 5 | / \ |OffersV1| |ERC20TransferHelper| 6 | Caller `---+----' `---------+---------' 7 | | createOffer() | | 8 | | -----------------> | 9 | | | | 10 | | | transferFrom() | 11 | | | -----------------------------> 12 | | | | 13 | | | |----. 14 | | | | | transfer tokens into escrow 15 | | | |<---' 16 | | | | 17 | | |----. | 18 | | | | offer count ++ | 19 | | |<---' | 20 | | | | 21 | | |----. | 22 | | | | create offer | 23 | | |<---' | 24 | | | | 25 | | |----. 26 | | | | offersFor[NFT].append(id) 27 | | |<---' 28 | | | | 29 | | |----. | 30 | | | | emit OfferCreated() | 31 | | |<---' | 32 | | | | 33 | | id | | 34 | | <----------------- | 35 | Caller ,---+----. ,---------+---------. 36 | ,-. |OffersV1| |ERC20TransferHelper| 37 | `-' `--------' `-------------------' 38 | /|\ 39 | | 40 | / \ 41 | -------------------------------------------------------------------------------- /uml/OffersV1/createOffer.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant OffersV1 4 | participant ERC20TransferHelper 5 | 6 | Caller -> OffersV1 : createOffer() 7 | OffersV1 -> ERC20TransferHelper : transferFrom() 8 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens into escrow 9 | OffersV1 -> OffersV1 : offer count ++ 10 | OffersV1 -> OffersV1 : create offer 11 | OffersV1 -> OffersV1 : offersFor[NFT].append(id) 12 | OffersV1 -> OffersV1 : emit OfferCreated() 13 | OffersV1 -> Caller :id 14 | 15 | @enduml 16 | 17 | -------------------------------------------------------------------------------- /uml/OffersV1/fillOffer.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant OffersV1 4 | participant ERC721TransferHelper 5 | 6 | Caller -> OffersV1 : fillOffer() 7 | 8 | OffersV1 -> OffersV1 : validate token owner 9 | 10 | OffersV1 -> OffersV1 : handle royalty payouts 11 | 12 | alt finders fee configured for this offer? 13 | 14 | OffersV1 -> OffersV1 : handle finders fee payout 15 | 16 | else noop 17 | 18 | end 19 | 20 | OffersV1 -> ERC721TransferHelper : transferFrom() 21 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from taker to maker 22 | 23 | OffersV1 -> OffersV1 : emit ExchangeExecuted() 24 | OffersV1 -> OffersV1 : emit OfferFilled() 25 | OffersV1 -> OffersV1 : delete offer from contract 26 | 27 | @enduml -------------------------------------------------------------------------------- /uml/OffersV1/setOfferAmount.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------. ,-------------------. 5 | / \ |OffersV1| |ERC20TransferHelper| 6 | Caller `---+----' `---------+---------' 7 | | setOfferAmount() | | 8 | | -----------------> | 9 | | | | 10 | | | | 11 | | _______________________________________________________________________ 12 | | ! ALT / same token? | ! 13 | | !_____/ | | ! 14 | | ! | retrieve increase / refund decrease| ! 15 | | ! | -----------------------------------> ! 16 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 17 | | ! [different token] | ! 18 | | ! | refund previous offer | ! 19 | | ! | -----------------------------------> ! 20 | | ! | | ! 21 | | ! | retrieve new offer | ! 22 | | ! | -----------------------------------> ! 23 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 24 | | | | 25 | | |----. | 26 | | | | emit OfferUpdated() | 27 | | |<---' | 28 | Caller ,---+----. ,---------+---------. 29 | ,-. |OffersV1| |ERC20TransferHelper| 30 | `-' `--------' `-------------------' 31 | /|\ 32 | | 33 | / \ 34 | -------------------------------------------------------------------------------- /uml/OffersV1/setOfferAmount.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant OffersV1 4 | participant ERC20TransferHelper 5 | 6 | Caller -> OffersV1 : setOfferAmount() 7 | 8 | alt same token? 9 | 10 | OffersV1 -> ERC20TransferHelper : retrieve increase / refund decrease 11 | 12 | else different token 13 | 14 | OffersV1 -> ERC20TransferHelper : refund previous offer 15 | 16 | OffersV1 -> ERC20TransferHelper : retrieve new offer 17 | end 18 | 19 | OffersV1 -> OffersV1 : emit OfferUpdated() 20 | 21 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ReserveAuctionCoreErc20| 6 | Caller `-----------+-----------' 7 | | cancelAuction() | 8 | | ------------------------>| 9 | | | 10 | | ----. 11 | | | emit AuctionCanceled() 12 | | <---' 13 | | | 14 | | ----. 15 | | | delete auction 16 | | <---' 17 | Caller ,-----------+-----------. 18 | ,-. |ReserveAuctionCoreErc20| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreErc20 4 | 5 | Caller -> ReserveAuctionCoreErc20 : cancelAuction() 6 | 7 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : emit AuctionCanceled() 8 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ReserveAuctionCoreErc20| 6 | Caller `-----------+-----------' 7 | | createAuction() | 8 | | ------------------------>| 9 | | | 10 | | ----. 11 | | | store auction metadata 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AuctionCreated() 16 | | <---' 17 | Caller ,-----------+-----------. 18 | ,-. |ReserveAuctionCoreErc20| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreErc20 4 | 5 | Caller -> ReserveAuctionCoreErc20 : createAuction() 6 | 7 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : store auction metadata 8 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreErc20 4 | participant ERC721TransferHelper 5 | participant ERC20TransferHelper 6 | 7 | 8 | Caller -> ReserveAuctionCoreErc20 : createBid() 9 | 10 | alt First bid? 11 | 12 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : start auction 13 | ReserveAuctionCoreErc20 -> ERC721TransferHelper : transferFrom() 14 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to escrow 15 | 16 | else refund previous bidder 17 | 18 | ReserveAuctionCoreErc20 -> ERC20TransferHelper : handle outgoing refund 19 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to bidder 20 | 21 | end 22 | 23 | ReserveAuctionCoreErc20 -> ERC20TransferHelper : handle incoming bid 24 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to escrow 25 | 26 | alt Bid placed within 15 min of end? 27 | 28 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : extend auction 29 | 30 | else noop 31 | 32 | end 33 | 34 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : emit AuctionBid() 35 | 36 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ReserveAuctionCoreErc20| 6 | Caller `-----------+-----------' 7 | | setAuctionReservePrice() | 8 | | ------------------------>| 9 | | | 10 | | ----. 11 | | | update reserve price 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AuctionReservePriceUpdated() 16 | | <---' 17 | Caller ,-----------+-----------. 18 | ,-. |ReserveAuctionCoreErc20| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreErc20 4 | 5 | Caller -> ReserveAuctionCoreErc20 : setAuctionReservePrice() 6 | 7 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : update reserve price 8 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/settleAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ReserveAuctionCoreErc20| 6 | Caller `-----------+-----------' 7 | | settleAuction() | 8 | | ------------------------>| 9 | | | 10 | | ----. 11 | | | validate auction ended 12 | | <---' 13 | | | 14 | | ----. 15 | | | handle royalty payouts 16 | | <---' 17 | | | 18 | | ----. 19 | | | handle seller funds recipient payout 20 | | <---' 21 | | | 22 | | ----. 23 | | | transfer NFT from escrow to winning bidder 24 | | <---' 25 | | | 26 | | ----. 27 | | | emit AuctionEnded() 28 | | <---' 29 | | | 30 | | ----. 31 | | | delete auction from contract 32 | | <---' 33 | Caller ,-----------+-----------. 34 | ,-. |ReserveAuctionCoreErc20| 35 | `-' `-----------------------' 36 | /|\ 37 | | 38 | / \ 39 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ERC20/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreErc20 4 | 5 | Caller -> ReserveAuctionCoreErc20 : settleAuction() 6 | 7 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : validate auction ended 8 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : handle royalty payouts 9 | 10 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : handle seller funds recipient payout 11 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : transfer NFT from escrow to winning bidder 12 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : emit AuctionEnded() 13 | ReserveAuctionCoreErc20 -> ReserveAuctionCoreErc20 : delete auction from contract 14 | 15 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,---------------------. 5 | / \ |ReserveAuctionCoreEth| 6 | Caller `----------+----------' 7 | | cancelAuction() | 8 | | ----------------------->| 9 | | | 10 | | ----. 11 | | | emit AuctionCanceled() 12 | | <---' 13 | | | 14 | | ----. 15 | | | delete auction 16 | | <---' 17 | Caller ,----------+----------. 18 | ,-. |ReserveAuctionCoreEth| 19 | `-' `---------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreEth 4 | 5 | Caller -> ReserveAuctionCoreEth : cancelAuction() 6 | 7 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : emit AuctionCanceled() 8 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,---------------------. 5 | / \ |ReserveAuctionCoreEth| 6 | Caller `----------+----------' 7 | | createAuction() | 8 | | ----------------------->| 9 | | | 10 | | ----. 11 | | | store auction metadata 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit AuctionCreated() 16 | | <---' 17 | Caller ,----------+----------. 18 | ,-. |ReserveAuctionCoreEth| 19 | `-' `---------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreEth 4 | 5 | Caller -> ReserveAuctionCoreEth : createAuction() 6 | 7 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : store auction metadata 8 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreEth 4 | participant ERC721TransferHelper 5 | 6 | 7 | Caller -> ReserveAuctionCoreEth : createBid() 8 | 9 | alt First bid? 10 | 11 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : start auction 12 | ReserveAuctionCoreEth -> ERC721TransferHelper : transferFrom() 13 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to escrow 14 | 15 | else refund previous bidder 16 | 17 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : transfer ETH to bidder 18 | 19 | end 20 | 21 | 22 | alt Bid placed within 15 min of end? 23 | 24 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : extend auction 25 | 26 | else noop 27 | 28 | end 29 | 30 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : emit AuctionBid() 31 | 32 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,---------------------. 5 | / \ |ReserveAuctionCoreEth| 6 | Caller `----------+----------' 7 | | setAuctionReservePrice()| 8 | | ------------------------> 9 | | | 10 | | |----. 11 | | | | update reserve price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionReservePriceUpdated() 16 | | |<---' 17 | Caller ,----------+----------. 18 | ,-. |ReserveAuctionCoreEth| 19 | `-' `---------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreEth 4 | 5 | Caller -> ReserveAuctionCoreEth : setAuctionReservePrice() 6 | 7 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : update reserve price 8 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/settleAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,---------------------. 5 | / \ |ReserveAuctionCoreEth| 6 | Caller `----------+----------' 7 | | settleAuction() | 8 | | ----------------------->| 9 | | | 10 | | ----. 11 | | | validate auction ended 12 | | <---' 13 | | | 14 | | ----. 15 | | | handle royalty payouts 16 | | <---' 17 | | | 18 | | ----. 19 | | | handle seller funds recipient payout 20 | | <---' 21 | | | 22 | | ----. 23 | | | transfer NFT from escrow to winning bidder 24 | | <---' 25 | | | 26 | | ----. 27 | | | emit AuctionEnded() 28 | | <---' 29 | | | 30 | | ----. 31 | | | delete auction from contract 32 | | <---' 33 | Caller ,----------+----------. 34 | ,-. |ReserveAuctionCoreEth| 35 | `-' `---------------------' 36 | /|\ 37 | | 38 | / \ 39 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Core/ETH/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionCoreEth 4 | 5 | Caller -> ReserveAuctionCoreEth : settleAuction() 6 | 7 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : validate auction ended 8 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : handle royalty payouts 9 | 10 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : handle seller funds recipient payout 11 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : transfer NFT from escrow to winning bidder 12 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : emit AuctionEnded() 13 | ReserveAuctionCoreEth -> ReserveAuctionCoreEth : delete auction from contract 14 | 15 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionFindersErc20| 6 | Caller `------------+-------------' 7 | | cancelAuction() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | emit AuctionCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete auction 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionFindersErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersErc20 4 | 5 | Caller -> ReserveAuctionFindersErc20 : cancelAuction() 6 | 7 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : emit AuctionCanceled() 8 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionFindersErc20| 6 | Caller `------------+-------------' 7 | | createAuction() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | store auction metadata 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionCreated() 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionFindersErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersErc20 4 | 5 | Caller -> ReserveAuctionFindersErc20 : createAuction() 6 | 7 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : store auction metadata 8 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersErc20 4 | participant ERC721TransferHelper 5 | participant ERC20TransferHelper 6 | 7 | 8 | Caller -> ReserveAuctionFindersErc20 : createBid() 9 | 10 | alt First bid? 11 | 12 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : start auction 13 | ReserveAuctionFindersErc20 -> ERC721TransferHelper : transferFrom() 14 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to escrow 15 | 16 | else refund previous bidder 17 | 18 | ReserveAuctionFindersErc20 -> ERC20TransferHelper : handle outgoing refund 19 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to bidder 20 | 21 | end 22 | 23 | ReserveAuctionFindersErc20 -> ERC20TransferHelper : handle incoming bid 24 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to escrow 25 | 26 | alt Bid placed within 15 min of end? 27 | 28 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : extend auction 29 | 30 | else noop 31 | 32 | end 33 | 34 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : emit AuctionBid() 35 | 36 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionFindersErc20| 6 | Caller `------------+-------------' 7 | | setAuctionReservePrice() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | update reserve price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionReservePriceUpdated() 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionFindersErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersErc20 4 | 5 | Caller -> ReserveAuctionFindersErc20 : setAuctionReservePrice() 6 | 7 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : update reserve price 8 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ERC20/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersErc20 4 | 5 | Caller -> ReserveAuctionFindersErc20 : settleAuction() 6 | 7 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : validate auction ended 8 | 9 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : handle royalty payouts 10 | 11 | alt finders fee configured for this auction? 12 | 13 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : handle finders fee payout 14 | 15 | else noop 16 | 17 | end 18 | 19 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : handle seller funds recipient payout 20 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : transfer NFT from escrow to winning bidder 21 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : emit AuctionEnded() 22 | ReserveAuctionFindersErc20 -> ReserveAuctionFindersErc20 : delete auction from contract 23 | 24 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionFindersEth| 6 | Caller `-----------+------------' 7 | | cancelAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | emit AuctionCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete auction 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionFindersEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersEth 4 | 5 | Caller -> ReserveAuctionFindersEth : cancelAuction() 6 | 7 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : emit AuctionCanceled() 8 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionFindersEth| 6 | Caller `-----------+------------' 7 | | createAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | store auction metadata 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionCreated() 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionFindersEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersEth 4 | 5 | Caller -> ReserveAuctionFindersEth : createAuction() 6 | 7 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : store auction metadata 8 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersEth 4 | participant ERC721TransferHelper 5 | 6 | 7 | Caller -> ReserveAuctionFindersEth : createBid() 8 | 9 | alt First bid? 10 | 11 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : start auction 12 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : transferFrom() 13 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : transfer NFT from seller to escrow 14 | 15 | else refund previous bidder 16 | 17 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : transfer ETH to bidder 18 | 19 | end 20 | 21 | 22 | alt Bid placed within 15 min of end? 23 | 24 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : extend auction 25 | 26 | else noop 27 | 28 | end 29 | 30 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : emit AuctionBid() 31 | 32 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionFindersEth| 6 | Caller `-----------+------------' 7 | | setAuctionReservePrice() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | update reserve price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionReservePriceUpdated() 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionFindersEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersEth 4 | 5 | Caller -> ReserveAuctionFindersEth : setAuctionReservePrice() 6 | 7 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : update reserve price 8 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/settleAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionFindersEth| 6 | Caller `-----------+------------' 7 | | settleAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | validate auction ended 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | handle royalty payouts 16 | | |<---' 17 | | | 18 | | | 19 | | __________________________________________________________ 20 | | ! ALT / finders fee configured for this auction? ! 21 | | !_____/ | ! 22 | | ! |----. ! 23 | | ! | | handle finders fee payout ! 24 | | ! |<---' ! 25 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 26 | | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 27 | | | 28 | | |----. 29 | | | | handle seller funds recipient payout 30 | | |<---' 31 | | | 32 | | |----. 33 | | | | transfer NFT from escrow to winning bidder 34 | | |<---' 35 | | | 36 | | |----. 37 | | | | emit AuctionEnded() 38 | | |<---' 39 | | | 40 | | |----. 41 | | | | delete auction from contract 42 | | |<---' 43 | Caller ,-----------+------------. 44 | ,-. |ReserveAuctionFindersEth| 45 | `-' `------------------------' 46 | /|\ 47 | | 48 | / \ 49 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Finders/ETH/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionFindersEth 4 | 5 | Caller -> ReserveAuctionFindersEth : settleAuction() 6 | 7 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : validate auction ended 8 | 9 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : handle royalty payouts 10 | 11 | alt finders fee configured for this auction? 12 | 13 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : handle finders fee payout 14 | 15 | else noop 16 | 17 | end 18 | 19 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : handle seller funds recipient payout 20 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : transfer NFT from escrow to winning bidder 21 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : emit AuctionEnded() 22 | ReserveAuctionFindersEth -> ReserveAuctionFindersEth : delete auction from contract 23 | 24 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionListingErc20| 6 | Caller `------------+-------------' 7 | | cancelAuction() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | emit AuctionCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete auction 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionListingErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingErc20 4 | 5 | Caller -> ReserveAuctionListingErc20 : cancelAuction() 6 | 7 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : emit AuctionCanceled() 8 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionListingErc20| 6 | Caller `------------+-------------' 7 | | createAuction() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | store auction metadata 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionCreated() 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionListingErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingErc20 4 | 5 | Caller -> ReserveAuctionListingErc20 : createAuction() 6 | 7 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : store auction metadata 8 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingErc20 4 | participant ERC721TransferHelper 5 | participant ERC20TransferHelper 6 | 7 | 8 | Caller -> ReserveAuctionListingErc20 : createBid() 9 | 10 | alt First bid? 11 | 12 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : start auction 13 | ReserveAuctionListingErc20 -> ERC721TransferHelper : transferFrom() 14 | ERC721TransferHelper -> ERC721TransferHelper : transfer NFT from seller to escrow 15 | 16 | else refund previous bidder 17 | 18 | ReserveAuctionListingErc20 -> ERC20TransferHelper : handle outgoing refund 19 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to bidder 20 | 21 | end 22 | 23 | ReserveAuctionListingErc20 -> ERC20TransferHelper : handle incoming bid 24 | ERC20TransferHelper -> ERC20TransferHelper : transfer tokens to escrow 25 | 26 | alt Bid placed within 15 min of end? 27 | 28 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : extend auction 29 | 30 | else noop 31 | 32 | end 33 | 34 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : emit AuctionBid() 35 | 36 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,--------------------------. 5 | / \ |ReserveAuctionListingErc20| 6 | Caller `------------+-------------' 7 | | setAuctionReservePrice() | 8 | | --------------------------> 9 | | | 10 | | |----. 11 | | | | update reserve price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionReservePriceUpdated() 16 | | |<---' 17 | Caller ,------------+-------------. 18 | ,-. |ReserveAuctionListingErc20| 19 | `-' `--------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingErc20 4 | 5 | Caller -> ReserveAuctionListingErc20 : setAuctionReservePrice() 6 | 7 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : update reserve price 8 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ERC20/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingErc20 4 | 5 | Caller -> ReserveAuctionListingErc20 : settleAuction() 6 | 7 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : validate auction ended 8 | 9 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : handle royalty payouts 10 | 11 | alt listing fee configured for this auction? 12 | 13 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : handle listing fee payout 14 | 15 | else noop 16 | 17 | end 18 | 19 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : handle seller funds recipient payout 20 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : transfer NFT from escrow to winning bidder 21 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : emit AuctionEnded() 22 | ReserveAuctionListingErc20 -> ReserveAuctionListingErc20 : delete auction from contract 23 | 24 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/cancelAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionListingEth| 6 | Caller `-----------+------------' 7 | | cancelAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | emit AuctionCanceled() 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | delete auction 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionListingEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/cancelAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingEth 4 | 5 | Caller -> ReserveAuctionListingEth : cancelAuction() 6 | 7 | ReserveAuctionListingEth -> ReserveAuctionListingEth : emit AuctionCanceled() 8 | ReserveAuctionListingEth -> ReserveAuctionListingEth : delete auction 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/createAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionListingEth| 6 | Caller `-----------+------------' 7 | | createAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | store auction metadata 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionCreated() 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionListingEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/createAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingEth 4 | 5 | Caller -> ReserveAuctionListingEth : createAuction() 6 | 7 | ReserveAuctionListingEth -> ReserveAuctionListingEth : store auction metadata 8 | ReserveAuctionListingEth -> ReserveAuctionListingEth : emit AuctionCreated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/createBid.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingEth 4 | participant ERC721TransferHelper 5 | 6 | 7 | Caller -> ReserveAuctionListingEth : createBid() 8 | 9 | alt First bid? 10 | 11 | ReserveAuctionListingEth -> ReserveAuctionListingEth : start auction 12 | ReserveAuctionListingEth -> ReserveAuctionListingEth : transferFrom() 13 | ReserveAuctionListingEth -> ReserveAuctionListingEth : transfer NFT from seller to escrow 14 | 15 | else refund previous bidder 16 | 17 | ReserveAuctionListingEth -> ReserveAuctionListingEth : transfer ETH to bidder 18 | 19 | end 20 | 21 | 22 | alt Bid placed within 15 min of end? 23 | 24 | ReserveAuctionListingEth -> ReserveAuctionListingEth : extend auction 25 | 26 | else noop 27 | 28 | end 29 | 30 | ReserveAuctionListingEth -> ReserveAuctionListingEth : emit AuctionBid() 31 | 32 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/setAuctionReservePrice.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionListingEth| 6 | Caller `-----------+------------' 7 | | setAuctionReservePrice() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | update reserve price 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit AuctionReservePriceUpdated() 16 | | |<---' 17 | Caller ,-----------+------------. 18 | ,-. |ReserveAuctionListingEth| 19 | `-' `------------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/setAuctionReservePrice.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingEth 4 | 5 | Caller -> ReserveAuctionListingEth : setAuctionReservePrice() 6 | 7 | ReserveAuctionListingEth -> ReserveAuctionListingEth : update reserve price 8 | ReserveAuctionListingEth -> ReserveAuctionListingEth : emit AuctionReservePriceUpdated() 9 | 10 | @enduml -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/settleAuction.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,------------------------. 5 | / \ |ReserveAuctionListingEth| 6 | Caller `-----------+------------' 7 | | settleAuction() | 8 | | -------------------------> 9 | | | 10 | | |----. 11 | | | | validate auction ended 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | handle royalty payouts 16 | | |<---' 17 | | | 18 | | | 19 | | __________________________________________________________ 20 | | ! ALT / listing fee configured for this auction? ! 21 | | !_____/ | ! 22 | | ! |----. ! 23 | | ! | | handle listing fee payout ! 24 | | ! |<---' ! 25 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 26 | | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 27 | | | 28 | | |----. 29 | | | | handle seller funds recipient payout 30 | | |<---' 31 | | | 32 | | |----. 33 | | | | transfer NFT from escrow to winning bidder 34 | | |<---' 35 | | | 36 | | |----. 37 | | | | emit AuctionEnded() 38 | | |<---' 39 | | | 40 | | |----. 41 | | | | delete auction from contract 42 | | |<---' 43 | Caller ,-----------+------------. 44 | ,-. |ReserveAuctionListingEth| 45 | `-' `------------------------' 46 | /|\ 47 | | 48 | / \ 49 | -------------------------------------------------------------------------------- /uml/ReserveAuction/Listing/ETH/settleAuction.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ReserveAuctionListingEth 4 | 5 | Caller -> ReserveAuctionListingEth : settleAuction() 6 | 7 | ReserveAuctionListingEth -> ReserveAuctionListingEth : validate auction ended 8 | 9 | ReserveAuctionListingEth -> ReserveAuctionListingEth : handle royalty payouts 10 | 11 | alt listing fee configured for this auction? 12 | 13 | ReserveAuctionListingEth -> ReserveAuctionListingEth : handle listing fee payout 14 | 15 | else noop 16 | 17 | end 18 | 19 | ReserveAuctionListingEth -> ReserveAuctionListingEth : handle seller funds recipient payout 20 | ReserveAuctionListingEth -> ReserveAuctionListingEth : transfer NFT from escrow to winning bidder 21 | ReserveAuctionListingEth -> ReserveAuctionListingEth : emit AuctionEnded() 22 | ReserveAuctionListingEth -> ReserveAuctionListingEth : delete auction from contract 23 | 24 | @enduml -------------------------------------------------------------------------------- /uml/ZoraModuleManager/registerModule.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------. ,-----------------------. 5 | / \ |ZoraModuleManager| |ZoraProtocolFeeSettings| 6 | Registrar `--------+--------' `-----------+-----------' 7 | | registerModule() | | 8 | |----------------------->| | 9 | | | | 10 | | ----. | 11 | | | register module | 12 | | <---' | 13 | | | | 14 | | | mint() | 15 | | |------------------------------>| 16 | | | | 17 | | | ----. 18 | | | | mint token to registrar 19 | | | <---' 20 | | | | 21 | | ----. | 22 | | | emit ModuleRegistered() | 23 | | <---' | 24 | Registrar ,--------+--------. ,-----------+-----------. 25 | ,-. |ZoraModuleManager| |ZoraProtocolFeeSettings| 26 | `-' `-----------------' `-----------------------' 27 | /|\ 28 | | 29 | / \ 30 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/registerModule.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Registrar 3 | participant ZoraModuleManager 4 | participant ZoraProtocolFeeSettings 5 | 6 | Registrar -> ZoraModuleManager : registerModule() 7 | 8 | ZoraModuleManager -> ZoraModuleManager : register module 9 | ZoraModuleManager -> ZoraProtocolFeeSettings : mint() 10 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : mint token to registrar 11 | ZoraModuleManager -> ZoraModuleManager : emit ModuleRegistered() 12 | 13 | @enduml 14 | 15 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setApprovalForModule.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------. 5 | / \ |ZoraModuleManager| 6 | Caller `--------+--------' 7 | | setApprovalForModule()| 8 | | ----------------------> 9 | | | 10 | | |----. 11 | | | | set approval for module 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | emit ModuleApprovalSet() 16 | | |<---' 17 | Caller ,--------+--------. 18 | ,-. |ZoraModuleManager| 19 | `-' `-----------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setApprovalForModule.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ZoraModuleManager 4 | 5 | Caller -> ZoraModuleManager : setApprovalForModule() 6 | ZoraModuleManager -> ZoraModuleManager : set approval for module 7 | ZoraModuleManager -> ZoraModuleManager : emit ModuleApprovalSet() 8 | 9 | @enduml 10 | 11 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setApprovalForModuleBySig.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------. 5 | / \ |ZoraModuleManager| 6 | Caller `--------+--------' 7 | | setApprovalForModuleBySig()| 8 | | ---------------------------> 9 | | | 10 | | |----. 11 | | | | recover user address from signature 12 | | |<---' 13 | | | 14 | | |----. 15 | | | | set approval for module 16 | | |<---' 17 | | | 18 | | |----. 19 | | | | emit ModuleApprovalSet() 20 | | |<---' 21 | Caller ,--------+--------. 22 | ,-. |ZoraModuleManager| 23 | `-' `-----------------' 24 | /|\ 25 | | 26 | / \ 27 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setApprovalForModuleBySig.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ZoraModuleManager 4 | 5 | Caller -> ZoraModuleManager : setApprovalForModuleBySig() 6 | ZoraModuleManager -> ZoraModuleManager : recover user address from signature 7 | ZoraModuleManager -> ZoraModuleManager : set approval for module 8 | ZoraModuleManager -> ZoraModuleManager : emit ModuleApprovalSet() 9 | 10 | @enduml 11 | 12 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setBatchApprovalForModules.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------. 5 | / \ |ZoraModuleManager| 6 | Caller `--------+--------' 7 | | setBatchApprovalForModule()| 8 | | ---------------------------> 9 | | | 10 | | | 11 | | _____________________________________________________ 12 | | ! LOOP / for each module ! 13 | | !______/ | ! 14 | | ! |----. ! 15 | | ! | | set approval for module ! 16 | | ! |<---' ! 17 | | ! | ! 18 | | ! |----. ! 19 | | ! | | emit ModuleApprovalSet() ! 20 | | ! |<---' ! 21 | | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! 22 | Caller ,--------+--------. 23 | ,-. |ZoraModuleManager| 24 | `-' `-----------------' 25 | /|\ 26 | | 27 | / \ 28 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setBatchApprovalForModules.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Caller 3 | participant ZoraModuleManager 4 | 5 | Caller -> ZoraModuleManager : setBatchApprovalForModule() 6 | 7 | loop for each module 8 | 9 | ZoraModuleManager -> ZoraModuleManager : set approval for module 10 | ZoraModuleManager -> ZoraModuleManager : emit ModuleApprovalSet() 11 | 12 | end 13 | 14 | @enduml 15 | 16 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setRegistrar.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------. 5 | / \ |ZoraModuleManager| 6 | Registrar `--------+--------' 7 | | setRegistrar() | 8 | |----------------------->| 9 | | | 10 | | ----. 11 | | | set registrar 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit RegistrarChanged() 16 | | <---' 17 | Registrar ,--------+--------. 18 | ,-. |ZoraModuleManager| 19 | `-' `-----------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ZoraModuleManager/setRegistrar.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Registrar 3 | participant ZoraModuleManager 4 | 5 | Registrar -> ZoraModuleManager : setRegistrar() 6 | 7 | ZoraModuleManager -> ZoraModuleManager : set registrar 8 | ZoraModuleManager -> ZoraModuleManager : emit RegistrarChanged() 9 | 10 | @enduml 11 | 12 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/mint.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ZoraProtocolFeeSettings| 6 | Minter `-----------+-----------' 7 | | mint() | 8 | | ------------------------>| 9 | | | 10 | | ----. 11 | | | derive token ID from module address 12 | | <---' 13 | | | 14 | | ----. 15 | | | mint token to given address 16 | | <---' 17 | | | 18 | | return token ID | 19 | | <------------------------| 20 | Minter ,-----------+-----------. 21 | ,-. |ZoraProtocolFeeSettings| 22 | `-' `-----------------------' 23 | /|\ 24 | | 25 | / \ 26 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/mint.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Minter 3 | participant ZoraProtocolFeeSettings 4 | 5 | Minter -> ZoraProtocolFeeSettings : mint() 6 | 7 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : derive token ID from module address 8 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : mint token to given address 9 | ZoraProtocolFeeSettings -> Minter : return token ID 10 | 11 | @enduml 12 | 13 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setFeeParams.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ZoraProtocolFeeSettings| 6 | ModuleOwner `-----------+-----------' 7 | | setFeeParams() | 8 | |--------------------------->| 9 | | | 10 | | ----. 11 | | | set fee parameters 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit ProtocolFeeUpdated() 16 | | <---' 17 | ModuleOwner ,-----------+-----------. 18 | ,-. |ZoraProtocolFeeSettings| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setFeeParams.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor ModuleOwner 3 | participant ZoraProtocolFeeSettings 4 | 5 | ModuleOwner -> ZoraProtocolFeeSettings : setFeeParams() 6 | 7 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : set fee parameters 8 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : emit ProtocolFeeUpdated() 9 | 10 | @enduml 11 | 12 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setMetadata.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ZoraProtocolFeeSettings| 6 | Owner `-----------+-----------' 7 | | setMetadata() | 8 | |------------------------>| 9 | | | 10 | | ----. 11 | | | set metadata 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit MetadataUpdated() 16 | | <---' 17 | Owner ,-----------+-----------. 18 | ,-. |ZoraProtocolFeeSettings| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setMetadata.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Owner 3 | participant ZoraProtocolFeeSettings 4 | 5 | Owner -> ZoraProtocolFeeSettings : setMetadata() 6 | 7 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : set metadata 8 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : emit MetadataUpdated() 9 | 10 | @enduml 11 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setOwner.atxt: -------------------------------------------------------------------------------- 1 | ,-. 2 | `-' 3 | /|\ 4 | | ,-----------------------. 5 | / \ |ZoraProtocolFeeSettings| 6 | Owner `-----------+-----------' 7 | | setOwner() | 8 | |------------------------>| 9 | | | 10 | | ----. 11 | | | set owner 12 | | <---' 13 | | | 14 | | ----. 15 | | | emit OwnerUpdated() 16 | | <---' 17 | Owner ,-----------+-----------. 18 | ,-. |ZoraProtocolFeeSettings| 19 | `-' `-----------------------' 20 | /|\ 21 | | 22 | / \ 23 | -------------------------------------------------------------------------------- /uml/ZoraProtocolFeeSettings/setOwner.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor Owner 3 | participant ZoraProtocolFeeSettings 4 | 5 | Owner -> ZoraProtocolFeeSettings : setOwner() 6 | 7 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : set owner 8 | ZoraProtocolFeeSettings -> ZoraProtocolFeeSettings : emit OwnerUpdated() 9 | 10 | @enduml 11 | 12 | --------------------------------------------------------------------------------