4444pub struct RoyaltyInfo {
4545 pub collection_royalty_bps : Option < u16 > ,
4646 pub collection_royalty_recipient : Option < Addr > ,
47- pub collection_royalty_on_primary : Option < bool > ,
4847
4948 pub primary_complete : bool ,
5049}
@@ -54,7 +53,6 @@ impl Default for RoyaltyInfo {
5453 RoyaltyInfo {
5554 collection_royalty_bps : None ,
5655 collection_royalty_recipient : None ,
57- collection_royalty_on_primary : None ,
5856 primary_complete : false ,
5957 }
6058 }
@@ -101,35 +99,15 @@ pub type DefaultPluginCtx<'a> = PluginCtx<'a, DefaultXionAssetContext, Empty>;
10199
102100#[ cw_serde]
103101pub enum Plugin {
104- ExactPrice {
105- amount : Coin ,
106- } ,
107- MinimumPrice {
108- amount : Coin ,
109- } ,
110- RequiresProof {
111- proof : Vec < u8 > ,
112- } ,
113- NotBefore {
114- time : Expiration ,
115- } ,
116- NotAfter {
117- time : Expiration ,
118- } ,
119- TimeLock {
120- time : Duration ,
121- } ,
122- Royalty {
123- bps : u16 ,
124- recipient : Addr ,
125- on_primary : bool ,
126- } ,
127- AllowedMarketplaces {
128- marketplaces : Vec < Addr > ,
129- } ,
130- AllowedCurrencies {
131- denoms : Vec < Coin > ,
132- } ,
102+ ExactPrice { amount : Coin } ,
103+ MinimumPrice { amount : Coin } ,
104+ RequiresProof { proof : Vec < u8 > } ,
105+ NotBefore { time : Expiration } ,
106+ NotAfter { time : Expiration } ,
107+ TimeLock { time : Duration } ,
108+ Royalty { bps : u16 , recipient : Addr } ,
109+ AllowedMarketplaces { marketplaces : Vec < Addr > } ,
110+ AllowedCurrencies { denoms : Vec < Coin > } ,
133111}
134112
135113impl Display for Plugin {
@@ -141,15 +119,9 @@ impl Display for Plugin {
141119 Plugin :: NotBefore { time } => write ! ( f, "NotBefore: {}" , time) ,
142120 Plugin :: NotAfter { time } => write ! ( f, "NotAfter: {}" , time) ,
143121 Plugin :: TimeLock { time } => write ! ( f, "TimeLock: {:?}" , time) ,
144- Plugin :: Royalty {
145- bps,
146- recipient,
147- on_primary,
148- } => write ! (
149- f,
150- "Royalty: {} bps to {} on_primary: {}" ,
151- bps, recipient, on_primary
152- ) ,
122+ Plugin :: Royalty { bps, recipient } => {
123+ write ! ( f, "Royalty: {} bps to {}" , bps, recipient)
124+ }
153125 Plugin :: AllowedMarketplaces { marketplaces } => {
154126 write ! ( f, "AllowedMarketplaces: {:?}" , marketplaces)
155127 }
@@ -186,14 +158,9 @@ impl Plugin {
186158 ctx. data . not_after = * time;
187159 default_plugins:: not_after_plugin ( ctx) ?;
188160 }
189- Plugin :: Royalty {
190- bps,
191- recipient,
192- on_primary,
193- } => {
161+ Plugin :: Royalty { bps, recipient } => {
194162 ctx. royalty . collection_royalty_bps = Some ( * bps) ;
195163 ctx. royalty . collection_royalty_recipient = Some ( ( * recipient) . clone ( ) ) ;
196- ctx. royalty . collection_royalty_on_primary = Some ( * on_primary) ;
197164 default_plugins:: royalty_plugin ( ctx) ?;
198165 }
199166 Plugin :: AllowedMarketplaces { marketplaces } => {
@@ -217,14 +184,9 @@ impl Plugin {
217184 ctx : & mut PluginCtx < T , U > ,
218185 ) -> StdResult < bool > {
219186 match self {
220- Plugin :: Royalty {
221- bps,
222- recipient,
223- on_primary,
224- } => {
187+ Plugin :: Royalty { bps, recipient } => {
225188 ctx. royalty . collection_royalty_bps = Some ( * bps) ;
226189 ctx. royalty . collection_royalty_recipient = Some ( ( * recipient) . clone ( ) ) ;
227- ctx. royalty . collection_royalty_on_primary = Some ( * on_primary) ;
228190 default_plugins:: is_transfer_enabled_plugin ( ctx) ?;
229191 }
230192 _ => { }
@@ -847,27 +809,18 @@ pub mod default_plugins {
847809 }
848810
849811 pub fn royalty_plugin ( ctx : & mut PluginCtx < DefaultXionAssetContext , Empty > ) -> StdResult < bool > {
850- let ( recipient, bps, on_primary ) = match (
812+ let ( recipient, bps) = match (
851813 ctx. royalty . collection_royalty_recipient . clone ( ) ,
852814 ctx. royalty . collection_royalty_bps ,
853- ctx. royalty . collection_royalty_on_primary ,
854815 ) {
855- ( Some ( recipient) , Some ( bps) , on_primary ) => ( recipient, bps, on_primary ) ,
816+ ( Some ( recipient) , Some ( bps) ) => ( recipient, bps) ,
856817 _ => return Ok ( true ) ,
857818 } ;
858819
859820 if bps == 0 {
860821 return Ok ( true ) ;
861822 }
862823
863- let is_primary_sale = !ctx. royalty . primary_complete ;
864- let collect_on_primary = on_primary. unwrap_or ( false ) ;
865- let should_collect = !is_primary_sale || collect_on_primary;
866-
867- if !should_collect {
868- return Ok ( true ) ;
869- }
870-
871824 if let Some ( ask_price) = & ctx. data . ask_price {
872825 if ask_price. amount . is_zero ( ) {
873826 return Ok ( true ) ;
0 commit comments