started CREATE2 work and abandoned it
This commit is contained in:
32
src/IPartyPoolDeployer.sol
Normal file
32
src/IPartyPoolDeployer.sol
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
|
pragma solidity ^0.8.30;
|
||||||
|
|
||||||
|
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||||
|
import {IPartyPool} from "./IPartyPool.sol";
|
||||||
|
import {NativeWrapper} from "./NativeWrapper.sol";
|
||||||
|
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
|
||||||
|
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";
|
||||||
|
|
||||||
|
interface IPartyPoolDeployer {
|
||||||
|
|
||||||
|
struct DeployParams {
|
||||||
|
address owner;
|
||||||
|
string memory name;
|
||||||
|
string memory symbol;
|
||||||
|
IERC20[] memory tokens;
|
||||||
|
int128 kappa;
|
||||||
|
uint256[] memory fees;
|
||||||
|
uint256 flashFeePpm;
|
||||||
|
uint256 protocolFeePpm;
|
||||||
|
address protocolFeeAddress;
|
||||||
|
NativeWrapper wrapper;
|
||||||
|
PartyPoolSwapImpl swapImpl;
|
||||||
|
PartyPoolMintImpl mintImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deploy(DeployParams memory params) external returns (IPartyPool pool);
|
||||||
|
|
||||||
|
function params() external returns (DeployParams memory params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,91 +1,40 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
pragma solidity ^0.8.30;
|
pragma solidity ^0.8.30;
|
||||||
|
|
||||||
import "./PartyPoolMintImpl.sol";
|
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||||
import "./PartyPoolSwapImpl.sol";
|
import {IPartyPool} from "./IPartyPool.sol";
|
||||||
|
import {IPartyPoolDeployer} from "./IPartyPoolDeployer.sol";
|
||||||
|
import {NativeWrapper} from "./NativeWrapper.sol";
|
||||||
import {PartyPool} from "./PartyPool.sol";
|
import {PartyPool} from "./PartyPool.sol";
|
||||||
import {PartyPoolBalancedPair} from "./PartyPoolBalancedPair.sol";
|
import {PartyPoolBalancedPair} from "./PartyPoolBalancedPair.sol";
|
||||||
|
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
|
||||||
|
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";
|
||||||
|
|
||||||
// This pattern is needed because the PartyPlanner constructs two different types of pools (regular and balanced-pair)
|
// This pattern is needed because the PartyPlanner constructs two different types of pools (regular and balanced-pair)
|
||||||
// but doesn't have room to store the initialization code of both contracts. Therefore, we delegate pool construction.
|
// but doesn't have room to store the initialization code of both contracts. Therefore, we delegate pool construction.
|
||||||
|
|
||||||
interface IPartyPoolDeployer {
|
abstract contract BasePartyPoolDeployer is IPartyPoolDeployer {
|
||||||
function deploy(
|
uint256 private nonce;
|
||||||
address owner_,
|
DeployParams public params;
|
||||||
string memory name_,
|
|
||||||
string memory symbol_,
|
function deploy(DeployParams memory params_) external returns (IPartyPool pool) {
|
||||||
IERC20[] memory tokens_,
|
params = params_;
|
||||||
int128 kappa_,
|
pool = _doDeploy(nonce);
|
||||||
uint256[] memory fees_,
|
nonce += 1;
|
||||||
uint256 flashFeePpm_,
|
}
|
||||||
uint256 protocolFeePpm_,
|
|
||||||
address protocolFeeAddress_,
|
function _doDeploy(uint256 nonce) virtual internal returns (IPartyPool pool);
|
||||||
NativeWrapper wrapper_,
|
|
||||||
PartyPoolSwapImpl swapImpl_,
|
|
||||||
PartyPoolMintImpl mintImpl_
|
|
||||||
) external returns (IPartyPool pool);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contract PartyPoolDeployer is IPartyPoolDeployer {
|
|
||||||
function deploy(
|
contract PartyPoolDeployer is BasePartyPoolDeployer {
|
||||||
address owner_,
|
function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
|
||||||
string memory name_,
|
return new PartyPool(nonce);
|
||||||
string memory symbol_,
|
|
||||||
IERC20[] memory tokens_,
|
|
||||||
int128 kappa_,
|
|
||||||
uint256[] memory fees_,
|
|
||||||
uint256 flashFeePpm_,
|
|
||||||
uint256 protocolFeePpm_,
|
|
||||||
address protocolFeeAddress_,
|
|
||||||
NativeWrapper wrapper_,
|
|
||||||
PartyPoolSwapImpl swapImpl_,
|
|
||||||
PartyPoolMintImpl mintImpl_
|
|
||||||
) external returns (IPartyPool) {
|
|
||||||
return new PartyPool(
|
|
||||||
owner_,
|
|
||||||
name_,
|
|
||||||
symbol_,
|
|
||||||
tokens_,
|
|
||||||
kappa_,
|
|
||||||
fees_,
|
|
||||||
flashFeePpm_,
|
|
||||||
protocolFeePpm_,
|
|
||||||
protocolFeeAddress_,
|
|
||||||
wrapper_,
|
|
||||||
swapImpl_,
|
|
||||||
mintImpl_
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract PartyPoolBalancedPairDeployer is IPartyPoolDeployer {
|
contract PartyPoolBalancedPairDeployer is BasePartyPoolDeployer {
|
||||||
function deploy(
|
function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
|
||||||
address owner_,
|
return new PartyPoolBalancedPair(nonce);
|
||||||
string memory name_,
|
|
||||||
string memory symbol_,
|
|
||||||
IERC20[] memory tokens_,
|
|
||||||
int128 kappa_,
|
|
||||||
uint256[] memory fees_,
|
|
||||||
uint256 flashFeePpm_,
|
|
||||||
uint256 protocolFeePpm_,
|
|
||||||
address protocolFeeAddress_,
|
|
||||||
NativeWrapper wrapper_,
|
|
||||||
PartyPoolSwapImpl swapImpl_,
|
|
||||||
PartyPoolMintImpl mintImpl_
|
|
||||||
) external returns (IPartyPool) {
|
|
||||||
return new PartyPoolBalancedPair(
|
|
||||||
owner_,
|
|
||||||
name_,
|
|
||||||
symbol_,
|
|
||||||
tokens_,
|
|
||||||
kappa_,
|
|
||||||
fees_,
|
|
||||||
flashFeePpm_,
|
|
||||||
protocolFeePpm_,
|
|
||||||
protocolFeeAddress_,
|
|
||||||
wrapper_,
|
|
||||||
swapImpl_,
|
|
||||||
mintImpl_
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user