Skip to content

Commit

Permalink
feat: add gateway example
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Feb 26, 2024
1 parent 5a48e5a commit 28bc371
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions contracts/script/gateway-examples/DeployAndRegisterFunction.s.sol
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);
}
}

0 comments on commit 28bc371

Please sign in to comment.