@@ -101,12 +101,12 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
101
101
_setLimit (limit, _getOutboundLimitParamsStorage ());
102
102
}
103
103
104
- function _getOutboundLimitParams () internal pure returns (RateLimitParams memory ) {
104
+ function getOutboundLimitParams () public pure returns (RateLimitParams memory ) {
105
105
return _getOutboundLimitParamsStorage ();
106
106
}
107
107
108
108
function getCurrentOutboundCapacity () public view returns (uint256 ) {
109
- TrimmedAmount memory trimmedCapacity = _getCurrentCapacity (_getOutboundLimitParams ());
109
+ TrimmedAmount memory trimmedCapacity = _getCurrentCapacity (getOutboundLimitParams ());
110
110
uint8 decimals = tokenDecimals ();
111
111
return trimmedCapacity.untrim (decimals);
112
112
}
@@ -123,16 +123,12 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
123
123
_setLimit (limit, _getInboundLimitParamsStorage ()[chainId_]);
124
124
}
125
125
126
- function _getInboundLimitParams (uint16 chainId_ )
127
- internal
128
- view
129
- returns (RateLimitParams memory )
130
- {
126
+ function getInboundLimitParams (uint16 chainId_ ) public view returns (RateLimitParams memory ) {
131
127
return _getInboundLimitParamsStorage ()[chainId_];
132
128
}
133
129
134
130
function getCurrentInboundCapacity (uint16 chainId_ ) public view returns (uint256 ) {
135
- TrimmedAmount memory trimmedCapacity = _getCurrentCapacity (_getInboundLimitParams (chainId_));
131
+ TrimmedAmount memory trimmedCapacity = _getCurrentCapacity (getInboundLimitParams (chainId_));
136
132
uint8 decimals = tokenDecimals ();
137
133
return trimmedCapacity.untrim (decimals);
138
134
}
@@ -213,22 +209,22 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
213
209
function _consumeOutboundAmount (TrimmedAmount memory amount ) internal {
214
210
if (rateLimitDuration == 0 ) return ;
215
211
_consumeRateLimitAmount (
216
- amount, _getCurrentCapacity (_getOutboundLimitParams ()), _getOutboundLimitParamsStorage ()
212
+ amount, _getCurrentCapacity (getOutboundLimitParams ()), _getOutboundLimitParamsStorage ()
217
213
);
218
214
}
219
215
220
216
function _backfillOutboundAmount (TrimmedAmount memory amount ) internal {
221
217
if (rateLimitDuration == 0 ) return ;
222
218
_backfillRateLimitAmount (
223
- amount, _getCurrentCapacity (_getOutboundLimitParams ()), _getOutboundLimitParamsStorage ()
219
+ amount, _getCurrentCapacity (getOutboundLimitParams ()), _getOutboundLimitParamsStorage ()
224
220
);
225
221
}
226
222
227
223
function _consumeInboundAmount (TrimmedAmount memory amount , uint16 chainId_ ) internal {
228
224
if (rateLimitDuration == 0 ) return ;
229
225
_consumeRateLimitAmount (
230
226
amount,
231
- _getCurrentCapacity (_getInboundLimitParams (chainId_)),
227
+ _getCurrentCapacity (getInboundLimitParams (chainId_)),
232
228
_getInboundLimitParamsStorage ()[chainId_]
233
229
);
234
230
}
@@ -237,7 +233,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
237
233
if (rateLimitDuration == 0 ) return ;
238
234
_backfillRateLimitAmount (
239
235
amount,
240
- _getCurrentCapacity (_getInboundLimitParams (chainId_)),
236
+ _getCurrentCapacity (getInboundLimitParams (chainId_)),
241
237
_getInboundLimitParamsStorage ()[chainId_]
242
238
);
243
239
}
@@ -268,7 +264,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
268
264
returns (bool )
269
265
{
270
266
return rateLimitDuration != 0
271
- ? _isAmountRateLimited (_getCurrentCapacity (_getOutboundLimitParams ()), amount)
267
+ ? _isAmountRateLimited (_getCurrentCapacity (getOutboundLimitParams ()), amount)
272
268
: false ;
273
269
}
274
270
@@ -277,7 +273,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
277
273
uint16 chainId_
278
274
) internal view returns (bool ) {
279
275
return rateLimitDuration != 0
280
- ? _isAmountRateLimited (_getCurrentCapacity (_getInboundLimitParams (chainId_)), amount)
276
+ ? _isAmountRateLimited (_getCurrentCapacity (getInboundLimitParams (chainId_)), amount)
281
277
: false ;
282
278
}
283
279
0 commit comments