Verified contractExactMIT
PathwayExpander
Address0xcdbdd8533e8e287f378687aa70208ffcff997d39
- Balance
0 ETH
- Transactions
9
- Compiler
solc 0.8.30
- Same code
1 more contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,389,633
- Creation transaction
- 0x868c24c86b…7fa8719770
127 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/PathwayExpander.solmain16.37 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/MessageLibBase.sol528 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/SendLibBase.sol10.51 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IExecutor.sol1.4 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IExecutorFeeLib.sol1.66 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroExecutor.sol1.35 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroReadExecutor.sol878 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroTreasury.sol442 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IWorker.sol985 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/libs/ExecutorOptions.sol4.33 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/libs/SafeCall.sol4.64 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol7.32 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/UlnOptions.sol8.48 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol1.53 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppCore.sol3.36 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppReceiver.sol5.41 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol5.63 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppCore.sol1.86 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppReceiver.sol1.08 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/EndpointV2ViewUpgradeable.sol3.44 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/MessagingContext.sol1.48 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol2.59 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol519 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLib.sol805 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol2.76 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol1.54 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol1.03 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol239 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol923 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/AddressCast.sol1.47 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol1.78 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/Errors.sol1.26 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/GUID.sol460 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol1.12 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol751 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol3.56 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol3.67 KB
- @layerzerolabs/oapp-evm/contracts/oapp/OAppCore.sol3.36 KB
- @layerzerolabs/oapp-evm/contracts/oapp/OAppReceiver.sol5.41 KB
- @layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppCore.sol1.86 KB
- @layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppReceiver.sol1.08 KB
- @layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol9.28 KB
- @layerzerolabs/oft-evm/contracts/libs/OFTMsgCodec.sol2.91 KB
- @layerzerolabs/test-devtools-evm-hardhat/contracts/mocks/EndpointV2Mock.sol27.37 KB
- @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol6.64 KB
- @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol9.38 KB
- @openzeppelin/contracts/access/Ownable.sol2.62 KB
- @openzeppelin/contracts/interfaces/IERC1271.sol666 B
- @openzeppelin/contracts/interfaces/IERC5267.sol738 B
- @openzeppelin/contracts/security/ReentrancyGuard.sol3.13 KB
- @openzeppelin/contracts/token/ERC20/ERC20.sol12.85 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.74 KB
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol683 B
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol3.8 KB
- @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol6.94 KB
- @openzeppelin/contracts/token/ERC721/ERC721.sol17.01 KB
- @openzeppelin/contracts/token/ERC721/IERC721.sol4.88 KB
- @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol987 B
- @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol6.81 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol1.02 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol761 B
- @openzeppelin/contracts/utils/Address.sol9.36 KB
- @openzeppelin/contracts/utils/Base64.sol3.89 KB
- @openzeppelin/contracts/utils/Context.sol962 B
- @openzeppelin/contracts/utils/ShortStrings.sol4.29 KB
- @openzeppelin/contracts/utils/StorageSlot.sol4.11 KB
- @openzeppelin/contracts/utils/Strings.sol2.78 KB
- @openzeppelin/contracts/utils/cryptography/ECDSA.sol9.13 KB
- @openzeppelin/contracts/utils/cryptography/EIP712.sol5.66 KB
- @openzeppelin/contracts/utils/cryptography/MerkleProof.sol9.62 KB
- @openzeppelin/contracts/utils/cryptography/draft-EIP712.sol231 B
- @openzeppelin/contracts/utils/introspection/ERC165.sol987 B
- @openzeppelin/contracts/utils/introspection/IERC165.sol853 B
- @openzeppelin/contracts/utils/math/Math.sol12.79 KB
- @openzeppelin/contracts/utils/math/SafeCast.sol35.08 KB
- @openzeppelin/contracts/utils/math/SignedMath.sol1.26 KB
- @openzeppelin/contracts/utils/structs/EnumerableSet.sol12.96 KB
- contracts/CawActions.sol93.41 KB
- contracts/CawActionsArchive.sol39.68 KB
- contracts/CawActionsERC1271.sol13.13 KB
- contracts/CawBuyAndBurn.sol4.09 KB
- contracts/CawCapOracle.sol23.55 KB
- contracts/CawChallengeRelay.sol11.05 KB
- contracts/CawFontDataA.sol35.4 KB
- contracts/CawFontDataB.sol23.93 KB
- contracts/CawL1PriceReader.sol5.52 KB
- contracts/CawNetworkManager.sol36.56 KB
- contracts/CawProfile.sol59.58 KB
- contracts/CawProfileLedger.sol61.35 KB
- contracts/CawProfileLens.sol5.15 KB
- contracts/CawProfileMarketplace.sol36.94 KB
- contracts/CawProfileMinter.sol46.75 KB
- contracts/CawProfileQuoter.sol18.65 KB
- contracts/CawProfileURI.sol23.24 KB
- contracts/CivicKycVerifier.sol1.01 KB
- contracts/ISwapRouter.sol5.12 KB
- contracts/IZKActionsVerifier.sol565 B
- contracts/MintableCaw.sol951 B
- contracts/MockLayerZeroEndpoint.sol398 B
- contracts/OnlyOnce.sol474 B
- contracts/SessionMessageParser.sol10.99 KB
- contracts/SigVerification.sol4.18 KB
- contracts/SmartEOA.sol54.16 KB
- contracts/examples/CawActionVerifier.sol5.98 KB
- contracts/examples/CawMultisigProfile.sol6.22 KB
- contracts/examples/CawTipResponder.sol6.45 KB
- contracts/interfaces/ICawActions.sol2.08 KB
- contracts/interfaces/ICawCapOracle.sol1.06 KB
- contracts/interfaces/IMint.sol2.31 KB
- contracts/interfaces/ISmartEOA.sol1.78 KB
- contracts/interfaces/ISpend.sol578 B
- contracts/interfaces/IUniswapV2Pair.sol599 B
- contracts/mocks/FeeRecipientMock.sol497 B
- contracts/mocks/LzReceiveHelper.sol1.16 KB
- contracts/mocks/MockContractOwner.sol1.87 KB
- contracts/mocks/MockLzEndpointSimple.sol881 B
- contracts/mocks/MockOAppOwnable.sol576 B
- contracts/mocks/MockSwapRouter.sol1.32 KB
- contracts/sp1-vendor/Groth16Verifier.sol26.77 KB
- contracts/sp1-vendor/ISP1Verifier.sol955 B
- contracts/sp1-vendor/SP1VerifierGroth16.sol3.24 KB
- contracts/test-helpers/CawActionsDigestExposer.sol3.04 KB
- contracts/test-helpers/MockCawActionsCapTarget.sol941 B
- contracts/test-helpers/MockSP1Verifier.sol1.5 KB
- contracts/test/GasMeter.sol1.49 KB
- contracts/test/RevertingBidder.sol728 B
- solidity-bytes-utils/contracts/BytesLib.sol19.44 KB
contracts/PathwayExpander.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/// @notice Minimal interface to the OApp surface we need.
interface IOAppOwner {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function renounceOwnership() external;
function peers(uint32 eid) external view returns (bytes32);
function setPeer(uint32 eid, bytes32 peer) external;
}
/// @notice Minimal interface to CawProfileMinter's additions-only KYC slot.
interface IKycRegistrar {
function addKycVerifier(uint8 level, address verifier) external;
}
/// @notice Minimal interface to the LZ EndpointV2 config surface.
/// @dev Only setConfig/getConfig are used here. The full endpoint ABI is
/// intentionally not imported to keep PathwayExpander lean and dependency-free.
interface ILzEndpoint {
struct SetConfigParam {
uint32 eid;
uint32 configType;
bytes config;
}
function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;
}
/// @title PathwayExpander
/// @notice Becomes the owner AND LZ delegate of every CAW OApp (CawProfile,
/// CawProfileLedger, CawActionsArchive, CawChallengeRelay) so that
/// the deployer EOA can renounce its direct authority over them while
/// still leaving the door open for TWO specific operations: adding
/// peers for new eids, and configuring DVN/ULN settings for NEW
/// (oapp, eid) pathways.
///
/// The original CAW OApps already gate setPeer per-eid via
/// OnlyOnce, so existing peers can never be reconfigured. This
/// contract reinforces that with its own check (peers[eid] == 0
/// required) — defense in depth.
///
/// For DVN config, PathwayExpander maintains its own
/// `_pathwayConfigured` bitmap so that existing pathway configs
/// can never be overwritten — additions-only. A compromised
/// expander key can add malicious DVN config for NEW pathways
/// but cannot rewrite existing ones. Same compromise profile as
/// addPeer.
///
/// There is no path to:
/// - reconfigure existing peers,
/// - rewrite existing DVN configs,
/// - call any other OnlyOwner function on the underlying OApp,
/// - transfer the OApp's ownership to anything else.
/// If a future protocol wants any of those, it has to deploy a
/// new PathwayExpander variant and migrate ownership *before*
/// this one is renounced.
///
/// @dev Trust profile: this contract has its own owner (the deployer or
/// whatever address it's transferred to). The owner can call
/// addPeer / configureNewPathway to bring up new pathways. The owner
/// CANNOT pull ownership of the underlying OApps back out — there is
/// no "transferOApp" function. This is intentional: the upstream
/// OApps' OnlyOnce per-eid guards are what make existing pathways
/// immutable, and this contract preserves that property.
///
/// The owner CAN renounceOwnership() on this contract, which
/// neutralizes the additions-only path entirely (no new chains
/// ever again, but all existing pathways keep working).
contract PathwayExpander is Ownable {
// ULN config type id — LZ V2 standard (CONFIG_TYPE_EXECUTOR=1, CONFIG_TYPE_ULN=2).
uint32 public constant CONFIG_TYPE_ULN = 2;
/// @dev Tracks which (oapp, lib, eid) DVN configs have already been set via
/// configureNewPathway. The check uses a nested mapping rather than
/// endpoint.getConfig because getConfig merges OApp-specific config with
/// endpoint defaults and always returns non-empty bytes — making it
/// useless as an "is this freshly configured?" sentinel.
mapping(address => mapping(address => mapping(uint32 => bool))) private _pathwayConfigured;
// ----- escalation state (appended; never reorder) -----
/// @dev 0 = initial 2-of-3, 1 = bumped to 3-of-4, 2 = bumped to 3-of-5, 3+ = LOCKED.
/// Pathway must already exist (_pathwayConfigured must be true) before
/// addDvnToPathway can be called.
mapping(address => mapping(address => mapping(uint32 => uint8))) private _dvnEscalationStep;
/// @dev keccak256 of the most recently applied ulnConfig bytes for this pathway.
/// Set by configureNewPathway and updated by addDvnToPathway. Used as a
/// replay-protection snapshot so the caller can't supply a stale "current"
/// config to rewind the escalation schedule.
mapping(address => mapping(address => mapping(uint32 => bytes32))) private _ulnConfigHash;
/// @dev Mirrors the LZ V2 UlnConfig ABI layout used for abi.decode.
struct UlnConfig {
uint64 confirmations;
uint8 requiredDVNCount;
uint8 optionalDVNCount;
uint8 optionalDVNThreshold;
address[] requiredDVNs;
address[] optionalDVNs;
}
event PeerAdded(address indexed oapp, uint32 indexed eid, bytes32 peer);
event KycVerifierAdded(address indexed minter, uint8 indexed level, address indexed verifier);
/// @notice Emitted after a successful DVN escalation step.
/// @param newStep The step we just moved TO (1 or 2).
/// @param optionalCount optionalDVNCount in the new config.
/// @param threshold optionalDVNThreshold in the new config.
/// @param addedDvn The single new DVN address that was appended.
event DvnEscalated(
address indexed oapp,
address indexed lib,
uint32 indexed eid,
uint8 newStep,
uint8 optionalCount,
uint8 threshold,
address addedDvn
);
event PathwayConfigured(address indexed oapp, address indexed lib, uint32 indexed eid, bytes config);
constructor(address _owner) {
require(_owner != address(0), "PathwayExpander: zero address");
_transferOwnership(_owner);
}
/// @notice Add a peer for a new eid on an OApp this contract owns.
/// @dev Reverts if the eid already has a peer set on the OApp,
/// which means existing pathways are unmovable. Also reverts
/// if this contract isn't the OApp's owner — early failure
/// is friendlier than letting the call dispatch into the
/// OApp and revert there with onlyOwner.
/// @param oapp The OApp contract whose peer table we're extending.
/// @param eid The new LayerZero eid to register.
/// @param peer The peer address (bytes32-encoded for non-EVM compat).
function addPeer(address oapp, uint32 eid, bytes32 peer) external onlyOwner {
_addPeer(oapp, eid, peer);
}
/// @notice Convenience batch wrapper. Same per-call semantics as addPeer.
function addPeers(
address[] calldata oapps,
uint32[] calldata eids,
bytes32[] calldata peers
) external onlyOwner {
uint256 n = oapps.length;
require(n == eids.length && n == peers.length, "PathwayExpander: length mismatch");
for (uint256 i; i < n; ++i) {
_addPeer(oapps[i], eids[i], peers[i]);
}
}
function _addPeer(address oapp, uint32 eid, bytes32 peer) internal {
require(oapp != address(0), "PathwayExpander: zero address");
require(peer != bytes32(0), "PathwayExpander: zero peer");
IOAppOwner o = IOAppOwner(oapp);
require(o.owner() == address(this), "PathwayExpander: not OApp owner");
require(o.peers(eid) == bytes32(0), "PathwayExpander: peer already set");
o.setPeer(eid, peer);
emit PeerAdded(oapp, eid, peer);
}
/// @notice Register a new KYC verifier level on a CawProfileMinter that
/// points its `pathwayExpander` slot at this contract. Forwards
/// to Minter.addKycVerifier; the Minter itself enforces the
/// additions-only rule (existing levels can't be rewritten) AND
/// the level >= 2 floor (level 0 = no gate, level 1 = time-lock;
/// both are verifier-free paths in the withdraw-gate state machine).
/// @dev Same trust profile as addPeer — a compromised expander key
/// can grow the KYC surface but cannot redirect an existing
/// level. To rotate an existing adapter, redeploy the Minter
/// (and CawProfile, since CawProfile.minter is immutable).
function addKycVerifier(address minter, uint8 level, address verifier) external onlyOwner {
require(minter != address(0), "PathwayExpander: zero address");
require(verifier != address(0), "PathwayExpander: zero verifier");
IKycRegistrar(minter).addKycVerifier(level, verifier);
emit KycVerifierAdded(minter, level, verifier);
}
/// @notice Set the ULN (DVN) config for a NEW (oapp, lib, eid) pathway.
/// Reverts if this (oapp, lib, eid) triple has already been configured
/// via this function — additions-only. A compromised expander key can
/// add malicious DVN config for NEW pathways but cannot rewrite
/// existing ones. Same compromise profile as addPeer.
///
/// @dev Caller supplies the lib address (sendUln302 or receiveUln302) and
/// the pre-encoded ULN config bytes (ABI-encoded UlnConfig struct,
/// matching what endpoint.setConfig expects for CONFIG_TYPE_ULN).
///
/// @dev endpoint.getConfig is not used as the "already configured" check
/// because it delegates to the message lib's getConfig, which merges
/// the OApp-specific config with the endpoint's default ULN config.
/// For any supported eid the merged result is always non-empty, making
/// it useless as a "freshly unconfigured" sentinel. State is tracked
/// locally instead.
///
/// @param oapp The OApp whose DVN config is being set.
/// @param endpointAddr The LZ EndpointV2 address on this chain.
/// @param lib The send or receive ULN302 library address.
/// @param eid The remote LZ eid this config applies to.
/// @param ulnConfig ABI-encoded UlnConfig (the `config` field of SetConfigParam).
function configureNewPathway(
address oapp,
address endpointAddr,
address lib,
uint32 eid,
bytes calldata ulnConfig
) external onlyOwner {
require(oapp != address(0), "PathwayExpander: zero oapp");
require(endpointAddr != address(0), "PathwayExpander: zero endpoint");
require(lib != address(0), "PathwayExpander: zero lib");
require(ulnConfig.length > 0, "PathwayExpander: empty config");
require(
!_pathwayConfigured[oapp][lib][eid],
"PathwayExpander: pathway already configured"
);
// Mark before the external call (CEI pattern).
_pathwayConfigured[oapp][lib][eid] = true;
// Snapshot the initial config so addDvnToPathway can replay-protect itself
// against a caller supplying a stale "current" config.
_ulnConfigHash[oapp][lib][eid] = keccak256(ulnConfig);
ILzEndpoint.SetConfigParam[] memory params = new ILzEndpoint.SetConfigParam[](1);
params[0] = ILzEndpoint.SetConfigParam({ eid: eid, configType: CONFIG_TYPE_ULN, config: ulnConfig });
ILzEndpoint(endpointAddr).setConfig(oapp, lib, params);
emit PathwayConfigured(oapp, lib, eid, ulnConfig);
}
/// @notice Add exactly one new optional DVN to an existing pathway, following
/// the fixed escalation sequence:
/// step 0 → 1 : optionalDVNCount 3→4, threshold 2→3
/// step 1 → 2 : optionalDVNCount 4→5, threshold unchanged (3)
/// step 2+ : LOCKED — reverts
///
/// At every step the honest-DVN majority is preserved: at 3-of-5 the
/// owner has appended at most 2 DVNs, so passing threshold still
/// requires 1 honest DVN.
///
/// @dev Replay-safe via the stored hash of the current config. Owner can't
/// remove DVNs, lower threshold, replace required DVNs, reorder the
/// existing optional set, or skip a step.
///
/// @param oapp The OApp whose DVN set we're extending.
/// @param endpointAddr The LZ EndpointV2 address for this chain.
/// @param lib The send- or receive-ULN library address.
/// @param eid Remote eid identifying the pathway.
/// @param currentUlnConfig ABI-encoded UlnConfig bytes of the CURRENT config.
/// @param newUlnConfig ABI-encoded UlnConfig bytes of the PROPOSED config.
function addDvnToPathway(
address oapp,
address endpointAddr,
address lib,
uint32 eid,
bytes calldata currentUlnConfig,
bytes calldata newUlnConfig
) external onlyOwner {
require(_pathwayConfigured[oapp][lib][eid], "PathwayExpander: pathway not configured");
uint8 step = _dvnEscalationStep[oapp][lib][eid];
require(step < 2, "PathwayExpander: escalation locked");
require(
keccak256(currentUlnConfig) == _ulnConfigHash[oapp][lib][eid],
"PathwayExpander: current config hash mismatch"
);
UlnConfig memory cur = abi.decode(currentUlnConfig, (UlnConfig));
UlnConfig memory nxt = abi.decode(newUlnConfig, (UlnConfig));
// Invariants that must never change.
require(nxt.confirmations == cur.confirmations, "PathwayExpander: confirmations changed");
require(nxt.requiredDVNCount == cur.requiredDVNCount, "PathwayExpander: requiredDVNCount changed");
require(nxt.requiredDVNs.length == cur.requiredDVNs.length, "PathwayExpander: requiredDVNs length changed");
for (uint256 i; i < cur.requiredDVNs.length; ++i) {
require(nxt.requiredDVNs[i] == cur.requiredDVNs[i], "PathwayExpander: requiredDVNs changed");
}
// Transition-specific shape checks.
// step 0→1: optional 3 → 4, threshold 2 → 3
// step 1→2: optional 4 → 5, threshold stays 3
uint8 expectedNewOptionalCount = cur.optionalDVNCount + 1;
uint8 expectedNewThreshold = (step == 0) ? 3 : cur.optionalDVNThreshold;
require(nxt.optionalDVNCount == expectedNewOptionalCount, "PathwayExpander: wrong optionalDVNCount");
require(nxt.optionalDVNThreshold == expectedNewThreshold, "PathwayExpander: wrong optionalDVNThreshold");
require(nxt.optionalDVNs.length == nxt.optionalDVNCount, "PathwayExpander: optionalDVNs array length mismatch");
require(cur.optionalDVNs.length == cur.optionalDVNCount, "PathwayExpander: current optionalDVNs array length mismatch");
// Prefix must be identical (no reordering).
for (uint256 i; i < cur.optionalDVNCount; ++i) {
require(nxt.optionalDVNs[i] == cur.optionalDVNs[i], "PathwayExpander: optionalDVNs prefix reordered");
}
// New DVN must be fresh.
address addedDvn = nxt.optionalDVNs[cur.optionalDVNCount];
require(addedDvn != address(0), "PathwayExpander: zero DVN address");
for (uint256 i; i < cur.requiredDVNs.length; ++i) {
require(addedDvn != cur.requiredDVNs[i], "PathwayExpander: duplicate DVN (required)");
}
for (uint256 i; i < cur.optionalDVNCount; ++i) {
require(addedDvn != cur.optionalDVNs[i], "PathwayExpander: duplicate DVN (optional)");
}
// Forward to LZ endpoint.
ILzEndpoint.SetConfigParam[] memory params = new ILzEndpoint.SetConfigParam[](1);
params[0] = ILzEndpoint.SetConfigParam({ eid: eid, configType: CONFIG_TYPE_ULN, config: newUlnConfig });
ILzEndpoint(endpointAddr).setConfig(oapp, lib, params);
// Advance state.
uint8 newStep = step + 1;
_dvnEscalationStep[oapp][lib][eid] = newStep;
_ulnConfigHash[oapp][lib][eid] = keccak256(newUlnConfig);
emit DvnEscalated(oapp, lib, eid, newStep, nxt.optionalDVNCount, nxt.optionalDVNThreshold, addedDvn);
}
/// @notice Returns the current DVN escalation step for a pathway.
/// 0 = initial (2-of-3), 1 = 3-of-4, 2 = 3-of-5, anything higher = locked.
function dvnEscalationStep(address oapp, address lib, uint32 eid) external view returns (uint8) {
return _dvnEscalationStep[oapp][lib][eid];
}
/// @notice Returns true if configureNewPathway has already been called for
/// this (oapp, lib, eid) triple. Read by deploy tooling to decide
/// whether to skip an already-applied config step.
function isPathwayConfigured(address oapp, address lib, uint32 eid) external view returns (bool) {
return _pathwayConfigured[oapp][lib][eid];
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.