Skip to content

Commit

Permalink
feat: scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pegahcarter committed Nov 8, 2024
1 parent 846929b commit 509fd3e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@ pragma solidity ^0.8.19;
import { BaseScript } from "frax-std/BaseScript.sol";
import { console } from "frax-std/FraxTest.sol";
import { FraxtalLZCurveComposer } from "../contracts/composers/FraxtalLZCurveComposer.sol";
import { FraxtalLZCurveAMO } from "../contracts/amos/FraxtalLZCurveAMO.sol";
import { FraxProxy } from "../contracts/FraxProxy.sol";

// Run this with source .env && forge script --broadcast --rpc-url $MAINNET_URL DeployFraxtalLZCurveComposer.s.sol
contract DeployFraxtalLZCurveComposer is BaseScript {
address endpoint = 0x1a44076050125825900e736c501f859c50fE728c; // fraxtal endpoint v2
address multisig = address(0); // TODO

function run() public broadcaster {

// deploy FraxtalLzCurveComposer
address implementation = address(new FraxtalLZCurveComposer());
new FraxProxy(implementation, msg.sender, abi.encodeCall(FraxtalLZCurveComposer.initialize, (endpoint)));
FraxProxy proxy = new FraxProxy(implementation, multisig, abi.encodeCall(FraxtalLZCurveComposer.initialize, (endpoint)));
console.log("FraxtalLZCurveComposer @ ", address(proxy));

// deploy FraxtalLZCurveAmo
implementation = address(new FraxtalLZCurveAMO());
proxy = new FraxProxy(implementation, multisig, abi.encodeCall(FraxtalLZCurveAMO.initialize, (deployer)));
console.log("FraxtalLZCurveAMO @ ", address(proxy));
}
}
37 changes: 37 additions & 0 deletions src/script/2DeployEthereum.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;

import { BaseScript } from "frax-std/BaseScript.sol";
import { console } from "frax-std/FraxTest.sol";
import { EthereumNativeBridgeComposer } from "../contracts/composers/EthereumNativeBridgeComposer.sol";
import { EthereumLZSenderAMO } from "../contracts/amos/EthereumLZSenderAMO.sol";
import { FraxProxy } from "../contracts/FraxProxy.sol";

// Run this with source .env && forge script --broadcast --rpc-url $MAINNET_URL DeployFraxtalL.s.sol
contract DeployFraxtalL is BaseScript {

address multisig = address(0); // TODO

address endpoint = 0x1a44076050125825900e736c501f859c50fE728c;
address l1Bridge = 0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2;
address fraxtalLzCurveAmo = address(0); // TODO

address fraxOft = 0x909DBdE1eBE906Af95660033e478D59EFe831fED;
address sFraxOft = 0xe4796cCB6bB5DE2290C417Ac337F2b66CA2E770E;
address sFrxEthOft = 0x1f55a02A049033E3419a8E2975cF3F572F4e6E9A;
address fxsOft = 0x23432452B720C80553458496D4D9d7C5003280d0;
address fpiOft = 0x6Eca253b102D41B6B69AC815B9CC6bD47eF1979d;

function run() public broadcaster {

// deploy EthereumNativeBridgeComposer
address implementation = address(new EthereumNativeBridgeComposer());
FraxProxy proxy = new FraxProxy(implementation, multisig, abi.encodeCall(EthereumNativeBridgeComposer.initialize, (endpoint, l1Bridge, fraxtalLzCurveAmo)));
console.log("EthereumNativeBridgeComposer @ ", address(proxy));

// Deploy EthereumLZSenderAMO
implementation = address(new EthereumLZSenderAMO());
proxy = new FraxProxy(implementation, multisig, abi.encodeCall(EthereumLZSenderAMO.initialize, (fraxtalLzCurveAmo, fraxOft, sFraxOft, sFrxEthOft, fxsOft, fpiOft)));
console.log("EthereumLZSenderAMO @ ", address(proxy));
}
}
27 changes: 27 additions & 0 deletions src/script/3SetupFraxtal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.19;

import { BaseScript } from "frax-std/BaseScript.sol";
import { console } from "frax-std/FraxTest.sol";
import { FraxtalLZCurveAMO } from "../contracts/amos/FraxtalLZCurveAMO.sol";
import { FraxProxy } from "../contracts/FraxProxy.sol";

// Run this with source .env && forge script --broadcast --rpc-url $MAINNET_URL DeployFraxtalL.s.sol
contract SetupFraxtal is BaseScript {

FraxtalLZCurveAMO fraxtalLzCurveAmo = FraxtalLZCurveAMO(address(0)); // TODO
address ethereumComposer = address(0); // TODO
address ethereumLzSenderAmo = address(0); // TODO
address multisig = address(0); // TODO

bytes32 DEFAULT_ADMIN_ROLE = 0x00;

function run() public broadcaster {
fraxtalLzCurveAmo.setStorage({
_ethereumComposer: ethereumComposer,
_ethereumLzSenderAmo: ethereumLzSenderAmo
});
fraxtalLzCurveAmo.grantRole(DEFAULT_ADMIN_ROLE, multisig);
fraxtalLzCurveAmo.renounceRole(DEFAULT_ADMIN_ROLE, deployer);
}
}

0 comments on commit 509fd3e

Please sign in to comment.