@layerzerolabs/lz-evm-v1-0.7 2.3.7 → 2.3.9

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @layerzerolabs/lz-evm-v1-0.7
2
2
 
3
+ ## 2.3.9
4
+
5
+ ### Patch Changes
6
+
7
+ - c208955: minor update & fix some bugs
8
+
9
+ ## 2.3.8
10
+
11
+ ### Patch Changes
12
+
13
+ - e0f5d04: deploy contracts to Ebi mainnet
14
+
3
15
  ## 2.3.7
4
16
 
5
17
  ### Patch Changes
@@ -97,9 +97,13 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe
97
97
 
98
98
  uint256 public nativeDecimalsRate;
99
99
 
100
- RateLimiter.Info public limiter;
100
+ RateLimiter.Info public limiter; // deprecated
101
101
 
102
- event RateLimiterSet(uint64 capacity, uint64 rate);
102
+ event RateLimiterSet(uint64 capacity, uint64 rate); // deprecated
103
+
104
+ mapping(address => bool) public limiterWhitelist; // if true, sender bypasses rate limits
105
+ mapping(uint16 => RateLimiter.Info) public limiters;
106
+ event DstRateLimiterSet(uint16 dstChain, uint64 capacity, uint64 rate);
103
107
 
104
108
  // owner is always approved
105
109
  modifier onlyApproved() {
@@ -148,6 +152,9 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe
148
152
 
149
153
  //----------------------------------------------------------------------------------
150
154
  // onlyApproved
155
+ function setLimiterWhitelist(address _addr, bool _skipRateLimits) external onlyApproved {
156
+ limiterWhitelist[_addr] = _skipRateLimits;
157
+ }
151
158
 
152
159
  function setDstPrice(uint16 _chainId, uint128 _dstPriceRatio, uint128 _dstGasPriceInWei) external onlyApproved {
153
160
  // No longer used: Write prices in PriceFeed.
@@ -192,10 +199,11 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe
192
199
 
193
200
  //----------------------------------------------------------------------------------
194
201
  // onlyOwner
195
- function configRateLimiter(uint64 _capacity, uint64 _rate) external onlyOwner {
196
- limiter.setCapacity(_capacity);
197
- limiter.setRate(_rate);
198
- emit RateLimiterSet(_capacity, _rate);
202
+ function configRateLimiter(uint16 _dstChainId, uint64 _capacity, uint64 _rate) external onlyOwner {
203
+ RateLimiter.Info storage dstLimiter = limiters[_dstChainId];
204
+ dstLimiter.setCapacity(_capacity);
205
+ dstLimiter.setRate(_rate);
206
+ emit DstRateLimiterSet(_dstChainId, _capacity, _rate);
199
207
  }
200
208
 
201
209
  function setApprovedAddress(address _relayerAddress, bool _approve) public onlyOwner {
@@ -313,9 +321,12 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe
313
321
  uint _payloadSize,
314
322
  bytes calldata _adapterParams
315
323
  ) external override returns (uint fee) {
316
- if (_dstChainId >= 10000 && limiter.capacity > 0) {
324
+ if (_dstChainId >= 10000) {
325
+ RateLimiter.Info storage dstLimiter = limiters[_dstChainId];
317
326
  // sandbox or testnet
318
- limiter.tryConsume(10000);
327
+ if (!limiterWhitelist[_userApplication] && dstLimiter.capacity > 0) {
328
+ dstLimiter.tryConsume(10000);
329
+ }
319
330
  }
320
331
 
321
332
  require(msg.sender == address(uln), "Relayer: invalid uln");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/lz-evm-v1-0.7",
3
- "version": "2.3.7",
3
+ "version": "2.3.9",
4
4
  "license": "BUSL-1.1",
5
5
  "files": [
6
6
  "contracts/**/*"