Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/verification/VerificationRouter.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Verifier} from "./interfaces/Verifier.sol";
/**
* @title VerificationRouter
* @notice A routing contract that manages multiple verifiers
* @dev Immutable append-only contract that allows the owner to add verification routes with their corresponding verifier address
* and allows routing of verification requests to the appropriate verifier based on a name identifier.
*/
contract VerificationRouter is Ownable {
/// @notice Mapping of route names to their corresponding verifier contract addresses
/// @dev Maps string identifiers to contract addresses for verification routing
mapping(string => address) public routes;
/**
* @notice Emitted when a new verification route is added
* @param name The identifier name for the route
* @param route The address of the verifier contract
*/
event RouteAdded(string indexed name, address indexed route);
/**
* @notice Contract constructor that sets the deployer as the owner
* @dev Inherits from Ownable and sets msg.sender as the initial owner
*/
constructor() Ownable(msg.sender) {}
/**
* @notice Adds a new verification route
* @dev Only callable by the contract owner. Prevents overwriting existing routes.
* @param name The identifier name for the verification route
* @param route The address of the verifier contract to route to
* @custom:requirements
* - Caller must be the contract owner
* - Route address cannot be the zero address
* - Route name must not already exist
*/
function addRoute(string memory name, address route) external onlyOwner {
require(route != address(0), "Invalid route address");
require(routes[name] == address(0), "Route already exists");
routes[name] = route;
emit RouteAdded(name, route);
}
/**
* @notice Retrieves the verifier contract address for a given route name
* @param name The identifier name of the route to look up
* @return The address of the verifier contract, or address(0) if route doesn't exist
*/
function getRoute(string memory name) external view returns (address) {
return routes[name];
}
/**
* @notice Performs verification by routing to the appropriate verifier contract
* @dev Routes the verification request to the verifier contract registered under the given name.
* The function will revert if the route doesn't exist or if the underlying verification fails.
* @param name The identifier name of the verification route to use
* @param vk The verification key data required by the verifier
* @param proof The cryptographic proof to be verified
* @param inputs The public inputs associated with the proof
* @param payload Additional data payload required by the verifier, for example a domain proof that needs to be verified against a domain VK
* @return Always returns true if verification succeeds (reverts on failure)
* @custom:requirements
* - The specified route name must exist in the routes mapping
* - The target verifier contract must implement the Verifier interface
* - All verification parameters must be valid according to the target verifier
*/
function verify(
string memory name,
bytes calldata vk,
bytes calldata proof,
bytes calldata inputs,
bytes calldata payload
) external view returns (bool) {
// Ensure the route exists
address route = routes[name];
require(route != address(0), "Route not found");
// Call the verify function on the Verifier contract at the route address
return Verifier(route).verify(vk, proof, inputs, payload);
}
}
"
},
"dependencies/@openzeppelin-contracts-5.2.0/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
"
},
"src/verification/interfaces/Verifier.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
/**
* @title Verifier
* @dev Common interface for a verifier contract that can verify zk proofs.
*
* This interface is used to abstract the verification process, allowing different implementations
* to be used without changing the code that relies on it.
*/
interface Verifier {
/**
* @dev Verifies a proof against the given inputs with a given VK.
* @param vk The verification key to use for the proof.
* @param proof The proof to verify.
* @param inputs The inputs to verify against.
* @param payload Additional payload, which in first version will be the domain proof to be validated against the domain VK.
* @return True if the proof is valid, false otherwise.
*/
function verify(bytes calldata vk, bytes calldata proof, bytes calldata inputs, bytes calldata payload)
external
view
returns (bool);
}
"
},
"dependencies/@openzeppelin-contracts-5.2.0/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
"
}
},
"settings": {
"remappings": [
"@layerzerolabs/lz-evm-oapp-v2/=dependencies/@layerzerolabs-lz-evm-oapp-v2-3.0.81/",
"@layerzerolabs/lz-evm-protocol-v2/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.81/",
"@openzeppelin-contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.2.0/",
"@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.2.0/",
"@stargatefinance/stg-evm-v2/=dependencies/@stargatefinance-stg-evm-v2-2.0.2/",
"aave-v3-origin/=dependencies/aave-v3-origin-3.3.0/src/contracts/",
"forge-std/=dependencies/forge-std-1.9.4/",
"hyperlane/=dependencies/hyperlane-5.8.3/solidity/contracts/",
"succinctlabs-sp1-contracts/=dependencies/succinctlabs-sp1-contracts-4.0.0/contracts/",
"@layerzerolabs-lz-evm-oapp-v2-3.0.81/=dependencies/@layerzerolabs-lz-evm-oapp-v2-3.0.81/contracts/",
"@layerzerolabs-lz-evm-protocol-v2-3.0.81/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.81/contracts/",
"@openzeppelin-contracts-5.2.0/=dependencies/@openzeppelin-contracts-5.2.0/",
"@openzeppelin-contracts-upgradeable-5.2.0/=dependencies/@openzeppelin-contracts-upgradeable-5.2.0/",
"@stargatefinance-stg-evm-v2-2.0.2/=dependencies/@stargatefinance-stg-evm-v2-2.0.2/src/",
"aave-v3-origin-3.3.0/=dependencies/aave-v3-origin-3.3.0/src/",
"ds-test/=dependencies/aave-v3-origin-3.3.0/lib/forge-std/lib/ds-test/src/",
"forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/",
"hyperlane-5.8.3/=dependencies/hyperlane-5.8.3/",
"openzeppelin-contracts-upgradeable/=dependencies/aave-v3-origin-3.3.0/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=dependencies/aave-v3-origin-3.3.0/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"solidity-utils/=dependencies/aave-v3-origin-3.3.0/lib/solidity-utils/src/",
"succinctlabs-sp1-contracts-4.0.0/=dependencies/succinctlabs-sp1-contracts-4.0.0/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}
}}
Submitted on: 2025-09-27 10:50:18
Comments
Log in to comment.
No comments yet.