Skip to content

Commit b01fb20

Browse files
authored
Merge pull request #480 from AmbireTech/issue-471-route-units-for-slot
Issue #471 Route `POST /units-for-slot`
2 parents 0c58faa + 236ec88 commit b01fb20

32 files changed

+1363
-744
lines changed

Cargo.lock

Lines changed: 178 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adview-manager/serve/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::sync::Arc;
22

33
use adex_primitives::{
4+
sentry::IMPRESSION,
45
supermarket::units_for_slot,
56
targeting::{input::Global, Input},
67
test_util::{DUMMY_CAMPAIGN, DUMMY_IPFS},
@@ -77,11 +78,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7778
targeting_input_base: Input {
7879
ad_view: None,
7980
global: Global {
80-
ad_slot_id: options.market_slot.to_string(),
81+
ad_slot_id: options.market_slot,
8182
ad_slot_type: "".into(),
8283
publisher_id: publisher_addr,
8384
country: Some("Bulgaria".into()),
84-
event_type: "IMPRESSION".into(),
85+
event_type: IMPRESSION,
8586
seconds_since_epoch: Utc::now(),
8687
user_agent_os: None,
8788
user_agent_browser_family: None,

adview-manager/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ pub fn get_unit_html_with_events(
211211
let event = match event_type {
212212
"CLICK" => Event::Click {
213213
publisher: options.publisher_addr,
214-
ad_unit: Some(ad_unit.id),
215-
ad_slot: Some(options.market_slot),
214+
ad_unit: ad_unit.id,
215+
ad_slot: options.market_slot,
216216
referrer: Some("document.referrer".to_string()),
217217
},
218218
_ => Event::Impression {
219219
publisher: options.publisher_addr,
220-
ad_unit: Some(ad_unit.id),
221-
ad_slot: Some(options.market_slot),
220+
ad_unit: ad_unit.id,
221+
ad_slot: options.market_slot,
222222
referrer: Some("document.referrer".to_string()),
223223
},
224224
};

docs/config/dev.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ creators_whitelist = []
2727
validators_whitelist = []
2828
admins = ['0xce07CbB7e054514D590a0262C93070D838bFBA2e']
2929

30+
[platform]
31+
url = "https://platform.adex.network"
32+
# 20 minutes in milliseconds
33+
keep_alive_interval = 1200000
34+
35+
[limits.units_for_slot]
36+
# The maximum number of campaigns a publisher can earn from
37+
# This will limit the returned Campaigns to the set number
38+
max_campaigns_earning_from = 25
39+
40+
# 0.01 (UnifiedNum) per 1000 impressions
41+
# 1_000 * (per) 1_000 / 10^8 = 0.01
42+
global_min_impression_price = '1000000'
43+
3044
# Ethereum mainnet tokens
3145
[chain."Ethereum Mainnet"]
3246
# Ethereum Mainnet for testing

0 commit comments

Comments
 (0)