The Swan protocol allows users to list and purchase NFTs through buyer agents. When an NFT is purchased, it should be fully transferred to the buyer including both the token and ownership rights.
The SwanAsset
contract inherits from both ERC721
and Ownable
, meaning NFTs have separate token ownership and contract ownership. The contract ownership controls administrative rights.
In the Swan.purchase()
function, when an NFT is purchased, only the ERC721 token is transferred to the buyer via transferFrom()
, but the contract ownership is not transferred:
This creates a discrepancy where the buyer owns the NFT token but the seller retains contract ownership and administrative control over the NFT contract.
The issue becomes particularly problematic given the TODO comment indicating plans to use asset.owner()
instead of seller
in the future. This would mean the protocol would check contract ownership rather than token ownership, breaking core functionality.
Medium. While currently the contract ownership retention doesn't directly impact core functionality, it:
Will break core protocol functionality if the planned change to use asset.owner()
is implemented
Creates an inconsistent ownership model that could confuse users and integrations
High. This issue affects every NFT purchase transaction in the protocol and will definitely cause problems if the planned changes are implemented.
Alice creates and lists an NFT through Swan.list()
Bob purchases the NFT through Swan.purchase()
The NFT token is transferred to Bob
Alice still retains contract ownership via Ownable
If the protocol is updated to use asset.owner()
, Bob won't be able to interact with the NFT despite being the token owner
Modify the purchase()
function to transfer both token and contract ownership:
This ensures the buyer receives full control of the NFT, maintaining consistency between token and contract ownership.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.