Closed sherlock-admin4 closed 3 months ago
As per the updated readme, ERC20 issues are not valid
I think this is a relevant issue that isn't exactly tied to ERC20 or token handling, but rather from expectations about the api.
what do you think @xiaoming9090 ?
xiaoming90
high
Incorrect assets will be charged during minting and creation of work.
Summary
Incorrect assets will be charged as the minting fee or creation fee, resulting in a loss of assets for either the users or the creator.
Vulnerability Detail
During the publishing of a new work/collection of an Edition, the creator is given the option to set the fee to be collected to ETH or an arbitrary ERC20 token, as shown in Line 337 below. Assume that Bob wants to collect the fee in WETH. Thus, he will set the
strategy_.asset
to USDC ERC20 address when creating his new work/collection.https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L337
The
getMintFee
function will be triggered to compute the minting fee when someone mints a token from Bob's collection.However, as shown in Line 256 below, the assets to be collected as fee is always hardcoded to native ETH (ETH_ADDRESS). Thus, ETH instead of USDC will be charged as a fee, which is incorrect.
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L256
The same issue also occurs during the creation of the new Edition. The scenario is exactly the same, and omitted for brevity.
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L225
Impact
Incorrect assets will be charged as the minting fee or creation fee, resulting in a loss of assets for either the users or the creator.
Code Snippet
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L337
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L256
https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L225
Tool used
Manual Review
Recommendation
Consider the following change to ensure that the correct asset is charged as the minting or creation fee.