Skip to content

Commit 2a25222

Browse files
committed
feat: add warn where trigger_value is below 0.1 grt
1 parent 676a437 commit 2a25222

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

config/src/config.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ impl Config {
9494
),
9595
_ => {}
9696
}
97+
let grt_wei = self.tap.max_amount_willing_to_lose_grt.get_value();
98+
let decimal = BigDecimal::from_u128(grt_wei).unwrap();
99+
let divisor = &self.tap.rav_request.trigger_value_divisor;
100+
let trigger_value = (decimal / divisor)
101+
.to_u128()
102+
.expect("Could not represent the trigger value in u128");
103+
let minimum_recommended_for_max_willing_to_lose_grt = 0.1;
104+
if trigger_value
105+
< minimum_recommended_for_max_willing_to_lose_grt
106+
.to_u128()
107+
.unwrap()
108+
{
109+
warn!(
110+
"Trigger value is too low,currently below 0.1 GRT. \
111+
Please modify `max_amount_willing_to_lose_grt` or `trigger_value_divisor`.
112+
To have a higher trigger value, ideally above 1 GRT \
113+
Anything lower can cause issues with the heaviest \
114+
allocation not returning any receipts.
115+
`Trigger value` is defined by \
116+
(max_amount_willing_to_lose_grt / trigger_value_divisor) "
117+
)
118+
}
97119

98120
let ten: BigDecimal = 10.into();
99121
let usual_grt_price = BigDecimal::from_str("0.0001").unwrap() * ten;

0 commit comments

Comments
 (0)