sepolia redeploy

This commit is contained in:
tim
2025-11-13 18:11:53 -04:00
parent 9273430f2a
commit af90b490c9
91 changed files with 145 additions and 111 deletions

View File

@@ -23,6 +23,9 @@ import {MockERC20} from "../test/MockERC20.sol";
import {MockFlashBorrower} from "../test/MockFlashBorrower.sol";
contract DeploySepolia is Script {
// for some reason the mintAll() causes Sepolia to complain sometimes with:
// server returned an error response: error code -32003: gas limit too high
bool constant private ALLOW_MINT = true;
address constant public PROTOCOL_FEE_ADDRESS = 0x0E280F5eDA58872d7cDaA8AC0A57A55fD6133AEd;
uint256 constant public PROTOCOL_FEE_PPM = 10_0000; // 10% of LP fees
@@ -33,6 +36,7 @@ contract DeploySepolia is Script {
vm.startBroadcast();
console2.log('deploying mock tokens');
// create mock _tokens
// usxd = new MockERC20('Joke Currency', 'USXD', 6);
// fusd = new MockERC20('Fake USD', 'FUSD', 6);
@@ -53,12 +57,17 @@ contract DeploySepolia is Script {
// give tokens to msg.sender for later use
mintAll(msg.sender, 1_000_000);
console2.log('creating swap impl');
PartyPoolSwapImpl swapImpl = new PartyPoolSwapImpl(WETH);
console2.log('creating mint impl');
PartyPoolMintImpl mintImpl = new PartyPoolMintImpl(WETH);
console2.log('creating pool init');
PartyPoolInitCode poolInit = new PartyPoolInitCode();
console2.log('creating bppool init');
PartyPoolBalancedPairInitCode bpInit = new PartyPoolBalancedPairInitCode();
// deploy a PartyPlanner factory and create the pool via factory
console2.log('creating planner');
PartyPlanner planner = new PartyPlanner(
msg.sender, // admin address is the same as the deployer
WETH,
@@ -102,6 +111,7 @@ contract DeploySepolia is Script {
int128 kappa = LMSRStabilized.computeKappaFromSlippage(3, ABDKMath64x64.divu(1, 10), ABDKMath64x64.divu(50,10000));
// call full newPool signature on factory which will take the deposits and mint initial LP
console2.log('deploying exercise pool');
(IPartyPool exercisePool,) = planner.newPool(
'Token Pool',
'TP',
@@ -139,6 +149,7 @@ contract DeploySepolia is Script {
initialDeposits[2] = _bases[2] * 10_000;
// call full newPool signature on factory which will take the deposits and mint initial LP
console2.log('deploying stablecoin pool');
planner.newPool(
'Stablecoin Pool',
'STAP',
@@ -174,6 +185,7 @@ contract DeploySepolia is Script {
initialDeposits[1] = _bases[1] * 10_000;
// call full newPool signature on factory which will take the deposits and mint initial LP
console2.log('deploying balanced pair pool');
planner.newPool(
'Stable Pair',
'SPAIR',
@@ -189,10 +201,13 @@ contract DeploySepolia is Script {
0
);
console2.log('deploying info');
PartyInfo info = new PartyInfo(swapImpl, mintImpl);
console2.log('running exercise');
exercise(exercisePool, info);
console2.log('broadcast completed');
vm.stopBroadcast();
// Set ENV vars
@@ -228,11 +243,14 @@ contract DeploySepolia is Script {
MockERC20 private wteth;
function mintAll(address who, uint256 amount) internal {
usxd.mint(who, amount * 1e6);
fusd.mint(who, amount * 1e6);
dive.mint(who, amount * 1e18);
butc.mint(who, amount * 1e8);
wteth.mint(who, amount * 1e18);
if(ALLOW_MINT) {
console2.log('minting mock tokens');
usxd.mint(who, amount * 1e6);
fusd.mint(who, amount * 1e6);
dive.mint(who, amount * 1e18);
butc.mint(who, amount * 1e8);
wteth.mint(who, amount * 1e18);
}
}
function approveAll(address spender) internal {