This repository has been archived by the owner on Oct 27, 2024. It is now read-only.
xiaoming90 - Original collection referrer will be overwritten when a new collection/work is created #265
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
xiaoming90
high
Original collection referrer will be overwritten when a new collection/work is created
Summary
Original collection referrers will be overwritten when a new collection/work is created. This results in the original collection referrers being unable to collect the fee they are entitled to, leading to a loss of assets for them.
Vulnerability Detail
Note
The following information is taken from the sponsor's response in the Contest's Discord Channel.
There are two types of referrers in this ecosystem. The first is a collection referrer, who refers the creation of a new Edition, and gets a cut of all mint fees for that Edition. The second is a mint referrer, who refers a mint and gets a cut of the mint fee for that mint.
The following describes the difference between collection referrer and mint referrer.
Assume that Alice creates a referral link to create a collection. Bob uses that link to publish a new collection/work called$Collection_A$ that is based on an Edition called $Edition_A$ . The collection referrer of $Collection_A$ will Alice.
Bob will call the following$Edition_A$ and the
TitlesCore.publish
function with theedition
parameter set toreferrer_
parameter will be automatically set to Alice by the front end.https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/TitlesCore.sol#L103
Within the
TitlesCore.publish
, the followingfeeManager.createRoute
function will be executed internally. ThefeeManager.createRoute
function will store Alice's wallet address within thereferrers[edition_]
mapping. Thus, the state of thereferrers
mapping will be as follows:referrers[Edition_A] = Alice
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L125
When someone mints a new token for$Collection_A$ , Alice, who is the collection referrer, will get a share of the minting fee per Line 421 below.
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L421
Let's assume Charles also creates a referral link to create a collection. David uses that link to publish a new collection/work called$Collection_B$ that is based on the same Edition called $Edition_A$ . The collection referral of $Collection_B$ will be Charles.
When the
FeeManager.createRoute
function is executed during the publishing of the new work/collection, Charles's wallet address will be stored within thereferrers[edition_]
mapping. Thus, the state of thereferrers
mapping will be as follows:referrers[Edition_A] = Charles
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L125
It is important to note that the$Collection_A$ , the collection referral fee will be routed to Charles instead of Alice. Alice is the referral for $Collection_A$ , yet she does not receive the referral fee, resulting in a loss of assets for Alice.
referrers[Edition_A]
have been updated from Alice to Charles here. At this point onwards, if someone mints tokens forImpact
Loss of assets as shown in the above scenario. The original collection referrers are unable to collect the fee they are entitled to, leading to a loss of assets for them.
Code Snippet
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/TitlesCore.sol#L103
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L125
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L421
Tool used
Manual Review
Recommendation
Consider the following changes to ensure that the collection referral fee is routed to the correct collection referrer for each collection/work.
With the following changes, Alice will continue to receive the collection referral fee for$Collection_A$ and Bob will receive the collection referral fee for $Collection_B$ even if there are multiple collections/works for a specific Edition.
The text was updated successfully, but these errors were encountered: