Skip to content

Commit

Permalink
feat: onlyRegisterer
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Farterson committed Jan 14, 2022
1 parent b9e011d commit ac134af
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion contracts/Hub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -37,6 +44,7 @@ contract Hub is IHub, Ownable, Initializable {
foundry = IFoundry(_foundry);
vaultRegistry = IRegistry(_vaultRegistry);
curveRegistry = IRegistry(_curveRegistry);
registerer = owner();
}

/// @inheritdoc IHub
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit ac134af

Please sign in to comment.