Skip to content

Commit

Permalink
Merge pull request #4 from symbioticfi/new-arch
Browse files Browse the repository at this point in the history
Renamings
  • Loading branch information
1kresh authored Jun 27, 2024
2 parents 80064e6 + 0d5192b commit 25d15c1
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions src/contracts/DelegatorFactory.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratablesFactory} from "src/contracts/common/NonMigratablesFactory.sol";
import {Factory} from "src/contracts/common/Factory.sol";

import {IDelegatorFactory} from "src/interfaces/IDelegatorFactory.sol";

contract DelegatorFactory is NonMigratablesFactory, IDelegatorFactory {
constructor(address owner_) NonMigratablesFactory(owner_) {}
contract DelegatorFactory is Factory, IDelegatorFactory {
constructor(address owner_) Factory(owner_) {}
}
6 changes: 3 additions & 3 deletions src/contracts/SlasherFactory.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratablesFactory} from "src/contracts/common/NonMigratablesFactory.sol";
import {Factory} from "src/contracts/common/Factory.sol";

import {ISlasherFactory} from "src/interfaces/ISlasherFactory.sol";

contract SlasherFactory is NonMigratablesFactory, ISlasherFactory {
constructor(address owner_) NonMigratablesFactory(owner_) {}
contract SlasherFactory is Factory, ISlasherFactory {
constructor(address owner_) Factory(owner_) {}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {INonMigratableEntity} from "src/interfaces/common/INonMigratableEntity.sol";
import {IEntity} from "src/interfaces/common/IEntity.sol";

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

abstract contract NonMigratableEntity is Initializable, INonMigratableEntity {
abstract contract Entity is Initializable, IEntity {
constructor() {
_disableInitializers();
}

/**
* @inheritdoc INonMigratableEntity
* @inheritdoc IEntity
*/
function initialize(bytes memory data) external initializer {
_initialize(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ pragma solidity 0.8.25;

import {Registry} from "./Registry.sol";

import {INonMigratableEntity} from "src/interfaces/common/INonMigratableEntity.sol";
import {INonMigratablesFactory} from "src/interfaces/common/INonMigratablesFactory.sol";
import {IEntity} from "src/interfaces/common/IEntity.sol";
import {IFactory} from "src/interfaces/common/IFactory.sol";

import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

contract NonMigratablesFactory is Registry, Ownable, INonMigratablesFactory {
contract Factory is Registry, Ownable, IFactory {
using EnumerableSet for EnumerableSet.AddressSet;
using Clones for address;

Expand All @@ -19,21 +19,21 @@ contract NonMigratablesFactory is Registry, Ownable, INonMigratablesFactory {
constructor(address owner_) Ownable(owner_) {}

/**
* @inheritdoc INonMigratablesFactory
* @inheritdoc IFactory
*/
function totalImplementations() public view returns (uint64) {
return uint64(_whitelistedImplementations.length());
}

/**
* @inheritdoc INonMigratablesFactory
* @inheritdoc IFactory
*/
function implementation(uint64 index) public view returns (address) {
return _whitelistedImplementations.at(index);
}

/**
* @inheritdoc INonMigratablesFactory
* @inheritdoc IFactory
*/
function whitelist(address implementation_) external onlyOwner {
if (!_whitelistedImplementations.add(implementation_)) {
Expand All @@ -42,11 +42,11 @@ contract NonMigratablesFactory is Registry, Ownable, INonMigratablesFactory {
}

/**
* @inheritdoc INonMigratablesFactory
* @inheritdoc IFactory
*/
function create(uint64 index, bytes memory data) external returns (address entity_) {
entity_ = implementation(index).clone();
INonMigratableEntity(entity_).initialize(data);
IEntity(entity_).initialize(data);

_addEntity(entity_);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratableEntity} from "src/contracts/common/NonMigratableEntity.sol";
import {Entity} from "src/contracts/common/Entity.sol";

import {IFullRestakingDelegator} from "src/interfaces/delegator/IFullRestakingDelegator.sol";
import {IFullRestakeDelegator} from "src/interfaces/delegator/IFullRestakeDelegator.sol";
import {IDelegator} from "src/interfaces/delegator/IDelegator.sol";
import {IRegistry} from "src/interfaces/common/IRegistry.sol";
import {IVault} from "src/interfaces/vault/IVault.sol";
Expand All @@ -16,7 +16,7 @@ import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
import {Time} from "@openzeppelin/contracts/utils/types/Time.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable, IFullRestakingDelegator {
contract FullRestakeDelegator is Entity, AccessControlUpgradeable, IFullRestakeDelegator {
using Checkpoints for Checkpoints.Trace256;
using Math for uint256;

Expand All @@ -26,32 +26,32 @@ contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable
uint64 public constant VERSION = 1;

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
bytes32 public constant NETWORK_LIMIT_SET_ROLE = keccak256("NETWORK_LIMIT_SET_ROLE");

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
bytes32 public constant OPERATOR_NETWORK_LIMIT_SET_ROLE = keccak256("OPERATOR_NETWORK_LIMIT_SET_ROLE");

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
address public immutable NETWORK_REGISTRY;

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
address public immutable VAULT_FACTORY;

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
address public immutable OPERATOR_VAULT_OPT_IN_SERVICE;

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
address public immutable OPERATOR_NETWORK_OPT_IN_SERVICE;

Expand Down Expand Up @@ -91,42 +91,42 @@ contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function networkLimitIn(address network, uint48 duration) public view returns (uint256) {
return _networkLimit[network].upperLookupRecent(Time.timestamp() + duration);
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function networkLimit(address network) public view returns (uint256) {
return _networkLimit[network].upperLookupRecent(Time.timestamp());
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function totalOperatorNetworkLimitIn(address network, uint48 duration) public view returns (uint256) {
return _totalOperatorNetworkLimit[network].upperLookupRecent(Time.timestamp() + duration);
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function totalOperatorNetworkLimit(address network) public view returns (uint256) {
return _totalOperatorNetworkLimit[network].upperLookupRecent(Time.timestamp());
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function operatorNetworkLimitIn(address network, address operator, uint48 duration) public view returns (uint256) {
return _operatorNetworkLimit[network][operator].upperLookupRecent(Time.timestamp() + duration);
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function operatorNetworkLimit(address network, address operator) public view returns (uint256) {
return _operatorNetworkLimit[network][operator].upperLookupRecent(Time.timestamp());
Expand Down Expand Up @@ -196,7 +196,7 @@ contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function setMaxNetworkLimit(address network, uint256 amount) external {
if (maxNetworkLimit[msg.sender] == amount) {
Expand All @@ -215,7 +215,7 @@ contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function setNetworkLimit(address network, uint256 amount) external onlyRole(NETWORK_LIMIT_SET_ROLE) {
if (amount > maxNetworkLimit[network]) {
Expand All @@ -228,7 +228,7 @@ contract FullRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable
}

/**
* @inheritdoc IFullRestakingDelegator
* @inheritdoc IFullRestakeDelegator
*/
function setOperatorNetworkLimit(
address network,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratableEntity} from "src/contracts/common/NonMigratableEntity.sol";
import {Entity} from "src/contracts/common/Entity.sol";

import {INetworkRestakingDelegator} from "src/interfaces/delegator/INetworkRestakingDelegator.sol";
import {INetworkRestakeDelegator} from "src/interfaces/delegator/INetworkRestakeDelegator.sol";
import {IDelegator} from "src/interfaces/delegator/IDelegator.sol";
import {IRegistry} from "src/interfaces/common/IRegistry.sol";
import {IVault} from "src/interfaces/vault/IVault.sol";
Expand All @@ -16,7 +16,7 @@ import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/acce
import {Time} from "@openzeppelin/contracts/utils/types/Time.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradeable, INetworkRestakingDelegator {
contract NetworkRestakeDelegator is Entity, AccessControlUpgradeable, INetworkRestakeDelegator {
using Checkpoints for Checkpoints.Trace256;
using Math for uint256;

Expand All @@ -26,32 +26,32 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
uint64 public constant VERSION = 1;

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
bytes32 public constant NETWORK_LIMIT_SET_ROLE = keccak256("NETWORK_LIMIT_SET_ROLE");

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
bytes32 public constant OPERATOR_NETWORK_SHARES_SET_ROLE = keccak256("OPERATOR_NETWORK_SHARES_SET_ROLE");

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
address public immutable NETWORK_REGISTRY;

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
address public immutable VAULT_FACTORY;

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
address public immutable OPERATOR_VAULT_OPT_IN_SERVICE;

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
address public immutable OPERATOR_NETWORK_OPT_IN_SERVICE;

Expand Down Expand Up @@ -91,35 +91,35 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function networkLimitIn(address network, uint48 duration) public view returns (uint256) {
return _networkLimit[network].upperLookupRecent(Time.timestamp() + duration);
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function networkLimit(address network) public view returns (uint256) {
return _networkLimit[network].upperLookupRecent(Time.timestamp());
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function totalOperatorNetworkSharesIn(address network, uint48 duration) public view returns (uint256) {
return _totalOperatorNetworkShares[network].upperLookupRecent(Time.timestamp() + duration);
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function totalOperatorNetworkShares(address network) public view returns (uint256) {
return _totalOperatorNetworkShares[network].upperLookupRecent(Time.timestamp());
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function operatorNetworkSharesIn(
address network,
Expand All @@ -130,7 +130,7 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function operatorNetworkShares(address network, address operator) public view returns (uint256) {
return _operatorNetworkShares[network][operator].upperLookupRecent(Time.timestamp());
Expand Down Expand Up @@ -199,7 +199,7 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function setMaxNetworkLimit(address network, uint256 amount) external {
if (maxNetworkLimit[msg.sender] == amount) {
Expand All @@ -218,7 +218,7 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function setNetworkLimit(address network, uint256 amount) external onlyRole(NETWORK_LIMIT_SET_ROLE) {
if (amount > maxNetworkLimit[network]) {
Expand All @@ -231,7 +231,7 @@ contract NetworkRestakingDelegator is NonMigratableEntity, AccessControlUpgradea
}

/**
* @inheritdoc INetworkRestakingDelegator
* @inheritdoc INetworkRestakeDelegator
*/
function setOperatorNetworkShares(
address network,
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/slasher/Slasher.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {NonMigratableEntity} from "src/contracts/common/NonMigratableEntity.sol";
import {Entity} from "src/contracts/common/Entity.sol";

import {ISlasher} from "src/interfaces/slasher/ISlasher.sol";
import {IRegistry} from "src/interfaces/common/IRegistry.sol";
Expand All @@ -12,7 +12,7 @@ import {IOptInService} from "src/interfaces/service/IOptInService.sol";

import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

contract Slasher is NonMigratableEntity, ISlasher {
contract Slasher is Entity, ISlasher {
/**
* @inheritdoc ISlasher
*/
Expand Down
Loading

0 comments on commit 25d15c1

Please sign in to comment.