Skip to content
Business logic Audit finding Intermediate

RoyaltyVault.sol is Not Equipped to Handle On-Chain Royalties From Secondary Sales

The royalty vault was meant to collect fees on both primary and secondary sales, but no on-chain mechanism existed for secondary-sale royalties. As a result, collection owners could miss out on those fees, and users could avoid paying them by trading on other marketplaces.

leastwood Follow

Originally disclosed on Code4rena

Submitted by leastwood

https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol

https://github.com/code-423n4/2022-03-joyn/blob/main/royalty-vault/contracts/RoyaltyVault.sol

Impact

The Joyn documentation mentions that Joyn royalty vaults should be equipped to handle revenue generated on a collection’s primary and secondary sales. Currently, CoreCollection.sol allows the collection owner to receive a fee on each token mint, however, there is no existing implementation which allows the owner of a collection to receive fees on secondary sales.

After discussion with the Joyn team, it appears that this will be gathered from Opensea which does not have an on-chain royalty mechanism. As such, each collection will need to be added manually on Opensea, introducing further centralisation risk. It is also possible for users to avoid paying the secondary fee by using other marketplaces such as Foundation.

Recommended Mitigation Steps

Consider implementing the necessary functionality to allow for the collection of fees through an on-chain mechanism. ERC2981 outlines the appropriate behaviour for this.

sofianeOuafir (Joyn) confirmed and commented:

This is a great observation. Something we are aware of and intend to fix as well. 👍


The original report as published on Code4rena, by leastwood. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contracts were built without any on-chain royalty standard, so secondary-sale fees depended on an external marketplace being configured by hand.

Impact

Collection owners may not receive secondary-sale fees, and users could avoid paying them by using other marketplaces such as Foundation.

What the attacker needed

Collection owner relies on secondary fees; buyer uses a marketplace without royalties

The fix

The team should add an on-chain royalty mechanism following the ERC2981 standard; the report says they intend to fix it.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When an NFT is resold, the original creator often gets a small cut called a royalty. This project only had a way to take a fee when tokens were first created, not when they were resold later. So creators could lose that income, and buyers could dodge the fee by selling somewhere else.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by leastwood

View all

70 more disclosed reports, best first.

More from Joyn contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.