@gearbox-protocol/periphery-v3 1.4.1 → 1.5.1

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/README.md CHANGED
@@ -1 +1,66 @@
1
- # Gearbox V3 Periphery
1
+ ## Foundry
2
+
3
+ **Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
4
+
5
+ Foundry consists of:
6
+
7
+ - **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
8
+ - **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
9
+ - **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
10
+ - **Chisel**: Fast, utilitarian, and verbose solidity REPL.
11
+
12
+ ## Documentation
13
+
14
+ https://book.getfoundry.sh/
15
+
16
+ ## Usage
17
+
18
+ ### Build
19
+
20
+ ```shell
21
+ $ forge build
22
+ ```
23
+
24
+ ### Test
25
+
26
+ ```shell
27
+ $ forge test
28
+ ```
29
+
30
+ ### Format
31
+
32
+ ```shell
33
+ $ forge fmt
34
+ ```
35
+
36
+ ### Gas Snapshots
37
+
38
+ ```shell
39
+ $ forge snapshot
40
+ ```
41
+
42
+ ### Anvil
43
+
44
+ ```shell
45
+ $ anvil
46
+ ```
47
+
48
+ ### Deploy
49
+
50
+ ```shell
51
+ $ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52
+ ```
53
+
54
+ ### Cast
55
+
56
+ ```shell
57
+ $ cast <subcommand>
58
+ ```
59
+
60
+ ### Help
61
+
62
+ ```shell
63
+ $ forge --help
64
+ $ anvil --help
65
+ $ cast --help
66
+ ```
@@ -37,7 +37,7 @@ contract DegenDistributorV3 is IDegenDistributorV3 {
37
37
 
38
38
  constructor(address addressProvider) {
39
39
  treasury = IAddressProviderV3(addressProvider).getAddressOrRevert(AP_TREASURY, NO_VERSION_CONTROL);
40
- degenNFT = IAddressProviderV3(addressProvider).getAddressOrRevert(AP_DEGEN_NFT, 2);
40
+ degenNFT = IAddressProviderV3(addressProvider).getAddressOrRevert(AP_DEGEN_NFT, NO_VERSION_CONTROL);
41
41
  }
42
42
 
43
43
  function updateMerkleRoot(bytes32 newRoot) external treasuryOnly {
@@ -9,6 +9,11 @@ import {ICreditManagerV3} from "@gearbox-protocol/core-v3/contracts/interfaces/I
9
9
  import {ACLNonReentrantTrait} from "@gearbox-protocol/core-v3/contracts/traits/ACLNonReentrantTrait.sol";
10
10
  import {ContractsRegisterTrait} from "@gearbox-protocol/core-v3/contracts/traits/ContractsRegisterTrait.sol";
11
11
 
12
+ enum PausableAction {
13
+ Pause,
14
+ Unpause
15
+ }
16
+
12
17
  /// @title MultiPause
13
18
  /// @author Gearbox Foundation
14
19
  /// @notice Allows pausable admins to pause multiple contracts in a single transaction
@@ -23,14 +28,14 @@ contract MultiPause is ACLNonReentrantTrait, ContractsRegisterTrait {
23
28
  /// @dev Ignores contracts that are already paused
24
29
  /// @dev Reverts if caller is not a pausable admin
25
30
  function pauseContracts(address[] memory contracts) external pausableAdminsOnly {
26
- _pauseContracts(contracts);
31
+ _pauseContracts(contracts, PausableAction.Pause);
27
32
  }
28
33
 
29
34
  /// @notice Pauses all registered pools
30
35
  /// @dev Ignores contracts that are already paused
31
36
  /// @dev Reverts if caller is not a pausable admin
32
37
  function pauseAllPools() external pausableAdminsOnly {
33
- _pauseAllPools();
38
+ _pauseAllPools(PausableAction.Pause);
34
39
  }
35
40
 
36
41
  /// @notice Pauses all registered credit managers
@@ -38,24 +43,32 @@ contract MultiPause is ACLNonReentrantTrait, ContractsRegisterTrait {
38
43
  /// @dev Ignores contracts that are already paused
39
44
  /// @dev Reverts if caller is not a pausable admin
40
45
  function pauseAllCreditManagers() external pausableAdminsOnly {
41
- _pauseAllCreditManagers();
46
+ _pauseAllCreditManagers(PausableAction.Pause);
42
47
  }
43
48
 
44
49
  /// @notice Pauses all registered credit managers and pools
45
50
  /// @dev Ignores contracts that are already paused
46
51
  /// @dev Reverts if caller is not a pausable admin
47
52
  function pauseAllContracts() external pausableAdminsOnly {
48
- _pauseAllPools();
49
- _pauseAllCreditManagers();
53
+ _pauseAllPools(PausableAction.Pause);
54
+ _pauseAllCreditManagers(PausableAction.Pause);
55
+ }
56
+
57
+ /// @notice Unpauses all registered credit managers and pools
58
+ /// @dev Ignores contracts that aren't paused
59
+ /// @dev Reverts if caller is not a unpausable admin
60
+ function unpauseAllContracts() external unpausableAdminsOnly {
61
+ _pauseAllPools(PausableAction.Unpause);
62
+ _pauseAllCreditManagers(PausableAction.Unpause);
50
63
  }
51
64
 
52
65
  /// @dev Internal function to pause all pools
53
- function _pauseAllPools() internal {
54
- _pauseContracts(IContractsRegister(contractsRegister).getPools());
66
+ function _pauseAllPools(PausableAction action) internal {
67
+ _pauseContracts(IContractsRegister(contractsRegister).getPools(), action);
55
68
  }
56
69
 
57
70
  /// @dev Internal function to pause all credit managers
58
- function _pauseAllCreditManagers() internal {
71
+ function _pauseAllCreditManagers(PausableAction action) internal {
59
72
  address[] memory contracts = IContractsRegister(contractsRegister).getCreditManagers();
60
73
  uint256 len = contracts.length;
61
74
  unchecked {
@@ -64,16 +77,21 @@ contract MultiPause is ACLNonReentrantTrait, ContractsRegisterTrait {
64
77
  contracts[i] = ICreditManagerV3(contracts[i]).creditFacade();
65
78
  }
66
79
  }
67
- _pauseContracts(contracts);
80
+ _pauseContracts(contracts, action);
68
81
  }
69
82
 
70
- /// @dev Internal function to pause contracts from the given list
71
- function _pauseContracts(address[] memory contracts) internal {
83
+ /// @dev Internal function to pause/unpause contracts from the given list
84
+ function _pauseContracts(address[] memory contracts, PausableAction action) internal {
72
85
  uint256 len = contracts.length;
73
86
  unchecked {
74
87
  for (uint256 i; i < len; ++i) {
75
- if (ACLNonReentrantTrait(contracts[i]).paused()) continue;
76
- ACLNonReentrantTrait(contracts[i]).pause();
88
+ if (action == PausableAction.Pause) {
89
+ if (ACLNonReentrantTrait(contracts[i]).paused()) continue;
90
+ ACLNonReentrantTrait(contracts[i]).pause();
91
+ } else {
92
+ if (!ACLNonReentrantTrait(contracts[i]).paused()) continue;
93
+ ACLNonReentrantTrait(contracts[i]).unpause();
94
+ }
77
95
  }
78
96
  }
79
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/periphery-v3",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:Gearbox-protocol/periphery-v3.git",
6
6
  "author": "Mikael <26343374+0xmikko@users.noreply.github.com>",