Skip to content

Commit

Permalink
refactor: update logic to be more similar to settle
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefMist committed Mar 22, 2024
1 parent 6a4cb02 commit 7b07b9d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/VaultTest#Vault.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7069
7049
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73023
72621
Original file line number Diff line number Diff line change
@@ -1 +1 @@
34513
34111
5 changes: 3 additions & 2 deletions src/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ contract Vault is IVault, VaultToken, Ownable {
isLocked
returns (uint256 paid, uint256 refund)
{
paid = currency.balanceOfSelf() - reservesOfVault[currency];
reservesOfVault[currency] += paid;
uint256 reservesBefore = reservesOfVault[currency];
reservesOfVault[currency] = currency.balanceOfSelf();
paid = reservesOfVault[currency] - reservesBefore;

int256 currentDelta = SettlementGuard.getCurrencyDelta(msg.sender, currency);
if (currentDelta >= 0 && paid > currentDelta.toUint256()) {
Expand Down

0 comments on commit 7b07b9d

Please sign in to comment.