Skip to content

Commit

Permalink
fix: add warn where trigger_value is below 0.1 grt (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosvdr authored Oct 4, 2024
1 parent ad8d4fb commit 203e1ec
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ impl Config {
),
_ => {}
}
let grt_wei = self.tap.max_amount_willing_to_lose_grt.get_value();
let decimal = BigDecimal::from_u128(grt_wei).unwrap();
let divisor = &self.tap.rav_request.trigger_value_divisor;
let trigger_value = (decimal / divisor)
.to_u128()
.expect("Could not represent the trigger value in u128");
let minimum_recommended_for_max_willing_to_lose_grt = 0.1;
if trigger_value
< minimum_recommended_for_max_willing_to_lose_grt
.to_u128()
.unwrap()
{
warn!(
"Trigger value is too low, currently below 0.1 GRT. \
Please modify `max_amount_willing_to_lose_grt` or `trigger_value_divisor`. \
It is best to have a higher trigger value, ideally above 1 GRT. \
Anything lower and the system may constantly deny the sender. \
`Trigger value` is defined by: \
(max_amount_willing_to_lose_grt / trigger_value_divisor) "
)
}

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

0 comments on commit 203e1ec

Please sign in to comment.