Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-14] add ability to pause deposits #72

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[FEA-1063] remediate Slowmist audit suggestion [N3] (#71)
  • Loading branch information
eyqs authored Oct 23, 2024
commit 3266a02100dc01042865515f6c9b4278991824b0
2 changes: 1 addition & 1 deletion staking/src/RWAStaking.sol
Original file line number Diff line number Diff line change
@@ -250,7 +250,7 @@ contract RWAStaking is AccessControlUpgradeable, UUPSUpgradeable {
uint256 newBalance = stablecoin.balanceOf(address(this));
uint256 actualAmount = previousBalance - newBalance;

userState.amountSeconds -= userState.amountSeconds * amount / userState.amountStaked;
userState.amountSeconds -= userState.amountSeconds * actualAmount / userState.amountStaked;
userState.amountStaked -= actualAmount;
userState.lastUpdate = timestamp;
$.totalAmountStaked -= actualAmount;
4 changes: 2 additions & 2 deletions staking/src/ReserveStaking.sol
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ contract ReserveStaking is AccessControlUpgradeable, UUPSUpgradeable {
sbtc.safeTransfer(msg.sender, sbtcAmount);
uint256 newBalance = sbtc.balanceOf(address(this));
actualSbtcAmount = previousBalance - newBalance;
userState.sbtcAmountSeconds -= userState.sbtcAmountSeconds * sbtcAmount / userState.sbtcAmountStaked;
userState.sbtcAmountSeconds -= userState.sbtcAmountSeconds * actualSbtcAmount / userState.sbtcAmountStaked;
userState.sbtcAmountStaked -= actualSbtcAmount;
userState.sbtcLastUpdate = timestamp;
$.sbtcTotalAmountStaked -= actualSbtcAmount;
@@ -268,7 +268,7 @@ contract ReserveStaking is AccessControlUpgradeable, UUPSUpgradeable {
stone.safeTransfer(msg.sender, stoneAmount);
uint256 newBalance = stone.balanceOf(address(this));
actualStoneAmount = previousBalance - newBalance;
userState.stoneAmountSeconds -= userState.stoneAmountSeconds * stoneAmount / userState.stoneAmountStaked;
userState.stoneAmountSeconds -= userState.stoneAmountSeconds * actualStoneAmount / userState.stoneAmountStaked;
userState.stoneAmountStaked -= actualStoneAmount;
userState.stoneLastUpdate = timestamp;
$.stoneTotalAmountStaked -= actualStoneAmount;