@@ -2,8 +2,9 @@ use std::ops::{Add, Mul};
22
33use adex_primitives:: {
44 campaign:: Validators ,
5- sentry:: { Event , EventType , InsertEventsRequest , CLICK , IMPRESSION } ,
6- supermarket:: units_for_slot:: response:: AdUnit ,
5+ sentry:: {
6+ units_for_slot:: response:: AdUnit , Event , EventType , InsertEventsRequest , CLICK , IMPRESSION ,
7+ } ,
78 BigNum , CampaignId ,
89} ;
910use num_integer:: Integer ;
@@ -68,7 +69,7 @@ pub(crate) fn is_video(ad_unit: &AdUnit) -> bool {
6869
6970/// Does not copy the JS impl, instead it generates the BigNum from the IPFS CID bytes
7071pub ( crate ) fn randomized_sort_pos ( ad_unit : & AdUnit , seed : BigNum ) -> BigNum {
71- let bytes = ad_unit. id . 0 . to_bytes ( ) ;
72+ let bytes = ad_unit. ipfs . 0 . to_bytes ( ) ;
7273
7374 let unit_id = BigNum :: from_bytes_be ( & bytes) ;
7475
@@ -138,13 +139,13 @@ pub fn get_unit_html_with_events(
138139 let event = match event_type {
139140 EventType :: Impression => Event :: Impression {
140141 publisher : options. publisher_addr ,
141- ad_unit : ad_unit. id ,
142+ ad_unit : ad_unit. ipfs ,
142143 ad_slot : options. market_slot ,
143144 referrer : Some ( "document.referrer" . to_string ( ) ) ,
144145 } ,
145146 EventType :: Click => Event :: Click {
146147 publisher : options. publisher_addr ,
147- ad_unit : ad_unit. id ,
148+ ad_unit : ad_unit. ipfs ,
148149 ad_slot : options. market_slot ,
149150 referrer : Some ( "document.referrer" . to_string ( ) ) ,
150151 } ,
@@ -204,7 +205,7 @@ mod test {
204205
205206 fn get_ad_unit ( media_mime : & str ) -> AdUnit {
206207 AdUnit {
207- id : DUMMY_IPFS [ 0 ] ,
208+ ipfs : DUMMY_IPFS [ 0 ] ,
208209 media_url : "" . to_string ( ) ,
209210 media_mime : media_mime. to_string ( ) ,
210211 target_url : "" . to_string ( ) ,
@@ -237,7 +238,7 @@ mod test {
237238 #[ test]
238239 fn test_randomized_position ( ) {
239240 let ad_unit = AdUnit {
240- id : DUMMY_IPFS [ 0 ] ,
241+ ipfs : DUMMY_IPFS [ 0 ] ,
241242 media_url : "ipfs://QmWWQSuPMS6aXCbZKpEjPHPUZN2NjB3YrhJTHsV4X3vb2t" . to_string ( ) ,
242243 media_mime : "image/jpeg" . to_string ( ) ,
243244 target_url : "https://google.com" . to_string ( ) ,
0 commit comments