Skip to content

Commit

Permalink
Create: NewCurveRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Farterson committed Sep 5, 2021
1 parent 0f5fea8 commit c018f2f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions contracts/registries/NewCurveRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";

contract NewCurveRegistry is Ownable {

event Register(address curve);
event Deactivate(address curve);

// NOTE: keys are addresses to the curve library, values are if it's active
mapping(address => bool) private curves;

function register(address _curve) external onlyOwner {
require(!isActive(_curve), "Already active");
curves[_curve] = true;
emit Register(_curve);
}

function deactivate(address _curve) external onlyOwner {
require(isActive(_curve), "Already inactive");
emit Deactivate(_curve);
}

function isActive(address _curve) public view returns (bool) {
return curves[_curve];
}
}

0 comments on commit c018f2f

Please sign in to comment.