Skip to content

Commit

Permalink
Merge pull request #40 from symbioticfi/renaming
Browse files Browse the repository at this point in the history
Vault.balanceOf() -> Vault.slashableBalanceOf()
  • Loading branch information
1kresh authored Sep 12, 2024
2 parents 1246641 + a09031c commit 1e391f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/contracts/vault/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract Vault is VaultStorage, MigratableEntity, AccessControlUpgradeable, IVau
/**
* @inheritdoc IVault
*/
function balanceOf(
function slashableBalanceOf(
address account
) external view returns (uint256) {
uint256 epoch = currentEpoch();
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/vault/IVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ interface IVault is IMigratableEntity, IVaultStorage {
* @notice Get a total amount of the collateral that can be slashed for a given account.
* @return total amount of the slashable collateral
*/
function balanceOf(
function slashableBalanceOf(
address account
) external view returns (uint256);

Expand Down
22 changes: 11 additions & 11 deletions test/vault/Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ contract VaultTest is Test {
assertEq(vault.isWithdrawalsClaimed(0, alice), false);
assertEq(vault.depositWhitelist(), depositWhitelist);
assertEq(vault.isDepositorWhitelisted(alice), false);
assertEq(vault.balanceOf(alice), 0);
assertEq(vault.slashableBalanceOf(alice), 0);

blockTimestamp = blockTimestamp + vault.epochDuration() - 1;
vm.warp(blockTimestamp);
Expand Down Expand Up @@ -754,7 +754,7 @@ contract VaultTest is Test {
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp - 1), ""), 0);
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp), ""), amount1);
assertEq(vault.activeBalanceOf(alice), amount1);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);

blockTimestamp = blockTimestamp + 1;
vm.warp(blockTimestamp);
Expand Down Expand Up @@ -815,7 +815,7 @@ contract VaultTest is Test {
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp - 1), ""), amount1);
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp), ""), amount1 + amount2);
assertEq(vault.activeBalanceOf(alice), amount1 + amount2);
assertEq(vault.balanceOf(alice), amount1 + amount2);
assertEq(vault.slashableBalanceOf(alice), amount1 + amount2);
gasLeft = gasleft();
assertEq(
vault.activeBalanceOfAt(
Expand Down Expand Up @@ -962,7 +962,7 @@ contract VaultTest is Test {
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp - 1), ""), 0);
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp), ""), amount1 - 1);
assertEq(vault.activeBalanceOf(alice), amount1 - 1);
assertEq(vault.balanceOf(alice), amount1 - 1);
assertEq(vault.slashableBalanceOf(alice), amount1 - 1);

blockTimestamp = blockTimestamp + 1;
vm.warp(blockTimestamp);
Expand Down Expand Up @@ -1027,7 +1027,7 @@ contract VaultTest is Test {
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp - 1), ""), amount1 - 1);
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp), ""), amount1 - 1 + amount2 - 1);
assertEq(vault.activeBalanceOf(alice), amount1 - 1 + amount2 - 1);
assertEq(vault.balanceOf(alice), amount1 - 1 + amount2 - 1);
assertEq(vault.slashableBalanceOf(alice), amount1 - 1 + amount2 - 1);
gasLeft = gasleft();
assertEq(
vault.activeBalanceOfAt(
Expand Down Expand Up @@ -1135,14 +1135,14 @@ contract VaultTest is Test {
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp - 1), ""), amount1);
assertEq(vault.activeBalanceOfAt(alice, uint48(blockTimestamp), ""), amount1);
assertEq(vault.activeBalanceOf(alice), amount1);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);
assertEq(vault.activeSharesOfAt(bob, uint48(blockTimestamp - 1), ""), 0);
assertEq(vault.activeSharesOfAt(bob, uint48(blockTimestamp), ""), shares2);
assertEq(vault.activeSharesOf(bob), shares2);
assertEq(vault.activeBalanceOfAt(bob, uint48(blockTimestamp - 1), ""), 0);
assertEq(vault.activeBalanceOfAt(bob, uint48(blockTimestamp), ""), amount2);
assertEq(vault.activeBalanceOf(bob), amount2);
assertEq(vault.balanceOf(bob), amount2);
assertEq(vault.slashableBalanceOf(bob), amount2);
}

function test_DepositRevertInvalidOnBehalfOf(
Expand Down Expand Up @@ -1215,7 +1215,7 @@ contract VaultTest is Test {
assertEq(vault.withdrawalSharesOf(vault.currentEpoch(), alice), 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 1, alice), mintedShares);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 2, alice), 0);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);

shares -= burnedShares;

Expand Down Expand Up @@ -1253,7 +1253,7 @@ contract VaultTest is Test {
assertEq(vault.withdrawalSharesOf(vault.currentEpoch(), alice), amount2 * 10 ** 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 1, alice), amount3 * 10 ** 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 2, alice), 0);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);

shares -= burnedShares;

Expand Down Expand Up @@ -1358,7 +1358,7 @@ contract VaultTest is Test {
assertEq(vault.withdrawalSharesOf(vault.currentEpoch(), alice), 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 1, alice), mintedShares);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 2, alice), 0);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);

shares -= amount2;

Expand Down Expand Up @@ -1398,7 +1398,7 @@ contract VaultTest is Test {
assertEq(vault.withdrawalSharesOf(vault.currentEpoch(), alice), withdrawnAssets2 * 10 ** 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 1, alice), withdrawnAssets3 * 10 ** 0);
assertEq(vault.withdrawalSharesOf(vault.currentEpoch() + 2, alice), 0);
assertEq(vault.balanceOf(alice), amount1);
assertEq(vault.slashableBalanceOf(alice), amount1);

shares -= amount3;

Expand Down

0 comments on commit 1e391f3

Please sign in to comment.