CREATE2 callback validation; init code storage contracts

This commit is contained in:
tim
2025-11-13 16:41:52 -04:00
parent c2ac0e3624
commit 9273430f2a
28 changed files with 779 additions and 588 deletions

View File

@@ -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();