Skip to content

Commit

Permalink
feat: mode deployment (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
simplyoptimistic authored Nov 8, 2024
1 parent 2b18759 commit 63b2e08
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 51 deletions.
12 changes: 12 additions & 0 deletions deployment-addresses/DeployCL-Mode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"leafGaugeFactory: ": "0xeAD23f606643E387a073D0EE8718602291ffaAeB",
"leafPoolFactory: ": "0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F",
"leafPoolImplementation: ": "0x321f7Dfb9B2eA9131B8C17691CF6e01E5c149cA8",
"mixedQuoter: ": "0x2f7150B288ef1cc553207bD9fbd40D4e0e093B24",
"nft: ": "0x991d5546C4B442B4c5fdc4c8B8b8d131DEB24702",
"nftDescriptor: ": "0xf13bd1AFdf4f8b394928228F8FD122DC225f9140",
"quoter: ": "0x3FA596fAC2D6f7d16E01984897Ac04200Cb9cA05",
"swapFeeModule: ": "0x479Bec910d4025b4aC440ec27aCf28eac522242B",
"swapRouter: ": "0x63951637d667f23D5251DEdc0f9123D22d8595be",
"unstakedFeeModule: ": "0x03Cd805861CC6D9891e4908BAcD0472a3341E90C"
}
5 changes: 5 additions & 0 deletions deployment-addresses/DeployCL-Optimism.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rootGaugeFactory: ": "0xeAD23f606643E387a073D0EE8718602291ffaAeB",
"rootPoolFactory: ": "0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F",
"rootPoolImplementation: ": "0x321f7Dfb9B2eA9131B8C17691CF6e01E5c149cA8"
}
27 changes: 10 additions & 17 deletions script/01_DeployLeafBaseFixture.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,22 +214,15 @@ abstract contract DeployLeafBaseFixture is DeployFixture, Constants {
string memory root = vm.projectRoot();
string memory path = string(abi.encodePacked(root, "/deployment-addresses/", _params.outputFilename));
/// @dev This might overwrite an existing output file
vm.writeJson(
path,
string(
abi.encodePacked(
stdJson.serialize("", "leafPoolImplementation", address(leafPoolImplementation)),
stdJson.serialize("", "leafPoolFactory", address(leafPoolFactory)),
stdJson.serialize("", "nftDescriptor", address(nftDescriptor)),
stdJson.serialize("", "nft", address(nft)),
stdJson.serialize("", "leafGaugeFactory", address(leafGaugeFactory)),
stdJson.serialize("", "swapFeeModule", address(swapFeeModule)),
stdJson.serialize("", "unstakedFeeModule", address(unstakedFeeModule)),
stdJson.serialize("", "mixedQuoter", address(mixedQuoter)),
stdJson.serialize("", "quoter", address(quoter)),
stdJson.serialize("", "swapRouter", address(swapRouter))
)
)
);
vm.writeJson(vm.serializeAddress("", "leafPoolImplementation: ", address(leafPoolImplementation)), path);
vm.writeJson(vm.serializeAddress("", "leafPoolFactory: ", address(leafPoolFactory)), path);
vm.writeJson(vm.serializeAddress("", "nftDescriptor: ", address(nftDescriptor)), path);
vm.writeJson(vm.serializeAddress("", "nft: ", address(nft)), path);
vm.writeJson(vm.serializeAddress("", "leafGaugeFactory: ", address(leafGaugeFactory)), path);
vm.writeJson(vm.serializeAddress("", "swapFeeModule: ", address(swapFeeModule)), path);
vm.writeJson(vm.serializeAddress("", "unstakedFeeModule: ", address(unstakedFeeModule)), path);
vm.writeJson(vm.serializeAddress("", "mixedQuoter: ", address(mixedQuoter)), path);
vm.writeJson(vm.serializeAddress("", "quoter: ", address(quoter)), path);
vm.writeJson(vm.serializeAddress("", "swapRouter: ", address(swapRouter)), path);
}
}
17 changes: 5 additions & 12 deletions script/01_DeployRootBaseFixture.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ abstract contract DeployRootBaseFixture is DeployFixture, Constants {
address messageBridge;
address votingRewardsFactory;
address poolFactoryOwner;
address feeManager;
address notifyAdmin;
address emissionAdmin;
uint256 emissionCap;
string outputFilename;
}

