Skip to content

Commit

Permalink
Add base deployment.json + script updates (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeaster authored May 1, 2024
1 parent 0bc14c3 commit ec080fd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 11 deletions.
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
VERBOSITY=
LOCAL_DEPLOY_FLAGS=--broadcast ${VERBOSITY} --ffi --slow
DEPLOY_FLAGS=--verify ${LOCAL_DEPLOY_FLAGS}
MAINNET_DEPLOYER=--account v0_owner

DEPLOY_PROXY_FACTORY_CMD=forge script DeployERC1967ProxyFactory --rpc-url
DEPLOY_REGISTRY_CMD=forge script DeployLPNRegistry --rpc-url
DEPLOY_CLIENTS_CMD=forge script DeployClients --rpc-url
QUERY_CMD=forge script Query --rpc-url
WITHDRAW_FEES_CMD=forge script WithdrawFees --rpc-url
BRIDGE_CMD=forge script Bridge --rpc-url

# deps
install :; forge install
Expand All @@ -37,18 +40,26 @@ testnet_integration_test : testnet_deploy_registry base_testnet_deploy_registry
# Deploy the registry
local_deploy_registry :; ${DEPLOY_REGISTRY_CMD} local ${LOCAL_DEPLOY_FLAGS} --json
testnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} sepolia ${DEPLOY_FLAGS} --priority-gas-price 0.1gwei
mainnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} mainnet ${DEPLOY_FLAGS} --priority-gas-price 0.5gwei
mainnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} mainnet ${DEPLOY_FLAGS} --priority-gas-price 0.5gwei ${MAINNET_DEPLOYER}
base_testnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} baseSepolia ${DEPLOY_FLAGS}
base_mainnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} base ${DEPLOY_FLAGS}
base_mainnet_deploy_registry :; ${DEPLOY_REGISTRY_CMD} base ${DEPLOY_FLAGS} ${MAINNET_DEPLOYER}

# Deploy clients
local_deploy_clients :; ${DEPLOY_CLIENTS_CMD} local ${LOCAL_DEPLOY_FLAGS}
testnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} sepolia ${DEPLOY_FLAGS} --priority-gas-price 0.1gwei
mainnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} mainnet ${DEPLOY_FLAGS} --priority-gas-price 0.5gwei
mainnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} mainnet ${DEPLOY_FLAGS} --priority-gas-price 0.5gwei --account v0_owner
base_testnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} baseSepolia ${DEPLOY_FLAGS}
base_mainnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} base ${DEPLOY_FLAGS}
base_mainnet_deploy_clients :; ${DEPLOY_CLIENTS_CMD} base ${DEPLOY_FLAGS} ${MAINNET_DEPLOYER}

# Run Queries
testnet_query :; ${QUERY_CMD} sepolia ${DEPLOY_FLAGS}
base_testnet_query :; ${QUERY_CMD} baseSepolia ${DEPLOY_FLAGS}
base_mainnet_query :; ${QUERY_CMD} base ${DEPLOY_FLAGS}
base_mainnet_query :; ${QUERY_CMD} base ${DEPLOY_FLAGS} ${MAINNET_DEPLOYER}

# Withdraw fees
mainnet_withdraw_fees :; ${WITHDRAW_FEES_CMD} mainnet ${LOCAL_DEPLOY_FLAGS} --account v0_owner --sender 0x5d9aB52c84D0bA59A3143982a7Ba34BEE079f776 --priority-gas-price 0.01gwei

# Bridge
mainnet_bridge_base :; ${BRIDGE_CMD} mainnet ${LOCAL_DEPLOY_FLAGS} --account v0_relayer --sender 0x373a4796Eb758a416366F561206E0472B508eCd1 --priority-gas-price 0.01gwei

base_mainnet_deployment : base_mainnet_deploy_registry base_mainnet_deploy_clients
16 changes: 11 additions & 5 deletions script/BaseScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
ETH_MAINNET,
ETH_SEPOLIA,
BASE_MAINNET,
BASE_SEPOLIA
BASE_SEPOLIA,
isMainnet
} from "../src/utils/Constants.sol";
import {stdJson} from "forge-std/stdJson.sol";

