-
Notifications
You must be signed in to change notification settings - Fork 24
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
1 parent
d180c42
commit 5514895
Showing
3 changed files
with
59 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 |
---|---|---|
|
@@ -7,3 +7,5 @@ networks: | |
mnemonic: brownie | ||
fork: https://optimism-mainnet.wallet.coinbase.com | ||
evm_version: shanghai | ||
dependencies: | ||
- openzeppelin/[email protected] |
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,35 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import {Ownable} from "openzeppelin/[email protected]/contracts/access/Ownable.sol"; | ||
import {EnumerableSet} from "openzeppelin/[email protected]/contracts/utils/structs/EnumerableSet.sol"; | ||
|
||
/// @title Sugar Factory Registry | ||
/// @author @velodrome.finance | ||
/// @notice Sugar Factory Registry to keep track of leaf pool factories | ||
contract FactoryRegistry is Ownable { | ||
using EnumerableSet for EnumerableSet.AddressSet; | ||
|
||
/// @dev Array of poolFactories | ||
EnumerableSet.AddressSet private _poolFactories; | ||
|
||
constructor() Ownable(msg.sender) {} | ||
|
||
function approve(address poolFactory) external onlyOwner { | ||
require(!_poolFactories.contains(poolFactory), "AE"); | ||
_poolFactories.add(poolFactory); | ||
} | ||
|
||
function unapprove(address poolFactory) external onlyOwner { | ||
require(_poolFactories.contains(poolFactory), "NE"); | ||
_poolFactories.remove(poolFactory); | ||
} | ||
|
||
function factoriesToPoolFactory(address poolFactory) external pure returns (address, address) { | ||
return (address(0), poolFactory); | ||
} | ||
|
||
function poolFactories() external view returns (address[] memory) { | ||
return _poolFactories.values(); | ||
} | ||
} |
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,22 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import "forge-std/Script.sol"; | ||
import "contracts/helpers/FactoryRegistry.sol"; | ||
|
||
contract DeployFactoryRegistry is Script { | ||
|
||
uint256 public deployPrivateKey = vm.envUint("PRIVATE_KEY_DEPLOY"); | ||
address public deployerAddress = vm.addr(deployPrivateKey); | ||
|
||
function run() public { | ||
|
||
vm.startBroadcast(deployerAddress); | ||
|
||
FactoryRegistry factoryRegistry = new FactoryRegistry(); | ||
|
||
vm.stopBroadcast(); | ||
console.log("FactoryRegistry deployed at: ", address(factoryRegistry)); | ||
|
||
} | ||
} |