Skip to content

Commit

Permalink
updating deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dsshap committed Apr 6, 2024
1 parent b13a6e4 commit 22e6646
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 59 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ optimizer = false

[profile.optimized]
optimizer = true
optimizer_runs = 1000
optimizer_runs = 800

gas_reports = [
# "*",
Expand Down
15 changes: 8 additions & 7 deletions script/.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ GrappaOptionTokenDescriptor=0xd475161Df1036bEd8b03655fE4A082D956580df8
GrappaOptionTokenDescriptorProxy=0xE758119291fE4322866Eb6195d67aBf9B1a87FcD
GrappaOptionToken=0x35b9340BaD6F92E7eA648698BAAa2fE3056BA01A

CrossMarginPhysicalLib=0xE2c1E05dcef0256C6b962E97CB89C1F5629EB0E1
CrossMarginPhysicalMath=0x11a166B96d3568443154e95A1B4b8802369c9fFE
CrossMarginPhysicalEngine=0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8
CrossMarginPhysicalLib=0x0e6B762f45d412C13B975dB10001d467d6CAAA19
CrossMarginPhysicalMath=0x93cc687407ACFc75D8994d20A4fF70563Bcc4B42
CrossMarginPhysicalEngine=0x181D053611a754Df9A1aDa64FED24a12B63A39F8
CrossMarginPhysicalEngineProxy=0x341C281d11677795F1192bF1f7438666909841c8

CrossMarginCashOracle=0x9bcE7eB7F44FCa5b97fbc668787990f1a7861DF6
CrossMarginCashLib=0xe3db03a6a579B259061830746A6f2Ac16f37f9c4
CrossMarginCashMath=0xefF65967227f0b84eA115BdB8be1d166C3F371D0
CrossMarginCashEngine=0x732A6aeF505743ae47A1Afb11138b7cC926773cb
CrossMarginCashLib=0x2c6c57528D8651c2fBC46AA67e64Aaf9E9646b31
CrossMarginCashMath=0xCe1f4470571af4dFe54742824D26d19f806980EA
CrossMarginCashEngine=0x1d2103251C2f5EdeC640eF6e5a99D99E6bD53889
CrossMarginCashEngineProxy=0x9c742Aef14CC875C49f52bBD4473B35beBAD26Ae

CrossMarginOwner=0xD8Fe1aC0aa13E6D83116aB0107a34787fC3e96Be
CrossMarginOwner=0xD8Fe1aC0aa13E6D83116aB0107a34787fC3e96Be
RolesAuthorityProxy=0x470f3b37B9B20E13b0A2a5965Df6bD3f9640DFB4
26 changes: 9 additions & 17 deletions script/deploy-launch-cash.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,22 @@ contract Deploy is Script, Utilities {

vm.startBroadcast();

address grappa = vm.envAddress("GrappaProxy");
address optionToken = vm.envAddress("GrappaOptionToken");

// // deploy and register Cross Margin Engine
deployCrossMarginEngine(grappa, optionToken);

vm.stopBroadcast();
}

function deployCrossMarginEngine(address grappa, address optionToken) public returns (address crossMarginEngine) {
// ============ Deploy Cross Margin Engine (Upgradable) ============== //
address engineImplementation = address(
new CrossMarginCashEngine(
address(grappa), optionToken, vm.envAddress("CrossMarginCashOracle"), vm.envAddress("RolesAuthorityProxy")
vm.envAddress("GrappaProxy"),
vm.envAddress("GrappaOptionToken"),
vm.envAddress("CrossMarginCashOracle"),
vm.envAddress("RolesAuthorityProxy")
)
);

bytes memory engineData =
abi.encodeWithSelector(CrossMarginCashEngine.initialize.selector, vm.envAddress("CrossMarginOwner"));
crossMarginEngine = address(new CrossMarginCashEngineProxy(engineImplementation, engineData));
address engine = address(new CrossMarginCashEngineProxy(engineImplementation, engineData));

console.log("CrossMargin Cash Engine: \t\t\t", engineImplementation);
console.log("CrossMargin Cash Engine Proxy: \t\t", crossMarginEngine);
}
console.log("CrossMargin Cash Engine Proxy: \t\t", engine);

// add a function prefixed with test here so forge coverage will ignore this file
function testChill() public {}
vm.stopBroadcast();
}
}
20 changes: 4 additions & 16 deletions script/deploy-launch-physical.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,15 @@ contract DeployPhysicalMarginEngine is Script, Utilities {
address optionToken = vm.envAddress("PomaceOptionToken");
address authority = vm.envAddress("RolesAuthorityProxy");

// deploy and register Cross Margin Engine
deployCrossMarginPhysicalEngine(pomace, optionToken, authority);

vm.stopBroadcast();
}

