@@ -143,20 +143,23 @@ pub struct EthereumConfig {
143
143
pub escalation_policy : EscalationPolicyConfig ,
144
144
145
145
/// The minimum percentage profit to earn as a function of the callback cost.
146
- /// For example, 20 means a profit of 20% over the cost of the callback.
146
+ /// For example, 20 means a profit of 20% over the cost of a callback that uses the full gas limit .
147
147
/// The fee will be raised if the profit is less than this number.
148
- pub min_profit_pct : u64 ,
148
+ /// The minimum value for this is -100. If set to < 0, it means the keeper may lose money on callbacks that use the full gas limit.
149
+ pub min_profit_pct : i64 ,
149
150
150
151
/// The target percentage profit to earn as a function of the callback cost.
151
- /// For example, 20 means a profit of 20% over the cost of the callback.
152
+ /// For example, 20 means a profit of 20% over the cost of a callback that uses the full gas limit .
152
153
/// The fee will be set to this target whenever it falls outside the min/max bounds.
153
- pub target_profit_pct : u64 ,
154
+ /// The minimum value for this is -100. If set to < 0, it means the keeper may lose money on callbacks that use the full gas limit.
155
+ pub target_profit_pct : i64 ,
154
156
155
157
/// The maximum percentage profit to earn as a function of the callback cost.
156
- /// For example, 100 means a profit of 100% over the cost of the callback.
158
+ /// For example, 100 means a profit of 100% over the cost of a callback that uses the full gas limit .
157
159
/// The fee will be lowered if it is more profitable than specified here.
158
160
/// Must be larger than min_profit_pct.
159
- pub max_profit_pct : u64 ,
161
+ /// The minimum value for this is -100. If set to < 0, it means the keeper may lose money on callbacks that use the full gas limit.
162
+ pub max_profit_pct : i64 ,
160
163
161
164
/// Minimum wallet balance for the keeper. If the balance falls below this level, the keeper will
162
165
/// withdraw fees from the contract to top up. This functionality requires the keeper to be the fee
@@ -182,15 +185,20 @@ fn default_priority_fee_multiplier_pct() -> u64 {
182
185
183
186
#[ derive( Clone , Debug , serde:: Serialize , serde:: Deserialize ) ]
184
187
pub struct EscalationPolicyConfig {
185
- /// The initial gas multiplier to apply to the gas limit.
188
+ // The keeper will perform the callback as long as the tx is within this percentage of the configured gas limit.
189
+ // Default value is 110, meaning a 10% tolerance over the configured value.
190
+ #[ serde( default = "default_gas_limit_tolerance_pct" ) ]
191
+ pub gas_limit_tolerance_pct : u64 ,
192
+
193
+ /// The initial gas multiplier to apply to the tx gas estimate
186
194
#[ serde( default = "default_initial_gas_multiplier_pct" ) ]
187
195
pub initial_gas_multiplier_pct : u64 ,
188
196
189
- /// The gas multiplier to apply to the gas limit during backoff retries.
197
+ /// The gas multiplier to apply to the tx gas estimate during backoff retries.
190
198
/// The gas on each successive retry is multiplied by this value, with the maximum multiplier capped at `gas_multiplier_cap_pct`.
191
199
#[ serde( default = "default_gas_multiplier_pct" ) ]
192
200
pub gas_multiplier_pct : u64 ,
193
- /// The maximum gas multiplier to apply to the gas limit during backoff retries.
201
+ /// The maximum gas multiplier to apply to the tx gas estimate during backoff retries.
194
202
#[ serde( default = "default_gas_multiplier_cap_pct" ) ]
195
203
pub gas_multiplier_cap_pct : u64 ,
196
204
@@ -203,6 +211,10 @@ pub struct EscalationPolicyConfig {
203
211
pub fee_multiplier_cap_pct : u64 ,
204
212
}
205
213
214
+ fn default_gas_limit_tolerance_pct ( ) -> u64 {
215
+ 110
216
+ }
217
+
206
218
fn default_initial_gas_multiplier_pct ( ) -> u64 {
207
219
125
208
220
}
@@ -226,6 +238,7 @@ fn default_fee_multiplier_cap_pct() -> u64 {
226
238
impl Default for EscalationPolicyConfig {
227
239
fn default ( ) -> Self {
228
240
Self {
241
+ gas_limit_tolerance_pct : default_gas_limit_tolerance_pct ( ) ,
229
242
initial_gas_multiplier_pct : default_initial_gas_multiplier_pct ( ) ,
230
243
gas_multiplier_pct : default_gas_multiplier_pct ( ) ,
231
244
gas_multiplier_cap_pct : default_gas_multiplier_cap_pct ( ) ,
0 commit comments