Skip to content

Commit

Permalink
deploy contract on base sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
d4mr committed Dec 7, 2024
1 parent 5c7a5d1 commit aa88f2d
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 325 deletions.
53 changes: 53 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/84532/run-1733558607.json

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/84532/run-1733559212.json

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/84532/run-latest.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/foundry/contracts/ZKRailBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ abstract contract ZKRailBase is IZKRail, EIP712 {
function _hashIntentSolution(
IntentSolution calldata solution
) internal pure returns (bytes32) {
bytes32 intentHash = _hashIntent(solution.intent);

return
keccak256(
abi.encode(
INTENT_SOLUTION_TYPEHASH,
solution.intentId,
_hashIntent(solution.intent),
intentHash,
solution.paymentToken,
solution.paymentAmount,
solution.bondToken,
Expand Down
51 changes: 14 additions & 37 deletions packages/foundry/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
[profile.default]
src = 'contracts'
out = 'out'
libs = ['lib']
fs_permissions = [{ access = "read-write", path = "./"}]
src = "src"
out = "out"
libs = ["lib"]
via_ir = true # Add this
optimizer = true # Make sure optimizer is on
optimizer_runs = 200

[rpc_endpoints]
default_network = "http://127.0.0.1:8545"
localhost = "http://127.0.0.1:8545"

mainnet = "https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}"
sepolia = "https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
arbitrum = "https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
arbitrumSepolia = "https://arb-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
optimism = "https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
optimismSepolia = "https://opt-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
polygon = "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
polygonZkEvm = "https://zkevm-rpc.com"
polygonZkEvmTestnet = "https://rpc.public.zkevm-test.net"
gnosis = "https://rpc.gnosischain.com"
chiado = "https://rpc.chiadochain.net"
base = "https://mainnet.base.org"
baseSepolia = "https://sepolia.base.org"
scrollSepolia = "https://sepolia-rpc.scroll.io"
scroll = "https://rpc.scroll.io"
pgn = "https://rpc.publicgoods.network"
pgnTestnet = "https://sepolia.publicgoods.network"
[rpc_endpoints]
amoy = "https://80002.rpc.thirdweb.com"
base_sepolia = "https://84532.rpc.thirdweb.com"
bsc_testnet = "https://97.rpc.thirdweb.com"

[etherscan]
polygonMumbai = { key = "${ETHERSCAN_API_KEY}" }
sepolia = { key = "${ETHERSCAN_API_KEY}" }


[fmt]
multiline_func_header = "params_first"
line_length = 80
tab_width = 2
quote_style = "double"
bracket_spacing = true
int_types = "long"
amoy = { key = "${POLYGONSCAN_KEY}" }
base_sepolia = { key = "${BASESCAN_KEY}" }
bsc_testnet = { key = "${BSCSCAN_KEY}" }

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
39 changes: 27 additions & 12 deletions packages/foundry/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
pragma solidity ^0.8.20;

import "./DeployHelpers.s.sol";
import { DeployYourContract } from "./DeployYourContract.s.sol";
import "forge-std/Script.sol";
import "../contracts/rails/ZKRailUPI.sol";
import "@openzeppelin/contracts/utils/Create2.sol";

contract DeployScript is ScaffoldETHDeploy {
function run() external {
DeployYourContract deployYourContract = new DeployYourContract();
deployYourContract.run();
contract DeployZKRail is Script {
bytes32 public constant SALT = bytes32(uint256(0x1234));
// OpenZeppelin's Create2 Deployer address (same on all chains)
address constant CREATE2_DEPLOYER =
0x4e59b44847b379578588920cA78FbF26c0B4956C;

// deploy more contracts here
// DeployMyContract deployMyContract = new DeployMyContract();
// deployMyContract.run();
}
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// Compute the deployment address
bytes memory creationCode = type(ZKRailUPI).creationCode;
address computedAddress = Create2.computeAddress(
SALT,
keccak256(creationCode),
CREATE2_DEPLOYER
);
console.log("Computed deployment address:", computedAddress);

address token = Create2.deploy(0, SALT, creationCode);
require(token == computedAddress, "Deployment address mismatch");

vm.stopBroadcast();
}
}
127 changes: 0 additions & 127 deletions packages/foundry/script/DeployHelpers.s.sol

This file was deleted.

17 changes: 0 additions & 17 deletions packages/foundry/script/DeployYourContract.s.sol

This file was deleted.

131 changes: 0 additions & 131 deletions packages/foundry/script/VerifyAll.s.sol

This file was deleted.

0 comments on commit aa88f2d

Please sign in to comment.