Skip to content

royaltyInfo returns 0 if the result of the royaltyAmount calculation is less than 1 #27

Open
@marod424

Description

royaltyBPS isn't public, but royaltyInfo is callable, and it returns a royaltyAmount equal to the passed in _salePrice * royaltyBPS / 10_000.

Assuming a smallest royalty of 0.1%, if the sale price passed in is less than 1000, then the royaltyAmount will be less than 1, and since it's a uint256, its value is 0.

To avoid returning 0 when the royalty should be greater than 0, and in fact the royaltyBPS is greater than 0 in the contract, we can pass in a _salePrice of 10000 to reconstruct the royaltyBPS value. We can then calculate the royaltyInfo based on the actual sale price off chain. Therefore this is not critical, but the royaltyInfo call is misleading and can result in unexpected results.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions