71 lines
2.1 KiB
Solidity
71 lines
2.1 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.30;
|
|
|
|
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
|
import {PartyPlanner} from "./PartyPlanner.sol";
|
|
import {PartyPool} from "./PartyPool.sol";
|
|
import {PartyPoolBalancedPair} from "./PartyPoolBalancedPair.sol";
|
|
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
|
|
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";
|
|
import {PartyPoolView} from "./PartyPoolView.sol";
|
|
|
|
library Deploy {
|
|
|
|
function newPartyPlanner() internal returns (PartyPlanner) {
|
|
return new PartyPlanner(
|
|
new PartyPoolSwapImpl(),
|
|
new PartyPoolMintImpl(),
|
|
0, // protocolFeePpm = 0 for deploy helper
|
|
address(0) // protocolFeeAddress = address(0) for deploy helper
|
|
);
|
|
}
|
|
|
|
function newPartyPool(
|
|
string memory name_,
|
|
string memory symbol_,
|
|
IERC20[] memory tokens_,
|
|
uint256[] memory bases_,
|
|
int128 _kappa,
|
|
uint256 _swapFeePpm,
|
|
uint256 _flashFeePpm,
|
|
bool _stable
|
|
) internal returns (PartyPool) {
|
|
// default protocol fee/off parameters (per your instruction) - set to 0 / address(0)
|
|
uint256 protocolFeePpm = 0;
|
|
address protocolAddr = address(0);
|
|
|
|
return _stable && tokens_.length == 2 ?
|
|
new PartyPoolBalancedPair(
|
|
name_,
|
|
symbol_,
|
|
tokens_,
|
|
bases_,
|
|
_kappa,
|
|
_swapFeePpm,
|
|
_flashFeePpm,
|
|
protocolFeePpm,
|
|
protocolAddr,
|
|
new PartyPoolSwapImpl(),
|
|
new PartyPoolMintImpl()
|
|
) :
|
|
new PartyPool(
|
|
name_,
|
|
symbol_,
|
|
tokens_,
|
|
bases_,
|
|
_kappa,
|
|
_swapFeePpm,
|
|
_flashFeePpm,
|
|
protocolFeePpm,
|
|
protocolAddr,
|
|
new PartyPoolSwapImpl(),
|
|
new PartyPoolMintImpl()
|
|
);
|
|
}
|
|
|
|
|
|
function newViewer() internal returns (PartyPoolView) {
|
|
return new PartyPoolView(new PartyPoolSwapImpl(), new PartyPoolMintImpl());
|
|
}
|
|
}
|