Skip to content

Commit a1e10ab

Browse files
authored
Rename TCOMP_FEE_BPS; align calc_creators_fee and add is_royalty_enforced for both marketplace + AMM. (#25)
* Rename TCOMP_FEE_BPS -> TAKER_FEE_BPS to share b/w marketplace + amm. * Also change calc_creators_fee + add is_royalty_enforced.
1 parent 26369e2 commit a1e10ab

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

toolbox/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "tensor-toolbox"
33
description = "Toolbox of useful Rust utilities for Tensor Foundation's Solana programs"
44
repository = "https://github.com/tensor-foundation/toolbox"
55
homepage = "https://github.com/tensor-foundation/toolbox"
6-
version = "0.4.0"
6+
version = "0.5.0"
77
edition = "2021"
88
readme = "../README.md"
99
license = "Apache-2.0"

toolbox/src/common.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const HUNDRED_PCT_BPS: u64 = 10000;
1616
pub const HUNDRED_PCT: u64 = 100;
1717
pub const BROKER_FEE_PCT: u64 = 50;
1818
pub const TNSR_DISCOUNT_BPS: u64 = 2500;
19-
pub const TCOMP_FEE_BPS: u64 = 200;
19+
pub const TAKER_FEE_BPS: u64 = 200;
2020
pub const MAKER_BROKER_PCT: u64 = 80; // Out of 100
2121

2222
pub mod escrow {
@@ -134,20 +134,20 @@ pub fn calc_fees(args: CalcFeesArgs) -> Result<Fees> {
134134
})
135135
}
136136

137+
pub fn is_royalty_enforced(token_standard: Option<TokenStandard>) -> bool {
138+
matches!(
139+
token_standard,
140+
Some(TokenStandard::ProgrammableNonFungible)
141+
| Some(TokenStandard::ProgrammableNonFungibleEdition)
142+
)
143+
}
144+
137145
pub fn calc_creators_fee(
138146
seller_fee_basis_points: u16,
139147
amount: u64,
140-
token_standard: Option<TokenStandard>,
141-
optional_royalty_pct: Option<u16>,
148+
royalty_pct: Option<u16>,
142149
) -> Result<u64> {
143-
// Enforce royalties on pnfts.
144-
let adj_optional_royalty_pct = match token_standard {
145-
Some(TokenStandard::ProgrammableNonFungible)
146-
| Some(TokenStandard::ProgrammableNonFungibleEdition) => Some(100),
147-
_ => optional_royalty_pct,
148-
};
149-
150-
let creator_fee_bps = if let Some(royalty_pct) = adj_optional_royalty_pct {
150+
let creator_fee_bps = if let Some(royalty_pct) = royalty_pct {
151151
require!(royalty_pct <= 100, TensorError::BadRoyaltiesPct);
152152

153153
// If optional passed, pay optional royalties

0 commit comments

Comments
 (0)