-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a48e5a
commit 28bc371
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
contracts/script/gateway-examples/DeployAndRegisterFunction.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/Vm.sol"; | ||
import "forge-std/console.sol"; | ||
import {FunctionVerifier} from "./FunctionVerifier.sol"; | ||
import {SuccinctGateway} from "../../src/SuccinctGateway.sol"; | ||
|
||
contract DeployAndRegisterFunction is Script { | ||
function run() external { | ||
vm.startBroadcast(); | ||
|
||
// Assuming `MyContract` is the contract for which you want the deployment bytecode | ||
bytes memory bytecode = type(FunctionVerifier).creationCode; | ||
|
||
// Get Succinct Gateway address from arguments | ||
address gateway = vm.envAddress("SUCCINCT_GATEWAY"); | ||
console.logAddress(gateway); | ||
|
||
// Create2 salt | ||
bytes32 salt = vm.envBytes32("CREATE2_SALT"); | ||
|
||
(bytes32 functionId, | ||
address verifier) = SuccinctGateway(gateway).deployAndRegisterFunction(msg.sender, bytecode, salt); | ||
|
||
console.log("Function ID: "); | ||
console.logBytes32(functionId); | ||
console.log("Verifier Address: "); | ||
console.logAddress(verifier); | ||
} | ||
} |