CREATE2 callback validation; init code storage contracts
This commit is contained in:
@@ -10,10 +10,17 @@ import {StdCheatsSafe} from "../lib/forge-std/src/StdCheats.sol";
|
||||
import {StdUtils} from "../lib/forge-std/src/StdUtils.sol";
|
||||
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||
import {IERC20Metadata} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
||||
import {PartyPlanner} from "../src/PartyPlanner.sol";
|
||||
import {IPartyInfo} from "../src/IPartyInfo.sol";
|
||||
import {IPartyPlanner} from "../src/IPartyPlanner.sol";
|
||||
import {NativeWrapper} from "../src/NativeWrapper.sol";
|
||||
import {PartyInfo} from "../src/PartyInfo.sol";
|
||||
import {PartyPlanner} from "../src/PartyPlanner.sol";
|
||||
import {PartyPoolInitCode, PartyPoolBalancedPairInitCode} from "../src/PartyPoolDeployer.sol";
|
||||
import {PartyPoolMintImpl} from "../src/PartyPoolMintImpl.sol";
|
||||
import {PartyPoolSwapImpl} from "../src/PartyPoolSwapImpl.sol";
|
||||
import {Deploy} from "../test/Deploy.sol";
|
||||
import {MockERC20} from "../test/MockERC20.sol";
|
||||
import {WETH9} from "../test/WETH9.sol";
|
||||
|
||||
contract DeployMock is Script {
|
||||
|
||||
@@ -34,7 +41,19 @@ contract DeployMock is Script {
|
||||
wteth = new MockERC20('Wrapped TETH', 'WTETH', 18);
|
||||
|
||||
// deploy a PartyPlanner factory and create the pool via factory
|
||||
PartyPlanner planner = Deploy.newPartyPlanner();
|
||||
NativeWrapper wrapper = new WETH9();
|
||||
PartyPoolSwapImpl swapImpl = new PartyPoolSwapImpl(wrapper);
|
||||
PartyPoolMintImpl mintImpl = new PartyPoolMintImpl(wrapper);
|
||||
IPartyPlanner planner = new PartyPlanner(
|
||||
msg.sender,
|
||||
wrapper,
|
||||
swapImpl,
|
||||
new PartyPoolMintImpl(wrapper),
|
||||
new PartyPoolInitCode(),
|
||||
new PartyPoolBalancedPairInitCode(),
|
||||
Deploy.PROTOCOL_FEE_PPM,
|
||||
Deploy.PROTOCOL_FEE_RECEIVER
|
||||
);
|
||||
|
||||
//
|
||||
// Deploy 3-asset pool
|
||||
@@ -163,7 +182,7 @@ contract DeployMock is Script {
|
||||
0
|
||||
);
|
||||
|
||||
PartyInfo info = Deploy.newInfo();
|
||||
IPartyInfo info = new PartyInfo(swapImpl, mintImpl);
|
||||
|
||||
// give _tokens to dev7 for later use
|
||||
mintAll(DEV_ACCOUNT_7, 1_000_000);
|
||||
|
||||
@@ -10,15 +10,15 @@ import {StdCheatsSafe} from "../lib/forge-std/src/StdCheats.sol";
|
||||
import {StdUtils} from "../lib/forge-std/src/StdUtils.sol";
|
||||
import {IERC3156FlashBorrower} from "../lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashBorrower.sol";
|
||||
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||
import {IPartyPool} from "../src/IPartyPool.sol";
|
||||
import {IPartyInfo} from "../src/IPartyInfo.sol";
|
||||
import {IPartyPool} from "../src/IPartyPool.sol";
|
||||
import {LMSRStabilized} from "../src/LMSRStabilized.sol";
|
||||
import {NativeWrapper} from "../src/NativeWrapper.sol";
|
||||
import {PartyInfo} from "../src/PartyInfo.sol";
|
||||
import {PartyPlanner} from "../src/PartyPlanner.sol";
|
||||
import {PartyPoolDeployer, PartyPoolBalancedPairDeployer} from "../src/PartyPoolDeployer.sol";
|
||||
import {PartyPoolInitCode, PartyPoolBalancedPairInitCode} from "../src/PartyPoolDeployer.sol";
|
||||
import {PartyPoolMintImpl} from "../src/PartyPoolMintImpl.sol";
|
||||
import {PartyPoolSwapImpl} from "../src/PartyPoolSwapImpl.sol";
|
||||
import {PartyInfo} from "../src/PartyInfo.sol";
|
||||
import {MockERC20} from "../test/MockERC20.sol";
|
||||
import {MockFlashBorrower} from "../test/MockFlashBorrower.sol";
|
||||
|
||||
@@ -55,8 +55,8 @@ contract DeploySepolia is Script {
|
||||
|
||||
PartyPoolSwapImpl swapImpl = new PartyPoolSwapImpl(WETH);
|
||||
PartyPoolMintImpl mintImpl = new PartyPoolMintImpl(WETH);
|
||||
PartyPoolDeployer deployer = new PartyPoolDeployer();
|
||||
PartyPoolBalancedPairDeployer balancedPairDeployer = new PartyPoolBalancedPairDeployer();
|
||||
PartyPoolInitCode poolInit = new PartyPoolInitCode();
|
||||
PartyPoolBalancedPairInitCode bpInit = new PartyPoolBalancedPairInitCode();
|
||||
|
||||
// deploy a PartyPlanner factory and create the pool via factory
|
||||
PartyPlanner planner = new PartyPlanner(
|
||||
@@ -64,8 +64,8 @@ contract DeploySepolia is Script {
|
||||
WETH,
|
||||
swapImpl,
|
||||
mintImpl,
|
||||
deployer,
|
||||
balancedPairDeployer,
|
||||
poolInit,
|
||||
bpInit,
|
||||
PROTOCOL_FEE_PPM,
|
||||
PROTOCOL_FEE_ADDRESS
|
||||
);
|
||||
@@ -211,8 +211,8 @@ contract DeploySepolia is Script {
|
||||
console2.log(' PartyInfo', address(info));
|
||||
console2.log(' SwapImpl', address(swapImpl));
|
||||
console2.log(' MintImpl', address(mintImpl));
|
||||
console2.log(' Deployer', address(deployer));
|
||||
console2.log('BPair Deployer', address(balancedPairDeployer));
|
||||
console2.log(' PoolCode', address(poolInit));
|
||||
console2.log(' BPPoolCode', address(bpInit));
|
||||
console2.log();
|
||||
console2.log(' USXD', address(usxd));
|
||||
console2.log(' FUSD', address(fusd));
|
||||
@@ -284,7 +284,7 @@ contract DeploySepolia is Script {
|
||||
uint256 inputIndex = 0;
|
||||
uint256 outputIndex = n > 1 ? n - 1 : 0;
|
||||
uint256 maxIn = 89 * 10**6; // varied
|
||||
pool.swap(msg.sender, bytes4(0), msg.sender, inputIndex, outputIndex, maxIn, int128(0), 0, false);
|
||||
pool.swap(msg.sender, bytes4(0), msg.sender, inputIndex, outputIndex, maxIn, int128(0), 0, false, '');
|
||||
|
||||
// 6) Collect protocol fees now (after some swaps) so some will have been moved out
|
||||
pool.collectProtocolFees();
|
||||
|
||||
16
script/InitCodeHashes.sol
Normal file
16
script/InitCodeHashes.sol
Normal file
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.30;
|
||||
|
||||
import "forge-std/console2.sol";
|
||||
import {Script} from "../lib/forge-std/src/Script.sol";
|
||||
import {PartyPool} from "../src/PartyPool.sol";
|
||||
import {PartyPoolBalancedPair} from "../src/PartyPoolBalancedPair.sol";
|
||||
|
||||
contract InitCodeHashes is Script {
|
||||
function run() public pure {
|
||||
console2.log('\nPool Init Code Hash');
|
||||
console2.logBytes32(keccak256(type(PartyPool).creationCode));
|
||||
console2.log('\nBP Pool Init Code Hash');
|
||||
console2.logBytes32(keccak256(type(PartyPoolBalancedPair).creationCode));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user