Skip to content

Commit

Permalink
cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Korokhov committed May 21, 2024
1 parent 5fc2056 commit 70ed62d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
2 changes: 0 additions & 2 deletions src/contracts/NonMigratablesRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {INonMigratablesRegistry} from "src/interfaces/INonMigratablesRegistry.so
import {Registry} from "./Registry.sol";

contract NonMigratablesRegistry is Registry, INonMigratablesRegistry {
constructor() {}

/**
* @inheritdoc INonMigratablesRegistry
*/
Expand Down
50 changes: 21 additions & 29 deletions src/contracts/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,89 +107,89 @@ contract Vault is
/**
* @inheritdoc IVault
*/
mapping(uint256 epoch => uint256 amount) public withdrawals;
bool public depositWhitelist;

/**
* @inheritdoc IVault
*/
mapping(uint256 epoch => uint256 amount) public withdrawalsShares;
mapping(address account => bool value) public isDepositorWhitelisted;

/**
* @inheritdoc IVault
*/
mapping(uint256 epoch => mapping(address account => uint256 amount)) public withdrawalsSharesOf;
mapping(address account => uint48 timestamp) public firstDepositAt;

/**
* @inheritdoc IVault
*/
mapping(address account => uint48 timestamp) public firstDepositAt;
mapping(uint256 epoch => uint256 amount) public withdrawals;

/**
* @inheritdoc IVault
*/
mapping(address network => mapping(address resolver => bool value)) public isNetworkOptedIn;
mapping(uint256 epoch => uint256 amount) public withdrawalsShares;

/**
* @inheritdoc IVault
*/
mapping(address operator => uint48 timestamp) public operatorOptOutAt;
mapping(uint256 epoch => mapping(address account => uint256 amount)) public withdrawalsSharesOf;

/**
* @inheritdoc IVault
*/
mapping(address network => mapping(address resolver => uint256 amount)) public maxNetworkLimit;
SlashRequest[] public slashRequests;

/**
* @inheritdoc IVault
*/
mapping(address network => mapping(address resolver => DelayedLimit)) public nextNetworkLimit;
mapping(address token => RewardDistribution[] rewards_) public rewards;

/**
* @inheritdoc IVault
*/
mapping(address operator => mapping(address network => DelayedLimit)) public nextOperatorLimit;
mapping(address account => mapping(address token => uint256 rewardIndex)) public lastUnclaimedReward;

/**
* @inheritdoc IVault
*/
SlashRequest[] public slashRequests;
mapping(address network => mapping(address resolver => bool value)) public isNetworkOptedIn;

/**
* @inheritdoc IVault
*/
mapping(address token => RewardDistribution[] rewards_) public rewards;
mapping(address operator => uint48 timestamp) public operatorOptOutAt;

/**
* @inheritdoc IVault
*/
mapping(address account => mapping(address token => uint256 rewardIndex)) public lastUnclaimedReward;
mapping(address network => mapping(address resolver => uint256 amount)) public maxNetworkLimit;

/**
* @inheritdoc IVault
*/
bool public depositWhitelist;
mapping(address network => mapping(address resolver => DelayedLimit)) public nextNetworkLimit;

/**
* @inheritdoc IVault
*/
mapping(address account => bool value) public isDepositorWhitelisted;
mapping(address operator => mapping(address network => DelayedLimit)) public nextOperatorLimit;

Checkpoints.Trace256 private _activeShares;

Checkpoints.Trace256 private _activeSupplies;

mapping(address account => Checkpoints.Trace256 shares) private _activeSharesOf;

mapping(uint48 timestamp => uint256 amount) private _activeSharesCache;

mapping(uint48 timestamp => uint256 amount) private _activeSuppliesCache;

mapping(address operator => bool value) private _isOperatorOptedIn;

mapping(address network => mapping(address resolver => Limit limit)) private _networkLimit;

mapping(address operator => mapping(address network => Limit limit)) private _operatorLimit;

mapping(uint48 timestamp => uint256 amount) private _activeSharesCache;

mapping(uint48 timestamp => uint256 amount) private _activeSuppliesCache;

modifier isNetwork(address account) {
if (!IRegistry(NETWORK_REGISTRY).isEntity(account)) {
revert NotNetwork();
Expand Down Expand Up @@ -328,17 +328,7 @@ contract Vault is
* @inheritdoc IVault
*/
function maxSlash(address network, address resolver, address operator) public view returns (uint256) {
uint256 networkLimit_ = networkLimit(network, resolver);
uint256 operatorLimit_ = operatorLimit(operator, network);

uint256 amount = totalSupply();
if (networkLimit_ != type(uint256).max) {
amount = Math.min(amount, networkLimit_);
}
if (operatorLimit_ != type(uint256).max) {
amount = Math.min(amount, operatorLimit_);
}
return amount;
return Math.min(totalSupply(), Math.min(networkLimit(network, resolver), operatorLimit(operator, network)));
}

function slashRequestsLength() public view returns (uint256) {
Expand Down Expand Up @@ -447,6 +437,8 @@ contract Vault is
*/
function setMetadataURL(string calldata metadataURL_) external onlyOwner {
metadataURL = metadataURL_;

emit SetMetadataURL(metadataURL_);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/interfaces/IVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ interface IVault {
uint32[] activeSharesOfHints;
}

/**
* @notice Emitted when a metadata URL is set.
* @param metadataURL metadata URL of the vault
*/
event SetMetadataURL(string metadataURL);

/**
* @notice Emitted when a deposit is made.
* @param depositor account that made the deposit
Expand Down

0 comments on commit 70ed62d

Please sign in to comment.