The transferRoyalties function within the Swan contract is responsible for handling royalty payments when an asset is listed or relisted. This function calculates the necessary fees and transfers tokens from the asset seller to the Swan contract, subsequently distributing portions to the buyer and the Swan owner.
It performs the following operations:
The function relies on the ERC20 transferFrom method to transfer buyerFee tokens from the seller to the Swan contract. This operation assumes that the seller has previously approved and continues to approve the Swan contract to spend at least buyerFee tokens on their behalf. If the allowance is revoked, the transferFrom call will fail, causing the entire transaction to revert.
The seller holds an ERC20 token balance sufficient to cover buyerFee.
The seller has revoked the allowance for the Swan contract to transfer buyerFee tokens on their behalf.
A missing approval allowance check means that the transferFrom call within transferRoyalties will fail.
The failure of transferFrom causes the entire transaction, including the asset listing or relisting, to revert. This prevents the asset from being successfully listed and halts the royalty transfer process.
Manual Review
Before attempting the transferFrom
operation, the transferRoyalties
function should explicitly check that the seller has set sufficient allowances and not revoked them. This can provide clearer error messages and prevent unexpected transaction reverts.
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.