Skip to content

Commit 61e234f

Browse files
chore: lint
1 parent 692e790 commit 61e234f

File tree

6 files changed

+23
-25
lines changed

6 files changed

+23
-25
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Parallel Yield Bridge
1+
# Parallel Yield Bridge

contracts/interfaces/IStrategy.sol

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ pragma solidity 0.8.19;
22

33
interface IStrategy {
44
function withdraw(uint256 amount_) external returns (uint256 loss_);
5+
56
function withdrawAll() external;
6-
function estimatedTotalAssets() external view returns (uint256 totalAssets_);
7+
8+
function estimatedTotalAssets()
9+
external
10+
view
11+
returns (uint256 totalAssets_);
12+
713
function invest() external;
8-
}
14+
}
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// SPDX-License-Identifier: GPL-3.0-only
22
pragma solidity 0.8.19;
33

4-
5-
64
// contract AaveStrategy {
7-
// }
5+
// }

contracts/superbridge/ParallelVault.sol

+11-17
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ import "./RescueFundsLib.sol";
99
import "openzeppelin-contracts/contracts/utils/math/Math.sol";
1010
import "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
1111

12-
1312
// add rebalance external function (called from cron)
1413
// call rebalance from withdraw and deposit too (with timestamp check, settable by admin)
1514
// pausable vault
1615
// redeem all from strategy and detach
1716
// reentrancy guard
1817

19-
20-
21-
2218
contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
2319
using SafeTransferLib for ERC20;
2420
ERC20 public immutable token__;
@@ -66,14 +62,13 @@ contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
6662
uint256 debtOutstanding
6763
);
6864

69-
event ShutdownStateUpdated(
70-
bool shutdownState
71-
);
65+
event ShutdownStateUpdated(bool shutdownState);
7266

7367
modifier notShutdown() {
7468
if (emergencyShutdown) revert VaultShutdown();
7569
_;
7670
}
71+
7772
constructor(
7873
address token_,
7974
string memory name_,
@@ -91,11 +86,16 @@ contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
9186
strategy = strategy_;
9287
}
9388

94-
function setRebalanceingDelay(uint128 rebalanceingDelay_) external onlyOwner {
89+
function setRebalanceingDelay(
90+
uint128 rebalanceingDelay_
91+
) external onlyOwner {
9592
rebalanceingDelay = rebalanceingDelay_;
9693
}
9794

98-
function updateEmergencyShutdownState(bool shutdownState_, bool detachStrategy) external onlyOwner {
95+
function updateEmergencyShutdownState(
96+
bool shutdownState_,
97+
bool detachStrategy
98+
) external onlyOwner {
9999
if (shutdownState_ && detachStrategy) {
100100
// If we're exiting emergency shutdown, we need to empty strategy
101101
_withdrawAllFromStrategy();
@@ -148,9 +148,7 @@ contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
148148
_withdrawFromStrategy(assets_);
149149
}
150150

151-
function _withdrawFromStrategy(
152-
uint256 assets_
153-
) internal returns (uint256) {
151+
function _withdrawFromStrategy(uint256 assets_) internal returns (uint256) {
154152
uint256 preBalance = token__.balanceOf(address(this));
155153
IStrategy(strategy).withdraw(assets_);
156154
uint256 withdrawn = token__.balanceOf(address(this)) - preBalance;
@@ -170,7 +168,6 @@ contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
170168
return withdrawn;
171169
}
172170

173-
174171
function maxAvailableShares() public view returns (uint256) {
175172
return convertToShares(_totalAssets());
176173
}
@@ -180,28 +177,25 @@ contract ParallelVault is Gauge, Ownable2Step, ERC4626, ReentrancyGuard {
180177
}
181178

182179
function _checkDelayAndRebalance() internal returns (uint256) {
183-
184180
uint128 timeElapsed = uint128(block.timestamp) - lastRebalanceTimestamp;
185181
if (timeElapsed >= rebalanceingDelay) {
186182
return _rebalance();
187183
}
188184
}
189185

190186
function _rebalance() internal returns (uint256) {
191-
192187
if (strategy == address(0)) return;
193188
lastRebalanceTimestamp = uint128(block.timestamp);
194189
// Compute the line of credit the Vault is able to offer the Strategy (if any)
195190
uint256 credit = _creditAvailable();
196191
uint256 pendingDebt = _debtOutstanding();
197192

198-
if (credit>0) {
193+
if (credit > 0) {
199194
// Credit surplus, give to Strategy
200195
totalIdle -= credit;
201196
totalDebt += credit;
202197
token__.safeTransfer(strategy, credit);
203198
IStrategy(strategy).invest();
204-
205199
} else if (pendingDebt > 0) {
206200
// Credit deficit, take from Strategy
207201
_withdrawFromStrategy(pendingDebt);

contracts/superbridge/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Parallel Yield Bridge
1+
# Parallel Yield Bridge

test/Vault.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract TestVault is Test {
2525
function setUp() external {
2626
vm.startPrank(_admin);
2727
_token = new NonMintableToken("USDC", "USDC", 6, 1_000_000_000 ether);
28-
_vault = new ParallelVault(address(_token), "ParallelUSDC","pUSDC");
28+
_vault = new ParallelVault(address(_token), "ParallelUSDC", "pUSDC");
2929
vm.stopPrank();
3030
}
3131

0 commit comments

Comments
 (0)