Expand All @@ -20,13 +21,18 @@ abstract contract BaseScript is Script {
bytes32 public salt;

modifier broadcaster() {
vm.startBroadcast(deployer);
vm.startBroadcast();
_;
vm.stopBroadcast();
}

constructor() {
deployer = vm.rememberKey(vm.envUint("PRIVATE_KEY"));
// (, deployer,) = vm.readCallers(); // TODO: read sender from env
if (isMainnet()) {
deployer = getDeployerAddress();
} else {
deployer = vm.rememberKey(vm.envUint("PRIVATE_KEY"));
}

if (block.chainid == ETH_MAINNET) {
salt = bytes32(abi.encodePacked(deployer, "V0_EUCLID_0"));
Expand All @@ -43,8 +49,8 @@ abstract contract BaseScript is Script {
deployer = _deployer;
}

function getAddress() internal view returns (address) {
return vm.envAddress("address");
function getDeployerAddress() internal view returns (address) {
return vm.envAddress("DEPLOYER_ADDR");
}

function getDeployedRegistry() internal returns (address) {
Expand Down
12 changes: 12 additions & 0 deletions script/output/base/deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"addresses": {
"queryClient": "0x80c0a42F808d6f35e83F4939482A485caE536e6a",
"registryImpl": "0x7fc914f86A8eC5bCDA00d6F0D4655b5716f5f12d",
"registryProxy": "0x2584665Beff871534118aAbAE781BC267Af142f9",
"storageContract": "0x0000000000000000000000000000000000000000"
},
"chainInfo": {
"chainId": 8453,
"deploymentBlock": 13885371
}
}
28 changes: 28 additions & 0 deletions script/util/Bridge.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {BaseScript} from "../BaseScript.s.sol";
import {LPNRegistryV0} from "../../src/LPNRegistryV0.sol";
import {LPNQueryV0} from "../../src/client/LPNQueryV0.sol";
import {PUDGEY_PENGUINS, L1_BASE_BRIDGE} from "../../src/utils/Constants.sol";

contract Bridge is BaseScript {
function run() external broadcaster {
IBaseBridge baseBridge = IBaseBridge(L1_BASE_BRIDGE);
baseBridge.bridgeETH{value: 0.01 ether}(200_000, new bytes(0));
}
}

interface IBaseBridge {
/**
* @notice Sends ETH to the sender's address on the other chain.
*
* @param _minGasLimit Minimum amount of gas that the bridge can be relayed with.
* @param _extraData Extra data to be sent with the transaction. Note that the recipient will
* not be triggered with this data, but it will be emitted and can be used
* to identify the transaction.
*/
function bridgeETH(uint32 _minGasLimit, bytes calldata _extraData)
external
payable;
}
7 changes: 6 additions & 1 deletion script/util/Query.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ contract Query is BaseScript {
LPNRegistryV0 registry = LPNRegistryV0(getDeployedRegistry());
LPNQueryV0 queryClient = LPNQueryV0(getDeployedQueryClient());

address constant BLUR = 0x29469395eAf6f95920E59F858042f0e28D98a20B;

function run() external broadcaster {
address holder = deployer;
if (isMainnet()) {
holder = BLUR;
}
query(holder);
}

function query(address holder) private {
uint256 endBlock = L1BlockNumber();
uint256 startBlock = endBlock - 1;
uint256 startBlock = endBlock - 100;
uint8 offset = 5;
address storageContract = getDeployedStorageContract();

Expand Down
2 changes: 2 additions & 0 deletions src/utils/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ uint256 constant BASE_SEPOLIA = 84532;
address constant OP_STACK_L1_BLOCK_PREDEPLOY_ADDR =
0x4200000000000000000000000000000000000015;

address constant L1_BASE_BRIDGE = 0x3154Cf16ccdb4C6d922629664174b904d80F2C35;

address constant PUDGEY_PENGUINS = 0xBd3531dA5CF5857e7CfAA92426877b022e612cf8;

uint256 constant PUDGEY_PENGUINS_MAPPING_SLOT = 2;
Expand Down

0 comments on commit ec080fd

Please sign in to comment.