function deployCrossMarginPhysicalEngine(address pomace, address optionToken, address authority)
public
returns (address crossMarginEngine)
{
// ============ Deploy Cross Margin Engine (Upgradable) ============== //
address engineImplementation = address(new CrossMarginPhysicalEngine(pomace, optionToken, authority));
bytes memory engineData =
abi.encodeWithSelector(CrossMarginPhysicalEngine.initialize.selector, vm.envAddress("CrossMarginOwner"));
console.logBytes(engineData);
crossMarginEngine = address(new CrossMarginPhysicalEngineProxy(engineImplementation, engineData));
address engine = address(new CrossMarginPhysicalEngineProxy(engineImplementation, engineData));

console.log("CrossMargin Physical Engine: \t\t", engineImplementation);
console.log("CrossMargin Physical Engine Proxy: \t", crossMarginEngine);
}
console.log("CrossMargin Physical Engine Proxy: \t", engine);

// add a function prefixed with test here so forge coverage will ignore this file
function testChill() public {}
vm.stopBroadcast();
}
}
18 changes: 6 additions & 12 deletions script/deploy-upgrade-cash.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@ contract Deploy is Script {

vm.startBroadcast();

address grappa = vm.envAddress("GrappaProxy");
address optionToken = vm.envAddress("GrappaOptionToken");

// // deploy and register Cross Margin Engine
deployCrossMarginEngine(grappa, optionToken);

vm.stopBroadcast();
}

function deployCrossMarginEngine(address grappa, address optionToken) public {
// ============ Deploy Cross Margin Engine (Upgradable) ============== //
address engineImplementation = address(
new CrossMarginCashEngine(
address(grappa), optionToken, vm.envAddress("CrossMarginCashOracle"), vm.envAddress("RolesAuthorityProxy")
vm.envAddress("GrappaProxy"),
vm.envAddress("GrappaOptionToken"),
vm.envAddress("CrossMarginCashOracle"),
vm.envAddress("RolesAuthorityProxy")
)
);

console.log("CrossMargin Cash Engine: \t\t\t", engineImplementation);

vm.stopBroadcast();
}
}
2 changes: 0 additions & 2 deletions script/deploy-upgrade-physical.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ contract DeployPhysicalMarginEngine is Script {

vm.stopBroadcast();
}

function deployCrossMarginPhysicalEngine(address pomace, address optionToken) public {}
}
2 changes: 0 additions & 2 deletions script/register-collateralizable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import "forge-std/Script.sol";

import "../src/settled-physical/CrossMarginPhysicalEngine.sol";


interface IContract {
function setCollateralizable(address _asset0, address _asset1, bool _value) external;
}


contract RegisterCollateralizable is Script {
function run() external {
console.log("Deployer", msg.sender);
Expand Down
2 changes: 0 additions & 2 deletions script/register-engines.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import "forge-std/Script.sol";

import "../src/settled-physical/CrossMarginPhysicalEngine.sol";


interface IContract {
function registerEngine(address _engine) external returns (uint8);
}


contract RegisterCollateralizable is Script {
function run() external {
console.log("Deployer", msg.sender);
Expand Down

0 comments on commit 22e6646

Please sign in to comment.