Expand Down Expand Up @@ -74,7 +74,7 @@ abstract contract DeployRootBaseFixture is DeployFixture, Constants {
_params.votingRewardsFactory, // voting rewards factory
_params.notifyAdmin, // notify admin
_params.emissionAdmin, // emission admin
100 // 1% default cap
_params.emissionCap // 1% default cap
)
)
})
Expand All @@ -98,15 +98,8 @@ abstract contract DeployRootBaseFixture is DeployFixture, Constants {
string memory root = vm.projectRoot();
string memory path = string(abi.encodePacked(root, "/deployment-addresses/", _params.outputFilename));
/// @dev This might overwrite an existing output file
vm.writeJson(
path,
string(
abi.encodePacked(
stdJson.serialize("", "rootPoolImplementation", address(rootPoolImplementation)),
stdJson.serialize("", "rootPoolFactory", address(rootPoolFactory)),
stdJson.serialize("", "rootGaugeFactory", address(rootGaugeFactory))
)
)
);
vm.writeJson(vm.serializeAddress("", "rootPoolImplementation: ", address(rootPoolImplementation)), path);
vm.writeJson(vm.serializeAddress("", "rootPoolFactory: ", address(rootPoolFactory)), path);
vm.writeJson(vm.serializeAddress("", "rootGaugeFactory: ", address(rootGaugeFactory)), path);
}
}
1 change: 1 addition & 0 deletions script/DeployFixture.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ abstract contract DeployFixture is Script {

deploy();
logParams();
logOutput();

vm.stopBroadcast();
}
Expand Down
17 changes: 8 additions & 9 deletions script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ forge test

### Deployment

Command:

As of 2024, gas estimation for foundry on L2s continues to be inaccurate. You will need `--legacy --with-gas-price 2500000` if you wish to not overpay L2 gas.
For non-create transactions, `--gas-estimate-multiplier 200` must be used as gas estimation is incorrect for these as well.
Deploy Root Contracts

```
forge script script/DeployCL.s.sol:DeployCL --broadcast --slow --rpc-url optimism --verify -vvvv
forge script script/DeployLpMigrator.s.sol:DeployLpMigrator --broadcast --slow --rpc-url optimism --verify -vvvv
forge script script/deployParameters/optimism/DeployRootCL.s.sol:DeployRootCL --slow --rpc-url optimism -vvvv
forge script script/deployParameters/optimism/DeployRootCL.s.sol:DeployRootCL --broadcast --slow --rpc-url optimism --broadcast --verify -vvvv
```

forge script script/DeployPools.s.sol:DeployPools --broadcast --slow --rpc-url optimism -vvvv
Deploy Leaf Contracts

