-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carl Farterson
committed
Sep 5, 2021
1 parent
0f5fea8
commit c018f2f
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | ||
} | ||
} |