Skip to content

Commit

Permalink
Merge branch 'main' into yarn-solhint
Browse files Browse the repository at this point in the history
  • Loading branch information
madlabman authored Apr 10, 2024
2 parents 7410883 + a75b45e commit d0b734e
Show file tree
Hide file tree
Showing 7 changed files with 950 additions and 296 deletions.
154 changes: 79 additions & 75 deletions GAS.md

Large diffs are not rendered by default.

32 changes: 3 additions & 29 deletions src/CSAccounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ abstract contract CSAccountingBase {
error AlreadyInitialized();
error InvalidSender();
error SenderIsNotCSM();
error NodeOperatorDoesNotExist();
}

/// @author vgorkavenko
Expand Down Expand Up @@ -374,16 +373,8 @@ contract CSAccounting is
function depositETH(
address from,
uint256 nodeOperatorId
)
external
payable
whenResumed
onlyExistingNodeOperator(nodeOperatorId)
returns (uint256 shares)
{
from = _validateDepositSender(from);
) external payable whenResumed onlyCSM returns (uint256 shares) {
shares = CSBondCore._depositETH(from, nodeOperatorId);
CSM.onBondChanged(nodeOperatorId);
}

/// @notice Deposit user's stETH to the bond for the given Node Operator
Expand All @@ -398,14 +389,7 @@ contract CSAccounting is
uint256 nodeOperatorId,
uint256 stETHAmount,
PermitInput calldata permit
)
external
whenResumed
onlyExistingNodeOperator(nodeOperatorId)
returns (uint256 shares)
{
// TODO: can it be two functions rather than one with `from` param and condition?
from = _validateDepositSender(from);
) external whenResumed onlyCSM returns (uint256 shares) {
// preventing revert for already used permit or avoid permit usage in case of value == 0
if (
permit.value > 0 &&
Expand All @@ -423,7 +407,6 @@ contract CSAccounting is
);
}
shares = CSBondCore._depositStETH(from, nodeOperatorId, stETHAmount);
CSM.onBondChanged(nodeOperatorId);
}

/// @notice Unwrap user's wstETH and make deposit in stETH to the bond for the given Node Operator
Expand All @@ -438,14 +421,7 @@ contract CSAccounting is
uint256 nodeOperatorId,
uint256 wstETHAmount,
PermitInput calldata permit
)
external
whenResumed
onlyExistingNodeOperator(nodeOperatorId)
returns (uint256 shares)
{
// TODO: can it be two functions rather than one with `from` param and condition?
from = _validateDepositSender(from);
) external whenResumed onlyCSM returns (uint256 shares) {
// preventing revert for already used permit or avoid permit usage in case of value == 0
if (
permit.value > 0 &&
Expand All @@ -463,7 +439,6 @@ contract CSAccounting is
);
}
shares = CSBondCore._depositWstETH(from, nodeOperatorId, wstETHAmount);
CSM.onBondChanged(nodeOperatorId);
}

/// @dev only CSM can pass `from` != `msg.sender`
Expand Down Expand Up @@ -672,7 +647,6 @@ contract CSAccounting is
rewardsProof
);
_increaseBond(nodeOperatorId, distributed);
CSM.onBondChanged(nodeOperatorId);
}

modifier onlyCSM() {
Expand Down
Loading

0 comments on commit d0b734e

Please sign in to comment.