Skip to content

Commit

Permalink
script: L1ViewOracle deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
failfmi authored and lastminutedev committed Nov 20, 2023
1 parent 708b748 commit b135dbc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contracts/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ $ forge script scripts/foundry/InitializeL2BridgeContracts.s.sol:InitializeL2Bri
$ OUTPUT=$(forge script scripts/foundry/DeployL2L1BlocksContract.s.sol:DeployL2L1BlocksContract --rpc-url $SCROLL_L2_RPC --broadcast); echo $OUTPUT
$ echo "$OUTPUT" | grep -Eo "(L2)_.*" > .env.l2_addresses
$ source .env.l2_addresses

# Deploy L1 ViewOracle contract
$ OUTPUT=$(forge script scripts/foundry/DeployL1ViewOracle.s.sol:DeployL1ViewOracle --rpc-url $SCROLL_L1_RPC --broadcast); echo $OUTPUT
$ echo "$OUTPUT" | grep -Eo "(L1)_.*" > .env.l1_addresses
$ source .env.l1_addresses
```
24 changes: 24 additions & 0 deletions contracts/scripts/foundry/DeployL1ViewOracle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

import {L1ViewOracle} from "../../src/L1/L1ViewOracle.sol";

contract DeployL1ViewOracle is Script {
uint256 L1_DEPLOYER_PRIVATE_KEY = vm.envUint("L1_DEPLOYER_PRIVATE_KEY");

function run() external {
vm.startBroadcast(L1_DEPLOYER_PRIVATE_KEY);

L1ViewOracle l1ViewOracle = new L1ViewOracle();
logAddress("L1_VIEW_ORACLE_ADDR", address(l1ViewOracle));

vm.stopBroadcast();
}

function logAddress(string memory name, address addr) internal view {
console.log(string(abi.encodePacked(name, "=", vm.toString(address(addr)))));
}
}

0 comments on commit b135dbc

Please sign in to comment.