@layerzerolabs/utils-evm-contracts 4.0.3 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ pragma solidity ^0.8.22;
4
4
  /**
5
5
  * @title IRateLimiter
6
6
  * @author LayerZero Labs (tinom.eth)
7
- * @custom:version 1.0.0
7
+ * @custom:version 1.1.0
8
8
  * @notice Interface for the `RateLimiter` contract.
9
9
  */
10
10
  interface IRateLimiter {
@@ -42,7 +42,7 @@ interface IRateLimiter {
42
42
 
43
43
  /**
44
44
  * @notice Rate limit configuration.
45
- * @param overrideDefaultConfig Whether to override the default configuration
45
+ * @param active Whether the configuration is active, an inactive configuration is closed in both directions
46
46
  * @param outboundEnabled Whether the outbound rate limit is enabled
47
47
  * @param inboundEnabled Whether the inbound rate limit is enabled
48
48
  * @param netAccountingEnabled Whether net accounting is enabled
@@ -53,7 +53,7 @@ interface IRateLimiter {
53
53
  * @param inboundWindow Window of the inbound rate limit
54
54
  */
55
55
  struct RateLimitConfig {
56
- bool overrideDefaultConfig;
56
+ bool active;
57
57
  bool outboundEnabled;
58
58
  bool inboundEnabled;
59
59
  bool netAccountingEnabled;
@@ -169,7 +169,7 @@ interface IRateLimiter {
169
169
  /**
170
170
  * @notice Returns the rate limit state and configuration for a given ID.
171
171
  * @dev May return unscaled state if `SCALE_DECIMALS` is set, use `getRateLimitUsages` for scaled values.
172
- * @dev Reads the rate limit state from storage without checking defaults.
172
+ * @dev Returns the stored values, including the limits of an inactive configuration.
173
173
  * @dev A window of `type(uint32).max` means usage in that direction does not decay.
174
174
  * @param _id ID of the rate limit
175
175
  * @return rateLimit Rate limit state and configuration
@@ -186,8 +186,10 @@ interface IRateLimiter {
186
186
  /**
187
187
  * @notice Calculates decayed usages and capacities for a rate limit.
188
188
  * @dev Potentially scaled up by `SCALE_DECIMALS`.
189
- * @dev Checks config and falls back to default if necessary.
190
- * @dev If a rate limit is disabled in a given direction, the available amount is `type(uint256).max`.
189
+ * @dev The available amounts are 0 when the config that applies to `_id` is not active: its own config, or the
190
+ * shared config under global state.
191
+ * @dev The available amount is `type(uint256).max` in a disabled direction of an active config, and in both
192
+ * directions when the rate limiter is globally disabled.
191
193
  * @param _id ID of the rate limit
192
194
  * @return outboundUsage Scaled current usage of the outbound rate limit
193
195
  * @return outboundAvailableAmount Scaled capacity of the outbound rate limit
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@layerzerolabs/utils-evm-contracts",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "private": false,
5
5
  "description": "LayerZero Labs utility EVM contracts",
6
6
  "license": "MIT",
7
7
  "devDependencies": {
8
- "@layerzerolabs/solhint-configuration": "4.0.3",
8
+ "@layerzerolabs/solhint-configuration": "4.0.5",
9
9
  "@layerzerolabs/test-devtools-evm-foundry": "8.0.1",
10
10
  "@layerzerolabs/toolbox-foundry": "^0.1.13",
11
- "@layerzerolabs/vm-tooling-evm": "4.0.3",
11
+ "@layerzerolabs/vm-tooling-evm": "4.0.5",
12
12
  "@openzeppelin/contracts": "^5.0.2",
13
13
  "solhint": "^6.0.1"
14
14
  },