Royalty fees NFT Wrapper (secondary/subsequent fees)
=====
1. Auction is ended and it has a winning bid
2. Get royalty fees for the given sale
3. Create a fees array containing the marketplace fee % and the sponsor fee % (sponsor value is according to the royalty fee on the given sale)
4. Calculate the fee values passing as an argument the fees array created above, using the Fees library (calling `calculate` on Fee[] fees).
5. Distributes fees
Current implementation in this function accesses the fees array using static indexes
- index 0 for marketplace fee
- index 1 for sponsor fee
I think it’s time to make this more generic, we can iterate over the the fees array
and call `updateBalance` for every entry on the array though I think you’re already doing it, I’m not sure)
```mermaid
sequenceDiagram
title: Royalty fees
actor Buyer
actor Seller
participant Listing Manager
participant Mktp Configuration
participant Fee Library
participant NFT Wrapper
Seller ->> Listing Manager: list asset
Listing Manager->>Mktp Configuration: Get royalty fees for the given sale
Mktp Configuration->>Listing Manager: Returns royalty fee %
Listing Manager-)Listing Manager: creates `saleTo` fee argument with the right fees %
alt Calculates fees values using fee library
Listing Manager->>Fee Library: calculate(Fee [], ...)
Fee Library->>Listing Manager: returns fees
end
Listing Manager->>NFT Wrapper: saleTo(fees, payees, ...)
NFT Wrapper->>NFT Wrapper: Distribute fees
NFT Wrapper->>Buyer: transfer asset
```