forge script script/DeployPositionDescriptor.s.sol:DeployPositionDescriptor --broadcast --slow --rpc-url optimism -vvvv
```
forge script script/deployParameters/mode/DeployLeafCL.s.sol:DeployLeafCL --slow --rpc-url mode -vvvv
forge script script/deployParameters/mode/DeployLeafCL.s.sol:DeployLeafCL --broadcast --slow --rpc-url mode --broadcast --verify --verifier blockscout --verifier-url https://explorer.mode.network/api\? -vvvv
```
12 changes: 6 additions & 6 deletions script/deployParameters/mode/DeployLeafCL.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ contract DeployLeafCL is DeployLeafBaseFixture {
function setUp() public override {
_params = DeployLeafBaseFixture.DeploymentParameters({
weth: 0x4200000000000000000000000000000000000006,
leafVoter: 0xa0eD3C12C6FD753220b584b6790162f2Cbc81d13,
leafVoter: 0x97cDBCe21B6fd0585d29E539B1B99dAd328a1123,
factoryV2: 0x31832f2a97Fd20664D76Cc421207669b55CE4BC0,
xVelo: 0xa700b592304b69dDb70d9434F5E90877947f1f05,
messageBridge: 0x0b34Ec8995052783A62692B7F3fF7c856A184dDD,
team: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
poolFactoryOwner: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
feeManager: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
xVelo: 0x7f9AdFbd38b669F03d1d11000Bc76b9AaEA28A81,
messageBridge: 0xF278761576f45472bdD721EACA19317cE159c011,
team: 0xe915AEf46E1bd9b9eD2D9FE571AE9b5afbDE571b,
poolFactoryOwner: 0xe915AEf46E1bd9b9eD2D9FE571AE9b5afbDE571b,
feeManager: 0xe915AEf46E1bd9b9eD2D9FE571AE9b5afbDE571b,
nftName: "Slipstream Position NFT v1.2",
nftSymbol: "VELO-CL-POS",
outputFilename: "DeployCL-Mode.json"
Expand Down
10 changes: 5 additions & 5 deletions script/deployParameters/optimism/DeployRootCL.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ contract DeployRootCL is DeployRootBaseFixture {
function setUp() public override {
_params = DeployRootBaseFixture.DeploymentParameters({
voter: 0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C,
xVelo: 0xa700b592304b69dDb70d9434F5E90877947f1f05,
lockbox: 0xF37D648ff7ab53fBe71C4EE66c212f74372f846b,
messageBridge: 0x0b34Ec8995052783A62692B7F3fF7c856A184dDD,
votingRewardsFactory: 0xEAc8b42979528447d58779A6a3CaBEb4E4aEdEC5,
xVelo: 0x7f9AdFbd38b669F03d1d11000Bc76b9AaEA28A81,
lockbox: 0x12B64dF29590b4F0934070faC96e82e580D60232,
messageBridge: 0xF278761576f45472bdD721EACA19317cE159c011,
votingRewardsFactory: 0x7dc9fd82f91B36F416A89f5478375e4a79f4Fb2F,
poolFactoryOwner: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
feeManager: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
notifyAdmin: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
emissionAdmin: 0xBA4BB89f4d1E66AA86B60696534892aE0cCf91F5,
emissionCap: 150,
outputFilename: "DeployCL-Optimism.json"
});
}
Expand Down
3 changes: 1 addition & 2 deletions test/fork/DeployRootCL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ contract DeployRootCLForkTest is BaseForkFixture {
assertNotEq(params.messageBridge, address(0));
assertNotEq(params.votingRewardsFactory, address(0));
assertNotEq(params.poolFactoryOwner, address(0));
assertNotEq(params.feeManager, address(0));
assertNotEq(params.notifyAdmin, address(0));
assertNotEq(params.emissionAdmin, address(0));

Expand All @@ -74,7 +73,7 @@ contract DeployRootCLForkTest is BaseForkFixture {
assertEq(rootGaugeFactory.poolFactory(), address(rootPoolFactory));
assertEq(rootGaugeFactory.votingRewardsFactory(), params.votingRewardsFactory);
assertEq(rootGaugeFactory.emissionAdmin(), params.emissionAdmin);
assertEqUint(rootGaugeFactory.defaultCap(), 100);
assertEqUint(rootGaugeFactory.defaultCap(), 150);
assertEq(rootGaugeFactory.notifyAdmin(), params.notifyAdmin);
assertEqUint(rootGaugeFactory.weeklyEmissions(), 0);
assertEqUint(rootGaugeFactory.activePeriod(), 0);
Expand Down

0 comments on commit 63b2e08

Please sign in to comment.