-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sturgeon-protocol/dev
Dev
- Loading branch information
Showing
16 changed files
with
467 additions
and
14 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
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
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
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,61 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.21; | ||
|
||
import "./base/Controllable.sol"; | ||
import "./CompounderVault.sol"; | ||
import "./PearlStrategy.sol"; | ||
import "./interfaces/IMultiPool.sol"; | ||
import "./lib/DeployerLib.sol"; | ||
|
||
contract Factory is Controllable { | ||
function init(address controller_) external initializer { | ||
__Controllable_init(controller_); | ||
} | ||
|
||
modifier onlyGovernance() { | ||
_requireGovernance(); | ||
_; | ||
} | ||
|
||
function deployIfoHarvester( | ||
address underlying, | ||
address pearlGauge, | ||
string calldata vaultName, | ||
string calldata vaultSymbol | ||
) external onlyGovernance returns (address vault, address strategy) { | ||
address _controller = controller(); | ||
vault = DeployerLib.deployHarvesterVault(_controller, underlying, vaultName, vaultSymbol); | ||
strategy = address(new PearlStrategy(vault, pearlGauge, true, address(0))); | ||
IVault(vault).setStrategy(strategy); | ||
IGauge(IController(_controller).multigauge()).addStakingToken(vault); | ||
IController(_controller).registerVault(vault, true); | ||
} | ||
|
||
function deployCompounder( | ||
address underlying, | ||
string calldata vaultName, | ||
string calldata vaultSymbol | ||
) external onlyGovernance returns (address compounder) { | ||
compounder = address(new CompounderVault(IERC20(underlying), vaultName, vaultSymbol)); | ||
} | ||
|
||
function deployHarvester( | ||
address underlying, | ||
address pearlGauge, | ||
string calldata vaultName, | ||
string calldata vaultSymbol, | ||
address compounderVault | ||
) external onlyGovernance returns (address vault, address strategy) { | ||
address _controller = controller(); | ||
vault = DeployerLib.deployHarvesterVault(_controller, underlying, vaultName, vaultSymbol); | ||
strategy = address(new PearlStrategy(vault, pearlGauge, false, compounderVault)); | ||
IVault(vault).setStrategy(strategy); | ||
address multigauge = IController(_controller).multigauge(); | ||
IGauge(multigauge).addStakingToken(vault); | ||
IMultiPool(multigauge).registerRewardToken(vault, compounderVault); | ||
} | ||
|
||
function _requireGovernance() internal view { | ||
require(isGovernance(msg.sender), "Denied"); | ||
} | ||
} |
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
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
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
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
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
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,15 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.21; | ||
|
||
import "../HarvesterVault.sol"; | ||
|
||
library DeployerLib { | ||
function deployHarvesterVault( | ||
address controller, | ||
address underlying, | ||
string calldata vaultName, | ||
string calldata vaultSymbol | ||
) external returns (address) { | ||
return address(new HarvesterVault(controller, IERC20(underlying), vaultName, vaultSymbol, 4_000)); | ||
} | ||
} |
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
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
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
Oops, something went wrong.