From ac134afc02e39fcf78416d702003d0a3af902f7d Mon Sep 17 00:00:00 2001 From: Carl Farterson Date: Fri, 14 Jan 2022 08:43:08 -0800 Subject: [PATCH] feat: onlyRegisterer --- contracts/Hub.sol | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/contracts/Hub.sol b/contracts/Hub.sol index 1ad28ec3..6183c0ef 100644 --- a/contracts/Hub.sol +++ b/contracts/Hub.sol @@ -27,8 +27,15 @@ contract Hub is IHub, Ownable, Initializable { IRegistry public vaultRegistry; IRegistry public curveRegistry; + address private registerer; + mapping(uint256 => Details.Hub) private _hubs; + modifier onlyRegisterer() { + require(msg.sender == registerer, "!registerer"); + _; + } + function initialize( address _foundry, address _vaultRegistry, @@ -37,6 +44,7 @@ contract Hub is IHub, Ownable, Initializable { foundry = IFoundry(_foundry); vaultRegistry = IRegistry(_vaultRegistry); curveRegistry = IRegistry(_curveRegistry); + registerer = owner(); } /// @inheritdoc IHub @@ -48,7 +56,7 @@ contract Hub is IHub, Ownable, Initializable { uint256 _refundRatio, bytes memory _encodedCurveDetails, bytes memory _encodedVaultArgs - ) external override { + ) external override onlyRegisterer { // TODO: access control require(curveRegistry.isApproved(address(_curve)), "_curve !approved"); @@ -173,6 +181,11 @@ contract Hub is IHub, Ownable, Initializable { emit TransferHubOwnership(_id, _newOwner); } + function setRegisterer(address _registerer) external onlyRegisterer { + require(_registerer != registerer, "_registerer == registerer"); + registerer = _registerer; + } + /// @inheritdoc IHub function setWarmup(uint256 warmup_) external override onlyOwner { require(warmup_ != _warmup, "warmup_ == _warmup");