@@ -14,7 +14,7 @@ pub struct Banner {
14
14
}
15
15
16
16
#[ cw_serde]
17
- pub struct Action {
17
+ pub struct NewsAction {
18
18
pub label : String ,
19
19
pub url : String ,
20
20
}
@@ -25,17 +25,7 @@ pub struct News {
25
25
pub subtitle : String ,
26
26
pub text : String ,
27
27
pub image : String ,
28
- pub actions : Option < Vec < Action > > ,
29
- }
30
-
31
- #[ cw_serde]
32
- pub struct MarketingCollectionPreview {
33
- pub address : String ,
34
- pub image_uri : String ,
35
- pub collection_name : String ,
36
- pub creator_name : String ,
37
- pub twitter_url : String ,
38
- pub secondary_during_mint : bool ,
28
+ pub actions : Option < Vec < NewsAction > > ,
39
29
}
40
30
41
31
#[ cw_serde]
@@ -47,9 +37,6 @@ pub struct MarketingContract {
47
37
pub ( crate ) config : Item < ' static , Config > ,
48
38
pub ( crate ) banners : Map < ' static , u64 , Banner > ,
49
39
pub ( crate ) news : Map < ' static , u64 , News > ,
50
- pub ( crate ) upcoming_collections : Map < ' static , u64 , MarketingCollectionPreview > ,
51
- pub ( crate ) live_collections : Map < ' static , u64 , MarketingCollectionPreview > ,
52
- pub ( crate ) highlighted_collections : Map < ' static , u64 , MarketingCollectionPreview > ,
53
40
}
54
41
55
42
#[ entry_points]
@@ -61,9 +48,6 @@ impl MarketingContract {
61
48
config : Item :: new ( "config" ) ,
62
49
banners : Map :: new ( "banners" ) ,
63
50
news : Map :: new ( "news" ) ,
64
- upcoming_collections : Map :: new ( "upcoming_collections" ) ,
65
- live_collections : Map :: new ( "live_collections" ) ,
66
- highlighted_collections : Map :: new ( "highlighted_collections" ) ,
67
51
}
68
52
}
69
53
@@ -142,72 +126,6 @@ impl MarketingContract {
142
126
Ok ( Response :: new ( ) . add_attributes ( attributes) )
143
127
}
144
128
145
- #[ msg( exec) ]
146
- // Only the admin can execute it
147
- pub fn update_live_collections (
148
- & self ,
149
- ctx : ExecCtx ,
150
- live_collections : Vec < MarketingCollectionPreview > ,
151
- ) -> Result < Response , ContractError > {
152
- let attributes = vec ! [ attr( "action" , "update_live_collections" ) ] ;
153
- let config = self . config . load ( ctx. deps . storage ) ?;
154
- // Permission check
155
- if ctx. info . sender != config. admin_addr {
156
- return Err ( ContractError :: Unauthorized ) ;
157
- }
158
- // Replace all live_collections with the new ones
159
- self . live_collections . clear ( ctx. deps . storage ) ;
160
- for ( index, live_collection) in live_collections. into_iter ( ) . enumerate ( ) {
161
- self . live_collections . save ( ctx. deps . storage , index as u64 , & live_collection) ?;
162
- }
163
-
164
- Ok ( Response :: new ( ) . add_attributes ( attributes) )
165
- }
166
-
167
- #[ msg( exec) ]
168
- // Only the admin can execute it
169
- pub fn update_upcoming_collections (
170
- & self ,
171
- ctx : ExecCtx ,
172
- upcoming_collections : Vec < MarketingCollectionPreview > ,
173
- ) -> Result < Response , ContractError > {
174
- let attributes = vec ! [ attr( "action" , "update_upcoming_collections" ) ] ;
175
- let config = self . config . load ( ctx. deps . storage ) ?;
176
- // Permission check
177
- if ctx. info . sender != config. admin_addr {
178
- return Err ( ContractError :: Unauthorized ) ;
179
- }
180
- // Replace all upcoming_collections with the new ones
181
- self . upcoming_collections . clear ( ctx. deps . storage ) ;
182
- for ( index, upcoming_collection) in upcoming_collections. into_iter ( ) . enumerate ( ) {
183
- self . upcoming_collections . save ( ctx. deps . storage , index as u64 , & upcoming_collection) ?;
184
- }
185
-
186
- Ok ( Response :: new ( ) . add_attributes ( attributes) )
187
- }
188
-
189
- #[ msg( exec) ]
190
- // Only the admin can execute it
191
- pub fn update_highlighted_collections (
192
- & self ,
193
- ctx : ExecCtx ,
194
- highlighted_collections : Vec < MarketingCollectionPreview > ,
195
- ) -> Result < Response , ContractError > {
196
- let attributes = vec ! [ attr( "action" , "update_highlighted_collections" ) ] ;
197
- let config = self . config . load ( ctx. deps . storage ) ?;
198
- // Permission check
199
- if ctx. info . sender != config. admin_addr {
200
- return Err ( ContractError :: Unauthorized ) ;
201
- }
202
- // Replace all highlighted_collections with the new ones
203
- self . highlighted_collections . clear ( ctx. deps . storage ) ;
204
- for ( index, highlighted_collection) in highlighted_collections. into_iter ( ) . enumerate ( ) {
205
- self . highlighted_collections . save ( ctx. deps . storage , index as u64 , & highlighted_collection) ?;
206
- }
207
-
208
- Ok ( Response :: new ( ) . add_attributes ( attributes) )
209
- }
210
-
211
129
#[ msg( query) ]
212
130
pub fn get_config ( & self , ctx : QueryCtx ) -> StdResult < Config > {
213
131
let config = self . config . load ( ctx. deps . storage ) ?;
@@ -235,39 +153,6 @@ impl MarketingContract {
235
153
236
154
Ok ( news)
237
155
}
238
-
239
- #[ msg( query) ]
240
- pub fn get_live_collections ( & self , ctx : QueryCtx ) -> StdResult < Vec < MarketingCollectionPreview > > {
241
- let live_collections: Vec < MarketingCollectionPreview > = self
242
- . live_collections
243
- . range ( ctx. deps . storage , None , None , cosmwasm_std:: Order :: Ascending )
244
- . map ( |item| item. map ( |( _, live_collection) | live_collection) )
245
- . collect :: < StdResult < Vec < MarketingCollectionPreview > > > ( ) ?;
246
-
247
- Ok ( live_collections)
248
- }
249
-
250
- #[ msg( query) ]
251
- pub fn get_upcoming_collections ( & self , ctx : QueryCtx ) -> StdResult < Vec < MarketingCollectionPreview > > {
252
- let upcoming_collections: Vec < MarketingCollectionPreview > = self
253
- . upcoming_collections
254
- . range ( ctx. deps . storage , None , None , cosmwasm_std:: Order :: Ascending )
255
- . map ( |item| item. map ( |( _, upcoming_collection) | upcoming_collection) )
256
- . collect :: < StdResult < Vec < MarketingCollectionPreview > > > ( ) ?;
257
-
258
- Ok ( upcoming_collections)
259
- }
260
-
261
- #[ msg( query) ]
262
- pub fn get_highlighted_collections ( & self , ctx : QueryCtx ) -> StdResult < Vec < MarketingCollectionPreview > > {
263
- let highlighted_collections: Vec < MarketingCollectionPreview > = self
264
- . highlighted_collections
265
- . range ( ctx. deps . storage , None , None , cosmwasm_std:: Order :: Ascending )
266
- . map ( |item| item. map ( |( _, highlighted_collection) | highlighted_collection) )
267
- . collect :: < StdResult < Vec < MarketingCollectionPreview > > > ( ) ?;
268
-
269
- Ok ( highlighted_collections)
270
- }
271
156
}
272
157
273
158
0 commit comments