Skip to content

Trader fees - #16

Open
kainanaina wants to merge 6 commits into
mainfrom
trader-fees
Open

Trader fees#16
kainanaina wants to merge 6 commits into
mainfrom
trader-fees

Conversation

@kainanaina

@kainanaina kainanaina commented Jul 5, 2022

Copy link
Copy Markdown
Contributor

Adds fees support to makeOrder for trader platform via marketplacesConfig param.
Fee can either be { recipient: string; amount: bigint } or {recipient: string; basisPoints: number }.
Method calculateFees converts all fees amounts to BigNumber string, and computes BigNumber amount for basisPoints (amount * basisPoints / 10000). It properly asserts that no specific fee can be greater or equal to ERC20 amount, including the total fee value.
After total fees are computed, they are subtracted from ERC20 amount to give us the final amount, because nft-swap-sdk by default adds fees on top of the original amount, while we want fees to be part of the original price.
https://github.com/trader-xyz/nft-swap-sdk/blob/main/src/sdk/v4/NftSwapV4.ts#L1146

@kainanaina
kainanaina requested review from leeyikjiun and yongwee July 5, 2022 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant