Skip to content

Commit 8213637

Browse files
committed
other requested changes
1 parent 5347689 commit 8213637

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

adview-manager/serve/src/routes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,13 @@ pub async fn get_preview_ad(Extension(state): Extension<Arc<State>>) -> Html<Str
9191

9292
// Mock the `get_units_for_slot_resp` call
9393
let mock_call = Mock::given(method("GET"))
94-
// &depositAssets[]={}&depositAssets[]={}
9594
.and(path(format!("units-for-slot/{}", options.market_slot)))
9695
// pubPrefix=HEX&depositAssets[]=0xASSET1&depositAssets[]=0xASSET2
9796
.and(query_param("pubPrefix", pub_prefix))
9897
.and(query_param(
9998
"depositAssets[]",
10099
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
101100
))
102-
// .and(query_param("depositAssets[]", "0x6B175474E89094C44Da98b954EedeAC495271d03"))
103101
.respond_with(ResponseTemplate::new(200).set_body_json(units_for_slot_resp))
104102
.expect(1)
105103
.named("get_units_for_slot_resp");

adview-manager/src/manager.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ pub struct Options {
8282
#[serde(default)]
8383
pub disabled_sticky: bool,
8484
/// List of validators to query /units-for-slot from
85-
///
86-
/// default: `[]`
87-
#[serde(default)]
8885
pub validators: Vec<ApiUrl>,
8986
}
9087

@@ -263,9 +260,7 @@ impl Manager {
263260
let first_validator = self
264261
.options
265262
.validators
266-
.clone()
267-
.into_iter()
268-
.next()
263+
.get(0)
269264
.ok_or(Error::NoValidators)?;
270265

271266
let url = first_validator
@@ -277,7 +272,7 @@ impl Manager {
277272
// Ordering of the campaigns matters so we will just push them to the first result
278273
// We reuse `targeting_input_base`, `accepted_referrers` and `fallback_unit`
279274
let mut first_res: Response = self.client.get(url.as_str()).send().await?.json().await?;
280-
// let mut first_res: Response = serde_json::from_str(&json_res).expect("Should convert");
275+
281276
for validator in self.options.validators.iter().skip(1) {
282277
let url = validator
283278
.join(&format!(
@@ -290,8 +285,7 @@ impl Manager {
290285
if !first_res
291286
.campaigns
292287
.iter()
293-
.map(|rc| rc.campaign.id)
294-
.any(|x| x == response_campaign.campaign.id)
288+
.any(|c| c.campaign.id == response_campaign.campaign.id)
295289
{
296290
first_res.campaigns.push(response_campaign);
297291
}
@@ -585,9 +579,7 @@ mod test {
585579
// 2. Set up a manager
586580
let market_url = server.uri().parse().unwrap();
587581
let whitelisted_tokens = DEFAULT_TOKENS.clone();
588-
let publisher_addr = "0x0000000000000000626f62627973686d75726461"
589-
.parse()
590-
.unwrap();
582+
591583
let validator_1_url =
592584
ApiUrl::parse(&format!("{}/validator-1", server.uri())).expect("should parse");
593585
let validator_2_url =
@@ -597,7 +589,7 @@ mod test {
597589
let options = Options {
598590
market_url,
599591
market_slot: DUMMY_IPFS[0],
600-
publisher_addr,
592+
publisher_addr: *PUBLISHER,
601593
// All passed tokens must be of the same price and decimals, so that the amounts can be accurately compared
602594
whitelisted_tokens,
603595
size: Some(Size::new(300, 100)),

0 commit comments

Comments
 (0)