From 2c61f5d0003395ba050e2a920cf858e31e02fe74 Mon Sep 17 00:00:00 2001 From: Maxime Vanmeerbeck Date: Wed, 4 Oct 2023 18:58:26 +0200 Subject: [PATCH] del outdated md --- .../royalties-registry/RoyaltyRegistry.md | 29 ------- .../transfer-manager/TransferExecutor.md | 10 --- .../transfer-manager/TransferManager.md | 77 ------------------- 3 files changed, 116 deletions(-) delete mode 100644 packages/marketplace/contracts/royalties-registry/RoyaltyRegistry.md delete mode 100644 packages/marketplace/contracts/transfer-manager/TransferExecutor.md delete mode 100644 packages/marketplace/contracts/transfer-manager/TransferManager.md diff --git a/packages/marketplace/contracts/royalties-registry/RoyaltyRegistry.md b/packages/marketplace/contracts/royalties-registry/RoyaltyRegistry.md deleted file mode 100644 index b7508e5c43..0000000000 --- a/packages/marketplace/contracts/royalties-registry/RoyaltyRegistry.md +++ /dev/null @@ -1,29 +0,0 @@ - # Features - - `RoyaltiesRegistry` contract allows to processing different types of royalties: - -* `royaltiesByToken` -* v2 -* v1 -* external provider -* EIP-2981 - -## Methods - -* Sets royalties for the entire collection (`royaltiesByToken`) - - ```javascript - function setRoyaltiesByToken(address token, LibPart.Part[] memory royalties) external - ``` - -* Sets the provider's royalties — a separate contract that will return the royalties - - ```javascript - function setProviderByToken(address token, address provider) external - ``` - -* The implementation of Royalties v2, v1 and EIP-2981 is located inside the token and processed in this method - - ```javascript - function getRoyalties(address token, uint tokenId) - ``` diff --git a/packages/marketplace/contracts/transfer-manager/TransferExecutor.md b/packages/marketplace/contracts/transfer-manager/TransferExecutor.md deleted file mode 100644 index d1d6e9b3f5..0000000000 --- a/packages/marketplace/contracts/transfer-manager/TransferExecutor.md +++ /dev/null @@ -1,10 +0,0 @@ -#### Features - -`TransferExecutor.transfer` function should be able to transfer any supported Asset (see more at [LibAsset](../lib-asset/LibAsset.md)) from one side of the order to the other side of the order. - -Transfer is made using different types of contracts. There are 3 types of transfer proxies used by `TransferExecutor`: -- INftTransferProxy - this proxy is used to transfer NFTs (ERC-721 and ERC-1155) -- IERC20TransferProxy - this proxy is used to transfer ERC20 tokens -- ITransferProxy - this is generic proxy used to transfer all other types of Assets - -`TransferExecutor` has setTransferProxy to register new types of transfer proxies (when new types of Assets gets registered) diff --git a/packages/marketplace/contracts/transfer-manager/TransferManager.md b/packages/marketplace/contracts/transfer-manager/TransferManager.md deleted file mode 100644 index 7df10aa053..0000000000 --- a/packages/marketplace/contracts/transfer-manager/TransferManager.md +++ /dev/null @@ -1,77 +0,0 @@ -### Features - -[TransferManager](TransferManager.sol) is [ITransferManager](./interfaces/ITransferManager.sol). -It's responsible for transferring all Assets. This manager supports different types of fees, also it supports different beneficiaries (specified in Order.data) - -Types of fees supported: -- (!DEPRECATED) protocol fee (controlled by `protocolFee` field) -- origin fee (is coming from `Order.data`) -- royalties (provided by external `IRoyaltiesProvider`) - -### Algorithm -The transferring of assets takes places inside `doTransfers`, it takes following parameters as arguments: -- `LibAsset.AssetType` `makeMatch` - `AssetType` of a make-side asset of the order -- `LibAsset.AssetType` `takeMatch` - `AssetType` of a take-side asset of the order -- `LibFill.FillResult` `fill` - values from both sides to be transferred by this match -- `LibOrder.Order` `leftOrder` - left order data -- `LibOrder.Order` `rightOrder` - right order data - -Then, in this method the following actions are done: - -1. At first, fee side of the deal is calculated (Asset that can be interpreted as money). All fees and royalties will be taken in that Asset. - - to do so, we use `LibFeeSide.getFeeSide`, it takes assetClasses of both sides as arguments (e.g. "`ETH`" and "`ERC20`") and tries to determine which side is the fee side - - firstly it checks both assets for being `ETH`, if assetClass of any side is `ETH` then that side is the fee-side - - if there is no `ETH` in this match, both sides are checked for being `ERC20` - - then both sides are checked for being `ERC1155` - - if there are no `ETH`, `ERC20` or `ERC1155` in this match, then the fee side is `NONE` - - checks are made from make to take side, e.g. if both sides are `ERC20` then the make side is the fee side - -2. then transfers are made: - - if fee side is make: - - `doTransfersWithFees` is called for the make side, - - `transferPayouts` for the take side - - fee side is take - - `doTransfersWithFees` is called for the take side, - - `transferPayouts` for the make side - - fee side is NONE: - - `transferPayouts` is called for both sides - -- `doTransfersWithFees` - - calculates total amount of asset that is going to be transferred - - then royalties are transferred - - royalty is a fee that transferred to creator of `ERC1155`/`ERC721` token from every purchase - - royalties can't be over 50 % - - after that, origin fees are transferred - - origin fees can be added to any order, it's an array of address + value - - finally, `transferPayouts` is executed as the final action of `doTransfersWithFees` - -![Fees](../../exchange-v2/images/fees.svg) - -- `transferPayouts` - - transfers assets to payout address - - orders can have any number of payout addresses, e.g. payouts can be split 50/50 between 2 accounts, or any other way - - payuots are set in order by order maker - - if `transferPayouts` called in the end of `doTransfersWithFees`, then it transfers all that's left after paying fees - - if `transferPayouts` called for the nft side (non fee side), then it transfers full amount of this asset - - -So, to sum it all up, lets try to calculate all fees for a simple example (for V1 and V2 orders) -- there are 2 orders - 1. `ETH 100` => `1 ERC721`, `orderMaker` = acc1, `origins` = [[acc2, 3%], [acc3, 10%]], `payouts` = [[acc1, 100%]] - 2. `1 ERC721` => `100 ETH`, `orderMaker` = acc4, `origins` = [[]], `payouts` = [[acc4, 70%], [acc5, 30%]] -- royalty is set to 30% -- these are new orders, so they don't have previous fills -- fee side here is ETH, so we do - - `transferPayouts`(1 ERC721) - - there is only one payout address and 1 token, so it simply gets transferred to acc1 - - `doTransfersWithFees`(100 ETH) - - let's calculate ETH amount to be sent by acc1 - - 100 ETH + 3% acc2-origin + 10% acc3-origin = 100 + 0,13*100 = 113 ETH - - so acc1 needs to send 113 ETH, from which 3 are sent to acc2 as origin, 10 are sent to acc3 as origin too ( 100 ETH left) - - 30 ETH paid as royalty to nft creator, 70 left - - right order doesn't have origins, so we skip it - - what's left is divided between acc4 and acc5, as it says in right order payouts (`payouts` = [[acc4, 70%], [acc5, 30%]]), so 49 ETH goes to acc4, 21 ETH to acc5 - - - -